query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Generate the HTML report for the Scan
def html_report begin require 'ruport' rescue LoadError abort("Couldn't load ruport, suggest that gem install ruport should help") end unless @options.report_file html_report_file_name = 'Kismet-Wireless-Report-' + Time.now.to_s + '.html' end unless @options.report_file =~ /html$/ html_report_file_name = @options.report_file + '.html' end @report = File.new(html_report_file_name,'w+') html_report_header html_report_stats if @options.create_map @report << '<hr /><br /><br />' html_report_map_body end @report << '<hr /><br /><br />' html_report_inf @report << '<hr /><br /><br />' html_report_adhoc @report << '<hr /><br /><br />' html_report_probe @report << "</body>" @report << "</html>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_scan_report\n freshclam_stderr = IO.read($config[\"freshclam_stderr\"])\n freshclam_stdout = @freshclam_stdout\n template = IO.read(\"views/clamav.html.erb\")\n output = ERB.new(template).result(binding)\n File.open(\"clamav.html\", \"w\") {|file| file.write(output)}\nend", "def output_report\n report = \"\"\n report << '<html>'\n report << ' <head>'\n report << \" <title>#{@title}</title>\"\n report << ' </head>'\n report << ' <body>'\n @text.each { |line| report << \" <p>#{line}</p>\" }\n report << ' </body>'\n report << '</html>'\n end", "def html_report_stats\n @report << '<div id=\"title\"> General Statistics</div>'\n stat_tab = Ruport::Data::Table(%w[Stat Value])\n stat_tab << ['Number of servers Seen', @num_servers]\n stat_tab << ['Number of clients Seen', @num_clients]\n @num_by_cipher.each do |cipher, num|\n stat_tab << ['Encryption: ' + cipher, num]\n end\n @report << stat_tab.to_html\n @report << '<br /><br />'\n end", "def report\n \n end", "def report; end", "def report; end", "def report; end", "def report; end", "def report; end", "def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend", "def report\n\t\tend", "def html_report_inf\n @report << '<div id=\"title\">Infrastructure Networks</div><br /><br />'\n @log.debug(\"Starting reporting Infrastructure networks there were \" + @infrastructure_networks.length.to_s + \" networks to list\")\n @infrastructure_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid num_clients channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['clients'].length.to_s, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n content_type: FrameworkHelper.content_type_for_report( format ),\n text: FrameworkHelper.framework { |f| f.report_as format, @scan.report.object }\n end", "def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n text: FrameworkHelper.\n framework { |f| f.report_as format, @scan.report.object }\n end", "def write_report\n\n end", "def to_html\n Report.export(@analysis, :html)\n end", "def html_report(test_report, extra_report_header)\n\n html_report = <<-EOS\n <html>\n EOS\n\n html_style = <<-EOS\n <style>\n body {background-color: #FFFFF0; font-family: \"VAG Round\" ; color : #000080;font-weight:normal;word-break: break-all;}\n #specs-table{font-family:Arial,Helvetica,Sans-serif;font-size:12px;text-align:left;border-collapse:collapse;border-top: 2px solid #6678B1;border-bottom: 2px solid #6678B1;margin:20px;}\n #specs-table th{font-size:13px;font-weight:normal;background:#b9c9fe;border-top:4px solid #aabcfe;border-bottom:1px solid #fff;color:#039;padding:8px;}\n #specs-table td{background:#e8edff;border-top:1px solid #fff;border-bottom:1px solid #fff;color:#039;padding:8px;}\n #specifications{font-family:Arial,Helvetica,Sans-serif;font-size:13px;width:480px;background:#fff;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #specifications th{font-size:14px;font-weight:bold;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}\n #specifications td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #statuspass{font-family:Arial,Helvetica,Sans-serif;font-size:12px;color:green;font-weight:bold;}\n #statusfail{font-family:Arial,Helvetica,Sans-serif;font-size:12px;color:red;font-weight:bold;}\n #tcs{font-family:Arial,Helvetica,Sans-serif;font-size:13px;background:#fff;width:900px;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #tcs th{font-size:14px;font-weight:bold;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}\n #tcs td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #checkpoint{font-family:Arial,Helvetica,Sans-serif;font-size:13px;background:#fff;width:900px;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #checkpoint td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #container{margin: 0 30px;background: #fff;border:1px solid #ccc;}\n #header{background: #e8edff;padding: 2px;border-bottom: 2px solid #6678b1;}\n #steps{background: #e8edff;font-weight: bold;}\n #dp{font-weight: bold;}\n #validations{font-weight: bold;}\n #content{clear: left;padding: 10px;}\n #footer{background: #e8edff;text-align: right;padding: 10px;}\n </style>\n EOS\n\n title = <<-EOS\n <head><title>#{test_report[:test_suite_title]}</title></head>\n\n <body>\n EOS\n\n html_report += html_style + title\n\n report_header = <<-EOS\n <center>\n\n <a name=#{replace_space_by_dash(test_report[:test_suite_title])}></a>\n <table id=\"specifications\">\n <th align=\"center\">#{test_report[:test_suite_title]}</th>\n <tr><td>Test specification: #{test_report[:test_spec_path]}</td></tr>\n <tr><td>Kadu server: #{test_report[:kadu_server]}</td></tr>\n EOS\n @test_report[:test_cases].each do |tc_id, tc|\n if tc.has_key?(:server_info)\n report_header += <<-EOS\n <tr><td>Kadu branch: #{tc[:server_info][:kadu_branch]}</td></tr>\n <tr><td>Kadu version: #{tc[:server_info][:kadu_version]}</td></tr>\n <tr><td>Kadu index: #{tc[:server_info][:kadu_index]}</td></tr>\n EOS\n break\n end\n end\n if !extra_report_header.nil?\n details = extra_report_header.split(\"\\n\")\n details.each do |line|\n report_header += <<-EOS\n <tr><td>#{line}</td></tr>\n EOS\n end\n end\n test_suite_time_in_secs = Time.parse(test_report[:test_suite_completed_time].to_s) - Time.parse(test_report[:test_suite_start_time].to_s)\n\n report_header += <<-EOS\n <tr><td>Test suite started On: #{test_report[:test_suite_start_time]}</td></tr>\n <tr><td>Duration: #{test_suite_time_in_secs} secs</td></tr>\n <tr><td>Test suite status: <font id=#{status(test_report[:test_suite_result_status])}>#{test_report[:test_suite_result_status]}</font></td></tr>\n </table>\n <br>\n EOS\n report_tc_summary = <<-EOS\n <table id=\"tcs\">\n <tr>\n <th >Test Case</th>\n <th >Test Case Status</th>\n </tr>\n EOS\n\n test_report[:test_cases].each do |tc_id, tc|\n report_tc_summary += <<-EOS\n <tr>\n <td><a href=\"##{tc_id}\">#{tc_id}: #{tc[:title]}</a></td><td><font id=#{status(tc[:test_case_result_status])}>#{tc[:test_case_result_status]}</font></td>\n </tr>\n EOS\n end\n\n report_tc_summary += <<-EOS\n </table>\n <br>\n <h4>#{test_report[:test_suite_description]}</h4>\n <br>\n </center>\n EOS\n test_cases = \"\"\n test_report[:test_cases].each do |tc_id, tc|\n test_case = <<-EOS\n <div id=\"container\" style=\"word-break: break-all;width:100%;\">\n <div id=\"header\">\n <h4>\n <p><a name=\"#{tc_id}\">#{tc_id}: #{tc[:title]}</a></p>\n <p>#{tc[:description]}</p>\n <p>Test result status: <font id=#{status(tc[:test_case_result_status])}>#{tc[:test_case_result_status]}</font></p>\n </h4>\n </div>\n <div id=\"content\">\n <h4>\n Steps to reproduce\n </h4>\n EOS\n\n tc[:test_steps].each do |step_id, step|\n test_steps = <<-EOS\n <p id=\"steps\">#{step_id}</p>\n EOS\n\n if step.has_key?(:action) || step.has_key?(:mt_url)\n test_steps += <<-EOS\n <p style=\"word-break: break-all;\" width=900px >URL: #{step[:action]}</p>\n EOS\n end\n\n if step.has_key?(:dynamic_params)\n test_steps += <<-EOS\n <p id=\"dp\">Dynamic Parameters</p>\n EOS\n\n exclusion_term = \"set @kadu_response\"\n step[:dynamic_params].each do |parameter, expression|\n expression = exclusion_term if expression.to_s.include?(exclusion_term)\n test_steps += <<-EOS\n <p>#{parameter} = #{expression}</p>\n EOS\n end\n end\n\n if step.has_key?(:validation_steps)\n\n test_steps += <<-EOS\n <p id=\"validations\">\n Validations\n </p>\n <table id=\"checkpoint\">\n EOS\n\n step[:validation_steps].each do |vstep, result|\n steps = <<-EOS\n <tr>\n <td colspan=\"2\" width=\"90%\">\n <p>#{vstep}</p>\n <p>#{result[\"test_result_message\"]}</p>\n </td>\n <td width=\"10%\" rowspan=\"1\" align=\"center\"><font id=#{status(result[\"test_result_status\"])}>#{result[\"test_result_status\"]}</font></td>\n </tr>\n EOS\n test_steps += steps\n end\n\n test_steps += <<-EOS\n </table>\n EOS\n\n end\n test_case += test_steps\n end\n test_cases += test_case\n test_cases += <<-EOS\n </div>\n <div id=\"footer\">\n <a href=\"##{replace_space_by_dash(test_report[:test_suite_title])}\">back to test suite</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#summary\">back to summary</a>\n\t </div>\n </div>\n <br>\n EOS\n end\n\n report_footer = <<-EOS\n <br>\n <hr>\n <br>\n </body>\n </html>\n EOS\n\n html_report += report_header + report_tc_summary + test_cases + report_footer\n\n html_report\n end", "def report\n super\n\n begin\n puts \"Writing HTML reports to #{@reports_path}\"\n erb_str = File.read(@erb_template)\n renderer = ERB.new(erb_str)\n\n tests_by_suites = tests.group_by { |test| test_class(test) } # taken from the JUnit reporter\n\n suites = tests_by_suites.map do |suite, tests|\n suite_summary = summarize_suite(suite, tests)\n suite_summary[:tests] = tests.sort { |a, b| compare_tests(a, b) }\n suite_summary\n end\n\n suites.sort! { |a, b| compare_suites(a, b) }\n\n result = renderer.result(binding)\n File.open(html_file, 'w') do |f|\n f.write(result)\n end\n\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n puts 'There was an error writing the HTML report'\n puts 'This may have been caused by cancelling the test run'\n puts 'Use mode => :verbose in the HTML reporters constructor to see more detail' if @mode == :terse\n puts 'Use mode => :terse in the HTML reporters constructor to see less detail' if @mode != :terse\n raise e if @mode != :terse\n end\n # rubocop:enable Lint/RescueException\n end", "def html_report_probe\n @log.debug(\"Starting to report probe networks, there were \" + @probe_networks.length.to_s + \" to report\")\n @report << '<div id=\"title\">Probe Networks</div><br /><br />'\n @probe_tab = Ruport::Data::Table(%w[bssid manufacturer])\n @probe_networks.each do |probe,info|\n if @options.gps_data[probe]\n point = probe\n @log.debug(\"attempting to add link\")\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s\n probe = '<a href=\"' + url + '\">' + point + '</a>'\n end\n @probe_tab << [probe, info['manufacturer']]\n end\n\t @report << @probe_tab.to_html\n\t @report << \"<br /><br />\"\n end", "def generate_report\n self.consume_stdin\n self.data_sorter\n\n @drivers.each do |driver|\n driver.total_duration\n driver.distance_calculator\n driver.average_speed\n end\n\n self.compile_report\n end", "def html_report_header\n @report << '\n <html>\n <head>\n <title> Kismet Wireless Report</title>\n <style>\n body {\n\t font: normal 11px auto \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n\t color: #4f6b72;\n\t background: #E6EAE9;\n }\n #report-header {\n font-weight: bold;\n font-size: 24px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n\n }\n\n #sub-header {\n font-weight: italic;\n font-size: 10px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n\n }\n\n #title {\n font-weight: bold;\n font-size: 16px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n }\n\n th {\n\t font: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n\t color: #4f6b72;\n\t border-right: 1px solid #C1DAD7;\n\t border-bottom: 1px solid #C1DAD7;\n\t border-top: 1px solid #C1DAD7;\n\t letter-spacing: 2px;\n\t text-transform: uppercase;\n\t text-align: left;\n\t padding: 6px 6px 6px 12px;\n }\n\n td {\n\t border-right: 1px solid #C1DAD7;\n\t border-bottom: 1px solid #C1DAD7;\n\t background: #fff;\n\t padding: 6px 6px 6px 12px;\n\t color: #4f6b72;\n }\n\n\n td.alt {\n\t background: #F5FAFA;\n\t color: #797268;\n }\n\n\n\n </style>\n '\n if @options.create_map\n @report << %Q!\n <script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=false\"></script>\n <script type=\"text/javascript\">\n function initialize() {\n var latlng = new google.maps.LatLng(#{@map_centre['lat']}, #{@map_centre['long']});\n var myOptions = {\n zoom: 14,\n center: latlng,\n mapTypeId: google.maps.MapTypeId.ROADMAP\n };\n var map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);\n !\n\n #Yugh this is a hack\n @options.gps_data.each do |bssid,point|\n netname = bssid.gsub(':','')\n\n if @nets_by_bssid[bssid]\n #Next line is present to strip any single quotes from SSID's before putting them into the marker as that causes problems :)\n content_ssid = @nets_by_bssid[bssid]['ssid'].gsub(/['<>]/,'')\n @log.debug(\"About to add \" + content_ssid) if content_ssid\n @report << %Q!\n var contentString#{netname} = '<b>SSID: </b> #{content_ssid} <br />' +\n '<b>BSSID: </b> #{bssid}<br />' +\n '<b>Channel: </b> #{@nets_by_bssid[bssid]['channel']} <br />' +\n '<b>Ciphers: </b> #{@nets_by_bssid[bssid]['cipher']} <br />' +\n '<b>Cloaked?: </b> #{@nets_by_bssid[bssid]['cloaked']} <br />';\n var infowindow#{netname} = new google.maps.InfoWindow({\n content: contentString#{netname}\n });\n !\n end\n @report << %Q!\n var latlng#{netname} = new google.maps.LatLng(#{point['lat']}, #{point['lon']});\n\n var marker#{netname} = new google.maps.Marker({\n position: latlng#{netname},\n map: map\n });\n !\n if @nets_by_bssid[bssid]\n @report << %Q!\n google.maps.event.addListener(marker#{netname}, 'click', function() {\n infowindow#{netname}.open(map,marker#{netname});\n });\n !\n end\n end\n\n @report << %Q!\n }\n </script>\n\n !\n end\n @report << '</head>'\n if @options.create_map\n @report << '<body onload=\"initialize()\">'\n else\n @report << '<body>'\n end\n @report << '<div id=\"report-header\">Kismet Wireless Report</div> <br /> <div id=\"sub-header\"> Report Generated at ' + Time.now.to_s + '<br />'\n @report << 'Files analysed ' + @options.file_names.join(',<br />') + '<br /> <br /></div>'\n end", "def build_report\n puts \"building performance test comparison report...\"\n puts\n\n # load template\n report = File.read(@template_path)\n\n # metrics result\n result_comparison_table = extract_table_from_csv2html_output(@result_comparison_path)\n\n # atop summary\n atop_summary_comparison_table = extract_table_from_csv2html_output(@atop_summary_comparison_path)\n\n # atop detail\n # TODO: enable\n # atop_detail_comparison_table = extract_table(@atop_detail_comparison_path)\n\n # replace tables (do this first since table data may include parameters)\n report = report.gsub(\"$RESULT_COMPARISON_TABLE\", result_comparison_table)\n report = report.gsub(\"$ATOP_SUMMARY_COMPARISON_TABLE\", atop_summary_comparison_table)\n\n # TODO: enable\n # report = report.gsub(\"$ATOP_DETAIL_TABLE\", atop_detail_table)\n\n # replace parameters\n report = replace_parameters(report)\n\n # write report\n puts \"writing report to #{@output_path}\"\n\n File.write(@output_path, report)\nend", "def generate_report()\n system(\"java -cp emma.jar emma report -r html -in coverage.em,coverage.ec\")\nend", "def html_report_adhoc\n @log.debug(\"Starting to report ad-hoc networks, there were \" + @adhoc_networks.length.to_s + \"to report\")\n @report << '<div id=\"title\">Adhoc Networks</div><br /><br />'\n @adhoc_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end", "def run\n print_line\n print_status 'Creating HTML report...'\n\n plugins = format_plugin_results( auditstore.plugins )\n @base_path = File.dirname( options['tpl'] ) + '/' +\n File.basename( options['tpl'], '.erb' ) + '/'\n\n title_url = auditstore.options['url']\n begin\n title_url = uri_parse( auditstore.options['url'] ).host\n rescue\n end\n\n params = prepare_data.merge(\n title_url: escapeHTML( title_url ),\n audit_store: auditstore,\n plugins: plugins,\n base_path: @base_path\n )\n\n File.open( outfile, 'w' ) { |f| f.write( erb( options['tpl'], params ) ) }\n\n print_status \"Saved in '#{outfile}'.\"\n end", "def generateReport\n filePath = \"#{@reportFolder}/report.csv\"\n file = File.open(filePath, 'w')\n file.puts ['Screen', 'Description', 'Automation Message', 'Status'].join(',')\n @report.each do |result|\n file.puts result.join(',')\n end\n file.close\n end", "def report(output)\n end", "def report\n table = Terminal::Table.new(headings: ['Basic', 'Result']) do |t|\n t << [\"Number of paragraphs\", number_of_paragraphs]\n t << [\"Number of sentences\", number_of_sentences]\n t << [\"Number of words\", number_of_words]\n t << [\"Number of characters\", number_of_characters]\n t << [\"Number of syllables\", number_of_syllables]\n\n t << :separator\n t << [\"Average words per sentence\", mean_of_words_per_sentence]\n t << [\"Average syllables per word\", mean_of_syllables_per_word]\n t << [\"Average syllables per content word\", syllables_per_content_word]\n\n t << :separator\n t << [\"Verbs Ocurrencies\", verb_incidence]\n t << [\"Nouns Ocurrencies\", noun_incidence]\n t << [\"Adjective Ocurrencies\", adjective_incidence]\n t << [\"Adverb Ocurrencies\", adverb_incidence]\n t << [\"Pronoun Ocurrencies\", pronoun_incidence]\n t << [\"Content Word Ocurrencies\", content_word_incidence]\n t << [\"Function Word Ocurrencies\", function_word_incidence]\n\n t << :separator\n t << [\"Flesch score\", flesch]\n end\n puts table\n end", "def reportall\n\t\t@marriges = Marriage.find(:all, :order =>\"register_id\")\n \t\thtml = render :layout => false \n\t\tkit = PDFKit.new(html)\n\n\t\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\t\tsend_data(kit.to_pdf, :filename => \"marriagereport.pdf\", :type => 'application/pdf')\n\tend", "def build_report_body\n #@output << erb(RAILS_ROOT + \"/app/views/reports/_users.html.erb\") \n pad(10) do\n add_text usernotes\n end\n if timespan == \"Daily\" \n add_text \"Current Tasks and Tasks Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Tasks and Tasks Modified in the last Week\"\n else\n add_text \"Current Tasks\"\n end\n pad(10) do\n draw_table(data, :width => 600)\n end\n if timespan == \"Daily\" \n add_text \"Current Goals and Goals Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Goals and Goals Modified in the last Week\"\n else\n add_text \"Current Goals\"\n end\n pad(10) do\n draw_table(goaldata, :width => 600)\n end\n end", "def output_html\n path = ask_path('.html')\n path ? @report.to_html_file(path) : 'Annulé'\n end", "def report\n @report = Report.new(self)\n @results.keys.each do |key|\n yield key\n end\n @report.write\n end", "def report_html(tid)\n\t@test = Test.get(tid)\n\t@app = @test.application\n\t\n\trt = RecordType.get(@app.record_type)\n\n\tif(rt.exportFormat.nil? || rt.exportFormat == 0)\n\t\tf = File.open(\"exportTemplates/default.erb\", \"rb\")\n\t\trenderer = ERB.new(f.read)\n\t\treturn renderer.result(binding)\n\telse\n\t\tef = ExportFormat.get(rt.exportFormat)\n\t\tf = ef.erb\n\t\trenderer = ERB.new(f)\n\t\treturn renderer.result(binding)\n\tend\nend", "def report\n require File.join File.expand_path(File.dirname(__FILE__)), \"report\"\n Brakeman::Report.new(self)\n end", "def run\n\t\tself.print_hosts # generate all the host_*.html files\n\t\tself.print_index # generate the index.html file\n\t\tself.print_vulns # generate all the vuln_*.html files\n\t\tself.print_vuln_overview # generate the vuln_overview.html file\n\tend", "def generate_new_report\n log_info('MI Report generation started...')\n content = CSV.generate do |csv|\n csv << headers\n claims.find_each do |claim|\n ManagementInformationPresenter.new(claim, 'view').present! do |claim_journeys|\n claim_journeys.each { |journey| csv << journey } if claim_journeys.any?\n end\n end\n end\n log_info('MI Report generation finished')\n content\n rescue StandardError => e\n log_error(e, 'MI Report generation error')\n end", "def report(properties)\n if (@short_report)\n tags = 0\n @stats.tagged_files.each {|line| tags += line[1] }\n known = 0\n @stats.known_exceptions.each {|line| known += line[1] }\n missing = 0\n @stats.missing_tags.each {|line| missing += line[1] }\n\n puts \"Licenser: scanned #{@stats.file_count} files in #{@stats.dir_count} directories.\"\n printf(\" Licensed files: %5d\\n\", tags)\n printf(\" Known exceptions: %5d\\n\", known)\n printf(\" Missing tags: %5d\\n\", missing)\n else\n puts \"Licenser: run completed at #{DateTime.now.strftime(\"%H:%M:%S on %b %d, %Y\")}\"\n puts \" scanned #{@stats.file_count} files in #{@stats.dir_count} directories.\"\n puts\n puts 'Licensed files'\n @stats.tagged_files.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'Known non-licensed files'\n @stats.known_exceptions.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'Missing tags'\n @stats.missing_tags.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'properties:'\n properties.each do |key, value|\n puts \" #{key} = #{value}\"\n end\n end\n end", "def render output\n\t\t\t\treport_classification\n\n\t\t\t\treport_title Report.title\n\t\t\t\treport_subtitle \"Talking Points Report\"\n\t\t\t\treport_author \"This report was prepared by\\n#{Report.author}\"\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t@output.text \"Scan Date:\", :style => :bold\n\t\t\t\t@output.text \"#{Report.scan_date}\"\n\t\t\t\t@output.text \"\\n\"\n\n\t\t\t\t# Number of hosts / score\n\t\t\t\t@output.text \"There were #{Host.count} hosts identified, containing #{Item.critical_risks.to_a.count + Item.high_risks.to_a.count} critical and high risks findings. Of those there were #{Item.critical_risks.to_a.count} Critical risks, and #{Item.high_risks.to_a.count} High risks.\"\n\n\t\t\t\t@output.text \"These critical and highs were discovered on #{Host.unique_hosts_with_critical_and_high_count} unique hosts. #{Item.risk_percent_rounded_text} of the total assessed computers were found to have an critical or high finding.\"\n\n\t\t\t\t# @TODO need vulnerable host count\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Top Hosts with Findings\n\t\t\t\t#@TODO need this call\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Notable Findings\n\t\t\t\tItem.top_10_table(@output)\n\n\n\t\t\t\t# Plugin_output keyword search?\n\n\t\t\t\t@output.number_pages \"<page> of <total>\", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all\n\t\t\tend", "def generate\n data = { 'conflicts' => [], 'failing' => [], 'pending' => [], 'passing' => [] }\n\n pulls = client.pulls(repository)\n pulls.each do |pull|\n pull = Hubtrics::PullRequest.fetch(repository, pull.number)\n\n # pull.mergeable contains a nil when the check has not been performed yet, so we need to compare against false\n data['conflicts'] << pull.to_h if pull.mergeable == false\n data[pull.status] << pull.to_h\n end\n\n @report = template.render('data' => data, 'total_pulls' => pulls.count).strip\n end", "def print_index\n\t\tFile.open(@options[:output] + \"/index.html\",'w') do |f|\n\t\t\thtml_header(f,\"Home\")\n\n\t\t\tbar_js(f,\"bar_graph\",\"Top 20 Hosts\",@hosts.sort_by{|k,v| v[:total_excl_info]}.reverse.take(20))\n\n\t\t\tcrit_total = 0\n\t\t\thigh_total = 0\n\t\t\tmed_total = 0\n\t\t\tlow_total = 0\n\t\t\tinfo_total = 0\n\n\t\t\t@events.each do |k,v|\n\t\t\t\tcrit_total += 1 if v[:severity] == 4\n\t\t\t\thigh_total += 1 if v[:severity] == 3\n\t\t\t\tmed_total += 1 if v[:severity] == 2\n\t\t\t\tlow_total += 1 if v[:severity] == 1\n\t\t\t\tinfo_total += 1 if v[:severity] == 0\n\t\t\tend\n\n\t\t\tpie_data = []\n\t\t\tpie_data << ['Info',info_total.to_i,'blue'] if @options[:severity] <= 0 and info_total.to_i >= 0\n\t\t\tpie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1 and low_total.to_i > 0\n\t\t\tpie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2 and med_total.to_i > 0\n\t\t\tpie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3 and high_total.to_i > 0\n\t\t\tpie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4 and crit_total.to_i > 0\n\n\t\t\tpie_js(f,\"pie_graph\",\"Unique Vulnerability Breakdown\",\"Unique Vuln Breakdown\",pie_data,\"document.location.href = 'vuln_overview.html';\")\n\n\t\t\tcrit_total = 0\n\t\t\thigh_total = 0\n\t\t\tmed_total = 0\n\t\t\tlow_total = 0\n\t\t\tinfo_total = 0\n\n\t\t\t@hosts.each do |id,values|\n\t\t\t\tcrit_total += values[:crit].to_i\n\t\t\t\thigh_total += values[:high].to_i\n\t\t\t\tmed_total += values[:med].to_i\n\t\t\t\tlow_total += values[:low].to_i\n\t\t\t\tinfo_total += values[:info].to_i\n\t\t\tend\n\n\t\t\tpie_data = []\n\t\t\tpie_data << ['Info',info_total.to_i,'blue'] if @options[:severity] <= 0 and info_total.to_i >= 0\n\t\t\tpie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1 and low_total.to_i > 0\n\t\t\tpie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2 and med_total.to_i > 0\n\t\t\tpie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3 and high_total.to_i > 0\n\t\t\tpie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4 and crit_total.to_i > 0\n\n\t\t\tpie_js(f,\"pie_graph2\",\"Total Vulnerability Breakdown\",\"Total Vuln Breakdown\",pie_data,\"document.location = href= 'vuln_overview.html';\")\n\n\t\t\ttarget_lookup = \"var target_lookup = {\"\n\t\t\t@hosts.each_with_index do |host,index|\n\t\t\t\tif host[1][:hostname] == \"\"\n\t\t\t\t\ttarget_lookup += \"'\" + host[1][:ip] + \"'\"\n\t\t\t\telse\n\t\t\t\t\ttarget_lookup += \"'\" + host[1][:hostname] + \" (\" + host[1][:ip] + \")\" + \"'\"\n\t\t\t\tend\n\t\t\t\ttarget_lookup += \": \" + host[0].to_s\n\t\t\t\ttarget_lookup += \",\" unless index == @hosts.length - 1\n\t\t\tend\n\t\t\ttarget_lookup += \"}\"\n\n\t\t\tf.puts target_lookup\n\n\t\t\tclose_html_header(f)\n\n\t\t\tbody = '<div style=\"width: 800px; margin-left: auto; margin-right: auto; padding-top: 30px;\">'\n\t\t\tbody += '<div id=\"pie_graph\" style=\"min-width: 375px; height: 375px; margin: 0 auto; float: left\"></div>'\n\t\t\tbody += '<div id=\"pie_graph2\" style=\"min-width: 375px; height: 375px; margin: 0 auto; float: left\"></div>'\n\t\t\tbody += '</div>'\n\t\t\tbody += '<div style=\"clear: both;\"></div>'\n\t\t\tbody += '<div id=\"bar_graph\" style=\"min-width: 400px; height: 900px; margin: 0 auto\"></div>'\n\n\t\t\tbody += '<div id=\"allhosts\" style=\"font-family: Arial, Helvetica, sans-serif\"><h3>All Hosts</h3>'\n\n\t\t\tips = []\n\t\t\t@hosts.each do |host|\n\t\t\t\tips << host[1][:ip]\n\t\t\tend\n\n\t\t\tbody += '<table id=\"hosts_table\" class=\"display\"><thead><tr><th>IP</th><th>Hostname</th><th>OS</th><th>Vulnerability Count (Low to Critical)</th></tr></thead><tbody>'\n\t\t\tips.sort_by{|ip| ip.split('.').map{|octet| octet.to_i}}.each do |ip|\n\t\t\t\t@hosts.select{|k,v| v[:ip] == ip}.each do |k,v|\n\t\t\t\t\ttmp_actual_v_count = 0\n\t\t\t\t\ttmp_actual_v_count += v[:info].to_i if @options[:severity] <= 0 and v[:info].to_i >= 0\n\t\t\t\t\ttmp_actual_v_count += v[:low].to_i if @options[:severity] <= 1 and v[:low].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:med].to_i if @options[:severity] <= 2 and v[:med].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:high].to_i if @options[:severity] <= 3 and v[:high].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:crit].to_i if @options[:severity] <= 4 and v[:crit].to_i > 0\n\t\t\t\t\tbody += '<tr><td>'\n\t\t\t\t\tif tmp_actual_v_count > 0\n\t\t\t\t\t\tbody += '<a href=\"host_' + k.to_s + '.html\">' + ip + '</a>'\n\t\t\t\t\telse\n\t\t\t\t\t\tbody += ip\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</td><td>' + v[:hostname] + '</td><td>' + v[:os] + '</td><td>' + v[:total_excl_info].to_s + '</td></tr>'\n\t\t\t\tend\n\t\t\tend\n\t\t\tbody += '</tbody></table>'\n\n\t\t\tbody += '<script>$(document).ready(function() { $(\\'#hosts_table\\').dataTable({\"bPaginate\": false}); });</script>'\n\n\t\t\tbody_text(f,body)\n\n\t\t\tclose_all(f)\n\n\t\tend\n\n\tend", "def create(results, cls, user, custom_body=nil, complete_html= false)\n\t\t@report = WickedCore.new\n\t\t@report.open(results, cls,\"CDISC Terminology Change Report\", \"\", [], user, custom_body, complete_html)\n\t\t@report.close unless complete_html\n\t\treturn @report.html\n\tend", "def report_body; end", "def report_body; end", "def report\n sprintf \"Number of paragraphs %d \\n\" <<\n \"Number of sentences %d \\n\" <<\n \"Number of words %d \\n\" <<\n \"Number of characters %d \\n\\n\" <<\n \"Average words per sentence %.2f \\n\" <<\n \"Average syllables per word %.2f \\n\\n\" <<\n \"Flesch score %2.2f \\n\" <<\n \"Flesh-Kincaid grade level %2.2f \\n\" <<\n \"Fog Index %2.2f \\n\",\n num_paragraphs, num_sentences, num_words, num_characters,\n words_per_sentence, syllables_per_word,\n flesch, kincaid, fog\n end", "def generate_report\n validate_required_fields\n @report = []\n @report << header\n\n (number_of_intervals - 1).times do |row|\n @report << build_row(row)\n end\n @report\n end", "def create_report\n report_path = \"/tmp/metasploit_#{@workspace_name}.xml\"\n\n # Create the report using the db_export command\n _send_command(\"db_export #{report_path}\\n\")\n\n # We've sent the command, so let's sit back and wait for th\n # output to hit the disk.\n begin\n xml_string = \"\"\n status = Timeout::timeout(240) {\n # We don't know when the file is going to show up, so \n # wait for it...\n until File.exists? report_path do\n sleep 1\n end\n\n # Read and clean up the file when it exists...\n until xml_string.include? \"</MetasploitV4>\" do\n sleep 5\n xml_string = File.read(report_path)\n end\n \n File.delete(report_path)\n }\n rescue Timeout::Error\n xml_string = \"<MetasploitV4></MetasploitV4>\"\n end\n\n xml_string\n end", "def create_report\n report_path = \"/tmp/metasploit_#{@workspace_name}.xml\"\n\n # Create the report using the db_export command\n _send_command(\"db_export #{report_path}\\n\")\n\n # We've sent the command, so let's sit back and wait for th\n # output to hit the disk.\n begin\n xml_string = \"\"\n status = Timeout::timeout(240) {\n # We don't know when the file is going to show up, so\n # wait for it...\n until File.exists? report_path do\n sleep 1\n end\n\n # Read and clean up the file when it exists...\n until xml_string.include? \"</MetasploitV4>\" do\n sleep 5\n xml_string = File.read(report_path)\n end\n\n File.delete(report_path)\n }\n rescue Timeout::Error\n xml_string = \"<MetasploitV4></MetasploitV4>\"\n end\n\n xml_string\n end", "def create_report()\n $report_file.truncate(0)\n print_date()\n brands = create_brands_hash()\n toys = create_products_hash()\n print_products_ascii()\n print_toys_hash(toys)\n print_brands_ascii()\n print_brands_hash(brands)\n $report_file.close\nend", "def to_html\n html = generate_header\n i = 0\n project = Continuous4r.project\n errors_or_warnings = 0\n html_details = \"\"\n if !(Config::CONFIG['host_os'] =~ /mswin/)\n require 'open3'\n end\n ['spec'].each do |runner|\n error_detail_array, result = run_runner(runner)\n passed = test_passed?(result, error_detail)\n if !(error_detail_array.match(/rake aborted/).nil?) and error_detail_array.split(/$/).length > 1\n error_detail = extract_error_detail(error_detail_array)\n end\n html << generate_line_start(runner, passed)\n raise \" #{runner} tests failed.\\n BUILD FAILED.\" if project.ignore_tests_failures == \"false\" and passed == false\n File.open(\"#{Continuous4r::WORK_DIR}/test_#{runner}.log\", \"w\") do |file|\n file.write(result)\n file.close\n end\n html << \"<td style='text-align: center;'><img src='images/icon_#{passed ? 'success' : 'error'}_sml.gif'/></td>\"\n file_content = File.read(\"#{Continuous4r::WORK_DIR}/test_#{runner}.log\")\n array_file_content = file_content.split(/$/)\n test_results = extract_test_results(array_file_content)\n examples = test_results[0]\n failures = test_results[1]\n failures ||= 0\n errors_or_warnings += failures.to_i\n if failures.to_i > 0\n html_details << generate_failure_lines(array_file_content)\n end\n if array_file_content.select{|l| l =~ /^Finished in/}.length == 0\n html << generate_default_result_and_time_columns(result, error_detail, passed)\n else\n html << generate_result_and_time_columns(examples, failures, array_file_content)\n end\n i += 1\n end\n html << \"</tbody></table>\"\n return html if errors_or_warnings == 0\n html << generate_error_details(html_details)\n end", "def all_site_report(ticket_repository, options)\n group = \"#{options[:scan_mode]}s\"\n\n log_message(\"Generating full vulnerability report on user entered #{group}.\")\n items_to_query = Array(options[group.to_sym])\n log_message(\"Generating full vulnerability report on the following #{group}: #{items_to_query.join(', ')}\")\n \n items_to_query.each do |item|\n log_message(\"Running full vulnerability report on item #{item}\")\n initial_scan_file = ticket_repository.generate_initial_scan_data(options,\n item)\n\n log_message('Preparing tickets.')\n nexpose_id = format_id(item)\n ticket_rate_limiter(initial_scan_file, 'create', nexpose_id)\n post_scan(item_id: item, generate_asset_list: true)\n end\n\n log_message('Finished processing all vulnerabilities.')\n end", "def interpret_report(command)\n ensure_placed\n @ui.write_text @robot.report\n end", "def wardreport\n\t\t@wards = Ward.find(:all)\n\n\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"wardreport.pdf\", :type => 'application/pdf')\n\tend", "def output_report\n \t# Have user indicate the type of renewable energy system that generated the file\n \t# The Aurora is type-agnostic: it only reports power and energy regardless of the type.\n \t#\n \tputs \"Enter the number for the type of renewable production system?\\n\"\n \tputs \"1.\\tPV Solar\\n\"\n \tputs \"2.\\tThermal Solar\\n\"\n \tputs \"3.\\tOnshore Wind\\n\"\n \tputs \"4.\\tGeothermal\\n\"\n \tputs \"5.\\tHydroelectric\\n\"\n \tputs \"6.\\tBiomass\\n\"\n \tprint \"Your Choice: \"\n \twarning = \"\"\n\t\tinput = STDIN.gets.chomp\n\t\tcase input.to_i\n\t\twhen 1\n\t\t\t@system_type = :PV_Solar\n\t\twhen 2\n\t\t\t@system_type = :Thermal_Solar\n\t when 3\n\t \t@system_type = :Onshore_Wind\n\t\twhen 4\n\t\t\t@system_type = :Geothermal\n\t\twhen 5\n\t\t\t@system_type = :Hydroelectric\n\t\twhen 6\n\t\t\t@system_type = :Biomass\n\t else\n\t \twarning = \"Invalid energy type give. Default is \"\n\t \t@system_type = :PV_Solar\n\t\tend\n\t\t@carbon_savings = (@energy_amount / 1000.0) * (CO2_USGRID - ENERGY_TYPES[@system_type])\n\t\t@ave_power = (@energy_amount / @energy_run_time).round(2)\n\t\t# Write a new output file. Note that this overwrites any existing file.\n output_file = File.open(\"Energy Report.txt\", 'w+')\n text = create_text_report warning, TEXT_TEMPLATE\n output_file.write text\n output_file.close\n\n output_file = File.open(\"Energy Report.html\", 'w+')\n html = create_text_report warning, HTML_TEMPLATE\n output_file.write html\n output_file.close\n puts \"Created files: \\\"Engergy Report.txt\\\" and \\\"Engergy Report.html\\\"\"\n end", "def generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defined? write_extra_pages\n end", "def display_results\n print_header\n print_detailed_report\n write_csv_report\n display_status\n end", "def report\n\t\t dir = \"./report/\"\n File.open(dir + \"method.mmd\", \"w\") do |f|\n f.puts \"# Methods #\"\n Dir[\"./experiments/*/*.rb\"].each do |desc|\n if File.basename(desc) == File.basename(File.dirname(desc)) + \".rb\"\n File.read(desc).split(\"\\n\").each do |line|\n if m = line.match(/^\\# (.+)/)\n f.puts m[1]\n else\n break\n end\n end\n f.puts\n f.puts\n end\n end\n end\n require 'csv'\n require \"yaml\"\n require File.dirname(__FILE__) + \"/stats\"\n CSV.open(dir + \"/data.csv\", \"w\") do |csv|\n data = {}\n Dir[\"./results/*/results.yaml\"].each do |res|\n d = YAML::load_file(res)\n da = {}\n d.each do |k, vals|\n da[k.to_s + \" mean\"], da[k.to_s + \" sd\"] = Stats::mean(vals), Stats::standard_deviation(vals)\n vals.each_with_index do |v, i|\n da[k.to_s + \" cv:\" + i.to_s] = v\n end\n end\n array_merge(data, da)\n end\n data.keys.map do |key| \n \t\t # calculate stats\n \t\t a = data[key]\n \t\t [key] + a\n \t\t end.transpose.each do |row|\n \t\t csv << row\n \t\t end\n end\n\t\t\n\t\tend", "def generate_standard_report(start_date = nil, end_date = nil)\r\n report_lines = ['Affiliate Unique ID,Event Type,Timestamp,First Review?,Program Name']\r\n report_events(start_date, end_date) do |event|\r\n report_lines.push event.report_line\r\n end\r\n report_lines.join(\"\\n\")\r\n end", "def report_html\n Report.html_version\n end", "def storeconsumptionreport\n\t\t@storecunsumptions = Storecunsumption.find(:all)\t\t\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"storeconsumptionreport.pdf\", :type => 'application/pdf')\n\tend", "def Results(testcase_no, checkpoint, result, screenshot)\n Current_Date_Time()\n\t$fileHtml.puts \"</td><tr><td width=110><font size=2 face=verdana>\"\n\t$fileHtml.puts \"#{testcase_no}\"\n\t$fileHtml.puts \"</td><td width=400><font size=2 face=verdana>\"\n\t$fileHtml.puts \"#{checkpoint}\"\n \tif (\"#{result}\" == \"PASS\")\n $fileHtml.puts \"</td><td width=100 bgcolor=green><font size=2 face=verdana color=white><center><font color=white>\"\n\t elsif (\"#{result}\" == \"FAIL\")\n\t Capture_Screenshot(screenshot, testcase_no)\t \n $fileHtml.puts \"</td><td width=100 bgcolor=red><font size=2 face=verdana color=white><center><a href ='\" + \"#{$shot}\" + \"'><font color=white>\"\n\t else\n $fileHtml.puts \"</td><td width=100 bgcolor=SeaShell><font size=2 face=verdana color=white><center>\"\n\t end\n $fileHtml.puts \"#{result}\"\n $fileHtml.puts \"</a>\"\n $fileHtml.puts \"</td><td width=110><font size=2 face=verdana><center>\"\n $fileHtml.puts \"#{$current_time}\"+\" \"+\"#{$current_date}\"\n $fileHtml.puts \"</td>\"\nend", "def report_list(_)\n report_templates = ReportPrivate.all_report_templates(@path_to)\n report_templates = yield(report_templates) if block_given?\n @console.info self, ReportPrivate.table(report_templates)\n end", "def generate_report(_callback_data)\n text_report = OrderReport.new.generate\n\n respond_with :message, text: text_report, parse_mode: :Markdown\n answer_callback_ok\n end", "def hospitalreport\n\t\t@hospitals = Hospital.find (:all)\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"hospitalreport.pdf\", :type => 'application/pdf')\n\tend", "def execute\n puts @robot.report\n end", "def create_report()\n report = <<STR_END\n#### STEPS TO REPRODUCE BUG ####\n\n#{@list_steps_text.get_value}\n\n\n#### DESCRIPTION OF BUG ####\n\n#{@description_text.get_value}\n\n--#{@reproduce_check.get_value}\n--#{@past_check.get_value}\n\n\n#### SESSION LOG ####\n\n#{@parent.log_text.get_value}\n\n\n--------------------------------------------------------------------------------\n#{IO.readlines($attr[:name]).join(\"\\n\") if $attr[:name]}\nSTR_END\n \n fname = \"bugs/#{Time.now.to_s.split(\" \").join(\"_\")}_#{$attr[:name].split(/[\\/\\\\]/).join(\"_\") if $attr[:name]}_bug\"\n File.open(fname, 'w') {|fout| fout.write(report)}\n prompt = MessageDialog.new(self, \"Bug report saved to file: #{fname}\\nPlease email this file to the developer!\",\n \"Bug Report Created\", OK)\n exit_dlg() if prompt.show_modal == ID_OK\n end", "def write_report filename=nil\n\t\toutput_string = ''\t\t\n\t\tself.sort_drivers_by_miles.each do |key,driver|\n\t\t\toutput_string += \"#{driver.trip_report_str} \\n\"\n\t\tend\n\t\tunless filename.nil?\n\t\t\tFile.write(filename, output_string)\n\t\tend\n\t\tputs output_string\n\t\toutput_string\n\tend", "def to_html\n htmlString = %{<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">}\n htmlString += %{<tr>}\n LineCounter.columnNames.each { |name| htmlString += %{<th>#{name}</th>} }\n htmlString += %{</tr>}\n self.each do |result|\n htmlString += %{<tr>}\n result.to_a.each { |cell| htmlString += %{<td>#{cell}</td> } }\n htmlString += %{</tr>}\n end\n htmlString += %{</table>}\n htmlString += %{<p><em>Generated by } +\n %{<a href=\"http://countloc.rubyforge.org\">countloc</a> version #{VERSION} } +\n %{on #{Time.now.asctime}</em></p>}\n end", "def saveSearchPage(obj)\n fileinfo = \"#{@reportFolder}/Search #{@step['Parameter1']}\"\n saveScreen(fileinfo)\n msg = 'Saving Search result with html and screenshot'\n value = @reportFolder\n @report << [obj['Screen'], msg, value, 'True']\n end", "def reporting\n # STUB\n end", "def generate_html\n @main_url = main_url\n @sorted_files = @files.sort\n @sorted_classes = @classes.sort\n @sorted_methods = RDoc::Generator::Method.all_methods.sort\n\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n values = {\n :title_suffix => CGI.escapeHTML(\"[#{@options.title}]\"),\n :charset => @options.charset,\n :style_url => style_url('', @options.css),\n }\n\n @template.write_extra_pages(values) if\n @template.respond_to?(:write_extra_pages)\n end", "def verbose_report\n result = header\n result += \":\\n#{smell_list}\" if should_report\n result += \"\\n\"\n result\n end", "def Summary(logfile)\n $time = Time.new\n $fileHtml = File.new(\"#{logfile}\", \"w+\")\n $fileHtml.puts \"<div> \n <img src='../Attachments/mvasist_logo.jpg' align='right' size=2 />\n <img src='../Attachments/zen_logo.png' align='left' size=2 />\n <br><br><br><br><br><br></div>\"\n $fileHtml.puts \"<html><head><title>Results</title></head><body><br><center><font size=5 face=candara><b>Test Execution Summary<br><center><table border=1 width=610><tr>\"\n $fileHtml.puts \"<body><br><center><font size=4 face=candara><b>Script execution started at #{$time.strftime(\"%b-%d %H:%M:%S\")}<br>\"\n $fileHtml.puts \"<tr><td bgcolor=#153E7E width=110><b><font color=white><center>Test Case #</td><td bgcolor=#153E7E width=400><b><font color=white><center>Test Scenario</td><td bgcolor=#153E7E width=100><b><font color=white><center>Result</td><td bgcolor=#153E7E width=110><b><font color=white><center>Execution Time</td><tr>\"\nend", "def report\n message = [identification]\n\n message.concat(make_report('Original-Source', :original_source))\n message.concat(make_report('Generated-Source', :generated_source))\n message.concat(make_report('Original-Node', :original_node))\n message.concat(make_report('Generated-Node', :generated_node))\n message.concat(node_diff_report)\n\n message.join(\"\\n\")\n end", "def report\n # generate_report()\n ReportWorker.perform_async(\"07-01-2018\", \"08-01-2018\")\n render \\\n json: {status: 'SUCCESS', message:'REQUEST TO GENERATE A REPORT ADDED TO THE QUEUE'},\n status: :ok\n end", "def print_sales_report\n$report_file.puts \"\n ##### ######\n # # ## # ###### #### # # ###### ##### #### ##### #####\n # # # # # # # # # # # # # # # #\n ##### # # # ##### #### ###### ##### # # # # # # #\n # ###### # # # # # # ##### # # ##### #\n # # # # # # # # # # # # # # # # #\n ##### # # ###### ###### #### # # ###### # #### # # #\n********************************************************************************\n\"\nend", "def loanaccountreport\n\t\t@loanaccounts = Loanaccount.find(:all, :order=>\"loanaccountno\")\t\t\n \t html = render :layout => false \n \tkit = PDFKit.new(html)\n \tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n \tsend_data(kit.to_pdf, :filename => \"loanaccountreport.pdf\", :type => 'application/pdf')\n\tend", "def open_html\n console_message(J2R.open_file_command(@report.temp_html))\n end", "def report\n { :genome => @genome.report,\n :polymerase => @polymerase.report }\n end", "def report(file, result)\n Fast.report(result,\n file: file,\n show_link: @show_link,\n show_permalink: @show_permalink,\n show_sexp: @show_sexp,\n headless: @headless,\n bodyless: @bodyless,\n colorize: @colorize)\n end", "def report_title; end", "def report_title; end", "def write_to_screen!\n puts report_title\n puts report_body.lines.take(show_count)\n end", "def render(output)\n\t\t\t\treport_classification\n\n\t\t\t\treport_title NessusReport.title\n\t\t\t\treport_subtitle \"Talking Points NessusReport\"\n\t\t\t\treport_author \"This report was prepared by\\n#{NessusReport.author}\"\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t@output.text \"Scan Date:\", :style => :bold\n\t\t\t\t@output.text \"#{NessusReport.scan_date}\"\n\t\t\t\t@output.text \"\\n\"\n\n\t\t\t\t# Number of hosts / score\n\t\t\t\t@output.text \"There were #{Host.count} hosts identified, containing #{Item.critical_risks.to_a.count + Item.high_risks.to_a.count} critical and high risks findings. Of those there were #{Item.critical_risks.to_a.count} Critical risks, and #{Item.high_risks.to_a.count} High risks.\"\n\n\t\t\t\t@output.text \"These critical and highs were discovered on #{Host.unique_hosts_with_critical_and_high_count} unique hosts. #{Item.risk_percent_rounded_text} of the total assessed computers were found to have an critical or high finding.\"\n\n\t\t\t\t# @TODO need vulnerable host count\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Top Hosts with Findings\n\t\t\t\t#@TODO need this call\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Notable Findings\n\t\t\t\tItem.top_10_table(@output)\n\n\n\t\t\t\t# Plugin_output keyword search?\n\n\t\t\t\t@output.number_pages \"<page> of <total>\", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all\n\t\t\tend", "def complaintsreport\n\t\t@complaints = Complaint.find(:all)\t\t\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"complaintsreport.pdf\", :type => 'application/pdf')\n\tend", "def report\n [\n self,\n {\n generation: generation,\n fitness: report_fitness,\n fitness_species: report_fitness_species,\n best_critter: report_best_fit,\n worst_critter: report_worst_fit,\n all_critters: report_critters,\n }\n ]\n end", "def print_vuln_overview\n\t\tFile.open(@options[:output] + \"/vuln_overview.html\", 'w') do |f|\n\t\t\thtml_header(f,\"Vulns Overview\")\n\n\t\t\tclose_html_header(f)\n\n\t\t\tbody = '<a href=\"index.html\">Home</a><br /><div id=\"vulns\" style=\"font-family: Arial, Helvetica, sans-serif\"><h2>Vulnerabilities</h2>'\n\n\t\t\tbody += '<table id=\"vulns_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Severity</th><th>Name</th><th>Family</th><th>Ports</th><th>Number of impacted hosts</th></tr></thead><tbody>'\n\t\t\t@events.each do |k,v|\n\t\t\t\tnext if v[:severity].to_i < @options[:severity].to_i\n\t\t\t\tbody += '<tr><td><a href=\"vuln_' + k.to_s + '.html\">' + k.to_s\n\t\t\t\tbody += '</a></td><td>' + v[:severity].to_s + '<td>' + v[:plugin_name] + '</td>'\n\t\t\t\tbody += '<td>' + v[:family].to_s + '</td><td>'\n\t\t\t\timpacted_hosts = []\n\t\t\t\tv[:ports].each_with_index do |(k2,v2),index|\n\t\t\t\t\tbody += k2.to_s\n\t\t\t\t\tbody += \", \" unless index == v[:ports].length - 1\n\t\t\t\t\tv2[:hosts].each do |h,w|\n\t\t\t\t\t\timpacted_hosts << h\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\timpacted_hosts.uniq!\n\t\t\t\tbody += '</td><td>' + impacted_hosts.count.to_s + '</td></tr>'\n\t\t\tend\n\t\t\tbody += '</tbody></table>'\n\n\t\t\tbody += '<script>$(document).ready(function() { $(\\'#vulns_table\\').dataTable({\"bPaginate\": false,\"aaSorting\": [[0,\"desc\"],[5,\"desc\"]]}); });</script>'\n\t\t\tbody_text(f,body)\n\n\t\t\tclose_all(f)\n\t\tend\n\tend", "def build_report\n # build cases\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.testsuites {\n testsuite = xml.testsuite {\n @cases.each do |tc|\n testcase = xml.testcase {\n if tc.result_has_message?\n result_type = xml.send(tc.result)\n result_type[:message] = tc.message if tc.message.present?\n end\n\n if tc.system_out.size > 0\n xml.send('system-out') { xml.text tc.system_out.to_s }\n end\n\n if tc.system_err.size > 0\n xml.send('system-err') { xml.text tc.system_err.to_s }\n end\n }\n\n testcase[:name] = tc.name if tc.name.present?\n testcase[:time] = tc.time if tc.time.present?\n\n testcase[:classname] = package if package.present?\n if tc.classname.present?\n if testcase[:classname].present?\n testcase[:classname] = \"#{testcase[:classname]}.#{tc.classname}\"\n else\n testcase[:classname] = tc.classname\n end\n end\n\n end\n }\n\n testsuite[:name] = name if name.present?\n testsuite[:package] = package if package.present?\n }\n end\n\n builder.parent.root.to_xml\n end", "def report\n if @coverage_level > 0 then\n extend RDoc::Text\n end\n\n if @coverage_level.zero? then\n calculate\n\n return great_job if @num_items == @doc_items\n end\n\n ucm = @store.unique_classes_and_modules\n\n report = RDoc::Markup::Document.new\n report << RDoc::Markup::Paragraph.new('The following items are not documented:')\n report << RDoc::Markup::BlankLine.new\n\n ucm.sort.each do |cm|\n body = report_class_module(cm) {\n [\n report_constants(cm),\n report_attributes(cm),\n report_methods(cm),\n ].compact\n }\n\n report << body if body\n end\n\n if @coverage_level > 0 then\n calculate\n\n return great_job if @num_items == @doc_items\n end\n\n report\n end", "def reports(wspace=workspace)\n\t\twspace.reports\n\tend", "def print_results\n Report::print(@result_set)\n end", "def index_page\n '<html><head> <title>%s</title>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /></head>\n <body> <h1>%s</h1> <hr /> <table> <tr> <th class=\"name\">Name</th>\n <th class=\"size\">Size</th> <th class=\"type\">Type</th> \n <th class=\"mtime\">Last Modified</th> </tr> %s </table> <hr /> </body></html>'\n end", "def generate_report(report_start = nil, report_stop = nil)\r\n report_lines = ['Affiliate Unique ID,Event Type,Timestamp,First Review?,Affiliate Program']\r\n \r\n for program in affiliate_programs.active\r\n program.report_events(report_start, report_stop) do |event|\r\n report_lines.push event.report_line\r\n end\r\n end\r\n return report_lines.join(\"\\n\")\r\n end", "def index_page\n '<html><head> <title>%s</title>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /></head>\n <body> <h1>%s</h1> <hr /> <table> <tr> <th class=\"name\">Name</th>\n <th class=\"size\">Size</th> <th class=\"type\">Type</th>\n <th class=\"mtime\">Last Modified</th> </tr> %s </table> <hr /> </body></html>'\n end", "def report\n @report_file || \"kacl_report.json\"\n end", "def save_report\n\n # Parse the result with Nokogiri\n response = connect\n\n # Add the column headers to the file\n write_column_headers\n\n # Append the first batch of data to the file\n write_batch_data\n\n # Save the token for successive calls\n token = \"&token=\" + response[:token] || \"\"\n\n # Loop until the end of the query\n until response[:is_finished] === \"true\"\n response = connect(token)\n write_batch_data\n end\n\n end", "def print_report\n # total_bikes = @fleet.count \n # broken_bikes = @fleet.count {|b| b.is_broken?}\n # working_bikes = total_bikes-broken_bikes\n total_people = @people.count\n total_stations = @stations.count\n # show_stations = @stations.each do {|name, capacity| puts \"#{name}, #{capacity}\"}\n #tell me its name and capcity\n # puts \"Total bikes: #{total_bikes}\"\n # puts \"Broken bikes: #{broken_bikes}\"\n # puts \"Working bikes: #{working_bikes}\"\n puts \"Total people: #{total_people}\"\n # puts \"People with bikes: #{people_with_bikes}\"\n puts \"People without bikes #{people_without_bikes.count}\" \n puts \"Number of stations: #{total_stations}\" \n puts \"Stations:\"\n @stations.each do |station|\n puts \"#{station.name}, #{station.capacity}, #{station.bikes.count}\"\n end\n # result = \"total bikes #{total_bikes}\\n\" + \"broken bikes #{broken_bikes}\\n\" + \"working bikes #{working_bikes}\\n\"\n # result + \"total people #{total_people}\\n\" + \"people with bikes #{people_with_bikes}\\n\" + \"people without bikes #{people_without_bikes}\\n\" + \"number of stations #{total_stations}\\n\" + \"stations #{show_stations}\"\n end", "def create_page\n @outfile.puts <<'EOF'\n<!DOCTYPE html>\n<html>\n <head>\n <title>Fun Fun Fun</title>\n <meta charset=\"utf-8\">\nEOF\n\n include_stylesheets\n include_javascript\n add_data(@batch)\n @outfile.puts <<'EOF'\n </head>\n <body>\n <svg class=\"chart\">\n </svg>\n </body>\n</html>\nEOF\n end", "def testcase_generate\n\t\n\t\thtml = ''\n\t\t\n\t\tthread = ::Thread.new do\n\t\t\n\t\t\tfinished_pass = false\n\n\t\t\tcase @current_pass\n\t\t\t\twhen 1\n\t\t\t\t\t# Initial verification\n\t\t\t\t\tfinished_pass = @genopts.finished?\n\t\t\t\t\t@genopts.skip().call if not finished_pass\n\t\t\t\twhen 2\n\t\t\t\t\t# Reducing elements\n\t\t\t\t\tfinished_pass = @elems.finished?\n\t\t\t\t\t@elems.skip if not finished_pass\n\t\t\t\twhen 3\n\t\t\t\t\t# Reducing idx's\n\t\t\t\t\tfinished_pass = @idxs.finished?\n\t\t\t\t\t@idxs.skip if not finished_pass\n\t\t\t\twhen 4\n\t\t\t\t\t# Final verification\n\t\t\t\t\t# do nothing, we just want to verify the final testcase will still generate a crash\n\t\t\t\telse\n\t\t\t\t\tfinished_pass = true\n\t\t\tend\n\t\t\t\n\t\t\tif( finished_pass )\n\t\t\t\t@reduction_server.stop\n\t\t\t\t::Thread.current.kill\n\t\t\tend\n\t\t\t\n\t\t\t# generate the html testcase from the log file\n\t\t\thtml = @xmlcrashlog.generate_html( @opts, @elems ? @elems.skipping : [], @idxs ? @idxs.skipping : [] )\n\t\tend\n\t\t\n\t\tthread.join\n\t\t\n\t\t# and serve it back out to the browser via the server\n\t\treturn html\n\tend", "def generate_report(school_year=$config.school_year, reprint = false)\r\n reprints = reprint ? \"/WITH_INTACT_TAGS\" : \"\"\r\n puts \"ENTERED 'generate_report'\"\r\n session_school_year=(school_year)\r\n puts \"1\"\r\n student_first_name = first_name.value\r\n puts \"2\"\r\n student_last_name = self.last_name.value\r\n puts \"3\"\r\n file_path = $config.init_path(\"#{$paths.reports_path}Progress_Reports/School_Year_#{session_school_year}/#{term}_K6_Students#{reprints}\")\r\n puts \"4\"\r\n word_doc_path = \"#{file_path}STUDENT_#{student_id}.docx\"\r\n puts \"5\"\r\n pdf_doc_path = \"#{file_path}#{term}_#{student_last_name}_#{student_first_name}_#{student_id}.pdf\"\r\n puts \"6\"\r\n if File.exists?(pdf_doc_path)\r\n puts \"REPORT PREVIOUSLY GENERATED\"\r\n record = progress_record\r\n record.fields[\"reported_datetime\"].value = $idatetime\r\n record.save\r\n return pdf_doc_path\r\n else\r\n puts \"#{student.student_id} #{DateTime.now.strftime(\"%H:%M\")}\"\r\n teacher = self.teacher.value\r\n #each of these need to be set up to handle different school years\r\n puts \"GETTING PROGRESS DETAILS\"\r\n replace = Hash.new\r\n replace[\"[grade_level]\" ] = grade_level.value \r\n replace[\"[school_year]\" ] = session_school_year\r\n replace[\"[first_name]\" ] = student_first_name\r\n replace[\"[last_name]\" ] = student_last_name\r\n replace[\"[student_id]\" ] = student.student_id\r\n replace[\"[today]\" ] = $iuser\r\n replace[\"[school_enroll_date]\" ] = student.school_enroll_date.value\r\n replace[\"[teacher]\" ] = teacher\r\n replace[\"[a_p_1]\" ] = days_present(\"Q1\" ) || \"\"\r\n replace[\"[a_p_2]\" ] = days_present(\"Q2\" ) || \"\"\r\n replace[\"[a_p_3]\" ] = days_present(\"Q3\" ) || \"\"\r\n replace[\"[a_p_4]\" ] = days_present(\"Q4\" ) || \"\"\r\n replace[\"[a_e_1]\" ] = absences_excused(\"Q1\" ) || \"\"\r\n replace[\"[a_e_2]\" ] = absences_excused(\"Q2\" ) || \"\"\r\n replace[\"[a_e_3]\" ] = absences_excused(\"Q3\" ) || \"\"\r\n replace[\"[a_e_4]\" ] = absences_excused(\"Q4\" ) || \"\"\r\n replace[\"[a_u_1]\" ] = absences_unexcused(\"Q1\" ) || \"\"\r\n replace[\"[a_u_2]\" ] = absences_unexcused(\"Q2\" ) || \"\"\r\n replace[\"[a_u_3]\" ] = absences_unexcused(\"Q3\" ) || \"\"\r\n replace[\"[a_u_4]\" ] = absences_unexcused(\"Q4\" ) || \"\"\r\n replace[\"[math_goals_1]\" ] = math_goals(\"Q1\" ) || \"\"\r\n replace[\"[math_goals_2]\" ] = math_goals(\"Q2\" ) || \"\"\r\n replace[\"[math_goals_3]\" ] = math_goals(\"Q3\" ) || \"\"\r\n replace[\"[math_goals_4]\" ] = math_goals(\"Q4\" ) || \"\"\r\n replace[\"[reading_goals_1]\" ] = reading_goals(\"Q1\" ) || \"\"\r\n replace[\"[reading_goals_2]\" ] = reading_goals(\"Q2\" ) || \"\"\r\n replace[\"[reading_goals_3]\" ] = reading_goals(\"Q3\" ) || \"\"\r\n replace[\"[adequate_1]\" ] = adequate_progress(\"Q1\" ) || \"\"\r\n replace[\"[adequate_2]\" ] = adequate_progress(\"Q2\" ) || \"\"\r\n replace[\"[adequate_3]\" ] = adequate_progress(\"Q3\" ) || \"\"\r\n replace[\"[adequate_4]\" ] = adequate_progress(\"Q4\" ) || \"\"\r\n replace[\"[assessment_1]\" ] = assessment_completion(\"Q1\" ) || \"\"\r\n replace[\"[assessment_2]\" ] = assessment_completion(\"Q2\" ) || \"\"\r\n replace[\"[assessment_3]\" ] = assessment_completion(\"Q3\" ) || \"\"\r\n replace[\"[assessment_4]\" ] = assessment_completion(\"Q4\" ) || \"\"\r\n replace[\"[submission_1]\" ] = work_submission(\"Q1\" ) || \"\"\r\n replace[\"[submission_2]\" ] = work_submission(\"Q2\" ) || \"\"\r\n replace[\"[submission_3]\" ] = work_submission(\"Q3\" ) || \"\"\r\n replace[\"[submission_4]\" ] = work_submission(\"Q4\" ) || \"\"\r\n replace[\"[comments]\" ] = comments || \"\"\r\n \r\n puts \"GETTING COURSE PROGRESS\"\r\n #progress###############################################################\r\n p_h = Hash.new\r\n terms = [\"Q1\",\"Q2\",\"Q3\",\"Q4\"]\r\n i_terms = 0\r\n terms.each{|term|\r\n progress = progress(term)\r\n if progress\r\n progress.each{|p|\r\n #if term_active?(term) && !p.fields[\"course_subject_school\"].value.nil?\r\n subject = p.fields[\"course_subject_school\" ].value\r\n p_h[subject] = {\"Q1\"=>nil,\"Q2\"=>nil,\"Q3\"=>nil,\"Q4\"=>nil} if !p_h.has_key?(subject)\r\n p_h[subject][term] = p.fields[\"progress\"].to_user\r\n #end\r\n }\r\n end\r\n i_terms+=1\r\n }\r\n i=1\r\n p_h.each_pair{|subject,progress|\r\n replace[\"[p#{i}]\"] = subject\r\n terms.each{|term|\r\n replace[\"[p#{i}_#{term}]\"] = progress[term]\r\n }\r\n i+=1\r\n }\r\n i = 1\r\n while i <= 10\r\n replace[\"[p#{i}]\"] = \" \" if !replace.has_key?(\"[p#{i}]\")\r\n terms.each{|term|\r\n replace[\"[p#{i}_#{term}]\"] = \" \" if !replace.has_key?(\"[p#{i}_#{term}]\")\r\n }\r\n i+=1\r\n end\r\n ########################################################################\r\n \r\n #masteries##############################################################\r\n m_hash = {\r\n \"Reading\" => \"rm\",\r\n \"Mathematics\" => \"mm\",\r\n \"Writing\" => \"wm\",\r\n \"History\" => \"hm\",\r\n \"Science\" => \"sm\",\r\n \"Physical Education\" => \"pm\" \r\n }\r\n # mastery_records = masteries_snapshot\r\n ########################################################################\r\n \r\n #reading masteries######################################################\r\n rm_h = Hash.new\r\n terms = [\"Q2\",\"Q4\"]\r\n i_terms = 0\r\n placeholder_term = term\r\n terms.each{|this_term|\r\n term = this_term\r\n results = masteries\r\n if results\r\n results.each{|r|\r\n if term_open? #&& !r.fields[\"mastery_level\"].value.nil?\r\n mastery_id = r.fields[\"mastery_id\" ].value\r\n mastery_section = $tables.attach(\"K6_Mastery_Sections\").by_primary_id(mastery_id)\r\n content_area = mastery_section.fields[\"content_area\"].value\r\n if content_area == \"Reading\"\r\n desc = mastery_section.fields[\"description\" ].value\r\n rm_h[desc] = {\"Q2\"=>nil,\"Q4\"=>nil} if !rm_h.has_key?(desc)\r\n rm_h[desc][term] = r.fields[\"mastery_level\"].value\r\n end\r\n end\r\n }\r\n end\r\n i_terms+=1\r\n }\r\n \r\n i=1\r\n rm_h.each_pair{|k,v|\r\n replace[\"[rm#{i}_d]\"] = k\r\n terms.each{|term|\r\n replace[\"[rm#{i}_#{term}]\"] = v[term]\r\n }\r\n i+=1\r\n }\r\n i = 1\r\n while i <= 15\r\n replace[\"[rm#{i}_d]\"] = \" \" if !replace.has_key?(\"[rm#{i}_d]\")\r\n terms.each{|term|\r\n replace[\"[rm#{i}_#{term}]\"] = \" \" if !replace.has_key?(\"[rm#{i}_#{term}]\")\r\n }\r\n i+=1\r\n end\r\n ########################################################################\r\n \r\n #mathematics masteries######################################################\r\n mm_h = Hash.new\r\n i_terms = 0\r\n placeholder_term = term\r\n terms.each{|this_term|\r\n term = this_term\r\n results = masteries\r\n if results\r\n results.each{|r|\r\n if term_open? #&& !r.fields[\"mastery_level\"].value.nil?\r\n mastery_id = r.fields[\"mastery_id\" ].value\r\n mastery_section = $tables.attach(\"K6_Mastery_Sections\").by_primary_id(mastery_id)\r\n content_area = mastery_section.fields[\"content_area\"].value\r\n if content_area == \"Mathematics\"\r\n desc = mastery_section.fields[\"description\" ].value\r\n mm_h[desc] = {\"Q2\"=>nil,\"Q4\"=>nil} if !mm_h.has_key?(desc)\r\n mm_h[desc][term] = r.fields[\"mastery_level\"].value\r\n end\r\n end\r\n }\r\n end\r\n i_terms+=1\r\n }\r\n i=1\r\n mm_h.each_pair{|k,v|\r\n replace[\"[mm#{i}_d]\"] = k\r\n terms.each{|term|\r\n replace[\"[mm#{i}_#{term}]\"] = v[term]\r\n }\r\n i+=1\r\n }\r\n i = 1\r\n while i <= 20\r\n replace[\"[mm#{i}_d]\"] = \" \" if !replace.has_key?(\"[mm#{i}_d]\")\r\n terms.each{|term|\r\n replace[\"[mm#{i}_#{term}]\"] = \" \" if !replace.has_key?(\"[mm#{i}_#{term}]\")\r\n }\r\n i+=1\r\n end\r\n ########################################################################\r\n \r\n #writing masteries######################################################\r\n wm_h = Hash.new\r\n terms = [\"Q2\",\"Q4\"]\r\n i_terms = 0\r\n placeholder_term = term\r\n terms.each{|this_term|\r\n term = this_term\r\n results = masteries\r\n if results\r\n results.each{|r|\r\n if term_open? #&& !r.fields[\"mastery_level\"].value.nil?\r\n mastery_id = r.fields[\"mastery_id\" ].value\r\n mastery_section = $tables.attach(\"K6_Mastery_Sections\").by_primary_id(mastery_id)\r\n content_area = mastery_section.fields[\"content_area\"].value\r\n if content_area == \"Writing\"\r\n desc = mastery_section.fields[\"description\" ].value\r\n wm_h[desc] = {\"Q2\"=>nil,\"Q4\"=>nil} if !wm_h.has_key?(desc)\r\n wm_h[desc][term] = r.fields[\"mastery_level\"].value\r\n end\r\n end\r\n }\r\n end\r\n i_terms+=1\r\n }\r\n i=1\r\n wm_h.each_pair{|k,v|\r\n replace[\"[wm#{i}_d]\"] = k\r\n terms.each{|term|\r\n replace[\"[wm#{i}_#{term}]\"] = v[term]\r\n }\r\n i+=1\r\n }\r\n i = 1\r\n while i <= 8\r\n replace[\"[wm#{i}_d]\"] = \" \" if !replace.has_key?(\"[wm#{i}_d]\")\r\n terms.each{|term|\r\n replace[\"[wm#{i}_#{term}]\"] = \" \" if !replace.has_key?(\"[wm#{i}_#{term}]\")\r\n }\r\n i+=1\r\n end\r\n ########################################################################\r\n \r\n #history masteries######################################################\r\n hm_h = Hash.new\r\n terms = [\"Q2\",\"Q4\"]\r\n i_terms = 0\r\n placeholder_term = term\r\n terms.each{|this_term|\r\n term = this_term\r\n results = masteries\r\n if results\r\n results.each{|r|\r\n if term_open? #&& !r.fields[\"mastery_level\"].value.nil?\r\n mastery_id = r.fields[\"mastery_id\" ].value\r\n mastery_section = $tables.attach(\"K6_Mastery_Sections\").by_primary_id(mastery_id)\r\n content_area = mastery_section.fields[\"content_area\"].value\r\n if content_area == \"History\"\r\n desc = mastery_section.fields[\"description\" ].value\r\n hm_h[desc] = {\"Q2\"=>nil,\"Q4\"=>nil} if !hm_h.has_key?(desc)\r\n hm_h[desc][term] = r.fields[\"mastery_level\"].value\r\n end\r\n end\r\n }\r\n end\r\n i_terms+=1\r\n }\r\n i=1\r\n hm_h.each_pair{|k,v|\r\n replace[\"[hm#{i}_d]\"] = k\r\n terms.each{|term|\r\n replace[\"[hm#{i}_#{term}]\"] = v[term]\r\n }\r\n i+=1\r\n }\r\n i = 1\r\n while i <= 5\r\n replace[\"[hm#{i}_d]\"] = \" \" if !replace.has_key?(\"[hm#{i}_d]\")\r\n terms.each{|term|\r\n replace[\"[hm#{i}_#{term}]\"] = \" \" if !replace.has_key?(\"[hm#{i}_#{term}]\")\r\n }\r\n i+=1\r\n end\r\n ########################################################################\r\n \r\n #science masteries######################################################\r\n sm_h = Hash.new\r\n terms = [\"Q2\",\"Q4\"]\r\n i_terms = 0\r\n placeholder_term = term\r\n terms.each{|this_term|\r\n term = this_term\r\n results = masteries\r\n if results\r\n results.each{|r|\r\n if term_open? #&& !r.fields[\"mastery_level\"].value.nil?\r\n mastery_id = r.fields[\"mastery_id\" ].value\r\n mastery_section = $tables.attach(\"K6_Mastery_Sections\").by_primary_id(mastery_id)\r\n content_area = mastery_section.fields[\"content_area\"].value\r\n if content_area == \"History\"\r\n desc = mastery_section.fields[\"description\" ].value\r\n sm_h[desc] = {\"Q2\"=>nil,\"Q4\"=>nil} if !sm_h.has_key?(desc)\r\n sm_h[desc][term] = r.fields[\"mastery_level\"].value\r\n end\r\n end\r\n }\r\n end\r\n i_terms+=1\r\n }\r\n i=1\r\n sm_h.each_pair{|k,v|\r\n replace[\"[sm#{i}_d]\"] = k\r\n terms.each{|term|\r\n replace[\"[sm#{i}_#{term}]\"] = v[term]\r\n }\r\n i+=1\r\n }\r\n i = 1\r\n while i <= 1\r\n replace[\"[sm#{i}_d]\"] = \" \" if !replace.has_key?(\"[sm#{i}_d]\")\r\n terms.each{|term|\r\n replace[\"[sm#{i}_#{term}]\"] = \" \" if !replace.has_key?(\"[sm#{i}_#{term}]\")\r\n }\r\n i+=1\r\n end\r\n ########################################################################\r\n \r\n #PE masteries######################################################\r\n pm_h = Hash.new\r\n terms = [\"Q2\",\"Q4\"]\r\n i_terms = 0\r\n placeholder_term = term\r\n terms.each{|this_term|\r\n term = this_term\r\n results = masteries\r\n if results\r\n results.each{|r|\r\n if term_open? #&& !r.fields[\"mastery_level\"].value.nil?\r\n mastery_id = r.fields[\"mastery_id\" ].value\r\n mastery_section = $tables.attach(\"K6_Mastery_Sections\").by_primary_id(mastery_id)\r\n content_area = mastery_section.fields[\"content_area\"].value\r\n if content_area == \"Physical Education\"\r\n desc = mastery_section.fields[\"description\" ].value\r\n pm_h[desc] = {\"Q2\"=>nil,\"Q4\"=>nil} if !pm_h.has_key?(desc)\r\n pm_h[desc][term] = r.fields[\"mastery_level\"].value\r\n end\r\n end\r\n }\r\n end\r\n i_terms+=1\r\n }\r\n i=1\r\n pm_h.each_pair{|k,v|\r\n replace[\"[pm#{i}_d]\"] = k\r\n terms.each{|term|\r\n replace[\"[pm#{i}_#{term}]\"] = v[term]\r\n }\r\n i+=1\r\n }\r\n i = 1\r\n while i <= 1\r\n replace[\"[pm#{i}_d]\"] = \" \" if !replace.has_key?(\"[pm#{i}_d]\")\r\n terms.each{|term|\r\n replace[\"[pm#{i}_#{term}]\"] = \" \" if !replace.has_key?(\"[pm#{i}_#{term}]\")\r\n }\r\n i+=1\r\n end\r\n ##########################################################################\r\n grade_ = Integer(student.grade.value.split(\" \")[0].split(\"th\")[0].split(\"rd\")[0].split(\"nd\")[0])\r\n \r\n eoy = end_of_year_placement.value\r\n if eoy == \"Promoted\"\r\n replace[\"[end_of_year_placement]\"] = \"#{student.first_name.value} will be promoted to grade #{grade_ + 1} for the 2012-2013 school year.\"\r\n elsif eoy == \"Retained\"\r\n replace[\"[end_of_year_placement]\"] = \"#{student.first_name.value} will be retained in grade #{grade_} for the 2012-2013 school year.\"\r\n elsif eoy == \"Placed\"\r\n replace[\"[end_of_year_placement]\"] = \"#{student.first_name.value} will be placed in #{grade_ + 1} grade for the 2012-2013 school year.\"\r\n elsif eoy == \"Promoted Pending Summer School\"\r\n replace[\"[end_of_year_placement]\"] = \"If student attends Summer School at Agora and masters grade level standanrds, he/she will be promoted to the #{grade_ + 1} grade for the 2012-2013 school year.\"\r\n end\r\n \r\n term = placeholder_term\r\n puts \"CREATING DOCUMENT\"\r\n failed = 0\r\n document_created = false\r\n until document_created || failed == 3\r\n begin\r\n puts \"CONNECTING TO WORD\"\r\n word = $base.word\r\n puts \"OPENING WORD TEMPLATE\"\r\n doc = word.Documents.Open(\"#{$paths.templates_path}student_progress_report_k6__with_masteries.docx\")\r\n puts \"BEGINNING FIND AND REPLACE\"\r\n replace.each_pair{|f,r|\r\n #footer\r\n word.ActiveWindow.View.Type = 3\r\n word.ActiveWindow.ActivePane.View.SeekView = 10\r\n word.Selection.HomeKey(unit=6)\r\n find = word.Selection.Find\r\n find.Text = f\r\n while word.Selection.Find.Execute\r\n if r.nil? || r == \"\"\r\n rvalue = \" \"\r\n elsif r.class == Field\r\n rvalue = r.to_user.nil? || r.to_user.to_s.empty? ? \" \" : r.to_user.to_s\r\n else\r\n rvalue = r.to_s\r\n end\r\n word.Selection.TypeText(text=rvalue.gsub(\"’\",\"'\"))\r\n end\r\n \r\n #main body\r\n word.ActiveWindow.ActivePane.View.SeekView = 0\r\n word.Selection.HomeKey(unit=6)\r\n find = word.Selection.Find\r\n find.Text = f\r\n while word.Selection.Find.Execute\r\n if r.nil? || r == \"\"\r\n rvalue = \" \"\r\n elsif r.class == Field\r\n rvalue = r.to_user.nil? || r.to_user.to_s.empty? ? \" \" : r.to_user.to_s\r\n else\r\n rvalue = r.to_s\r\n end\r\n word.Selection.TypeText(text=rvalue.gsub(\"’\",\"'\"))\r\n end\r\n }\r\n puts \"SAVING WORD DOC\"\r\n doc.SaveAs(word_doc_path.gsub(\"/\",\"\\\\\"))\r\n puts \"CONVERTING TO PDF\"\r\n doc.SaveAs(pdf_doc_path.gsub(\"/\",\"\\\\\"),17)\r\n doc.close\r\n document_created = true\r\n word.quit\r\n puts \"REMOVING WORD DOC\"\r\n FileUtils.rm(word_doc_path) if File.exists?(word_doc_path)\r\n puts \"WORD DOC REMOVED\"\r\n \r\n record = progress_record\r\n record.fields[\"reported_datetime\"].value = $idatetime\r\n record.save\r\n rescue => e\r\n puts e\r\n failed+=1\r\n puts \"Failed Attempt #{failed}.\"\r\n $base.system_notification(\r\n subject = \"K6 Progress Report Failed - SID: #{student_id}\",\r\n content = \"#{__FILE__} #{__LINE__}\",\r\n caller[0],\r\n e\r\n ) if failed == 3\r\n end\r\n end\r\n \r\n \r\n #MARK AS REPORTED - FNORD\r\n \r\n puts \"RETURNING PDF PATH\"\r\n return pdf_doc_path\r\n end\r\n end" ]
[ "0.74271506", "0.7393127", "0.7189573", "0.7033436", "0.7022559", "0.7022559", "0.7022559", "0.7022559", "0.7022559", "0.69930935", "0.6981009", "0.696098", "0.6942693", "0.6930092", "0.6929381", "0.6885061", "0.6865236", "0.67651916", "0.6759264", "0.6730457", "0.6719262", "0.6635199", "0.66034865", "0.65617037", "0.6458413", "0.63960534", "0.63855654", "0.6374597", "0.63726175", "0.6337952", "0.62813556", "0.6227977", "0.6207862", "0.6204384", "0.620202", "0.61862457", "0.618068", "0.6168253", "0.61582214", "0.61550814", "0.61448914", "0.61411136", "0.6124763", "0.6124763", "0.6111461", "0.6106816", "0.60961115", "0.6093711", "0.6079887", "0.6072316", "0.6014212", "0.59823173", "0.59796077", "0.5962705", "0.5943706", "0.5935741", "0.59349465", "0.5914601", "0.5910918", "0.5909625", "0.590624", "0.5905253", "0.5903512", "0.5884181", "0.58628845", "0.5858518", "0.5848635", "0.58395076", "0.58392113", "0.5823122", "0.58175725", "0.58156073", "0.58091414", "0.5802555", "0.58016604", "0.58014864", "0.57956135", "0.57922155", "0.5786066", "0.57837665", "0.5783091", "0.5783091", "0.5781671", "0.57760394", "0.57703906", "0.57540745", "0.5752067", "0.5746071", "0.5738158", "0.573265", "0.57317233", "0.57309717", "0.5723707", "0.5718171", "0.57022834", "0.5691619", "0.56887555", "0.5687831", "0.5686276", "0.5679245" ]
0.7743368
0
Sets up the HTML report header. CSS and Javascript for the Google Maps Option
def html_report_header @report << ' <html> <head> <title> Kismet Wireless Report</title> <style> body { font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; background: #E6EAE9; } #report-header { font-weight: bold; font-size: 24px; font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; } #sub-header { font-weight: italic; font-size: 10px; font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; } #title { font-weight: bold; font-size: 16px; font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; } th { font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; border-right: 1px solid #C1DAD7; border-bottom: 1px solid #C1DAD7; border-top: 1px solid #C1DAD7; letter-spacing: 2px; text-transform: uppercase; text-align: left; padding: 6px 6px 6px 12px; } td { border-right: 1px solid #C1DAD7; border-bottom: 1px solid #C1DAD7; background: #fff; padding: 6px 6px 6px 12px; color: #4f6b72; } td.alt { background: #F5FAFA; color: #797268; } </style> ' if @options.create_map @report << %Q! <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function initialize() { var latlng = new google.maps.LatLng(#{@map_centre['lat']}, #{@map_centre['long']}); var myOptions = { zoom: 14, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); ! #Yugh this is a hack @options.gps_data.each do |bssid,point| netname = bssid.gsub(':','') if @nets_by_bssid[bssid] #Next line is present to strip any single quotes from SSID's before putting them into the marker as that causes problems :) content_ssid = @nets_by_bssid[bssid]['ssid'].gsub(/['<>]/,'') @log.debug("About to add " + content_ssid) if content_ssid @report << %Q! var contentString#{netname} = '<b>SSID: </b> #{content_ssid} <br />' + '<b>BSSID: </b> #{bssid}<br />' + '<b>Channel: </b> #{@nets_by_bssid[bssid]['channel']} <br />' + '<b>Ciphers: </b> #{@nets_by_bssid[bssid]['cipher']} <br />' + '<b>Cloaked?: </b> #{@nets_by_bssid[bssid]['cloaked']} <br />'; var infowindow#{netname} = new google.maps.InfoWindow({ content: contentString#{netname} }); ! end @report << %Q! var latlng#{netname} = new google.maps.LatLng(#{point['lat']}, #{point['lon']}); var marker#{netname} = new google.maps.Marker({ position: latlng#{netname}, map: map }); ! if @nets_by_bssid[bssid] @report << %Q! google.maps.event.addListener(marker#{netname}, 'click', function() { infowindow#{netname}.open(map,marker#{netname}); }); ! end end @report << %Q! } </script> ! end @report << '</head>' if @options.create_map @report << '<body onload="initialize()">' else @report << '<body>' end @report << '<div id="report-header">Kismet Wireless Report</div> <br /> <div id="sub-header"> Report Generated at ' + Time.now.to_s + '<br />' @report << 'Files analysed ' + @options.file_names.join(',<br />') + '<br /> <br /></div>' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header()\n if @api_key\n \"<script src=\\\"http://maps.google.com/maps?file=api&amp;v=2&amp;key=#{@api_key}\\\" type=\\\"text/javascript\\\"></script>\"\n else\n \"<!-- Google Map Header requires a valid api. Please add the api key to the relevant code calls. -->\"\n end\n end", "def set_info\n @page_header = 'Insight Engine'\n @page_secondary = 'Let\\'s get a view at 10,000 feet.'\n @page_title = 'LeadAccount | Insight Engine'\n @page_icon = 'lightbulb'\n end", "def set_info\n @page_header = 'Dashboard'\n @page_title = 'LeadAccount | Dashboard'\n @page_icon = 'dashboard'\n end", "def prerender_header_and_footer(options); end", "def appoxy_header\n # stylesheets and what not could either be included in this gem or links to s3\n\n # include google javascript for jquery and jquery-ui and perhaps jquery tools\n ret = appoxy_javascripts\n ret.html_safe\n end", "def header(with_vml = true)\r\n GMap.header(:with_vml => with_vml)\r\n end", "def visit_header\n composer.text_box 'Prepare for your visit', at: [30, composer.bounds.top - 405], size: 16, style: :bold\n end", "def header\n @io.content_type = content_type if @io.respond_to?(:content_type)\n\n @io << \"<html>\"\n @io << tag(:head) do |headers|\n headers << tag(:title, 'Request-log-analyzer report')\n headers << tag(:style, '\n body {\n \tfont: normal 11px auto \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n \tcolor: #4f6b72;\n \tbackground: #E6EAE9;\n \tpadding-left:20px;\n \tpadding-top:20px;\n \tpadding-bottom:20px;\n }\n\n a {\n \tcolor: #c75f3e;\n }\n\n .color_bar {\n border: 1px solid;\n height:10px;\n \tbackground: #CAE8EA;\n }\n\n #mytable {\n \twidth: 700px;\n \tpadding: 0;\n \tmargin: 0;\n \tpadding-bottom:10px;\n }\n\n caption {\n \tpadding: 0 0 5px 0;\n \twidth: 700px;\t\n \tfont: italic 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n \ttext-align: right;\n }\n\n th {\n \tfont: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n \tcolor: #4f6b72;\n \tborder-right: 1px solid #C1DAD7;\n \tborder-bottom: 1px solid #C1DAD7;\n \tborder-top: 1px solid #C1DAD7;\n \tletter-spacing: 2px;\n \ttext-transform: uppercase;\n \ttext-align: left;\n \tpadding: 6px 6px 6px 12px;\n \tbackground: #CAE8EA url(images/bg_header.jpg) no-repeat;\n }\n\n td {\n \tfont: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n \tborder-right: 1px solid #C1DAD7;\n \tborder-bottom: 1px solid #C1DAD7;\n \tbackground: #fff;\n \tpadding: 6px 6px 6px 12px;\n \tcolor: #4f6b72;\n }\n\n td.alt {\n \tbackground: #F5FAFA;\n \tcolor: #797268;\n }\n ', :type => \"text/css\")\n end\n @io << '<body>'\n @io << tag(:h1, 'Request-log-analyzer summary report')\n @io << tag(:p, \"Version #{RequestLogAnalyzer::VERSION} - written by Willem van Bergen and Bart ten Brinke\")\n end", "def write_header() \n @builder.head do\n @builder.title('OmniFocus OPML Export')\n @builder.dateCreated(Time.now.httpdate)\n @builder.dateModified(Time.now.httpdate)\n# TODO @builder.ownerName(\"\")\n# TODO @builder.ownerEmail('example@example.com')\n end\n end", "def page_header(site_config, page_count)\n # start common page region\n page = %(<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <!-- The above 3 meta tags *must* come first in the head;\n any other head content must come *after* these tags -->\n <title>#{site_config['title']}</title>)\n page += add_icons\n page += %(\n <meta name=\"description\" content=\"#{site_config['description']}\">\n <meta name=\"theme-color\" content=\"##{site_config['theme_color']}\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap-theme.min.css\">\n <style>\n .container-fluid { padding: 0px; }\n .navbar, .navbar-default { margin-bottom: 0; padding: 5pt; background-color: ##{site_config['theme_color']}; font-size: 12pt; }\n .navbar, .navbar-default li a { color: ##{site_config['text_color']} !important; }\n .navbar-default .navbar-brand { margin-left: 20px !important; color: ##{site_config['logo_text_color']}; font-size: 18pt; font-weight: bold; }\n .navbar-brand:hover { background-color: #{site_config['nav_hover_color']} !important; }\n div[id^=\"d3pie_chart_div_\"], canvas { margin-bottom: 100px; }\n footer { background-color: ##{site_config['theme_color']}; min-height: 200px;}\n footer ul a { color: ##{site_config['text_color']} !important; font-size: 13pt; }\n footer .container { margin-left: 15px; }\n .built { text-decoration: none !important; }\n .selected { background-color: #{site_config['nav_selected_color']}; font-weight: bold; }\n .navbar-default li:hover a { background-color: #{site_config['nav_hover_color']} !important; }\n h1 { text-align: center; background-color: ##{site_config['theme_color']}; padding: 14px; color: ##{site_config['text_color']}; }\n pre { white-space: pre-wrap; word-wrap: break-word; }\n .homepage { padding: 5px 30px 5px 30px; }\n .logo { float: left; }\n .oll { padding-left: 1em; }\n h2#other { text-align: center; }\n .plotlypie { height: 625px; }\n </style>\n </head>\n <body>\n <!-- Static navbar -->\n <nav class=\"navbar navbar-default\" id=\"head1\">\n <div class=\"container-fluid\">\n <div class=\"navbar-header\">\n <a href=\"index.html\"><img src=\"assets/images/logo.png\" alt=\"Ruby Powered\" class=\"logo\"></a>\n <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\n <span class=\"sr-only\">Toggle navigation</span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button>\n <a class=\"navbar-brand\" href=\"index.html\">#{site_config['nav_heading']}</a>\n </div>\n <div id=\"navbar\" class=\"navbar-collapse collapse\">\n <ul class=\"nav navbar-nav\">)\n page += add_links(page_count)\n page += %(\n </ul>\n </div>\n </div>\n </nav>\n <div class=\"container-fluid\">)\n (0..page_count).map do |i|\n instance_variable_set(\"@page#{ii(i)}\", page)\n end\nend", "def draw_header\n document.text \"Practicing Ruby Weekly Report\", :size => 24\n document.text \"This report summarizes the subscriber count and \"+\n \"change in\\nsubscriber count over time.\"\n\n document.move_down(in2pt(0.75))\n end", "def insert_general_sections(report)\n report.add_field(:client, 'mg')\n report.add_field(:project, 'pcv')\n report.add_field(:section, 'dev1')\n report.add_field(:name, person.name)\n report.add_field(:title_function, person.role)\n\n report.add_field(:header_info, \"#{person.name} - Version 1.0\")\n\n report.add_field(:date, Time.zone.today.strftime('%d.%m.%Y'))\n report.add_field(:version, '1.0')\n report.add_field(:comment, 'Aktuelle Ausgabe')\n end", "def head_main(options)\n options[:charset] ||= 'utf-8' \n \n # Prefix (leading space)\n if options[:prefix]\n prefix = options[:prefix]\n elsif options[:prefix] == false\n prefix = ''\n else\n prefix = ' '\n end\n\n # Separator\n unless options[:separator].blank?\n separator = options[:separator]\n else\n separator = '|'\n end\n\n # Suffix (trailing space)\n if options[:suffix]\n suffix = options[:suffix]\n elsif options[:suffix] == false\n suffix = ''\n else\n suffix = ' '\n end\n \n # Lowercase title?\n if options[:lowercase] == true\n @title = @title.downcase unless @title.blank?\n end\n \n # Default page title\n if @title.blank? && options[:default]\n @title = options[:default]\n end\n\n buffer = \"\"\n\n # Set website/page order\n if @title.blank?\n # If title is blank, return only website name\n buffer << content_tag(:title, options[:site]) \n else\n if options[:reverse] == true\n # Reverse order => \"Page : Website\"\n buffer << content_tag(:title, @title + prefix + separator + suffix + options[:site])\n else\n # Standard order => \"Website : Page\"\n buffer << content_tag(:title, options[:site] + prefix + separator + suffix + @title)\n end\n end\n \n buffer << \"\\n\"\n\t\tbuffer << tag(:meta, \"http-equiv\" => \"Content-type\", :content => \"text/html; charset=#{options[:charset]}\")\n\t\tbuffer << csrf_meta_tag\n\t\tbuffer.html_safe\n end", "def html_report(test_report, extra_report_header)\n\n html_report = <<-EOS\n <html>\n EOS\n\n html_style = <<-EOS\n <style>\n body {background-color: #FFFFF0; font-family: \"VAG Round\" ; color : #000080;font-weight:normal;word-break: break-all;}\n #specs-table{font-family:Arial,Helvetica,Sans-serif;font-size:12px;text-align:left;border-collapse:collapse;border-top: 2px solid #6678B1;border-bottom: 2px solid #6678B1;margin:20px;}\n #specs-table th{font-size:13px;font-weight:normal;background:#b9c9fe;border-top:4px solid #aabcfe;border-bottom:1px solid #fff;color:#039;padding:8px;}\n #specs-table td{background:#e8edff;border-top:1px solid #fff;border-bottom:1px solid #fff;color:#039;padding:8px;}\n #specifications{font-family:Arial,Helvetica,Sans-serif;font-size:13px;width:480px;background:#fff;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #specifications th{font-size:14px;font-weight:bold;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}\n #specifications td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #statuspass{font-family:Arial,Helvetica,Sans-serif;font-size:12px;color:green;font-weight:bold;}\n #statusfail{font-family:Arial,Helvetica,Sans-serif;font-size:12px;color:red;font-weight:bold;}\n #tcs{font-family:Arial,Helvetica,Sans-serif;font-size:13px;background:#fff;width:900px;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #tcs th{font-size:14px;font-weight:bold;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}\n #tcs td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #checkpoint{font-family:Arial,Helvetica,Sans-serif;font-size:13px;background:#fff;width:900px;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #checkpoint td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #container{margin: 0 30px;background: #fff;border:1px solid #ccc;}\n #header{background: #e8edff;padding: 2px;border-bottom: 2px solid #6678b1;}\n #steps{background: #e8edff;font-weight: bold;}\n #dp{font-weight: bold;}\n #validations{font-weight: bold;}\n #content{clear: left;padding: 10px;}\n #footer{background: #e8edff;text-align: right;padding: 10px;}\n </style>\n EOS\n\n title = <<-EOS\n <head><title>#{test_report[:test_suite_title]}</title></head>\n\n <body>\n EOS\n\n html_report += html_style + title\n\n report_header = <<-EOS\n <center>\n\n <a name=#{replace_space_by_dash(test_report[:test_suite_title])}></a>\n <table id=\"specifications\">\n <th align=\"center\">#{test_report[:test_suite_title]}</th>\n <tr><td>Test specification: #{test_report[:test_spec_path]}</td></tr>\n <tr><td>Kadu server: #{test_report[:kadu_server]}</td></tr>\n EOS\n @test_report[:test_cases].each do |tc_id, tc|\n if tc.has_key?(:server_info)\n report_header += <<-EOS\n <tr><td>Kadu branch: #{tc[:server_info][:kadu_branch]}</td></tr>\n <tr><td>Kadu version: #{tc[:server_info][:kadu_version]}</td></tr>\n <tr><td>Kadu index: #{tc[:server_info][:kadu_index]}</td></tr>\n EOS\n break\n end\n end\n if !extra_report_header.nil?\n details = extra_report_header.split(\"\\n\")\n details.each do |line|\n report_header += <<-EOS\n <tr><td>#{line}</td></tr>\n EOS\n end\n end\n test_suite_time_in_secs = Time.parse(test_report[:test_suite_completed_time].to_s) - Time.parse(test_report[:test_suite_start_time].to_s)\n\n report_header += <<-EOS\n <tr><td>Test suite started On: #{test_report[:test_suite_start_time]}</td></tr>\n <tr><td>Duration: #{test_suite_time_in_secs} secs</td></tr>\n <tr><td>Test suite status: <font id=#{status(test_report[:test_suite_result_status])}>#{test_report[:test_suite_result_status]}</font></td></tr>\n </table>\n <br>\n EOS\n report_tc_summary = <<-EOS\n <table id=\"tcs\">\n <tr>\n <th >Test Case</th>\n <th >Test Case Status</th>\n </tr>\n EOS\n\n test_report[:test_cases].each do |tc_id, tc|\n report_tc_summary += <<-EOS\n <tr>\n <td><a href=\"##{tc_id}\">#{tc_id}: #{tc[:title]}</a></td><td><font id=#{status(tc[:test_case_result_status])}>#{tc[:test_case_result_status]}</font></td>\n </tr>\n EOS\n end\n\n report_tc_summary += <<-EOS\n </table>\n <br>\n <h4>#{test_report[:test_suite_description]}</h4>\n <br>\n </center>\n EOS\n test_cases = \"\"\n test_report[:test_cases].each do |tc_id, tc|\n test_case = <<-EOS\n <div id=\"container\" style=\"word-break: break-all;width:100%;\">\n <div id=\"header\">\n <h4>\n <p><a name=\"#{tc_id}\">#{tc_id}: #{tc[:title]}</a></p>\n <p>#{tc[:description]}</p>\n <p>Test result status: <font id=#{status(tc[:test_case_result_status])}>#{tc[:test_case_result_status]}</font></p>\n </h4>\n </div>\n <div id=\"content\">\n <h4>\n Steps to reproduce\n </h4>\n EOS\n\n tc[:test_steps].each do |step_id, step|\n test_steps = <<-EOS\n <p id=\"steps\">#{step_id}</p>\n EOS\n\n if step.has_key?(:action) || step.has_key?(:mt_url)\n test_steps += <<-EOS\n <p style=\"word-break: break-all;\" width=900px >URL: #{step[:action]}</p>\n EOS\n end\n\n if step.has_key?(:dynamic_params)\n test_steps += <<-EOS\n <p id=\"dp\">Dynamic Parameters</p>\n EOS\n\n exclusion_term = \"set @kadu_response\"\n step[:dynamic_params].each do |parameter, expression|\n expression = exclusion_term if expression.to_s.include?(exclusion_term)\n test_steps += <<-EOS\n <p>#{parameter} = #{expression}</p>\n EOS\n end\n end\n\n if step.has_key?(:validation_steps)\n\n test_steps += <<-EOS\n <p id=\"validations\">\n Validations\n </p>\n <table id=\"checkpoint\">\n EOS\n\n step[:validation_steps].each do |vstep, result|\n steps = <<-EOS\n <tr>\n <td colspan=\"2\" width=\"90%\">\n <p>#{vstep}</p>\n <p>#{result[\"test_result_message\"]}</p>\n </td>\n <td width=\"10%\" rowspan=\"1\" align=\"center\"><font id=#{status(result[\"test_result_status\"])}>#{result[\"test_result_status\"]}</font></td>\n </tr>\n EOS\n test_steps += steps\n end\n\n test_steps += <<-EOS\n </table>\n EOS\n\n end\n test_case += test_steps\n end\n test_cases += test_case\n test_cases += <<-EOS\n </div>\n <div id=\"footer\">\n <a href=\"##{replace_space_by_dash(test_report[:test_suite_title])}\">back to test suite</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#summary\">back to summary</a>\n\t </div>\n </div>\n <br>\n EOS\n end\n\n report_footer = <<-EOS\n <br>\n <hr>\n <br>\n </body>\n </html>\n EOS\n\n html_report += report_header + report_tc_summary + test_cases + report_footer\n\n html_report\n end", "def render_header\n class_names = ''\n class_names += 'has-url' if @browser_url\n \"<figure class=\\\"browser-mockup #{class_names}\\\">\"\n end", "def head_content\n meta 'http-equiv' => 'content-type', :content => 'text/html;charset=UTF-8'\n title page_title\n\n included_stylesheets\n inline_styles\n\n included_scripts\n inline_scripts\n end", "def prepare_project_header_and_footer\n @header_text = @project.templets.find_by_name('PAGE_HEADER').render( @project )\n @footer_text = @project.templets.find_by_name('PAGE_FOOTER').render( @project )\n end", "def build_header \n pdf_writer.margins_in(1)\n if timespan == \"Weekly\"\n add_text \"Status Report for the Week of \" + Time.now.to_formatted_s(:date)\n else\n add_text \"Status Report for \" + Time.now.to_formatted_s(:date)\n end\n end", "def build_header \n pdf_writer.margins_in(1)\n \n pad_bottom(10) do\n if allflag\n add_text \"All Goals\"\n else\n add_text \"Current Goals\"\n end\n end \n \n end", "def html_report_probe\n @log.debug(\"Starting to report probe networks, there were \" + @probe_networks.length.to_s + \" to report\")\n @report << '<div id=\"title\">Probe Networks</div><br /><br />'\n @probe_tab = Ruport::Data::Table(%w[bssid manufacturer])\n @probe_networks.each do |probe,info|\n if @options.gps_data[probe]\n point = probe\n @log.debug(\"attempting to add link\")\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s\n probe = '<a href=\"' + url + '\">' + point + '</a>'\n end\n @probe_tab << [probe, info['manufacturer']]\n end\n\t @report << @probe_tab.to_html\n\t @report << \"<br /><br />\"\n end", "def index\n @stylesheet = \"front_page\"\n @google_fonts = \"Josefin+Slab|Muli\"\n @title = \"Bakery Market\"\n end", "def on_header_init()\n end", "def header\n end", "def head\n HEADER\n end", "def show\n @title = \"#{@map.name} | Maps\"\n @page_class = \"maps-#{@map.name}\"\n end", "def include_calendar_headers_tags\n unless @calendar_headers_tags_included\n @calendar_headers_tags_included = true\n content_for :additional_javascript do\n javascript_include_tag('calendar/calendar') +\n javascript_include_tag(\"calendar/lang/calendar-#{I18n.locale.to_s.downcase}.js\") +\n javascript_include_tag('calendar/calendar-setup') +\n stylesheet_link_tag('calendar')\n end\n end\n end", "def view_layouts_base_html_head(context = {})\n output = ''\n\n @controller = context[:controller]\n return output if !@controller\n return output if @@supported_controllers.include?(@controller.class.name) == false\n\n #include javascript/css to the head tag here\n output << javascript_include_tag('timesheet', :plugin => 'weekly_timesheet')\n output << stylesheet_link_tag('timesheet', :plugin => 'weekly_timesheet')\n\n return output\n rescue Exception => exc\n puts exc\n puts exc.backtrace\n return ''\n end", "def header; end", "def header; end", "def header; end", "def header\n\t\tlogo_path = Rails.root.join('app','assets','images','longbourn_logo.png')\n\t\timage logo_path, :width => 70, :height => 45\n\t\tdraw_text \"Informe de Desempeño de Alumnos\", :at => [100,25], size:12\n\t\tdraw_text \"Longbourn Institute\", :at => [100,10], size:12\n\tend", "def kopal_layout_before_page_header\n\n end", "def html_report\n begin\n require 'ruport'\n rescue LoadError\n abort(\"Couldn't load ruport, suggest that gem install ruport should help\")\n end\n\n unless @options.report_file\n html_report_file_name = 'Kismet-Wireless-Report-' + Time.now.to_s + '.html'\n end\n\n unless @options.report_file =~ /html$/\n html_report_file_name = @options.report_file + '.html'\n end\n\n @report = File.new(html_report_file_name,'w+')\n html_report_header\n html_report_stats\n \n if @options.create_map\n @report << '<hr /><br /><br />'\n html_report_map_body\n end\n @report << '<hr /><br /><br />'\n html_report_inf\n @report << '<hr /><br /><br />'\n html_report_adhoc\n @report << '<hr /><br /><br />'\n html_report_probe\n @report << \"</body>\"\n @report << \"</html>\"\n end", "def head()\n head = '<!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css\" integrity=\"sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z\" crossorigin=\"anonymous\">\n <title>Informacion Rover en Marte</title>\n </head>\n <body class=\"container\">'\n \n return head\n \n end", "def _brands_header\n\t$report_file.puts \" _ _ \"\n\t$report_file.puts \"| | | | \"\n\t$report_file.puts \"| |__ _ __ __ _ _ __ __| |___ \"\n\t$report_file.puts \"| '_ \\\\| '__/ _` | '_ \\\\ / _` / __|\"\n\t$report_file.puts \"| |_) | | | (_| | | | | (_| \\\\__ \\\\\"\n\t$report_file.puts \"|_.__/|_| \\\\__,_|_| |_|\\\\__,_|___/\"\n\t$report_file.puts\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts\nend", "def build_header \n pdf_writer.margins_in(1)\n \n pad_bottom(10) do\n if allflag\n add_text \"All Tasks\"\n else\n add_text \"Current Tasks\"\n end\n end \n end", "def index\n @head = '<script type=\"text/javascript\" src=\"/js/index.js\"></script>'\n @title = \"TinyCDR - FreeSWITCH CDR Reporting\"\n end", "def kopal_layout_after_page_header\n\n end", "def generate\n header + dict + footer\n end", "def map_javascript(options = {})\n if !map_center && !center_on_bounds?\n \"<!-- Google Map requires a lat long centering -->\"\n elsif !self.name\n \"<!-- Google map requires a name -->\"\n else\n \"<script type=\\\"text/javascript\\\">\\n// <![CDATA[\" << build_map << \" //]]>\\n</script>\"\n end\n end", "def html_head\n\t\treturn %Q{<html><head><title>GreyGoo</title></head><body><h1>#{status} - #{scode(status.to_i)}</h1><a href=\"/player\">player</a> | <a href=\"/room\">room</a><br>}\n\tend", "def header content = nil, options = nil, html_options = nil, &block\n @header = Component.new content, options, html_options, &block\n end", "def custom_html_header_content\n nil\n end", "def header_and_footer\n @title = _'Labvirt'\n @footer = _'Something nice should go down here...'\n end", "def head\n render 'head.html'\n end", "def header(opts = {}, &block)\n build_main_component :header, opts, &block\n end", "def gmaps(options, enable_css = true, enable_js = true )\n render :partial => 'gmaps4rails/gmaps4rails', :locals => { :options => options, :enable_css => enable_css, :enable_js => enable_js }\n end", "def gi_header_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"site-banner\")).a.innerText(\"/GameInformer/\"), __method__)\n end", "def add_page_header\n tenant = MnoEnterprise::Tenant.show\n title = Settings.dashboard.payment.enabled ? \"#{t(:monthly_invoice)} - \" : \"#{t(:account_statement)} - \"\n @pdf.repeat :all do\n @pdf.bounding_box([0, @pdf.bounds.top+@format[:header_size]], width: 540, height: @format[:footer_size]) do\n @pdf.float do\n @pdf.image main_logo_white_bg_path(true), fit: [135, (@format[:footer_size])]\n end\n @pdf.text tenant.name, align: :right, inline_format: true\n if tenant.main_address.present?\n tenant_address = \"#{tenant.main_address.dig('street')}\\n#{tenant.main_address.dig('city')}\\n#{ISO3166::Country.new(tenant.main_address.dig('country_code')).name}\"\n @pdf.move_down 5\n @pdf.text \"<color rgb='999999'>#{tenant_address}</color>\", align: :right, inline_format: true, style: :italic, size: 9\n end\n if contact_details = Settings.dashboard&.organization_management&.billing&.invoice_contact_details.presence\n @pdf.move_down 5\n @pdf.font_size(10) { @pdf.text contact_details, align: :right }\n end\n @pdf.move_down 10\n @pdf.font_size(20) { @pdf.text \"#{title} #{@data[:period_month]}\", style: :bold, align: :right }\n end\n end\n end", "def make_head( title='', filename=\"#{ENV['TM_FILEPATH']}\", styles=Array.new, head_adds='' )\n tm_extra_head = \"\"\n styles.each do |style|\n tm_extra_head << \"<link rel=\\\"stylesheet\\\" href=\\\"file://\"+style+\"\\\" type=\\\"text/css\\\" charset=\\\"utf-8\\\" media=\\\"screen\\\">\\n\"\n end\n tm_extra_head += head_adds\n# html_header(title, filename, tm_extra_head)\n puts html_head(:title => title, :sub_title =>filename, :html_head => tm_extra_head)\n end", "def generate_header(title, path = nil)\n version = Version::VERSION\n\n vars = {\n 'title' => escape_html(title),\n 'favicon' => escape_html(asset_url('favicon.ico')),\n 'style' => escape_html(asset_url('sabredav.css')),\n 'iconstyle' => escape_html(asset_url('openiconic/open-iconic.css')),\n 'logo' => escape_html(asset_url('sabredav.png')),\n 'baseUrl' => @server.base_uri\n }\n\n html = <<HTML\n<!DOCTYPE html>\n<html>\n<head>\n <title>#{vars['title']} - tilia/dav #{version}</title>\n <link rel=\"shortcut icon\" href=\"#{vars['favicon']}\" type=\"image/vnd.microsoft.icon\" />\n <link rel=\"stylesheet\" href=\"#{vars['style']}\" type=\"text/css\" />\n <link rel=\"stylesheet\" href=\"#{vars['iconstyle']}\" type=\"text/css\" />\n</head>\n<body>\n <header>\n <div class=\"logo\">\n <a href=\"#{vars['baseUrl']}\"><img src=\"#{vars['logo']}\" alt=\"tilia/dav\" /> #{vars['title']}</a>\n </div>\n </header>\n <nav>\nHTML\n\n # If the path is empty, there's no parent.\n if !path.blank?\n parent_uri = Http::UrlUtil.split_path(path).first\n full_path = @server.base_uri + Http::UrlUtil.encode_path(parent_uri)\n html << \"<a href=\\\"#{full_path}\\\" class=\\\"btn\\\">⇤ Go to parent</a>\"\n else\n html << '<span class=\"btn disabled\">⇤ Go to parent</span>'\n end\n\n html << ' <a href=\"?sabreAction=plugins\" class=\"btn\"><span class=\"oi\" data-glyph=\"puzzle-piece\"></span> Plugins</a>'\n html << '</nav>'\n\n html\n end", "def pdf_header(pdf, report)\n # TODO: when we can use prawn >= 0.7.1, use the pdf.page_number method instead of counting ourselves\n @page_count = 0\n pdf.header [pdf.margin_box.left, pdf.margin_box.top + 10] do\n pdf.font \"Helvetica\" do\n pdf.text report.title, :size => 12, :align => :left\n pdf.move_up(16) # move back up so that the next two lines are more or less even with the title line\n pdf.text Time.now, :size => 8, :align => :right\n pdf.text \"Page: #{@page_count = @page_count + 1}\", :size => 8, :align => :right\n pdf.stroke_horizontal_rule\n end\n end\n end", "def display_app_header\n\t\t\n\t\t\t#specifying font to be used\n\t\t\ttext_font @font, 25\n\t\t\t#setting title to dipslay\n\t\t\ttext \"SerialDuino v1a - StephanAG 2012\", 10 ,25\n\t\t\t\n\t\t\t#display intro paragraph\n\t\t\ttext_font @font, 13\n\t\t\ttext @intro_data, 10 ,45\n\t\tend", "def report_title; end", "def report_title; end", "def header\n image \"#{Rails.root}/app/assets/images/giftgardensmall.jpg\", \n width: 40, height: 40\n move_up 30\n text \"Activities Report\", size: 24, style: :bold, :align => :center\n end", "def govuk_page_header(heading_details)\n tag.h1(class: 'govuk-heading-xl', id: 'main_title') do\n if heading_details.caption3.present?\n concat(tag.span(class: 'govuk-caption-m govuk-!-margin-bottom-1') do\n concat(heading_details.caption3)\n end).html_safe\n end\n if heading_details.caption?\n concat(tag.span(class: 'govuk-caption-xl') do\n concat(heading_details.caption)\n concat(\" — #{heading_details.caption2}\") if heading_details.caption2.present?\n end).html_safe\n end\n concat(heading_details.text)\n concat(tag.p(heading_details.subtitle, class: 'govuk-body-l')) if heading_details.subtitle.present?\n end\n end", "def main()\n main_menu(SHOW_HEADER);\n end", "def html_report_inf\n @report << '<div id=\"title\">Infrastructure Networks</div><br /><br />'\n @log.debug(\"Starting reporting Infrastructure networks there were \" + @infrastructure_networks.length.to_s + \" networks to list\")\n @infrastructure_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid num_clients channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['clients'].length.to_s, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def header\n text \"Phishing Frenzy Results\", size: 30, style: :bold\n move_down 20\n end", "def set_page_title\n @page_title = \"Race Results Management\"\n end", "def prerender_header_and_footer(options)\n [:header, :footer].each do |hf|\n next unless options[hf] && options[hf][:html] && options[hf][:html][:template]\n\n options[hf][:html][:layout] ||= options[:layout]\n render_opts = render_options(options[hf][:html])\n path = render_to_tempfile(\"wicked_#{hf}_pdf.html\", render_opts)\n options[hf][:html][:url] = \"file:///#{path}\"\n end\n options\n end", "def setup \n @pdf_name = \"pdf name\"\n @options = { :pdf_layout => \"reports_layout.pdf.erb\", :pdf_template => \"reports/report.pdf.erb\", \n :render_options => {\n :header_right => 'Page [page] of [toPage]',\n :grayscale => true,\n :page_size => 'Letter'} \n } \n @page = \"<html><head><head><body><b>Hello</b> World</body></html>\" \n \n TooRendermonkey.configure = {\n :uri => \"http://localhost:4567/generate\",\n :api_key => \"835a3161dc4e71b\",\n :hash_key => \"sQQTe93eWcpV4Gr5HDjKUh8vu2aNDOvn3+suH1Tc4P4=\"\n } \n end", "def header(routes)\n # no need for a header\n end", "def build_map()\n \n return_string = \"\\n\"\n # see if we have any javascript variables to set up\n\n if @js_vars.length > 0\n return_string << \"// js_vars //\\n\"\n return_string << @js_vars.values.to_s\n end\n \n # see if we have any functions to include\n\n if @include_funcs.length > 0\n return_string << build_js_funcs\n end\n\n # see if we have any createmarker code \n \n if @marker_code.length > 0\n return_string << @marker_code.values.to_s\n end\n \n # see if we have any embedded javascript code\n \n if @js_code.length > 0\n return_string << @js_code.values.to_s\n end\n \n if @onload == true\n \n return_string << \"\n \n function #{onload_func_name}(){\n if (GBrowserIsCompatible()) {\" << build_load_func << \"\n \n }\n // display a warning if the browser was not compatible\n else {\n alert(\\\"Sorry, the Google Maps API is not compatible with this browser\\\");\n }\n }\n \"\n else\n return_string << \"\n if (GBrowserIsCompatible()) {\n function #{onload_func_name}(){\n \" << build_load_func << \"\n }\n #{onload_func_name}();\n }\n // display a warning if the browser was not compatible\n else {\n alert(\\\"Sorry, the Google Maps API is not compatible with this browser\\\");\n }\n \" \n end\n return return_string\n end", "def Header\r\n\t\tif @page == 1\r\n\t\t\tfirst_page_header\r\n\t\telse\r\n\t\t\tpage_header\t\r\n\t\tend\r\n\tend", "def locationManager manager, didUpdateToLocation: new, fromLocation: old\n coordinate = new.coordinate\n size = webView.bounds.size\n\n params = {\n markers: 'color:blue|%s,%s' % [coordinate.latitude, coordinate.longitude],\n zoom: 14,\n size: '%dx%d' % [size.width, size.height],\n sensor: 'false'\n }\n\n url = \"http://maps.googleapis.com/maps/api/staticmap?#{encodeParams params}\"\n\n loadUrl url\n end", "def tail()\n<<ENDING\n<script defer>\n\n/******************************************************************************************************************************************/\n// definitions\n/******************************************************************************************************************************************/\n\nvar map_location_callback = true;\nvar use_google_popup = true;\nvar use_pd_popup = false;\nvar use_tooltips = false;\nvar map_div = null;\nvar map = null;\nvar map_longitude = 0;\nvar map_latitude = 0;\nvar mgr = null;\nvar map_icons = [];\nvar map_icon_names = {};\nvar map_markers = [];\nvar map_marker;\nvar lat = 28.000;\nvar lon = -90.500;\nvar zoom = 9;\nvar map_markers_raw = #{@features.to_json};\nvar map_features = {}\nvar map_api_calback = \"/json\"\n\nvar icons = [ \"weather-storm.png\",\n\"weather-snow.png\",\n\"weather-overcast.png\",\n\"weather-showers-scattered.png\",\n\"weather-clear.png\",\n\"weather-few-clouds.png\",\n\"weather-clear-night.png\",\n\"start-here.png\",\n\"media-skip-forward.png\",\n\"media-record.png\",\n\"face-wink.png\",\n\"image-loading.png\",\n\"face-surprise.png\",\n\"face-smile.png\",\n\"face-smile-big.png\",\n\"face-sad.png\",\n\"face-plain.png\",\n\"face-monkey.png\",\n\"face-kiss.png\",\n\"face-devil-grin.png\",\n\"face-angel.png\",\n\"face-crying.png\",\n\"emblem-photos.png\",\n\"emblem-important.png\",\n\"emblem-favorite.png\",\n];\nvar base_icon;\nvar icon_index = 0;\n\n/******************************************************************************************************************************************/\n// helper utilities\n/******************************************************************************************************************************************/\n\nfunction mapper_make_links_clickable(twitter,username) {\n var status;\n\n /* buggy\n // http://deanjrobinson.com/wp-content/uploads/2009/07/blogger-mod.js.txt\n // status = twitter.replace(/((https?|s?ftp|ssh)\\:\\/\\/[^\"\\s\\<\\>]*[^.,;'\">\\:\\s\\<\\>\\)\\]\\!])/g, function(url) {\n // status = twitter.replace(/http[s]?:\\/\\[a-zA-Z0-9_]/g, function(url) {\n // status = twitter.replace(/https?:\\/\\/([-\\w\\.]+)+(:\\d+)?(\\/([\\w/_\\.]*(\\?\\S+)?)?)?/g, function(url) {\n // return '<a href=\"'+url+'\">'+url+'</a>';\n // })\n status = twitter.replace(/\\B@([_a-z0-9]+)/ig, function(reply) {\n return reply.charAt(0)+'<a href=\"http://twitter.com/'+reply.substring(1)+'\">'+reply.substring(1)+'</a>';\n }).replace(/\\B#([_a-z0-9]+)/ig, function(hashtag) {\n return '<a href=\"http://search.twitter.com/search?q=%23'+hashtag.substring(1)+'\">'+hashtag+'</a>';\n });\n */\n\n var results = twitter.split(\" \");\n for(var i = 0; i < results.length; i++ ) {\n var xxx = results[i];\n if(xxx.startsWith(\"http://\")) {\n results[i] = \"<a href='\"+xxx+\"'>\"+xxx+\"</a>\";\n }\n else if(xxx.startsWith(\"@\")) {\n results[i] = \"<a href='http://twitter.com/\"+xxx.substring(1)+\"'>\"+xxx+\"</a>\";\n }\n else if(xxx.startsWith(\"#\")) {\n results[i] = \"<a href='http://search.twitter.com/search?q=%23\"+xxx.substring(1)+\"'>\"+xxx+\"</a>\";\n }\n }\n status = results.join(\" \");\n\n return '<a href=\"http://twitter.com/'+username+'\">'+username+'</a> ' + status;\n}\n\nfunction relative_time(time_value) {\n var values = time_value.split(\" \");\n time_value = values[1] + \" \" + values[2] + \", \" + values[5] + \" \" + values[3];\n var parsed_date = Date.parse(time_value);\n var relative_to = (arguments.length > 1) ? arguments[1] : new Date();\n var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);\n delta = delta + (relative_to.getTimezoneOffset() * 60);\n\n if (delta < 60) {\n return 'less than a minute ago';\n } else if(delta < 120) {\n return 'about a minute ago';\n } else if(delta < (60*60)) {\n return (parseInt(delta / 60)).toString() + ' minutes ago';\n } else if(delta < (120*60)) {\n return 'about an hour ago';\n } else if(delta < (24*60*60)) {\n return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';\n } else if(delta < (48*60*60)) {\n return '1 day ago';\n } else {\n return (parseInt(delta / 86400)).toString() + ' days ago';\n }\n}\n\n/// convenience utility: drag event handler\nfunction mapper_disable_dragging() {\n if( map ) map.disableDragging();\n}\n/// convenience utility: drag event handler\nfunction mapper_enable_dragging() {\n if( map ) map.enableDragging();\n}\n/// mapper icon support\nfunction mapper_icons() {\n base_icon = new GIcon(G_DEFAULT_ICON);\n base_icon.shadow = \"http://www.google.com/mapfiles/shadow50.png\";\n base_icon.iconSize = new GSize(20, 34);\n base_icon.shadowSize = new GSize(37, 34);\n base_icon.iconAnchor = new GPoint(9, 34);\n //base_icon.infoWindowAnchor = new GPoint(9, 2);\n}\n/// add a map centering marker - unused\nfunction mapper_center_marker() {\t \n var center = map.getCenter();\n //mapper_set_marker(center);\n}\n/// javascript: center over predefined set \nfunction mapper_center() {\n var markers = map_markers;\n if (markers == null || markers.length < 1 ) return;\n var bounds = new GLatLngBounds();\n for (var i=0; i<markers.length; i++) {\n bounds.extend(markers[i].getPoint());\n }\n var thezoom = map.getBoundsZoomLevel(bounds);\n if(thezoom > 15 ) thezoom = 15;\n map.setCenter( bounds.getCenter( ), thezoom );\n}\n/// add a marker [ must be a separate function for closure ]\nfunction mapper_create_marker(point,title,glyph) {\n var number = map_markers.length\n var marker_options = { title:title }\n if ( glyph != null ) {\n\tmarker_options[\"icon\"] = glyph;\n }\n else if ( map_icons.length > 0 ) {\n\tmarker_options[\"icon\"] = map_icons[map_icons.length-1];\n }\n var marker = new GMarker(point, marker_options );\n map_markers.push(marker)\n marker.value = number;\n GEvent.addListener(marker, \"click\", function() {\n // marker.openInfoWindowHtml(title);\n map.openInfoWindowHtml(point,title);\n });\n map.addOverlay(marker);\n return marker;\n}\n/// saving the map location to a hidden input form if found\n/// [ very convenient for say telling server about location of a search form submission ]\nfunction mapper_save_location(center) {\n if(map == null ) return;\n var center = map.getCenter();\n if(center == null) return;\n var x = document.getElementById(\"longitude\");\n var y = document.getElementById(\"latitude\");\n if(x && y) {\n x.value = center.lat();\n y.value = center.lng();\n }\n map_latitude = center.lat();\n map_longitude = center.lng();\n}\n/// convenience utility: page refresh may supply map location [ this is the opposite ]\nfunction mapper_get_location() {\n var x = document.getElementById(\"note[longitude]\");\n var y = document.getElementById(\"note[latitude]\");\n if(x && y ) {\n x = parseFloat(x.value);\n y = parseFloat(y.value);\n }\n if(x && y && ( x >= -180 && x <= 180 ) && (y >= -90 && y <= 90) ) {\n return new google.maps.LatLng(y,x);\n }\n return new google.maps.LatLng(lat,lon);\n}\n\n/******************************************************************************************************************************************/\n// duplicate tracking\n/******************************************************************************************************************************************/\n\nvar mapper_features = {};\n\n/// a list tracking all features active on the screen so that we can not re-create ones that already exist\n/// do we have this feature on the screen? caller has to construct and supply a unique key signature identifying this object\nfunction mapper_feature_exists_test_and_mark(key) {\n\tvar feature = mapper_features[key];\n\tif(feature != null) {\n\t\tfeature.stale = false;\n\t\treturn true;\n\t}\n\treturn false;\n}\n/// visit all features and mark them as stale; this is done prior to adding more data to a view as an efficiency measure\nfunction mapper_mark_all_stale() {\n\tfor(var key in mapper_features) {\n\t\tvar feature = mapper_features[key];\n\t\tif(feature != null) {\n\t\t\tfeature.stale = true;\n\t\t}\n\t}\n}\n/// mark this feature as not stale\nfunction mapper_track_and_mark_not_stale(pointer,key) {\n\tpointer.stale = false;\n\tmapper_features[key] = pointer;\n}\n/// hide all stale features \n/// arguably to save memory we could actually remove these features but unsure if javascript conserves memory like so anyway\nfunction mapper_hide_stale() {\n\tfor(var key in mapper_features) {\n\t\tvar feature = mapper_features[key];\n\t\tif(feature != null && feature.stale == true) {\n\t\t\tfeature.hide(); // removeOverlay();\n\t\t} else if( feature != null ) {\n\t\t\tfeature.show();\n\t\t}\n\t}\n}\n/// build a key to more or less uniquely identify a feature\nfunction mapper_make_key(feature) {\n\tvar key = feature[\"lat\"] + \":\" + feature[\"lon\"] + \":\" + feature[\"title\"];\n\treturn key;\n}\n\n/******************************************************************************************************************************************/\n// do actual meat of binding our fairly generic system to google maps - add a feature to google maps\n/******************************************************************************************************************************************/\n\n/// javascript: try to get feature up\nfunction mapper_inject_feature(feature) {\n if(feature) {\n /*\n if(feature.kind == \"icon_numbered\") {\n var icon = new GIcon(base_icon);\n var letter = String.fromCharCode(\"A\".charCodeAt(0) + icon_index);\n icon.image = \"http://www.google.com/mapfiles/marker\" + letter + \".png\";\n map_icons.push(icon);\n } else\n */\n if(feature.kind == \"icon\") {\n var icon = new GIcon();\n icon.image = feature[\"image\"];\n icon.iconSize = new GSize(feature[\"iconSize\"][0],feature[\"iconSize\"][1]);\n icon.iconAnchor = new GPoint(feature[\"iconAnchor\"][0],feature[\"iconAnchor\"][1]);\n //icon.infoWindowAnchor = new GPoint(feature[\"infoWindowAnchor\"][0],feature[\"infoWindowAnchor\"][1]);\n map_icons.push(icon);\n map_icon_names[icon.image] = icon;\n }\n else if( feature.kind == \"marker\" ) {\n var key = mapper_make_key(feature);\n if(mapper_feature_exists_test_and_mark(key)) {\n return;\n }\n // Slightly randomize the map position of marker so markers do not always overlap\n var randx = Math.random()*0.01 - 0.005;\n var randy = Math.random()*0.01 - 0.005;\n var ll = new GLatLng(feature[\"lat\"] + randy ,feature[\"lon\"] + randx);\n var title = feature[\"title\"];\n var glyph = feature[\"glyph\"];\n if(glyph != null) {\n glyph = map_icon_names[glyph];\n }\n var marker = mapper_create_marker(ll,title,glyph);\n if(feature[\"style\"] == \"show\") { GEvent.trigger(marker,\"click\"); }\n mapper_track_and_mark_not_stale(marker,key);\n }\n else if( feature.kind == \"line\") {\n var p1 = new GLatLng(feature[\"lat\"],feature[\"lon\"]);\n var p2 = new GLatLng(feature[\"lat2\"],feature[\"lon2\"]);\n var line = new GPolyline([p1,p2], feature[\"color\"], feature[\"width\"], feature[\"opacity\"] );\n map.addOverlay(line);\n }\n else if( feature.kind == \"linez\" ) {\n var line = new GPolyline.fromEncoded({\n color: \"#FF0000\",\n weight: 10,\n opacity: 0.5,\n zoomFactor: feature[\"zoomFactor\"],\n numLevels: feature[\"numLevels\"],\n points: feature[\"points\"],\n levels: feature[\"levels\"]\n });\n map.addOverlay(line);\n }\n }\n}\n/// javascript: add a whole pile of new features \nfunction mapper_inject(features) {\n if(!features || !map) return;\n var j=features.length;\n for(var i=0;i<j;i++) {\n var feature = features[i];\n mapper_inject_feature(feature);\n }\n}\n\n/******************************************************************************************************************************************/\n// paint markers - this is somewhat application specialized and could be separated away\n/******************************************************************************************************************************************/\n\nvar glyph_post = null;\nvar glyph_person = null;\nvar glyph_url = null;\n\n//\n// Define some common features\n//\nfunction mapper_page_paint_icons() {\n\n if( glyph_url != null ) return;\n\n if(true) { \n glyph_post = \"/dynamapper/icons/weather-clear.png\";\n var feature = {};\n feature[\"kind\"] = \"icon\";\n feature[\"image\"] = glyph_post;\n feature[\"iconSize\"] = [ 32, 32 ];\n feature[\"iconAnchor\"] = [ 9, 34 ];\n feature[\"iconWindowAnchor\"] = [ 9, 2 ];\n mapper_inject_feature(feature);\n }\n\n if(true) {\n glyph_person = \"/dynamapper/icons/emblem-favorite.png\";\n var feature = {};\n feature[\"kind\"] = \"icon\";\n feature[\"image\"] = glyph_person;\n feature[\"iconSize\"] = [ 32, 32 ];\n feature[\"iconAnchor\"] = [ 9, 34 ];\n feature[\"iconWindowAnchor\"] = [ 9, 2 ];\n mapper_inject_feature(feature);\n }\n\n if(true) {\n glyph_url = \"/dynamapper/icons/emblem-important.png\";\n var feature = {};\n feature[\"kind\"] = \"icon\";\n feature[\"image\"] = glyph_url;\n feature[\"iconSize\"] = [ 32, 32 ];\n feature[\"iconAnchor\"] = [ 9, 34 ];\n feature[\"iconWindowAnchor\"] = [ 9, 2 ];\n mapper_inject_feature(feature);\n }\n}\n\n//\n// Paint a display in js\n//\nfunction mapper_page_paint_markers(blob) {\n\n\t// mark all objects as stale\n\tmapper_mark_all_stale();\n\n // build icons\n mapper_page_paint_icons();\n\n\t// visit all the markers and add them\n\tvar markers = blob['results'];\n\tfor (var i=0; i<markers.length; i++) {\n\n\t\tvar item = markers[i]['note'];\n\n\t\tvar key = mapper_make_key(item);\n\t\tif( mapper_feature_exists_test_and_mark(key) ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar id = item['id'];\n\t\tvar kind = item['kind'];\n\t\tvar lat = item['lat'];\n\t\tvar lon = item['lon'];\n\t\tvar title = item['title'];\n\t\tvar link = item['link'];\n\t\tvar description = item['description'];\n\t\tvar location = item['location'];\n\t\tvar created_at = item['created_at'];\n\t\tvar tagstring = item['tagstring'];\n\t\tvar statebits = item['statebits'];\n\t\tvar photo_file_name = item['photo_file_name'];\n\t\tvar photo_content_type = item['photo_content_type'];\n\t\tvar provenance = item['provenance'];\n\t\tvar owner_id = item['owner_id'];\n\t\tvar begins = item['begins'];\n\t\tvar ends = item['ends'];\n\n\t\tvar glyph = glyph_post;\n\t\tif( kind == \"KIND_USER\" ) glyph = glyph_person;\n\t\tif( kind == \"KIND_URL\" ) glyph = glyph_url;\n\n\t\t// Build map feature\n\t\t// TODO - i should publish all related parties by drawing lines\n\t\t// TODO - i should publish all the depictions from twitter as icons\n\t\tif(true) {\n var feature = {};\n\t\tfeature[\"kind\"] = \"marker\";\n\t\tfeature[\"title\"] = title;\n\t\tfeature[\"lat\"] = lat;\n\t\tfeature[\"lon\"] = lon;\n\t\tfeature[\"glyph\"] = glyph;\n\t\tmapper_inject_feature(feature);\n\t\t}\n\t}\n\n\t// sweep the ones that are not part of this display\n\tmapper_hide_stale();\n}\n\nfunction mapper_page_paint_text(blob) {\n\n // draw to these text widgets explicitly for now \n var people_box = document.getElementById(\"people_box\");\n var posts_box = document.getElementById(\"posts_box\");\n var urls_box = document.getElementById(\"urls_box\");\n if ( people_box != null && people_box.hasChildNodes() ) {\n while ( people_box.childNodes.length >= 1 ) { people_box.removeChild( people_box.firstChild ); }\n }\n if ( posts_box != null && posts_box.hasChildNodes() ) {\n while ( posts_box.childNodes.length >= 1 ) { posts_box.removeChild( posts_box.firstChild ); }\n }\n if ( urls_box != null && urls_box.hasChildNodes() ) {\n while ( urls_box.childNodes.length >= 1 ) { urls_box.removeChild( urls_box.firstChild ); }\n }\n\n // visit all the markers and add them\n var count_url = 0;\n var count_user = 0;\n var count_post = 0;\n var markers = blob['results'];\n for (var i=0; i<markers.length; i++) {\n\n\t\tvar item = markers[i]['note'];\n\n var id = item['id'];\n var kind = item['kind'];\n var lat = item['lat'];\n var lon = item['lon'];\n var title = item['title'];\n var link = item['link'];\n var description = item['description'];\n var location = item['location'];\n var created_at = item['created_at'];\n var tagstring = item['tagstring'];\n var statebits = item['statebits'];\n var photo_file_name = item['photo_file_name'];\n var photo_content_type = item['photo_content_type'];\n var provenance = item['provenance'];\n var owner_id = item['owner_id'];\n var begins = item['begins'];\n var ends = item['ends'];\n var ownername = \"person\"\n for (var j=0; j<markers.length; j++) {\n if(markers[j]['note']['id'] == owner_id) {\n ownername = markers[j]['note']['title']\n }\n }\n\n var glyph = glyph_post;\n if( kind == \"KIND_USER\" ) glyph = glyph_person;\n if( kind == \"KIND_URL\" ) glyph = glyph_url;\n\n // Draw a list of features as well\n var node = document.createElement('li');\n if(node) {\n\n if(kind == \"KIND_URL\" && urls_box != null) {\n node.innerHTML = \"<a href='\"+title+\"'>\"+title+\"</a>\";\n urls_box.appendChild(node);\n count_url++;\n }\n if(kind == \"KIND_USER\" && people_box != null) {\n node.innerHTML = \"<a href='http://twitter.com/\"+title+\"'>\"+title+\"</a>\";\n people_box.appendChild(node);\n count_user++;\n }\n if(kind == \"KIND_POST\" && posts_box != null) {\n node.innerHTML = mapper_make_links_clickable(title,ownername);\n posts_box.appendChild(node);\n count_post++;\n }\n }\n\t}\n // alert(\"total urls,users,posts = \" + count_url + \" \" + count_user + \" \" + count_post );\n}\n\nvar mapper_page_update_already_busy = 0;\n\n///\n/// Go ahead and paint the supplied set\n///\nfunction mapper_page_paint(blob) {\n\n if(mapper_page_update_already_busy) { return true; }\n mapper_page_update_already_busy = 1;\n\n try {\n mapper_page_paint_text(blob);\n } catch(err) {\n alert(err);\n }\n \n try {\n mapper_page_paint_markers(blob);\n } catch(err) {\n alert(err);\n }\n\n mapper_page_update_already_busy = 0;\n}\n\n//\n// Ask the server for a fresh set of map markers\n//\nfunction mapper_page_paint_request(recenter) {\n\n\tif(map == null) return;\n\tvar url = \"/json?country=#{@countrycode}&\";\n\n\t// tack on the search phrase\n\tvar q = document.getElementById(\"q\");\n\tif(q != null) {\n\t\tq = q.value;\n\t\tif(q != null && q.length < 1) q = null;\n\t}\n\tif(q != null) {\n\t\turl = url + \"q=\"+q+\"&\";\n\t}\n\n\t// send the bounds upward to server as well\n\tvar sw = map.getBounds().getSouthWest();\n\tvar ne = map.getBounds().getNorthEast();\n\tif(sw == null || ne == null) {\n\t\treturn;\n\t}\n\tvar s = sw.lat();\n\tvar w = sw.lng();\n\tvar n = ne.lat();\n\tvar e = ne.lng();\n\turl = url + \"s=\"+s+\"&w=\"+w+\"&n=\"+n+\"&e=\"+e;\n\n // spinner\n var spinner = document.getElementById('spinner');\n if(!spinner) {\n spinner = document.createElement('img');\n spinner.src = \"/spinner.gif\";\n spinner.id = \"spinner\";\n spinner.style.position = \"absolute\";\n spinner.style.left = \"10px\";\n spinner.style.top = \"300px\";\n spinner.style.display = \"block\";\n document.body.appendChild(spinner);\n }\n spinner.style.display = \"block\";\n\n\tnew Ajax.Request(url, {\n\t\tmethod:'get',\n\t\trequestHeaders: {Accept: 'application/json'},\n\t\tonSuccess: function(transport) {\n\t\t\tspinner.style.display = \"none\";\n var blob = transport.responseText.evalJSON();\n\t\t\tif( blob ) {\n\t\t\t\tmapper_page_paint(blob);\n\t\t\t\tif( recenter == true ) {\n\t\t\t\t\tmapper_center();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n}\n\nfunction mapper_goto_location() {\n\t// send the bounds upward to server as well\n\tvar sw = map.getBounds().getSouthWest();\n\tvar ne = map.getBounds().getNorthEast();\n\tif(sw == null || ne == null) {\n\t\treturn;\n\t}\n\tvar s = sw.lat();\n\tvar w = sw.lng();\n\tvar n = ne.lat();\n\tvar e = ne.lng();\n\turl = \"/?s=\"+s+\"&w=\"+w+\"&n=\"+n+\"&e=\"+e;\n document.getElementById('newplace').action = url;\n location.href = url;\n return false;\n}\n\n/******************************************************************************************************************************************/\n// initialization - start up and add any statically defined markers - (we keep markers in javascript as an array to be processed by client)\n/******************************************************************************************************************************************/\n\n///\n/// Start mapping engine once only\n///\nfunction mapper_initialize() {\n if(map_div) return;\n map_div = document.getElementById(\"map\");\n if(!map_div) return;\n if (!GBrowserIsCompatible()) return;\n if(map) return;\n map = new GMap2(document.getElementById(\"map\"));\n // map = new google.maps.Map2(document.getElementById(\"map\"));\n var mapControl = new GMapTypeControl();\n map.addControl(mapControl);\n map.addControl(new GSmallMapControl());\n // setup custom icon support\n mapper_icons();\n // map.removeMapType(G_HYBRID_MAP);\n // try to respect supplied map boundaries for the very first refresh before user does any actions\n map.south = #{@south};\n map.west = #{@west};\n map.north = #{@north};\n map.east = #{@east};\n var map_please_recenter = true;\n if(map.north < 0.0 || map.north > 0.0 || map.south < 0.0 || map.south > 0.0) {\n map_please_recenter = false;\n var bounds = new GLatLngBounds( new GLatLng(map.south,map.west,false), new GLatLng(map.north,map.east,false) );\n var center = bounds.getCenter();\n var zoom = map.getBoundsZoomLevel(bounds);\n if(zoom < 2 ) zoom = 2;\n map.setCenter(center,zoom);\n }\n // capture map location whenever the map is moved and go ahead and ask for a view of that areas markers from our own server\n if(map_location_callback) {\n GEvent.addListener(map, \"moveend\", function() {\n mapper_save_location();\n // when the map is moved go ahead and fetch new markers [ but do not center on them ]\n mapper_page_paint_request(false);\n });\n // also capture map location once at least\n mapper_save_location();\n }\n // add features from a statically cached list if any [ this can help make first page display a bit faster ]\n mapper_inject(map_markers_raw);\n // center on any data we have already if any [ slight tension here with dynamic updates so can be disabled ]\n if( map_please_recenter ) {\n\tif(#{@map_cover_all_points}) {\n \t \tmapper_center();\n\t}\n }\n // ask to add features from a remote connection dynamically [ and will center on them ]\n mapper_page_paint_request(map_please_recenter);\n // call a user callback as a last step\n if(self['#{@map_usercallback}'] && typeof #{@map_usercallback} == 'function') {\n #{@map_usercallback}();\n }\n}\n\n// TODO consider switching back to this google provided abstraction wrapper\n// google.setOnLoadCallback(mapper_initialize);\n// google.load(\"maps\", \"2.x\");\n\nmapper_initialize();\n\n</script>\nENDING\nend", "def report_js_includes\n javascript_include_tag(\"https://www.google.com/jsapi\") +\n javascript_tag('if (typeof(google) != \"undefined\")\n google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});')\n end", "def build_pdf_header4(pdf)\n pdf.font \"Helvetica\" , :size => 8\n\n $lcCli = @company.name \n $lcdir1 = @company.address1+@company.address2+@company.city+@company.state\n\n $lcFecha1= Date.today.strftime(\"%d/%m/%Y\").to_s\n $lcHora = Time.now.to_s\n pdf.text \"FORMATO 13.1: REGISTRO DE INVENTARIO PERMANENTE VALORIZADO - DETALLE DEL INVENTARIO VALORIZADO \"\n pdf.text \"PERIODO : \" +@fecha1.to_s+ \" Hasta: \"+@fecha2.to_s , :size => 11 \n pdf.text \"RUC : 20555691263 \" \n pdf.text \"APELLIDOS Y NOMBRES, DENOMINACION O RAZON SOCIAL : GRUPO E & E S.A.C. \"\n pdf.text \"ESTABLECIMIENTO : ALMACEN\"\n\n pdf \n end", "def gmaps4rails_api_script_tags(options = {})\n if include_gmaps4rails_api_in_header?\n options.merge!({ :scripts => :api }) # request only api scripts, here.\n api_urls = Gmaps4rails::ViewHelper.new(options).js_dependencies_array\n javascript_include_tag *api_urls\n end\n end", "def map\n # expires_in 1.year, public: true\n set_metadata({ 'title' => translate('classes.map_title') })\n @config = params.permit(:q, :latitude, :longitude, :type, :west, :east, :south, :north)\n @config[:theme] = 'wemeditate'\n render layout: 'minimal'\n end", "def to_html(options = {})\r\n no_load = options[:no_load]\r\n no_script_tag = options[:no_script_tag]\r\n no_declare = options[:no_declare]\r\n no_global = options[:no_global]\r\n fullscreen = options[:full]\r\n load_pr = options[:proto_load] #to prevent some problems when the onload event callback from Prototype is used\r\n \r\n html = \"\"\r\n html << \"<script type=\\\"text/javascript\\\">\\n\" if !no_script_tag\r\n #put the functions in a separate javascript file to be included in the page\r\n html << @global_init * \"\\n\"\r\n html << \"var #{@variable};\\n\" if !no_declare and !no_global\r\n if !no_load\r\n if load_pr\r\n html << \"Event.observe(window,'load',\"\r\n else\r\n html << \"window.onload = addCodeToFunction(window.onload,\"\r\n end\r\n html << \"function() {\\n\"\r\n end\r\n\r\n html << \"if (GBrowserIsCompatible()) {\\n\" \r\n \r\n if fullscreen\r\n #Adding the initial resizing and setting up the event handler for\r\n #future resizes\r\n html << \"setWindowDims(document.getElementById('#{@container}'));\\n\"\r\n html << \"if (window.attachEvent) { window.attachEvent(\\\"onresize\\\", function() {setWindowDims(document.getElementById('#{@container}'));})} else {window.addEventListener(\\\"resize\\\", function() {setWindowDims(document.getElementById('#{@container}')); } , false);}\\n\"\r\n end\r\n \r\n if !no_declare and no_global \r\n html << \"#{declare(@variable)}\\n\"\r\n else\r\n html << \"#{assign_to(@variable)}\\n\"\r\n end\r\n html << @init_begin * \"\\n\"\r\n html << @init * \"\\n\"\r\n html << @init_end * \"\\n\"\r\n html << \"\\n}\\n\"\r\n html << \"});\\n\" if !no_load\r\n html << \"</script>\" if !no_script_tag\r\n \r\n if fullscreen\r\n #setting up the style in case of full screen\r\n html << \"<style>html, body {width: 100%; height: 100%} body {margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px} ##{@container} {margin: 0px;} </style>\"\r\n end\r\n \r\n html\r\n end", "def Header()\n\t\tif (@print_header)\n\t\t\tif (@original_l_margin.nil?)\n\t\t\t\t@original_l_margin = @l_margin;\n\t\t\tend\n\t\t\tif (@original_r_margin.nil?)\n\t\t\t\t@original_r_margin = @r_margin;\n\t\t\tend\n\t\t\t\n\t\t\t#set current position\n\t\t\tSetXY(@original_l_margin, @header_margin);\n\t\t\t\n\t\t\tif ((@header_logo) and (@header_logo != @@k_blank_image))\n\t\t\t\tImage(@header_logo, @original_l_margin, @header_margin, @header_logo_width);\n\t\t\telse\n\t\t\t\t@img_rb_y = GetY();\n\t\t\tend\n\t\t\t\n\t\t\tcell_height = ((@@k_cell_height_ratio * @header_font[2]) / @k).round(2)\n\t\t\t\n\t\t\theader_x = @original_l_margin + (@header_logo_width * 1.05); #set left margin for text data cell\n\t\t\t\n\t\t\t# header title\n\t\t\tSetFont(@header_font[0], 'B', @header_font[2] + 1);\n\t\t\tSetX(header_x);\n\t\t\tCell(@header_width, cell_height, @header_title, 0, 1, 'L'); \n\t\t\t\n\t\t\t# header string\n\t\t\tSetFont(@header_font[0], @header_font[1], @header_font[2]);\n\t\t\tSetX(header_x);\n\t\t\tMultiCell(@header_width, cell_height, @header_string, 0, 'L', 0);\n\t\t\t\n\t\t\t# print an ending header line\n\t\t\tif (@header_width)\n\t\t\t\t#set style for cell border\n\t\t\t\tSetLineWidth(0.3);\n\t\t\t\tSetDrawColor(0, 0, 0);\n\t\t\t\tSetY(1 + (@img_rb_y > GetY() ? @img_rb_y : GetY()));\n\t\t\t\tSetX(@original_l_margin);\n\t\t\t\tCell(0, 0, '', 'T', 0, 'C'); \n\t\t\tend\n\t\t\t\n\t\t\t#restore position\n\t\t\tSetXY(@original_l_margin, @t_margin);\n\t\tend\n\tend", "def html_report_adhoc\n @log.debug(\"Starting to report ad-hoc networks, there were \" + @adhoc_networks.length.to_s + \"to report\")\n @report << '<div id=\"title\">Adhoc Networks</div><br /><br />'\n @adhoc_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def body()\n<<ENDING\n<div id=\"map\" style=\"width:#{@width};height:#{@height};\"></div>\n<div id=\"map_list\"></div>\nENDING\n end", "def initializer_function\n %{<script type=\"text/javascript\">\n var map_options = #{options_to_json};\n onload_before_#{name} = typeof window.onload == 'function' ? window.onload : function(){};\n window.onload = function(){\n onload_before_#{name};\n phoenix_cartographer.init_map('#{name}', map_options);\n map_options = null;\n }\n </script>\n }.minified!\n end", "def render\n renderer.render_header self\n end", "def header(routes); end", "def index\n @maps = Map.order(name: :asc)\n @title = 'Maps'\n @page_class = 'maps'\n end", "def _sales_report_header\n\t$report_file.puts \" _____ _ _____ _ \"\n\t$report_file.puts \" / ____| | | | __ \\\\ | |\"\n\t$report_file.puts \" | (___ __ _| | ___ ___ | |__) |___ _ __ ___ _ __| |_ \"\n\t$report_file.puts \" \\\\___ \\\\ / _` | |/ _ \\\\ __| | _ // _ \\\\ '_ \\\\ / _ \\\\| '__| __|\"\n\t$report_file.puts \" ____) | (_| | | __\\\\__ \\\\ | | \\\\ \\\\ __/ |_) | (_) | | | |_ \"\n\t$report_file.puts \" |_____/ \\\\__,_|_|\\\\___|___/ |_| \\\\_\\\\___| .__/ \\\\___/|_| \\\\__|\"\n\t$report_file.puts \" | | \"\n\t$report_file.puts \" |_| \t\"\n\t$report_file.puts\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts \"--------------------------------------------------------------------\"\n\t$report_file.puts\nend", "def header\n\t\tleft = bounds.left - 40\n right = bounds.right + 40\n full_width = bounds.width + 80\n bounding_box [left, bounds.top + 35], width: full_width, height: 60 do \n font \"Helvetica\"\n fill_color \"000000\"\n text @wo.requester.facility.name, align: :center, size: 20, style: :bold\n fill_color \"555555\"\n text \"Work Order \" + @wo.id.to_s, align: :center, size: 14, inline_format: :true, style: :bold\n\t\tend\n end", "def setHeaderHtml(html)\n if (!(!html.nil? && !html.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(html, \"setHeaderHtml\", \"html-to-pdf\", \"The string must not be empty.\", \"set_header_html\"), 470);\n end\n \n @fields['header_html'] = html\n self\n end", "def header(routes)\n end", "def heading(title, opts)\n \n # Default CSS location (relative).\n css_location = \"Cutlister/css/html-cutlist.css\"\n \n # Check to see if the css_location option was passed to the heading method.\n opts.each { |key, value|\n \n # Check to see if the css_location key exists in the option hash.\n if key.to_s == \"css_location\"\n\n css_location = value\n\n end\n\n }\n\n # Find the support file (absolute).\n css_file_path = File.join(CUTLISTER_BASE_PATH, css_location)\n \n css_file_contents = IO.read(css_file_path)\n \n puts \"[HTMLRenderer.heading] css_location: #{css_location}\" if $cutlister_debug\n puts \"[HTMLRenderer.heading] css_file_path: #{css_file_path}\" if $cutlister_debug\n \n return <<-EOS\n \n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\"xml:lang=\"en\" lang=\"en\">\n <head>\n\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"/>\n\n <title>#{title}</title>\n\n <!-- Stylesheets -->\n <!--<link type=\"text/css\" rel=\"stylesheet\" href=\"#{css_file_path}\" media=\"all\" />-->\n <style type=\"text/css\">\n \n #{css_file_contents}\n \n </style>\n\n </head>\n <body>\n\n EOS\n \n end", "def add_header\n @document.root = Atom::XML::Node.new('atom:entry')\n\n Atom::XML::Namespace.new(@document.root, 'atom', 'http://www.w3.org/2005/Atom')\n Atom::XML::Namespace.new(@document.root, 'apps', 'http://schemas.google.com/apps/2006')\n Atom::XML::Namespace.new(@document.root, 'gd', 'http://schemas.google.com/g/2005')\n end", "def set_meta options = {}\n\t @cur_tab ||= {}\n\t @cur_tab[:tab1] = options[:tab1] if options.has_key? :tab1\n\t @cur_tab[:tab2] = options[:tab2] if options.has_key? :tab2\n\t \n\t @head ||= {}\n\t \n\t if options.has_key? :title\n\t @head[:title] = options[:title]\n\t @head[:title] = @head[:title].join(' - ') if @head[:title].is_a? Array\n\t end\n\t \n if options.has_key? :javascripts\n @head[:javascripts] ||= []\n @head[:javascripts] << options[:javascripts] \n @head[:javascripts] = @head[:javascripts].flatten.uniq\n end\n end", "def html_report_stats\n @report << '<div id=\"title\"> General Statistics</div>'\n stat_tab = Ruport::Data::Table(%w[Stat Value])\n stat_tab << ['Number of servers Seen', @num_servers]\n stat_tab << ['Number of clients Seen', @num_clients]\n @num_by_cipher.each do |cipher, num|\n stat_tab << ['Encryption: ' + cipher, num]\n end\n @report << stat_tab.to_html\n @report << '<br /><br />'\n end", "def initialize(options) #:not-new:\n @options = options\n load_html_template\n @main_page_path = nil\n end", "def map_div_html\n %{<div style=\"#{style}\" id=\"#{name}\" > [Map]</div>}\n end", "def get_header() \n erb :header\n end", "def wizard_header()\n header = '<meta name=\"wizard_controller\" content=\"'+@wizard_controller+'\" />'\n header += '<meta name=\"wizard_id_prefix\" content=\"'+@wizard_id_prefix+'\" />'\n end", "def header(in_page=\"\")\n\t # workaround to shoes/shoes4#1212:\n\t $clicky ||= []\n\t $clicky.each{ |i| i.hide }\n\t $clicky = []\n\t \n\t # Header\n\t self.scroll_top = 0\n\t background pattern(img_path \"bg1.png\")\n\t stack do\n\t background enve_blue(0.4)\n\t stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190\n\t flow(width:1.0) do\n\t stack(width:40){}\n\t menu = [\n\t\t [\"Home\",\"/\",\"noun_208357_cc.png\"],\n\t\t [\"All tasks\",\"/index\",\"noun_208394_cc.png\"],\n\t\t [\"Examples\",\"/examples\",\"noun_229087_cc.png\"],\n\t\t [\"Update\",\"/update\",\"noun_229107_cc.png\"],\n\t\t [\"Website\",\"http://enve-omics.ce.gatech.edu/\",\n\t\t \"noun_208472_cc.png\"],\n\t\t [\"About\",\"/about\",\"noun_229118_cc.png\"]\n\t ]\n\t menu.each do |i|\n\t\t flow(width:60, height:65) do\n\t\t if i[1]==in_page\n\t\t\tbackground enve_blue(0.4)\n\t\t\tstack{ background rgb(0,0,0,1.0) } # shoes/shoes4#1190\n\t\t end\n\t\t stack(width:5, height:50){}\n\t\t stack(width:50) do\n\t\t\timage img_path((i[1]==in_page ? \"w-\" : \"\")+i[2]),\n\t\t\t width:50, height:50, margin:2\n\t\t\tinscription i[0], align:\"center\",\n\t\t\t size:(linux? ? 8 : 10),\n\t\t\t stroke: (i[1]==in_page ? white : black)\n\t\t end\n\t\t stack(width:5){}\n\t\t end.click{ (i[1]=~/^https?:/) ? open_url(i[1]) : visit(i[1]) }\n\t\t stack(width:5){}\n\t end\n\t end\n\t stack(height:5, width:1.0){}\n\t stack(height:2, width:1.0) { background black }\n\t end\n\t stack(height:20, width:1.0){}\n end", "def generate_map datecart\n image_tag \"https://maps.google.com/maps/api/staticmap?#{format_google_maps_api_call_parameters(datecart.cart_items)}\", :class => \"map\", :alt => \"Date Map\"\n end", "def to_html\n result = Array.new\n result << %Q{<div id=\"#{@div_id}\"></div>}\n result << %Q{<script type=\"text/javascript\" charset=\"utf-8\">}\n result << %Q{//<![CDATA[}\n result << %Q{/* Create a variable to hold the GMap2 instance and the icons in. */}\n result << %Q{var #{@name};}\n result << %Q{var #{@name}_icons;}\n result << \"\"\n # Yes, there are some really nice things that MSIE forces you to do!\n result << %Q|function #{@name}_loader() {|\n result << self.to_js\n result << %Q|}|\n result << \"\"\n result << %Q|if (window.addEventListener) { /* not MSIE */|\n result << %Q| window.addEventListener('load', function() { #{@name}_loader(); }, false);|\n result << %Q|} else { /* MSIE */|\n result << %Q| window.attachEvent('onload', function() { #{@name}_loader(); }, false);|\n result << %Q|}|\n result << \"\"\n\n # Add optional Javascript - like the GUnload() call.\n result << %Q|/* Optional Javascript */|\n if options[:register_gunload] then\n result << %Q|if (window.addEventListener) { /* not MSIE */|\n result << %Q| window.addEventListener('unload', function() { GUnload(); }, false);|\n result << %Q|} else { /* MSIE */|\n result << %Q| window.attachEvent('onunload', function() { GUnload(); }, false);|\n result << %Q|}|\n end\n \n result << %Q{// ]]>}\n result << %Q{</script>}\n \n return result.join(\"\\n\")\n end", "def default_headers_and_footers\n self.header ||= self.class.default_header\n self.footer ||= self.class.default_footer\n end", "def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend", "def set_page_data\n @page_title = \"Dragos | My Portfolio\"\n @seo_keywords = \"Dragos Portfolio\"\n end", "def index\n @schools = School.all\n\n @map = GoogleMap::Map.new\n @map.controls = [ :large, :menu_type, :overview ]\n \n @map.double_click_zoom = true\n @map.continuous_zoom = true\n @map.scroll_wheel_zoom = false\n \n @map.center = SKARZYSKO\n @map.zoom = 11\n \n @map.markers = []\n \n icon = GoogleMap::Icon.new(:width => 32, :height => 37, :image_url => '/images/markers/prison.png', :shadow_url => '', :map => @map, :anchor_y => 37, :anchor_x => 16, :info_anchor_x => 16, :info_anchor_y => 10 )\n \n @schools.each do |school|\n options = { :map => @map, \n :icon => icon,\n :lat => school.lat, \n :lng => school.lng,\n :dom_id => school.marker_id,\n :html => render_to_string(:partial => school),\n :marker_hover_text => \"Szkoła o nazwie #{school.name}\",\n :open_infoWindow => false \n }\n if admin?\n options[:draggable] = true\n #options[:dragstart] = \"school_position_update\"\n options[:dragend] = render_to_string(:partial => \"/schools/drag_end.js.erb\", :locals => { :school => school })\n end\n @map.markers << GoogleMap::Marker.new(options)\n end\n\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schools }\n end\n end", "def wrt_rpt_hdr(heading = :title)\n if heading == :title\n $report_file.puts(\" ##### ######\")\n $report_file.puts(\"# # ## # ###### #### # # ###### ##### #### ##### #####\")\n $report_file.puts(\"# # # # # # # # # # # # # # # #\")\n $report_file.puts(\" ##### # # # ##### #### ###### ##### # # # # # # #\")\n $report_file.puts(\" # ###### # # # # # # ##### # # ##### #\")\n $report_file.puts(\"# # # # # # # # # # # # # # # # #\")\n $report_file.puts(\" ##### # # ###### ###### #### # # ###### # #### # # #\")\n $report_file.puts(\"********************************************************************************\")\n $report_file.puts\n\n # Write the current date to the report file\n $report_file.puts(Time.now.strftime(\"%m/%d/%Y\"))\n end\n if heading == :product\n $report_file.puts(\" _ _\")\n $report_file.puts(\" | | | |\")\n $report_file.puts(\" _ __ _ __ ___ __| |_ _ ___| |_ ___\")\n $report_file.puts(\"| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\")\n $report_file.puts(\"| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\")\n $report_file.puts(\"| ,__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\")\n $report_file.puts(\"| | \")\n $report_file.puts(\"|_|\")\n $report_file.puts(\"************************\")\n $report_file.puts\n end\n if heading == :brand\n $report_file.puts(\" _ _\")\n $report_file.puts(\"| | | |\")\n $report_file.puts(\"| |__ _ __ __ _ _ __ __| |___\")\n $report_file.puts(\"| '_ \\\\| '__/ _` | '_ \\\\ / _` / __|\")\n $report_file.puts(\"| |_) | | | (_| | | | | (_| \\\\__ \\\\\")\n $report_file.puts(\"|_.__/|_| \\\\__,_|_| |_|\\\\__,_|___/\")\n $report_file.puts\n end\nend" ]
[ "0.643799", "0.61146224", "0.60882235", "0.60864824", "0.59782887", "0.5968217", "0.59363127", "0.5921589", "0.5841794", "0.58338255", "0.57765985", "0.57697207", "0.57680744", "0.57494533", "0.5705583", "0.56978935", "0.5579585", "0.55414575", "0.553895", "0.5527923", "0.5510135", "0.54900783", "0.5465007", "0.545918", "0.54571253", "0.5436103", "0.54341936", "0.5430964", "0.5430964", "0.5430964", "0.5428688", "0.54218817", "0.54010934", "0.5398848", "0.53899133", "0.53881603", "0.5368161", "0.53647715", "0.53613675", "0.53589326", "0.5352609", "0.53434116", "0.532162", "0.53128856", "0.53094923", "0.530087", "0.5299148", "0.5297072", "0.52946097", "0.5278676", "0.52699196", "0.5262002", "0.5250164", "0.5229686", "0.5229686", "0.52281755", "0.5212382", "0.5198016", "0.51921844", "0.51873636", "0.5172498", "0.5167927", "0.51577014", "0.5156817", "0.51479816", "0.513925", "0.51361346", "0.51338995", "0.5131186", "0.51274794", "0.5107237", "0.5106688", "0.5100925", "0.50959164", "0.50886226", "0.50845766", "0.50828874", "0.5082697", "0.50808895", "0.50695276", "0.506941", "0.5049266", "0.50480574", "0.5044202", "0.504105", "0.5037033", "0.5034684", "0.50262296", "0.502122", "0.5005758", "0.50029576", "0.5002302", "0.5002192", "0.49995434", "0.4989197", "0.49787956", "0.4977234", "0.4969092", "0.49684146", "0.49625185" ]
0.78838706
0
Sets up the statistics table
def html_report_stats @report << '<div id="title"> General Statistics</div>' stat_tab = Ruport::Data::Table(%w[Stat Value]) stat_tab << ['Number of servers Seen', @num_servers] stat_tab << ['Number of clients Seen', @num_clients] @num_by_cipher.each do |cipher, num| stat_tab << ['Encryption: ' + cipher, num] end @report << stat_tab.to_html @report << '<br /><br />' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n current_user = options[:currentuser]\n all_flag = options[:allflag]\n if current_user.percentcompleteenabled\n table = Table([:description, :goaltype_label, :datecompleted, :created_date, :last_updated_date, :percentcomplete]) do |t|\n if all_flag\n current_user.goals.find(:all).each {|g| t << g.report_record()}\n else\n current_user.goals.find(:all).each {|u| t << u.report_record unless u.datecompleted != nil}\n end\n end\n \n table.rename_columns(:description => \"Description\",\n :goaltype_label => \"Goal Type\",\n :datecompleted => \"Date Completed\",\n :created_date => \"Date Created\",\n :last_updated_date => \"Date Last Updated\",\n :percentcomplete => \"Percent Complete\")\n\n else\n table = Table([:description, :goaltype_label, :datecompleted, :created_date, :last_updated_date]) do |t|\n if all_flag\n current_user.goals.find(:all).each {|g| t << g.report_record()}\n else\n current_user.goals.find(:all).each {|u| t << u.report_record unless u.datecompleted != nil}\n end\n end\n\n table.rename_columns(:description => \"Description\",\n :goaltype_label => \"Goal Type\",\n :datecompleted => \"Date Completed\",\n :created_date => \"Date Created\",\n :last_updated_date => \"Date Last Updated\")\n\n \n end\n\n self.data = table\n end", "def performance_table_statistics(opts)\n opts = check_params(opts,[:tables])\n super(opts)\n end", "def stats\n @additions ||= 0\n @deletions ||= 0\n @stats_row_one = {\n active_user_count: @active_user_count,\n pull_count: @pull_count,\n comment_count: @comment_count,\n qa_signoff_count: @qa_signoff_count\n }\n @stats_row_two = {\n avg_additions: @additions.round.to_i,\n avg_deletions: @deletions.round.to_i,\n net_additions: @net_additions\n }\n end", "def index\n my_tenant_id = (current_user.role == 'admin' ? current_user.tenant_id : nil)\n @all_stats = Stats.new\n @seven_day_stats = Stats.new(tenant_id: my_tenant_id, since: (Time.new - 7.days))\n\n @ds_identifiers = build_table_query\n end", "def initialize\n @stats = {}\n @schema = {}\n @ebd_cache = {}\n end", "def create_stats_tbl\n tblName = \"#{@table}_stat\"\n creationQuery = \"select ''::text as key, ''::text as value from t_result where 1 =2\"\n # puts creationQuery\n DBConn.tblCreation(tblName, 'key', creationQuery)\n\n parseTree = @parseTree\n\n # fromPT = parseTree['SELECT']['fromClause']\n originalTargeList = parseTree['SELECT']['targetList']\n # fields = DBConn.getAllRelFieldList(fromPT)\n keyList = []\n valueList = []\n selectList = []\n pkJoinList = []\n \n pkArray = @pkList.split(',').map { |col| col.delete(' ') }\n pkArray.each do |pkcol|\n originalTargeList.each do |targetCol|\n targetField = targetCol['RESTARGET']['val']['COLUMNREF']['fields']\n if targetField.count > 1 && targetField[1].to_s == pkcol\n pkJoinList << \"t.#{pkcol} = #{targetField[0]}.#{targetField[1]}\"\n pkArray.delete(pkcol)\n end\n end\n end\n\n stats = {\n \"min\": {\"func\": \"min($COLUMN)\", \"type\": \"text\" },\n \"max\": {\"func\": \"max($COLUMN)\", \"type\": \"text\" },\n \"count\": {\"func\": \"count($COLUMN)\", \"type\": \"int\" },\n \"dist_count\": {\"func\": \"count(distinct $COLUMN)\", \"type\": \"int\" }\n }\n @all_cols.each do |field|\n # puts field.colname\n rel_alias = field.relalias\n stats.each do |stat, info|\n # SELECT\n # UNNEST(ARRAY['address_id_max','address_id_min']) AS key,\n # UNNEST(ARRAY[max(address_id),min(address_id)]) AS value\n # FROM address\n # only add N(umeric) and D(ate) type fields\n if %w(N D).include? field.typcategory\n keyList << \"'#{field.relname}_#{field.colname}_#{stat}'\"\n value = info[:func].gsub('$COLUMN',\"result.#{field.relname}_#{field.colname}\")\n # if info[:type] == 'text'\n value = \"#{value}::text\"\n # end\n valueList << value\n # valueList << \"#{stat}(result.#{field.relname}_#{field.colname})::text\"\n end\n end\n selectList << \"#{rel_alias}.#{field.colname} as #{field.relname}_#{field.colname} \"\n\n # construnct pk join cond\n if pkArray.include?(field.colname)\n pkJoinList << \"#{@table}.#{field.colname} = #{rel_alias}.#{field.colname}\"\n end\n end\n\n # # remove the where clause in query and replace targetList\n whereClauseReplacement = []\n selectQuery = ReverseParseTree.reverseAndreplace(parseTree, selectList.join(','), whereClauseReplacement)\n resultQuery = %(with result as (#{selectQuery} join #{@table} on #{pkJoinList.join(' AND ')}))\n newTargetList = \"UNNEST(ARRAY[#{keyList.join(',')}]) AS key, UNNEST(ARRAY[#{valueList.join(',')}]) as value\"\n\n newQuery = %(#{resultQuery} SELECT #{newTargetList} FROM result)\n query = %(INSERT INTO #{tblName} #{newQuery})\n # puts query\n DBConn.exec(query)\n end", "def setup\n current_user = options[:currentuser]\n all_flag = options[:allflag]\n if current_user.percentcompleteenabled\n table = Table([:description, :category_label, :created_date, :last_updated_date, :percentcomplete]) do |t|\n if all_flag\n current_user.tasks.find(:all).each {|u| t << u.report_record() }\n else\n completed_category = current_user.category.find(:all, :conditions => [\n \"label = 'Completed'\"\n ])\n current_user.tasks.find(:all).each {|u| t << u.report_record unless u.category_id == completed_category[0].id}\n end\n end\n table.rename_columns(:description => \"Description\",\n :category_label => \"Task Category\",\n :created_date => \"Date Created\",\n :last_updated_date => \"Date Last Updated\",\n :percentcomplete => \"Percent Complete\")\n else\n table = Table([:description, :category_label, :created_date, :last_updated_date]) do |t|\n if all_flag\n current_user.tasks.find(:all).each {|u| t << u.report_record() }\n else\n completed_category = current_user.category.find(:all, :conditions => [\n \"label = 'Completed'\"\n ])\n current_user.tasks.find(:all).each {|u| t << u.report_record unless u.category_id == completed_category[0].id}\n end\n end\n table.rename_columns(:description => \"Description\",\n :category_label => \"Task Category\",\n :created_date => \"Date Created\",\n :last_updated_date => \"Date Last Updated\")\n end\n \n self.data = table\n end", "def initialize_table; end", "def initialize\n @table = {}\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def setup_superuser_stats # rubocop:disable Metrics/AbcSize\n @stats =\n {\n user_count: User.all,\n dataset_count: Identifier.all,\n user_7days: User.where(['stash_engine_users.created_at > ?', Time.new - 7.days]),\n dataset_started_7days: Resource.joins(:current_resource_state)\n .where(stash_engine_resource_states: { resource_state: %i[in_progress] })\n .where(['stash_engine_resources.created_at > ?', Time.new - 7.days]),\n dataset_submitted_7days: Identifier.where(['stash_engine_identifiers.created_at > ?', Time.new - 7.days])\n }\n end", "def statistics; end", "def set_stats\n @stats = AppStats.new(Post.all, Quote.all)\n end", "def reset_statistics!; end", "def reset_statistics!; end", "def set_statisticreport\n @statisticreport = Statisticreport.all\n end", "def reset_all_statistics\n super\n end", "def initialize\n @statistics = { settings: {}, profiles: {} }.with_indifferent_access\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def initialize\n # We start with an empty hash of stats\n @stats = {}\n end", "def initialize (num_legs) #You can put specific table material in initialize\n\t\t@tabletop = []\n\t\t@num_legs = num_legs\n\tend", "def print_stats_table()\n res = @db.query(\"SELECT * FROM UserStats;\")\n while row = res.fetch_row do\n printf \"%s %s\\n\", row[0], row[1], row[2], row[3]\n end\n end", "def setup_data_structures\n\t\t\t@summaryMetricHashArr = []\n\t\t\t@metricsDataAggregator = {}\n\t\t\t@summaryMetrics = {}\n\t\t\t@sequenceCounter = 0\n\n\t\t\textractedFrames = @video.video_detections.first.extracted_frames\n\n\t\t\t@timeFactors = States::SummaryResolutions.new.timeFactors\n\t\t\t@minTimeFactor = @timeFactors.min\n\n\t\t\t@timeFactors.each do |t|\n\t\t\t\t@summaryMetrics[t] = SummaryMetric.create(\n\t\t\t\t\tvideo_id: @video.id,\n\t\t\t\t\tdet_group_id: @detGroupId,\n\t\t\t\t\tresolution_seconds: t)\n\n\t\t\t\t@metricsDataAggregator[t] = Metrics::MetricsDataAggregator.new(\n\t\t\t\t\t@configReader, t, @video.detection_frame_rate, @summaryMetrics[t].id, extractedFrames) \n\t\t\t\t@metricsDataAggregator[t].reset()\n\t\t\tend\n\t\tend", "def init_table\n\t$table = Array.new($height) { Array.new($width, '.')}\nend", "def setup_metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end", "def performance_table_list\n super\n end", "def init_table(layer, stat) # returns self\n tbl = Table.new(layer, stat)\n if stat[:data_ver].to_i > 0\n ___create_tbl(tbl)\n ___real_mode(stat, tbl)\n else\n ___dummy_mode(stat, tbl)\n end\n self\n end", "def global_statistics\n super\n end", "def update_stats \n $logger.info \"regenerating stats from #{self.table_name}...\"\n \n # first delete the old data (always a good idea)\n AccessByServicePerMin.delete_all standard_condition \n AccessByServicePerHour.delete_all standard_condition\n AccessByServicePerDay.delete_all standard_condition\n \n # and reconstruct from the raw data\n success_entries = get_grouped_entries\n failure_entries = get_grouped_entries(false) \n \n # fill up gaps, merge the success and failure data and\n # write per-minute statistics\n 0.upto(23) do |hour|\n 0.upto(59) do |minute|\n \n the_timestamp = Time.at(start_ts + (hour * 60 + minute) * 60)\n \n new_row = AccessByServicePerMin.new(\n :host_name => self.host_name,\n :service_name => self.service_name,\n :log_ts => the_timestamp.strftime(\"%Y-%m-%d %H:%M:%S\"),\n :success_count => 0, \n :failure_count => 0,\n :response_time_micros_avg => 0\n )\n if success_entries.has_key?(the_timestamp)\n new_row[:success_count] = success_entries[the_timestamp].the_count\n new_row[:response_time_micros_avg] = success_entries[the_timestamp].the_avg\n end\n if failure_entries.has_key?(the_timestamp)\n new_row[:failure_count] = failure_entries[the_timestamp].the_count\n end\n new_row.save()\n end\n end\n \n # group the data we've just written by hour\n grouped_by_hour = get_hour_stats_from_minutes\n 0.upto(23) do |hour|\n the_timestamp = Time.at(start_ts + (hour * 60 * 60))\n new_row = AccessByServicePerHour.new(\n :host_name => self.host_name,\n :service_name => self.service_name,\n :log_ts => the_timestamp.strftime(\"%Y-%m-%d %H:%M:%S\"),\n :success_count => 0, \n :failure_count => 0,\n :response_time_micros_avg => 0 \n )\n if grouped_by_hour.has_key?(the_timestamp)\n new_row[:success_count] = grouped_by_hour[the_timestamp].success_sum\n new_row[:failure_count] = grouped_by_hour[the_timestamp].failure_sum\n new_row[:response_time_micros_avg] = grouped_by_hour[the_timestamp].the_avg\n end\n new_row.save\n end\n \n # and update the daily stats from the hours\n row = get_daily_stats_from_hours.first \n AccessByServicePerDay.new(\n :host_name => self.host_name,\n :service_name => self.service_name,\n :log_ts => start_ts.strftime(\"%Y-%m-%d %H:%M:%S\"),\n :success_count => row.success_sum, \n :failure_count => row.failure_sum,\n :response_time_micros_avg => row.the_avg\n ).save()\n $logger.info \"updated stats for #{self.service_name}@#{self.host_name} : #{row.success_sum} successful calls, #{row.failure_sum} failures between #{start_ts} and #{stop_ts}\"\n end", "def create\n if @db.table_info(METADATA_TABLE_NAME).empty?\n stmt = \"CREATE TABLE #{METADATA_TABLE_NAME} (key VARCHAR(1024), val VARCHAR(8192), env VARCHAR(255))\"\n @db.execute(stmt)\n end\n\n if @db.table_info(RUN_HISTORY_TABLE_NAME).empty?\n stmt = \"CREATE TABLE #{RUN_HISTORY_TABLE_NAME} (name VARCHAR(1024), outcome VARCHAR(16), env VARCHAR(255), time DATETIME)\"\n @db.execute(stmt)\n\n index_stmt = \"CREATE INDEX index_run_history ON #{RUN_HISTORY_TABLE_NAME} (time DESC)\"\n @db.execute(index_stmt)\n end\n\n if @db.table_info(DISABLED_MONITOR_TABLE_NAME).empty?\n stmt = \"CREATE TABLE #{DISABLED_MONITOR_TABLE_NAME} (name VARCHAR(1024), env VARCHAR(255))\"\n @db.execute(stmt)\n end\n\n if @db.table_info(MONITOR_INFO_TABLE_NAME).empty?\n stmt = \"CREATE TABLE #{MONITOR_INFO_TABLE_NAME} (name VARCHAR(1024), description VARCHAR(8192))\"\n @db.execute(stmt)\n end\n end", "def initialize\n @table = [] # Array contains Arrays of Strings\n @col = 0\n @row = 0\n @total_time = 0\n @total_records = 0\n # omitting separators for now\n end", "def table(args={})\n args[:connection_name] = @connection_name unless args.has_key?(:connection_name)\n req(:required => [:table_name, :db_name],\n :args_object => args)\n dbh = Mysqladmin::Exec.new(:connection_name => args[:connection_name])\n dbh.use(args[:db_name])\n dbh.query(:sql => \"SHOW TABLE STATUS LIKE '#{args[:table_name]}'\")\n if dbh.rows > 0\n dbh.fetch_hash do |table_data|\n return {\n :table_name => table_data[\"Name\"],\n :engine => table_data[\"Engine\"].downcase,\n :data_length => table_data[\"Data_length\"].to_i,\n :index_length => table_data[\"Index_length\"].to_i,\n :total_length => (table_data[\"Data_length\"].to_i + table_data[\"Index_length\"].to_i),\n :collation => table_data[\"Collation\"].downcase,\n :rows => table_data[\"Rows\"].to_i,\n :avg_row_length => table_data[\"Avg_row_length\"].to_i,\n :max_data_length => table_data[\"Max_data_length\"].to_i,\n :row_format => table_data[\"Row_format\"].downcase\n }\n end\n end\n \n # :connection_name => The named connection to use for database statistics,\n # :db_name => The database to gather statistics on\n def database(args={})\n args[:connection_name] = @connection_name unless args.has_key?(:connection_name)\n req(:required => [:db_name],\n :args_object => args)\n data = {}\n dbh = Mysqladmin::Exec.new(:connection_name => args[:connection_name])\n dbh.use(args[:db_name])\n dbh.list_tables.each do |table_name|\n data[table_name] = table(:table_name => args[:table_name], :db_name => args[:db_name], :connection_name => args[:connection_name])\n end\n return data\n end\n \n end", "def index\n # Initalize table\n @profils_grid = initialize_grid(Profil)\n end", "def refresh_outcomes_table\n logger.debug('Initialising cohort temporary tables...')\n CohortBuilder.new(outcomes_definition: @outcomes_definition)\n .init_temporary_tables(@start_date, @end_date)\n end", "def setup_tables(&block)\n return nil unless block_given?\n self.class_eval(&block)\n self.table_settings \n end", "def draw_summary_table\n header = [\"Date\", \"Issue Number\", \n \"Total Subscribers\", \"Change in Subscribers\"]\n\n body = report.table(:date,:number,:count,:delta)\n\n document.table([header]+body) do |t|\n t.header = true\n t.style(t.columns(1..-1)) { |c| c.align = :right }\n end\n end", "def initialize_columns\n @columns = []\n valid_table = table.alias('valid_taxon_names')\n\n @columns.push({ header: 'ro', projected: rank_over(table, valid_table) })\n\n @columns.push({header: 'taxon_name_id', projected: table[:id].as('taxon_name_id') } )\n @columns.push({header: 'cached_valid_taxon_name_id', projected: table[:cached_valid_taxon_name_id].as('cached_valid_taxon_name_id') } )\n @columns.push({header: 'cached', projected: table[:cached].as('cached') } )\n @columns.push({header: 'cached_author_year', projected: table[:cached_author_year].as('cached_author_year') } )\n @columns.push({header: 'cached_is_valid', projected: table[:cached_is_valid].as('cached_is_valid') } )\n\n if fieldsets.include?('observations')\n @columns.push({header: 'otu_id', projected: otu_table[:id].as('otu_id') } )\n @columns.push({header: 'otu_name', projected: otu_table[:name].as('otu_name')} )\n end\n end", "def table; end", "def table; end", "def table; end", "def table; end", "def initialize(tabstabs_stats)\n @tabstabs_stats = tabstabs_stats\n end", "def set_stats(hunt_stat, str_stat, sneak_stat, chr_stat)\n $stats[:hunt] = hunt_stat\n $stats[:strength] = str_stat\n $stats[:sneak] = sneak_stat\n $stats[:charisma] = chr_stat\n end", "def initialize(metadata={})\n @table = {}\n\n case metadata\n when Hash\n update(metadata)\n else\n @table[:location] = metadata.to_s\n load_metadata\n end\n end", "def configure(conf)\n super\n @tables = Hash.new\n end", "def load_statistics\n\t\tnew_stats = self.stat_lines.map {|s_l| {:stat_line_id => s_l.id}} - self.stat_line_entries.map {|s_l_e| {:stat_line_id => s_l_e.stat_line_id}}\n\t\t# vvv\n\t\tnew_entries = self.stat_line_entries.new(new_stats)\n\t\t# new_entries.stat_line_units.new\n\t\tnew_entries.each do |entry|\n\n\t\t\t\n\t\t\tnew_unit = entry.stat_line_entry_units.new\n\t\t\tentry.stat_line_items.each do |item|\n\t\t\t\tnew_unit.stat_line_item_entries.new(:stat_line_item_id => item.id)\n\t\t\tend\n\t\t\t# StatLineEntryInstance.build_instance(entry)\n\t\t\t# entry.stat_line_entry_instances.new\n\t\tend\n\t\t# zzz\n\t\t# stat_hash = self.stat_lines\n\t\t# self.stat_line_entries.new(:stat_line => self.stat_lines.collect)\n\t\t# sss\n\t\tself\n\tend", "def initialize_table\n @total_rows.times do |row|\n row_array = Array.new(@total_columns, \"\")\n @reconstructed_table.push(row_array)\n end\n end", "def _table; @table end", "def initialize(height = AppConfig.default_height, width = AppConfig.default_width)\n @table = Table.new height, width\n end", "def stats; end", "def stats; end", "def initialize\n @get_table = TABLE\n end", "def index\n @statistics = Statistic.all\n end", "def index\n @statistics = Statistic.all\n end", "def index\n @statistics = Statistic.all\n end", "def prepare_schema\n begin\n ActiveRecord::Schema.define do\n # a twobot instance\n create_table :twobots do |t|\n t.string :name\n t.string :status, :null => false, :default => \"active\"\n end\n add_index :twobots, :name\n \n # has many twitter searches\n create_table :searches do |t|\n t.integer :twobot_id, :null => false\n t.string :query, :null => false\n t.integer :last_twid, :null => false, :default => 0\n t.timestamp :last_run\n t.integer :last_result_count\n t.integer :total, :default => 0\n end\n add_index :searches, :query\n \n # a search has many actions\n create_table :actions do |t|\n t.integer :search_id, :null => false\n t.text :code\n end\n \n # cache of tweets\n create_table :tweets do |t|\n t.integer :twid, :null => false\n t.string :from_user\n t.string :to_user\n t.integer :from_user_id\n t.integer :to_user_id\n t.string :text\n t.string :profile_image_url\n t.timestamp :created_at\n end\n add_index :tweets, :twid\n end\n rescue\n end\n end", "def index\n\t\t@tables = Table.where(statu:false, id:2..100).limit(60)\n end", "def stats\n \n end", "def reset_global_statistics\n super\n end", "def init_statistic\n create_statistic if course_user&.role == 'student' && statistic.nil?\n end", "def summary\n stats = Hash.new { |h,k| h[k] = {} }\n @stats.each do |field, actions|\n actions.each do |action|\n col = action.column_name\n ## register the value of this \"stats\" for the column name\n action.iterate do |ts,value|\n stats[ts][col] = value\n end\n end\n end\n return stats\n end", "def import_active_stats\n\n end", "def summary_table\n update_now_date_time\n calc_difference\n labels = [DueText.period, ' ', DueText.duration, DueText.measure]\n rows = summary_array\n puts tabulate(labels, rows, { 'indent' => 4, 'style' => 'fancy' })\n end", "def all_tmm_statistics\n super\n end", "def initialize(options)\n\t\tBASE.each do |stat|\n\t\t\traise \"Missing statistic #{stat}\" unless options[stat]\n\t\t\tset(stat, options[stat])\n\t\tend\n\t\tRATINGS.each { |rating| set(rating, 0) }\n\t\tOTHER.each { |rating| set(rating, 0) }\n\tend" ]
[ "0.65140104", "0.64707506", "0.64000475", "0.6295648", "0.6223087", "0.6158427", "0.613459", "0.6117456", "0.6061865", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.60543615", "0.6053073", "0.60480046", "0.60470265", "0.59912354", "0.59912354", "0.5941773", "0.5917324", "0.5901097", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.5895737", "0.58770496", "0.58770496", "0.58770496", "0.58770496", "0.58770496", "0.58770496", "0.58770496", "0.58770496", "0.58770496", "0.58770496", "0.58770496", "0.585043", "0.58455426", "0.5833849", "0.5833711", "0.58070195", "0.5777381", "0.5777381", "0.5777381", "0.57616764", "0.57392114", "0.5723114", "0.570063", "0.5672788", "0.5663401", "0.56595105", "0.5644071", "0.564255", "0.5639866", "0.5638518", "0.56301975", "0.562019", "0.5618373", "0.5618373", "0.5618373", "0.5618373", "0.5614211", "0.55973804", "0.5583593", "0.5575808", "0.55723715", "0.5556751", "0.5547013", "0.5539314", "0.5535684", "0.5535684", "0.5488771", "0.5488677", "0.5488677", "0.5488677", "0.54845303", "0.5477574", "0.5475517", "0.54538125", "0.545267", "0.5451669", "0.5448638", "0.5430919", "0.54033417", "0.539399" ]
0.0
-1
creates the report section for Infrastructure Networks
def html_report_inf @report << '<div id="title">Infrastructure Networks</div><br /><br />' @log.debug("Starting reporting Infrastructure networks there were " + @infrastructure_networks.length.to_s + " networks to list") @infrastructure_networks.each do |ssid,bssid| tab = Ruport::Data::Table(%w[bssid num_clients channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm]) ssid = "Hidden or Blank" if ssid.length < 1 @report << '<div id="title">SSID: ' + ssid + ' </div>' bssid.each do |net,info| if @options.gps_data[net] point = net @log.debug("attempting to add link") link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')' url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info net = '<a href="' + url + '">' + point + '</a>' end tab << [net, info['clients'].length.to_s, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']] end @report << tab.to_html @report << "<br /> <br />" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_report\n get_resource_list('network', 'v2.0/networks', 'networks')\n @network_csv_array = []\n @network_print_array = []\n @resource_id_list.each do |networkid|\n network = rest_get(\"#{@resource_url}/v2.0/networks/#{networkid}\", @token_id)\n network_array = JSON.parse(network)['network']\n network_name = network_array['name']\n network_status = network_array['status']\n network_vlanid = network_array['provider:segmentation_id']\n network_physnet = network_array['provider:physical_network']\n network_mtu = network_array['mtu']\n subnet_id = network_array['subnets']\n unless subnet_id.empty?\n subnet_id.each do |subnetid|\n subnet_rest = rest_get(\"#{@resource_url}/v2.0/subnets/#{subnetid}\", @token_id)\n subnet_array = JSON.parse(subnet_rest)['subnet']\n @subnet_enable_dhcp = subnet_array['enable_dhcp']\n @subnet_dns_server = subnet_array['dns_nameservers']\n @subnet_startip = subnet_array['allocation_pools'][0]['start']\n @subnet_endip = subnet_array['allocation_pools'][0]['end']\n @subnet_gateway = subnet_array['gateway_ip']\n @subnet_cidr = subnet_array['cidr']\n end\n end\n @network_csv_array << [network_name, network_status, network_vlanid, network_physnet, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, \\\n @subnet_gateway, @subnet_cidr]\n @network_print_headers = %w(Network_Name Network_VLANid Network_MTU Network_enable_dhcp Network_DNS_Servers Network_Start_IP Network_End_IP Network_Gateway Network_CIDR)\n @network_print_array << [network_name, network_vlanid, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, @subnet_gateway, @subnet_cidr]\n end\n end", "def report_network\n self.report('network_report')\n end", "def html_report_adhoc\n @log.debug(\"Starting to report ad-hoc networks, there were \" + @adhoc_networks.length.to_s + \"to report\")\n @report << '<div id=\"title\">Adhoc Networks</div><br /><br />'\n @adhoc_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def html_report_probe\n @log.debug(\"Starting to report probe networks, there were \" + @probe_networks.length.to_s + \" to report\")\n @report << '<div id=\"title\">Probe Networks</div><br /><br />'\n @probe_tab = Ruport::Data::Table(%w[bssid manufacturer])\n @probe_networks.each do |probe,info|\n if @options.gps_data[probe]\n point = probe\n @log.debug(\"attempting to add link\")\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s\n probe = '<a href=\"' + url + '\">' + point + '</a>'\n end\n @probe_tab << [probe, info['manufacturer']]\n end\n\t @report << @probe_tab.to_html\n\t @report << \"<br /><br />\"\n end", "def insert_general_sections(report)\n report.add_field(:client, 'mg')\n report.add_field(:project, 'pcv')\n report.add_field(:section, 'dev1')\n report.add_field(:name, person.name)\n report.add_field(:title_function, person.role)\n\n report.add_field(:header_info, \"#{person.name} - Version 1.0\")\n\n report.add_field(:date, Time.zone.today.strftime('%d.%m.%Y'))\n report.add_field(:version, '1.0')\n report.add_field(:comment, 'Aktuelle Ausgabe')\n end", "def generate_network_section(vAppId, network, config, type)\n params = {\n 'method' => :get,\n 'command' => \"/vApp/vapp-#{vAppId}/networkConfigSection\"\n }\n\n vapp_networks, headers = send_request(params)\n create_fake_network_node(vapp_networks, network[:name])\n\n if type.to_sym == :internal\n # Create a network configuration based on the config\n new_network = create_internal_network_node(config)\n else\n # Retrieve the requested network and prepare it for customization\n new_network = get_base_network(network[:id])\n end\n\n merge_network_config(vapp_networks, new_network, config)\n end", "def server_report\n get_resource_list('compute', 'servers', 'servers')\n @server_csv_array = []\n @server_print_array = []\n @resource_id_list.each do |serverid|\n server = rest_get(\"#{@resource_url}/servers/#{serverid}\", @token_id)\n server_array = JSON.parse(server)['server']\n server_name = server_array['name']\n server_lpar_name = server_array['OS-EXT-SRV-ATTR:instance_name']\n server_lpar_state = server_array['OS-EXT-STS:vm_state']\n server_state = server_array['status']\n server_health = server_array['health_status']['health_value']\n server_host = server_array['OS-EXT-SRV-ATTR:host']\n server_addresses = JSON.parse(server)['server']['addresses']\n @server_ipaddress = ''\n unless server_addresses.empty? || server_state != 'ACTIVE'\n @server_ipaddress = server_addresses.values[0][0]['addr']\n end\n server_flavor = server_array['flavor.original_name']\n server_cpus = server_array['cpus']\n server_memory = server_array['memory_mb']\n server_cpu_util = server_array['cpu_utilization']\n server_cpu_mode = server_array['vcpu_mode']\n server_os = server_array['operating_system']\n server_cpu_pool = server_array['shared_proc_pool_name']\n server_cpu_share_weight = server_array['shared_weight']\n server_compat_mode = server_array['desired_compatibility_mode']\n @server_csv_array << [server_name, server_lpar_name, server_lpar_state, server_state, server_host, server_health, @server_ipaddress, server_flavor, server_cpus, \\\n server_memory, server_cpu_util, server_cpu_mode, server_os, server_cpu_pool, server_cpu_share_weight, server_compat_mode]\n @server_print_headers = %w(Host_Name LPAR_Name LPAR_State OS_Status Machine_Name LPAR_Health IPaddress Template CPU Memory CPU_Util CPU_Mode CPU_Pool Share_Weight)\n @server_print_array << [server_name, server_lpar_name, server_lpar_state, server_state, server_host, server_health, @server_ipaddress, server_flavor, server_cpus, \\\n server_memory, server_cpu_util, server_cpu_mode, server_cpu_pool, server_cpu_share_weight]\n end\n end", "def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end", "def create_nsxt\n #-----------------------------------------------------------------------\n # Get NSX parameters needed to create the network\n #-----------------------------------------------------------------------\n ls_name = self['NAME']\n ls_description = self['TEMPLATE/DESCRIPTION']\n tz_id = self['TEMPLATE/NSX_TZ_ID']\n rep_mode = self['TEMPLATE/NSX_REP_MODE']\n admin_status = self['TEMPLATE/NSX_ADMIN_STATUS']\n\n #-----------------------------------------------------------------------\n # Use first cluster/dc to create the virtual wire\n #-----------------------------------------------------------------------\n host_id = @cluster[0][:hid]\n uuid = @cluster[0][:uuid]\n dc = @cluster[0][:dc]\n\n nsx_client = NSXDriver::NSXClient.new_from_id(host_id)\n\n opaque_spec = %(\n {\n \"transport_zone_id\": \"#{tz_id}\",\n \"replication_mode\": \"#{rep_mode}\",\n \"admin_state\": \"#{admin_status}\",\n \"display_name\": \"#{ls_name}\",\n \"description\": \"#{ls_description}\"\n }\n )\n\n lsw = NSXDriver::OpaqueNetwork.new(nsx_client, nil, tz_id, opaque_spec)\n\n vnet_ref = dc.nsx_network(lsw.ls_id,\n VCenterDriver::Network::NETWORK_TYPE_NSXT)\n\n \"VCENTER_NET_REF = '#{vnet_ref}'\\n\"\\\n \"VCENTER_INSTANCE_ID = '#{uuid}'\\n\"\\\n \"NSX_ID = '#{lsw.ls_id}'\\n\"\\\n \"NSX_VNI = '#{lsw.ls_vni}'\\n\"\\\n \"BRIDGE = '#{lsw.ls_name}'\\n\"\n end", "def generate_report\n validate_required_fields\n @report = []\n @report << header\n\n (number_of_intervals - 1).times do |row|\n @report << build_row(row)\n end\n @report\n end", "def create\n file = Tempfile.new(\"onevnet-#{resource[:name]}\")\n template = ERB.new <<-EOF\nNAME = \"<%= resource[:name] %>\"\nTYPE = <%= resource[:type]%>\nBRIDGE = <%= resource[:bridge] %>\n\n<% if resource[:phydev] %>\nPHYDEV = <%= resource[:phydev] %>\n<% end %>\n<% if resource[:type]== :fixed %>\n# FIXED NETWORK\n<% if resource[:leases] %>\n<% resource[:leases].each { |lease| %>\nLEASES = [IP=<%= lease%>]\n<% } %>\n<% end %>\n<% elsif resource[:type]== :ranged %>\n# RANGED NETWORK\n<% if resource[:network_size] %>NETWORK_SIZE = <%= resource[:network_size] %><% end %>\n<% if resource[:network_address] %>NETWORK_ADDRESS = <%= resource[:network_address] %><% end %>\n<% if resource[:network_start] %>IP_START = <%= resource[:network_start] %><% end %>\n<% if resource[:network_end] %>IP_END = <%= resource[:network_end] %><% end %>\n<% if resource[:macstart] %>MAC_START = <%= resource[:macstart] %><% end %>\n<% if resource[:siteprefix] %>SITE_PREFIX = <%= resource[:siteprefix] %><% end %>\n<% if resource[:globalprefix] %>GLOBAL_PREFIX = <%= resource[:globalprefix] %><% end %>\n<% end %>\n<% if resource[:vlanid] %>VLAN_ID = <%= resource[:vlanid] %><% end %>\n\n# Context information\n<% if resource[:context] %>\n<% resource[:context].each { |key,value| %>\n<%= key.upcase %> = <%= value %>\n<% } %>\n<% end %>\nEOF\n\n tempfile = template.result(binding)\n file.write(tempfile)\n file.close\n self.debug \"Adding new network using template: #{tempfile}\"\n onevnet('create', file.path)\n file.delete\n @property_hash[:ensure] = :present\n end", "def create_internal_network_node(network_config)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.Configuration {\n xml.IpScopes {\n xml.IpScope {\n xml.IsInherited(network_config[:is_inherited] || \"false\")\n xml.Gateway network_config[:gateway]\n xml.Netmask network_config[:netmask]\n xml.Dns1 network_config[:dns1] if network_config[:dns1]\n xml.Dns2 network_config[:dns2] if network_config[:dns2]\n xml.DnsSuffix network_config[:dns_suffix] if network_config[:dns_suffix]\n xml.IsEnabled(network_config[:is_enabled] || true)\n xml.IpRanges {\n xml.IpRange {\n xml.StartAddress network_config[:start_address]\n xml.EndAddress network_config[:end_address]\n }\n }\n }\n }\n xml.FenceMode 'isolated'\n xml.RetainNetInfoAcrossDeployments(network_config[:retain_info] || false)\n }\n end\n builder.doc\n end", "def create_report\n\tcreate_rep_heading\n \tcreate_product_data\n \tcreate_brand_data\nend", "def create_nsxv\n #-----------------------------------------------------------------------\n # Get NSX parameters needed to create the network\n #-----------------------------------------------------------------------\n ls_name = self['NAME']\n ls_description = self['TEMPLATE/DESCRIPTION']\n tz_id = self['TEMPLATE/NSX_TZ_ID']\n rep_mode = self['TEMPLATE/NSX_REP_MODE']\n\n #-----------------------------------------------------------------------\n # Use first cluster/dc to create the virtual wire\n #-----------------------------------------------------------------------\n host_id = @cluster[0][:hid]\n uuid = @cluster[0][:uuid]\n\n nsx_client = NSXDriver::NSXClient.new_from_id(host_id)\n\n vwire_spec =\n \"<virtualWireCreateSpec>\\\n <name>#{ls_name}</name>\\\n <description>#{ls_description}</description>\\\n <tenantId>virtual wire tenant</tenantId>\\\n <controlPlaneMode>#{rep_mode}</controlPlaneMode>\\\n <guestVlanAllowed>false</guestVlanAllowed>\\\n </virtualWireCreateSpec>\"\n\n lsw = NSXDriver::VirtualWire.new(nsx_client, nil, tz_id, vwire_spec)\n\n \"VCENTER_NET_REF = '#{lsw.ls_vcenter_ref}'\\n\"\\\n \"VCENTER_INSTANCE_ID = '#{uuid}'\\n\"\\\n \"NSX_ID = '#{lsw.ls_id}'\\n\"\\\n \"NSX_VNI = '#{lsw.ls_vni}'\\n\"\\\n \"BRIDGE = '#{lsw.ls_name}'\\n\"\n end", "def generate_new_report\n log_info('MI Report generation started...')\n content = CSV.generate do |csv|\n csv << headers\n claims.find_each do |claim|\n ManagementInformationPresenter.new(claim, 'view').present! do |claim_journeys|\n claim_journeys.each { |journey| csv << journey } if claim_journeys.any?\n end\n end\n end\n log_info('MI Report generation finished')\n content\n rescue StandardError => e\n log_error(e, 'MI Report generation error')\n end", "def generate_standard_report(start_date = nil, end_date = nil)\r\n report_lines = ['Affiliate Unique ID,Event Type,Timestamp,First Review?,Program Name']\r\n report_events(start_date, end_date) do |event|\r\n report_lines.push event.report_line\r\n end\r\n report_lines.join(\"\\n\")\r\n end", "def network_report_csv(filename)\n puts 'Creating the Networks report'\n CSV.open(\"#{filename}\", 'ab') do |csv|\n csv << [\"\\n\"]\n csv << %w(Network_List)\n csv << %w(Network_Name Network_Status Network_VLANid Network_Phys_Net Network_MTU Network_enable_dhcp Network_DNS_Servers Network_Start_IP Network_End_IP Network_Gateway Network_CIDR)\n network_report\n csv_array(@network_csv_array, csv)\n end\n puts 'Done'\n end", "def create_network_for_import(\n opts\n )\n nic = opts[:nic]\n ccr_ref = opts[:ccr_ref]\n ccr_name = opts[:ccr_name]\n vc_uuid = opts[:vc_uuid]\n vcenter_instance_name = opts[:vcenter_instance_name]\n dc_name = opts[:dc_name]\n template_ref = opts[:template_ref]\n dc_ref = opts[:dc_ref]\n vm_id = opts[:vm_id]\n hpool = opts[:hpool]\n vi_client = opts[:vi_client]\n\n config = {}\n config[:refs] = nic[:refs]\n\n # Let's get the OpenNebula hosts ids\n # associated to the clusters references\n config[:one_ids] = nic[:refs].map do |ref|\n VCenterDriver::VIHelper\n .find_by_ref(\n OpenNebula::HostPool,\n 'TEMPLATE/VCENTER_CCR_REF',\n ref,\n vc_uuid,\n hpool\n )['CLUSTER_ID'] rescue -1\n end\n\n if vm?\n unmanaged = 'wild'\n else\n unmanaged = 'template'\n end\n\n net = VCenterDriver::Network\n .new_from_ref(\n nic[:net_ref],\n vi_client\n )\n if net\n vid = VCenterDriver::Network.retrieve_vlanid(net.item)\n end\n case nic[:pg_type]\n # Distributed PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_DPG\n config[:sw_name] =\n nic[:network]\n .config\n .distributedVirtualSwitch\n .name\n # For DistributedVirtualPortgroups\n # there is networks and uplinks\n config[:uplink] = false\n # NSX-V PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_NSXV\n config[:sw_name] =\n nic[:network]\n .config\n .distributedVirtualSwitch\n .name\n # For NSX-V ( is the same as\n # DistributedVirtualPortgroups )\n # there is networks and uplinks\n config[:uplink] = false\n\n host_id = vi_client.instance_variable_get '@host_id'\n\n begin\n nsx_client = NSXDriver::NSXClient.new_from_id(host_id)\n rescue StandardError\n nsx_client = nil\n end\n\n if !nsx_client.nil?\n nsx_net = NSXDriver::VirtualWire\n .new_from_name(nsx_client, nic[:net_name])\n config[:nsx_id] = nsx_net.ls_id\n config[:nsx_vni] = nsx_net.ls_vni\n config[:nsx_tz_id] = nsx_net.tz_id\n end\n # Standard PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_PG\n # There is no uplinks for standard portgroups,\n # so all Standard\n # PortGroups are networks and no uplinks\n config[:uplink] = false\n config[:sw_name] = VCenterDriver::Network\n .virtual_switch(nic[:network])\n # NSX-T PortGroups\n when VCenterDriver::Network::NETWORK_TYPE_NSXT\n config[:sw_name] = \\\n nic[:network].summary.opaqueNetworkType\n # There is no uplinks for NSX-T networks,\n # so all NSX-T networks\n # are networks and no uplinks\n config[:uplink] = false\n\n host_id = vi_client.instance_variable_get '@host_id'\n\n begin\n nsx_client = NSXDriver::NSXClient.new_from_id(host_id)\n rescue StandardError\n nsx_client = nil\n end\n\n if !nsx_client.nil?\n nsx_net =\n NSXDriver::OpaqueNetwork\n .new_from_name(nsx_client, nic[:net_name])\n\n config[:nsx_id] = nsx_net.ls_id\n config[:nsx_vni] = nsx_net.ls_vni\n config[:nsx_tz_id] = nsx_net.tz_id\n end\n else\n raise \"Unknown network type: #{nic[:pg_type]}\"\n end\n\n import_opts = {\n :network_name=> nic[:net_name],\n :sw_name=> config[:sw_name],\n :network_ref=> nic[:net_ref],\n :network_type=> nic[:pg_type],\n :ccr_ref=> ccr_ref,\n :ccr_name=> ccr_name,\n :vcenter_uuid=> vc_uuid,\n :vcenter_instance_name=> vcenter_instance_name,\n :dc_name=> dc_name,\n :unmanaged=> unmanaged,\n :template_ref=> template_ref,\n :dc_ref=> dc_ref,\n :template_id=> vm_id\n }\n\n if nic[:pg_type] ==\n VCenterDriver::Network::NETWORK_TYPE_NSXV ||\n nic[:pg_type] ==\n VCenterDriver::Network::NETWORK_TYPE_NSXT\n import_opts[:nsx_id] = config[:nsx_id]\n import_opts[:nsx_vni] = config[:nsx_vni]\n import_opts[:nsx_tz_id] = config[:nsx_tz_id]\n end\n\n if vid\n vlanid = VCenterDriver::Network.vlanid(vid)\n\n # we have vlan id\n if /\\A\\d+\\z/.match(vlanid)\n import_opts[:vlanid] = vlanid\n end\n end\n\n # Prepare the Virtual Network template\n one_vnet = VCenterDriver::Network.to_one_template(import_opts)\n\n # always has to be created because of\n # templates when they are instantiated\n ar_tmp = ''\n ar_tmp << \"AR=[\\n\"\n ar_tmp << \"TYPE=\\\"ETHER\\\",\\n\"\n ar_tmp << \"SIZE=255\\n\"\n ar_tmp << \"]\\n\"\n\n if vm?\n ar_tmp << create_ar(nic, false, nic[:ipv4]) if nic[:ipv4]\n\n if nic[:ipv6]\n ar_tmp << create_ar(nic, false, nil, nic[:ipv6])\n end\n\n ar_tmp << create_ar(nic, true) if !nic[:ipv4] && !nic[:ipv6]\n end\n\n one_vnet[:one] << ar_tmp\n config[:one_object] = one_vnet[:one]\n _cluster_id = VCenterDriver::VIHelper\n .get_cluster_id(config[:one_ids])\n\n one_vn = VCenterDriver::Network.create_one_network(config)\n VCenterDriver::VIHelper.clean_ref_hash\n one_vn.info\n\n # Wait until the virtual network is in ready state\n t_start = Time.now\n error = false\n timeout = 30\n\n while Time.now - t_start < timeout\n begin\n if one_vn.short_state_str == 'rdy'\n error = false\n break\n end\n rescue StandardError\n error = true\n end\n\n sleep 1\n one_vn.info\n end\n\n if error\n error_msg = \"VNET #{one_vn.id} in state \"\n error_msg += \"#{one_vn.short_state_str}, aborting import\"\n raise error_msg\n end\n\n one_vn\n end", "def create_network_equipment(network_uid, network, refapi_path, site_uid = nil)\n network[\"type\"] = \"network_equipment\"\n network[\"uid\"] = network_uid\n\n network_path = ''\n if site_uid\n network_path = Pathname.new(refapi_path).join(\"sites\", site_uid, \"network_equipments\")\n else\n network_path = Pathname.new(refapi_path).join(\"network_equipments\")\n end\n network_path.mkpath()\n\n # Change the format of linecard from Hash to Array\n linecards_tmp = Marshal.load(Marshal.dump(network[\"linecards\"])) # bkp (deep_copy)\n\n linecards_array = []\n network[\"linecards\"].each do |linecard_index, linecard|\n ports = []\n linecard.delete(\"ports\").each do |port_index, port|\n port = { \"uid\"=> port } if port.is_a? String\n if port.is_a? Hash\n # complete entries (see bug 8587)\n if port['port'].nil? and linecard['port']\n port['port'] = linecard['port']\n end\n if port['kind'].nil? and linecard['kind']\n port['kind'] = linecard['kind']\n end\n if port['snmp_pattern'].nil? and linecard['snmp_pattern']\n port['snmp_pattern'] = linecard['snmp_pattern']\n end\n if port['snmp_pattern']\n port['snmp_name'] = port['snmp_pattern']\n .sub('%LINECARD%',linecard_index.to_s).sub('%PORT%',port_index.to_s)\n port.delete('snmp_pattern')\n end\n if ((!linecard['kind'].nil? &&\n port['kind'].nil? &&\n linecard['kind'] == 'node') ||\n port['kind'] == 'node') &&\n port['port'].nil?\n p = port['uid'].match(/([a-z]*-[0-9]*)-?(.*)/).captures[1]\n port['port'] = p != '' ? p : 'eth0'\n port['uid'] = port['uid'].gsub(/-#{p}$/, '')\n end\n end\n ports[port_index] = port\n end\n linecard[\"ports\"] = ports.map { |p| p || {} }\n linecards_array[linecard_index] = linecard\n end\n network[\"linecards\"] = linecards_array.map{|l| l || {}}\n\n network.delete_if {|k, v| k == \"network_adapters\"} # TO DELETE\n\n write_json(network_path.join(\"#{network_uid}.json\"), network)\n\n network[\"linecards\"] = linecards_tmp # restore\nend", "def create_global_report\n super\n end", "def create_networksolutions_records\n dme.create_mx_record(params[:domain], '', '0', \"inbound.#{params[:domain]}.netsolmail.net.\", {} )\n\n dme.create_record(params[:domain], 'mail', 'CNAME', \"mail.#{params[:domain]}.netsolmail.net.\", {})\n dme.create_record(params[:domain], 'mail', 'CNAME', \"smtp.#{params[:domain]}.netsolmail.net.\", {})\n end", "def write_report(file_name, annotate_only_list)\n system(\"rm *.jpg\")\n File.open(file_name,\"w\"){|file| file.puts \"\\nFINAL REPORT\\n\\n\"}\n for network in Network.get_all\n File.open(file_name,\"a\") {|file|\n file.puts \"NETWORK\" + network.network_id.to_s\n if annotate_only_list == true\n file.puts \"\\nThese are the network components that belong to your list\\n\\n\"\n file.puts (network.network_components & $genes).inspect\n file.puts \"\\nThis is the information on the pathways for the genes that belong to your list\\n\\n\"\n file.puts network.network_kegg_features.inspect\n file.puts \"\\nThis is the information on the biological processes for the genes that belong to your list\\n\\n\"\n file.puts network.network_go_features.inspect\n else\n file.puts \"\\nThese are the network components\\n\\n\"\n file.puts network.network_components.inspect\n file.puts \"\\nThis is the information on the pathways\\n\\n\"\n file.puts network.network_kegg_features.inspect\n file.puts \"\\nThis is the information on the biological processes\\n\\n\"\n file.puts network.network_go_features.inspect\n end\n file.puts \"\\n\"}\n #Comment the following two lines if the drawing is giving you problems (it might happen when the number of genes in a network is too big)\n network.network_graph.write_to_graphic_file(\"jpg\", \"Network\" + network.network_id.to_s)\n system(\"rm Network#{network.network_id}.dot\")\n end\nend", "def networking\n networking = {}\n if advanced_networking.nil? \n networking['eth0'] = {}\n networking['eth0']['dns'] = dns unless dns.nil?\n networking['eth0']['seclists'] = seclists unless (seclists.nil? or seclists[0]==nil)\n networking['eth0']['ipnetwork'] = ipnetwork unless ipnetwork.nil?\n networking['eth0']['nat'] = nat unless nat.nil?\n if networking['eth0']['ipnetwork'] and (not networking['eth0']['nat'].nil?) and (not networking['eth0']['nat'].is_a?(Array))\n # fix to oracle's format or else!\n if networking['eth0']['nat'].start_with?('ipreservation')\n networking['eth0']['nat']=\"network/v1/#{networking['eth0']['nat']}\"\n end\n networking['eth0']['nat']=[networking['eth0']['nat']]\n end\n networking['eth0']['ip'] = ip unless ip.nil?\n networking['eth0']['address'] = mac_address unless ip.nil?\n networking['eth0']['vnic'] = vnic unless vnic.nil?\n networking['eth0']['vnicsets'] = vnicsets unless vnic.nil?\n networking['eth0']['is_default_gateway'] = is_default_gateway unless is_default_gateway.nil?\n networking['eth0']['name_servers'] = name_servers unless name_servers.nil?\n networking['eth0']['search_domains'] = search_domains unless search_domains.nil?\n else\n networking=advanced_networking\n end\n\n\n networking\n end", "def enriched_report(final_report)\n return unless final_report.is_a?(Hash)\n\n # Remove nil profiles if any\n final_report[:profiles].select! { |p| p }\n\n # Label this content as an inspec_report\n final_report[:type] = 'inspec_report'\n\n # Ensure controls are never stored or shipped, since this was an accidential\n # addition in InSpec and will be remove in the next inspec major release\n final_report.delete(:controls)\n final_report[:node_name] = @node_name\n final_report[:end_time] = Time.now.utc.strftime('%FT%TZ')\n final_report[:node_uuid] = @entity_uuid\n final_report[:environment] = @environment\n final_report[:roles] = @roles\n final_report[:recipes] = @recipes\n final_report[:report_uuid] = @run_id\n final_report[:source_fqdn] = @source_fqdn\n final_report[:organization_name] = @organization_name\n final_report[:policy_group] = @policy_group\n final_report[:policy_name] = @policy_name\n final_report[:chef_tags] = @chef_tags\n final_report[:ipaddress] = @ipaddress\n final_report[:fqdn] = @fqdn\n\n final_report\n end", "def gen_san_vif_line(node, nic, vlan, assigned_domO_nics)\n domO_nic = (node.xen_domO.san_nics - assigned_domO_nics).first\n assigned_domO_nics << domO_nic\n vlan = domO_nic.port_name.match(/eth(\\d+)/)[1]\n \" 'mac=#{nic.mac_address}, bridge=xenbreth#{vlan}, script=network-bridge-vlan netdev=eth#{vlan}'\"\nend", "def html_report_stats\n @report << '<div id=\"title\"> General Statistics</div>'\n stat_tab = Ruport::Data::Table(%w[Stat Value])\n stat_tab << ['Number of servers Seen', @num_servers]\n stat_tab << ['Number of clients Seen', @num_clients]\n @num_by_cipher.each do |cipher, num|\n stat_tab << ['Encryption: ' + cipher, num]\n end\n @report << stat_tab.to_html\n @report << '<br /><br />'\n end", "def design_information_header\n @project.project_site_informations.map do |psi|\n si =\n [ [\"Project Design Information\",\"\",\"\",\"\"],\n [\"Project Name\",psi.project.project_name, \"Site Name\",psi.project_site.site_name],\n [\"Area Length\",psi.area_length,\"Area_Width\",psi.area_width],\n [\"Area Description\",psi.area_description,\"Surface Protection?\",psi.surface_protection_required.to_s],\n [\"Underground Obstacles?\", psi.under_ground_obstacles_yn.to_s,\"Structural Removal?\",psi.structural_removal_required.to_s],\n [\"Bobcat Accessible?\",psi.bobcat_accessible.to_s,\"PVT Locator?\",psi.pvt_locator_required.to_s],\n [\"Construction Fence?\",psi.construction_fence_required.to_s,\"Soil Condition\",psi.soil_condition],\n [\"Client Fence Reinstall?\",psi.client_fence_dismantle_reinstall_required.to_s,\"Drill Rig Access?\",psi.drill_rig_access.to_s],\n [\"Rock Excavation?\",psi.rock_excavation_required.to_s,\"Skytrack Boomlift Access?\",psi.skytrack_boomlift_access.to_s],\n [\"Hang Dig?\",psi.hand_dig_required.to_s,\"Geotech Report Possessed?\",psi.geotech_report_in_possession.to_s],\n [\"Dirt Haul Off?\", psi.dirt_haul_off_required.to_s,\"Crane Access?\",psi.crane_access.to_s],\n [\"Tree Vegetation?\", psi.tree_vegetation_removal_required.to_s,\"Concrete Truck Access?\",psi.concrete_truck_access.to_s],\n [\"Sloped Area?\",psi.area_is_sloped.to_s,\"Site Survey Required?\", psi.site_survey_required.to_s]\n ]\n psi.project_utilities.map do |ut|\n si = si + [[\"Project Utilities\",ut.utility.utility_name]]\n end\n psi.project_type_informations.map do |pti|\n # psi.project_type_informations.map do |pti|\n # [[pti.project_type.project_type_name]]\n design_header = [[\"Project Design Information\",\"Project Type: \" + pti.project_type.project_type_name]] +\n [[\"Proposal Number\",\"Revision Number\"]]\n design_header = design_header + [[pti.proposal_number,pti.revision_number]]\n pti.category_option_selections.map do |cos|\n design_header = design_header + [[cos.category_option.category.category_name,cos.category_option.category_option_name]]\n end\n pti.answers.map do |answer|\n design_header = design_header + [[answer.question.question_name,answer.answer_text]]\n end\n move_down 20\n start_new_page\n table si do\n columns(0..3).rows(1..-1).width = 135\n rows(0).text_color = \"FFFFFF\"\n rows(0).background_color = \"a414e2\"\n column(0).font_style = :bold\n column(2..3).row(0).font_style = :bold\n column(2).rows(1..-1).font_style = :bold\n column(1).row(0).font_style = :bold\n rows(0..-1).size = 10\n column(0).rows(1..-1).background_color = \"62fc7e\"\n column(1).background_color = \"adffbc\"\n column(2).rows(0..-1).background_color = \"62fc7e\"\n column(3).background_color = \"adffbc\"\n columns(0..3).row(0).background_color = \"a414e2\"\n column(0).row(0).borders = :top, :left\n column(1..2).row(0).borders = :top, :bottom\n column(3).row(0).borders = :top, :bottom, :right\n row(-1).background_color = \"f76571\"\n end\n move_down 20\n start_new_page\n table design_header do\n row(0..1).font_style = :bold\n column(0).rows(3..-1).font_style = :bold\n column(2).font_style = :bold\n column(0..1).width = 270\n rows(0..-1).size = 10\n rows(0).background_color = \"f7c3c6\"\n end\n end\n end\n end", "def formatted_inventory(&blk)\n require 'formatr'\n\n raise \"Need to give a block to formatted_inventory\" unless block_given?\n\n blk.call if block_given?\n\n raise \"Need to define page body format\" if @page_body.nil?\n\n body_fmt = FormatR::Format.new(@page_heading, @page_body)\n body_fmt.setPageLength(@page_length)\n time = Time.now\n\n util = rpcclient(\"rpcutil\")\n util.progress = false\n\n util.inventory do |t, resp|\n @node = {:identity => resp[:sender],\n :facts => resp[:data][:facts],\n :classes => resp[:data][:classes],\n :agents => resp[:data][:agents]}\n\n body_fmt.printFormat(binding)\n end\n rescue Exception => e\n STDERR.puts \"Could not create report: #{e.class}: #{e}\"\n exit 1\n end", "def build_network_profile(express_route_enabled, master_rg, pre_vnet, network_address, subnet_address_list, dns_list, ip_type, security_group_name)\n # get the objects needed to build the profile\n virtual_network = AzureNetwork::VirtualNetwork.new(creds, subscription)\n virtual_network.location = @location\n\n subnet_cls = AzureNetwork::Subnet.new(creds, subscription)\n\n # if the express route is enabled we will look for a preconfigured vnet\n if express_route_enabled == 'true'\n OOLog.info(\"Master resource group: '#{master_rg}'\")\n OOLog.info(\"Pre VNET: '#{pre_vnet}'\")\n #TODO add checks for master rg and preconf vnet\n virtual_network.name = pre_vnet\n # get the preconfigured vnet from Azure\n network = virtual_network.get(master_rg)\n # fail if we can't find a vnet\n OOLog.fatal('Expressroute requires preconfigured networks') if network.nil?\n else\n network_name = 'vnet_'+ network_address.gsub('.','_').gsub('/', '_')\n OOLog.info(\"Using RG: '#{@rg_name}' to find vnet: '#{network_name}'\")\n virtual_network.name = network_name\n # network = virtual_network.get(@rg_name)\n if !virtual_network.exists?(@rg_name)\n # if network.nil?\n # set the network info on the object\n virtual_network.address = network_address\n virtual_network.sub_address = subnet_address_list\n virtual_network.dns_list = dns_list\n\n # build the network object\n new_vnet = virtual_network.build_network_object\n # create the vnet\n network = virtual_network.create_update(@rg_name, new_vnet)\n else\n network = virtual_network.get(@rg_name)\n end\n end\n\n subnetlist = network.body.properties.subnets\n # get the subnet to use for the network\n subnet =\n subnet_cls.get_subnet_with_available_ips(subnetlist,\n express_route_enabled)\n\n # define the NIC ip config object\n nic_ip_config = define_nic_ip_config(ip_type, subnet)\n\n # define the nic\n network_interface = define_network_interface(nic_ip_config)\n\n #include the network securtiry group to the network interface\n nsg = AzureNetwork::NetworkSecurityGroup.new(creds, subscription)\n network_security_group = nsg.get(@rg_name, security_group_name)\n if !network_security_group.nil?\n network_interface.properties.network_security_group = network_security_group\n end\n\n # create the nic\n nic = create_update(network_interface)\n\n # retrieve and set the private ip\n @private_ip =\n nic.properties.ip_configurations[0].properties.private_ipaddress\n OOLog.info('Private IP is: ' + @private_ip)\n\n # set the nic id on the network_interface object\n network_interface.id = nic.id\n\n # create the network profile\n network_profile = Azure::ARM::Compute::Models::NetworkProfile.new\n # set the nic on the profile\n network_profile.network_interfaces = [network_interface]\n # set the profile on the object.\n @profile = network_profile\n end", "def format_pool(_)\n config_file = self.class.table_conf\n\n CLIHelper::ShowTable.new(config_file, self) do\n column :ID, 'Provider identifier', :size => 4 do |p|\n p['ID']\n end\n\n column :NAME, 'Name of the provider', :left, :size => 25 do |p|\n p['NAME']\n end\n\n column :REGTIME,\n 'Registration time of the Provider',\n :size => 15 do |p|\n p.extend(CLIHelper::HashWithSearch)\n p = JSON.parse(p.dsearch(\"TEMPLATE/#{TAG}\"))\n\n OpenNebulaHelper.time_to_str(p['registration_time'])\n end\n\n default :ID, :NAME, :REGTIME\n end\n end", "def generate_igive_report(start_date = nil, end_date = nil)\r\n report_lines = []\r\n report_events(start_date, end_date) do |event, review_count|\r\n report_lines.push [event.affiliate_user.affiliate_unique_id, event.event_type, event.created_at.strftime('%D %H:%M'), (review_count == max_events ? 5 : 0)].join(\",\")\r\n end\r\n report_lines.join(\"\\n\")\r\n end", "def create_revenue_report\n\t\treport = {}\n\t\taffiliates = 0\n\t\tresellers = 0\n\t\tdirect = 0\n\n\t\t@partners.each do |partner|\n\t\t\tif partner.program_type == :affiliate\n\t\t\t\taffiliates += partner.amount_due\n\t\t\telsif partner.program_type == :reseller\n\t\t\t\tresellers += partner.amount_due\n\t\t\telse\n\t\t\t\tdirect += partner.profit\n\t\t\tend\n\t\tend\n\t\t\n\t\treport[:affiliates] = affiliates\n\t\treport[:resellers] = resellers\n\t\treport[:direct] = direct\n\t\treport[:total] = affiliates + resellers + direct\n\n\t\treport\n\tend", "def print_layout # rubocop:disable Metrics/MethodLength\n [{ code: :linked_transactions, # section code\n divider: false, # should we have a section divider\n display_title: false, # Is the title to be displayed\n type: :list, # type list = the list of attributes to follow\n list_items: [{ code: :return_reference,\n key_scope: %i[returns lbtt_transactions linked_transactions] },\n { code: :consideration_amount, format: :money, when: :convey, is: [true],\n key_scope: %i[returns lbtt_transactions linked_transactions] },\n { code: :npv_inc, format: :money, when: :convey, is: [false],\n key_scope: %i[returns lbtt_transactions linked_transactions] },\n { code: :premium_inc, format: :money, when: :convey, is: [false],\n key_scope: %i[returns lbtt_transactions linked_transactions] }] }]\n end", "def buildDetails(storage)\n # Build options Hash\n options = {}\n\n options[:object] = \"Datastore - #{storage.name}\"\n\n # Set alert to alert description\n options[:alert] = $evm.root['miq_alert_description']\n\n # Get Appliance name from model unless specified below\n appliance = nil\n # appliance ||= $evm.object['appliance']\n appliance ||= $evm.root['miq_server'].ipaddress\n\n # Get signature from model unless specified below\n signature = nil\n signature ||= $evm.object['signature']\n\n # Build Email Subject\n subject = \"#{options[:alert]} | Datastore: [#{storage.name}]\"\n options[:subject] = subject\n\n # Build Email Body\n body = \"Attention, \"\n body += \"<br>EVM Appliance: #{$evm.root['miq_server'].hostname}\"\n body += \"<br>EVM Region: #{$evm.root['miq_server'].region_number}\"\n body += \"<br>Alert: #{options[:alert]}\"\n body += \"<br><br>\"\n\n body += \"<br>Storage <b>#{storage.name}</b> Properties:\"\n body += \"<br>Storage URL: <a href='https://#{appliance}/Storage/show/#{storage.id}'>https://#{appliance}/Storage/show/#{storage.id}</a>\"\n body += \"<br>Type: #{storage.store_type}\"\n body += \"<br>Free Space: #{storage.free_space.to_i / (1024**3)} GB (#{storage.v_free_space_percent_of_total}%)\"\n body += \"<br>Used Space: #{storage.v_used_space.to_i / (1024**3)} GB (#{storage.v_used_space_percent_of_total}%)\"\n body += \"<br>Total Space: #{storage.total_space.to_i / (1024**3)} GB\"\n body += \"<br><br>\"\n\n body += \"<br>Information for Registered VMs:\"\n body += \"<br>Used + Uncommitted Space: #{storage.v_total_provisioned.to_i / (1024**3)} GB (#{storage.v_provisioned_percent_of_total}%)\"\n body += \"<br><br>\"\n\n body += \"<br>Content:\"\n body += \"<br>VM Provisioned Disk Files: #{storage.disk_size.to_i / (1024**3)} GB (#{storage.v_disk_percent_of_used}%)\"\n body += \"<br>VM Snapshot Files: #{storage.snapshot_size.to_i / (1024**3)} GB (#{storage.v_snapshot_percent_of_used}%)\"\n body += \"<br>VM Memory Files: #{storage.v_total_memory_size.to_i / (1024**3)} GB (#{storage.v_memory_percent_of_used}%)\"\n body += \"<br><br>\"\n\n body += \"<br>Relationships:\"\n body += \"<br>Number of Hosts attached: #{storage.v_total_hosts}\"\n body += \"<br>Total Number of VMs: #{storage.v_total_vms}\"\n body += \"<br><br>\"\n\n body += \"<br>Datastore Tags:\"\n body += \"<br>#{storage.tags.inspect}\"\n body += \"<br><br>\"\n\n body += \"<br>Regards,\"\n body += \"<br>#{signature}\"\n options[:body] = body\n\n # Return options Hash with subject, body, alert\n options\nend", "def build_report\n # build cases\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.testsuites {\n testsuite = xml.testsuite {\n @cases.each do |tc|\n testcase = xml.testcase {\n if tc.result_has_message?\n result_type = xml.send(tc.result)\n result_type[:message] = tc.message if tc.message.present?\n end\n\n if tc.system_out.size > 0\n xml.send('system-out') { xml.text tc.system_out.to_s }\n end\n\n if tc.system_err.size > 0\n xml.send('system-err') { xml.text tc.system_err.to_s }\n end\n }\n\n testcase[:name] = tc.name if tc.name.present?\n testcase[:time] = tc.time if tc.time.present?\n\n testcase[:classname] = package if package.present?\n if tc.classname.present?\n if testcase[:classname].present?\n testcase[:classname] = \"#{testcase[:classname]}.#{tc.classname}\"\n else\n testcase[:classname] = tc.classname\n end\n end\n\n end\n }\n\n testsuite[:name] = name if name.present?\n testsuite[:package] = package if package.present?\n }\n end\n\n builder.parent.root.to_xml\n end", "def index\n @network_invitations = current_organization.network_invitations\n @networks = current_organization.networks.paginate(:page => params[:page], :order => \"name\")\n end", "def create_cfg_info(node_ips, o, masters)\n node_os = ENV['CONTIV_NODE_OS'] || CENTOS\n conn = {}\n node_ips.each_with_index do |node_ip, n|\n node = if n < masters\n { 'role' => 'master' }\n else\n {}\n end\n def_ctrl_if = node_os == UBUNTU ? 'enp0s8' : 'eth1'\n def_data_if = node_os == UBUNTU ? 'enp0s9' : 'eth2'\n node['control'] = ENV['CONTIV_CONTROL_IF'] || def_ctrl_if\n node['data'] = ENV['CONTIV_DATA_IF'] || def_data_if\n conn[node_ip] = node\n end\n cfg_data = { 'CONNECTION_INFO' => conn }\n cfg_file = (ENV['VAGRANT_CWD'] || '.') + '/.cfg_' + o + '.yaml'\n File.write(cfg_file, cfg_data.to_yaml)\nend", "def print_layout # rubocop:disable Metrics/MethodLength\n [{ code: :company_details, # section code\n divider: false, # should we have a section divider\n display_title: true, # Is the title to be displayed\n type: :list, # type list = the list of attributes to follow\n list_items: [{ code: :company_number },\n { code: :company_name },\n { code: :address_line1 },\n { code: :address_line2, label: false },\n { code: :locality },\n { code: :county },\n { code: :postcode },\n { code: :country }] }]\n end", "def generate_new_hire_report\n lines = []\n\n column_titles = [\n 'Social Security Number',\n 'Name - Last',\n 'Name - First',\n 'Gender',\n 'Date of Birth',\n 'Date of Hire - Original',\n 'Date of Rehire',\n 'Termination Date',\n 'Address - Street 1',\n 'Address - Street 2',\n 'Address - City',\n 'Address - State',\n 'Address - Postal Code',\n 'Division ID',\n 'Pre-tax Deferral',\n 'Roth Amount',\n 'Matching Amount',\n 'Matching Safe Harbor',\n 'Profit Sharing',\n 'Non Elective Safe Harbor',\n 'Plan Compensation',\n 'Current Hours',\n 'Marital Status',\n 'Loan Payments',\n 'Internet Address - Other',\n 'PARTICIPANTID'\n ]\n lines.push(column_titles.join(','))\n\n plan_symlink = @config.plan.symlink\n plan = Plan.where('symlink = ?', plan_symlink).first\n @new_employees.each do |employee|\n date_of_birth = employee[RecordField::DATE_BIRTH]\n if date_of_birth.present? && date_of_birth.is_a?(Date)\n date_of_birth = DateUtils.to_string(date_of_birth)\n else\n date_of_birth = ''.to_date\n end\n participant = participant_mapping(plan.id, employee, date_of_birth)\n next if participant.nil?\n\n calculate_assumed_hour = Plan.calculate_assumed_hour(employee, plan.id)\n hours = plan.assumed_hours_setting ? calculate_assumed_hour : employee[RecordField::HOURS_REGULAR]\n cells = [\n (employee[RecordField::SSN] || '').gsub(/[^\\d]/, ''),\n employee[RecordField::NAME_LAST],\n employee[RecordField::NAME_FIRST],\n employee[RecordField::GENDER] || '',\n employee[RecordField::DATE_BIRTH] || ' ',\n employee[RecordField::DATE_HIRE] || ' ',\n employee[RecordField::DATE_REHIRE] || ' ',\n employee[RecordField::DATE_TERMINATION] || ' ',\n employee[RecordField::ADDRESS_STREET_1],\n employee[RecordField::ADDRESS_STREET_2],\n employee[RecordField::ADDRESS_CITY],\n employee[RecordField::ADDRESS_STATE],\n employee[RecordField::ADDRESS_POSTAL_CODE],\n employee[RecordField::DIVISION_ID],\n employee[RecordField::AMOUNT_CONTRIBUTION_TRADITIONAL],\n employee[RecordField::AMOUNT_CONTRIBUTION_ROTH],\n employee[RecordField::AMOUNT_MATCH],\n employee[RecordField::AMOUNT_MATCH_SAFE_HARBOR],\n employee[RecordField::AMOUNT_PROFIT_SHARING],\n employee[RecordField::AMOUNT_NON_ELECTIVE_SAFE_HARBOR],\n employee[RecordField::AMOUNT_PAY_GROSS],\n hours,\n employee[RecordField::MARITAL_STATUS],\n employee[RecordField::AMOUNT_LOAN_PAYMENTS],\n employee[RecordField::EMAIL] || ' ',\n participant.try(:id)\n ]\n lines.push(cells.join(','))\n end\n\n return lines.join(\"\\n\")\n end", "def to_rif\n xml = ::Builder::XmlMarkup.new\n xml.registryObjects OAI::Provider::Metadata::Rif.instance.header_specification do\n xml.registryObject 'group' => 'PARADISEC' do\n xml.key xml_key\n xml.originatingSource 'http://catalog.paradisec.org.au', 'type' => 'authoritative'\n\n xml.collection 'type' => 'collection', 'dateModified' => updated_at.xmlschema do\n xml.dates 'type' => 'dc.created' do\n xml.date created_at.xmlschema, 'type' => 'dateFrom', 'dateFormat' => 'W3CDTF'\n end\n xml.name 'type' => 'primary' do\n xml.namePart title\n end\n xml.description description, 'type' => 'brief'\n xml.rights do\n xml.accessRights access_condition_name\n end\n xml.identifier full_path, 'type' => 'uri'\n xml.location do\n xml.address do\n xml.electronic 'type' => 'url' do\n xml.value full_path\n end\n xml.physical 'type' => 'postalAddress' do\n xml.addressPart 'PARADISEC Sydney, Department of Linguistics, second floor Transient Building F12, Fisher Road, The University of Sydney, Camperdown Campus, NSW 2006, AUSTRALIA, Phone: +61 2 9351 2002', 'type' => 'text'\n end\n end\n end\n\n xml.relatedObject do\n xml.key collector.xml_key\n xml.relation 'type' => 'hasCollector' do\n xml.url collector.full_path\n end\n end\n\n xml.relatedObject do\n xml.key 'paradisec.org.au'\n xml.relation 'type' => 'isManagedBy' do\n xml.url 'http://catalog.paradisec.org.au'\n end\n end\n\n if university\n xml.relatedObject do\n if university.party_identifier\n xml.key university.party_identifier\n xml.relation 'type' => 'isOutputOf'\n else\n xml.key university.xml_key\n xml.relation 'type' => 'isOutputOf' do\n xml.url university.full_path\n end\n end\n end\n end\n\n if funding_body\n xml.relatedObject do\n if grant_identifier\n xml.key full_grant_identifier\n else\n xml.key funding_body.key_prefix\n end\n xml.relation 'type' => 'isOutputOf'\n end\n end\n\n languages.each do |language|\n xml.subject language.name, 'type' => 'local'\n xml.subject language.code, 'type' => 'iso639-3'\n end\n\n if field_of_research\n xml.subject field_of_research.identifier, 'type' => 'anzsrc-for'\n end\n\n xml.coverage do\n countries.each do |country|\n xml.spatial country.name, 'type' => 'text'\n xml.spatial country.code, 'type' => 'iso31661'\n end\n\n if north_limit != 0 || south_limit != 0 || west_limit != 0 || east_limit != 0\n xml.spatial \"northlimit=#{north_limit}; southlimit=#{south_limit}; westlimit=#{west_limit}; eastLimit=#{east_limit};\", 'type' => 'iso19139dcmiBox'\n end\n\n unless items.map(&:originated_on).compact.empty?\n xml.temporal do\n if items.map(&:originated_on).compact.min\n xml.date items.map(&:originated_on).compact.min.xmlschema, 'type' => 'dateFrom', 'dateFormat' => 'W3CDTF'\n end\n if items.map(&:originated_on).compact.max\n xml.date items.map(&:originated_on).compact.max.xmlschema, 'type' => 'dateTo', 'dateFormat' => 'W3CDTF'\n end\n end\n end\n end\n\n xml.citationInfo do\n xml.fullCitation strip_tags(citation), 'style' => 'APA'\n end\n\n languages.each do |language|\n xml.relatedInfo 'type' => 'website' do\n xml.identifier \"http://www.ethnologue.com/show_language.asp?code=#{language.code}\", 'type' => 'uri'\n xml.title \"Ethnologue entry for #{language.name}\"\n end\n end\n end\n end\n\n xml.registryObject 'group' => 'PARADISEC' do\n xml.key collector.xml_key\n xml.originatingSource 'http://catalog.paradisec.org.au', 'type' => 'authoritative'\n\n xml.party 'type' => 'person', 'dateModified' => updated_at.xmlschema do\n xml.identifier collector.full_path, 'type' => 'uri'\n xml.name 'type' => 'primary' do\n xml.namePart collector.first_name, 'type' => 'given'\n xml.namePart collector.last_name, 'type' => 'family'\n end\n xml.location do\n xml.address do\n xml.electronic 'type' => 'url' do\n xml.value collector.full_path\n end\n xml.physical 'type' => 'postalAddress' do\n xml.addressPart collector.name + ' c/o PARADISEC, Department of Linguistics, The University of Sydney', 'type' => 'text'\n end\n end\n end\n xml.relatedObject do\n xml.key 'paradisec.org.au'\n xml.relation 'type' => 'isParticipantIn'\n end\n end\n end\n\n if university && !university.party_identifier\n xml.registryObject 'group' => 'PARADISEC' do\n xml.key university.xml_key\n xml.originatingSource 'http://catalog.paradisec.org.au', 'type' => 'authoritative'\n\n xml.party 'type' => 'group', 'dateModified' => updated_at.xmlschema do\n xml.identifier university.full_path, 'type' => 'uri'\n xml.name 'type' => 'primary' do\n xml.namePart university.name, 'type' => 'primary'\n end\n xml.location do\n xml.address do\n xml.electronic 'type' => 'url' do\n xml.value university.full_path\n end\n xml.physical 'type' => 'streetAddress' do\n xml.addressPart university.name, 'type' => 'locationDescriptor'\n end\n end\n end\n end\n end\n end\n end\n xml.target!\n end", "def create_partner_profit_report\n\t\treport = {}\n\n\t\t\t@partners.each do |partner|\n\t\t\t\tnext if(partner.program_type == :direct) \n\t\t\t\treport[partner.partner_name] = {}\n\n\t\t\t\treport[partner.partner_name][:profit] = partner.profit \n\t\t\tend\n\n\t\treport\n\tend", "def report_for(nodes, locale_code)\n output = ''\n locale = TRANSLATIONS[locale_code]\n\n output << <<~EO_MEDIAWIKI\n Back to the [[Hadoop]] / [[Impala]] / [[XAE_Network_Topology]] portal pages\n\n This page has been generated using <code>./bin/report --format mediawiki</code> on #{Time.now.utc.strftime('%F %T')} UTC.\n\n EO_MEDIAWIKI\n\n # Get all confs\n # Use the translations' keys to know all properties we want to display\n all_properties = (%i[physical_node cluster private_ips description] + locale.keys).uniq\n @nodes_handler.prefetch_metadata_of nodes, locale.keys\n nodes.\n map do |node|\n { node: node }.merge(all_properties.map { |property| [property, @nodes_handler.metadata_of(node, property)] }.to_h)\n end.\n # Group them by physical / VMs\n group_by do |node_info|\n # Consume the info to not display it again later\n physical_node = node_info.delete(:physical_node)\n !physical_node.nil? && physical_node\n end.\n each do |physical, nodes_for_physical|\n output << \"= #{physical ? 'Physical' : 'Virtual'} nodes =\\n\\n\"\n # Group them by location\n nodes_for_physical.\n group_by do |node_info|\n # Consume the info to not display it again later\n cluster = node_info.delete(:cluster)\n cluster.nil? ? '' : cluster\n end.\n sort.\n each do |cluster, nodes_for_cluster|\n output << \"== #{cluster.empty? ? 'Independent nodes' : \"Belonging to cluster #{cluster}\"} ==\\n\\n\"\n # Group them by IP range (24 bits)\n nodes_for_cluster.\n group_by { |node_info| node_info[:private_ips].nil? || node_info[:private_ips].empty? ? [] : node_info[:private_ips].first.split('.')[0..2].map(&:to_i) }.\n sort.\n each do |ip_range, nodes_for_ip_range|\n output << \"=== #{ip_range.empty? ? 'No IP' : \"#{ip_range.join('.')}/24\"} ===\\n\\n\"\n nodes_for_ip_range.\n sort_by { |node_info| node_info[:node] }.\n each do |node_info|\n output << \"* '''#{node_info.delete(:node)}'''#{node_info[:private_ips].nil? || node_info[:private_ips].empty? ? '' : \" - #{node_info[:private_ips].first}\"} - #{node_info.delete(:description)}\\n\"\n node_info.delete(:private_ips) if !node_info[:private_ips].nil? && node_info[:private_ips].size == 1\n node_info.sort.each do |property, value|\n next if value.nil?\n\n raise \"Missing translation of key: #{property}. Please edit TRANSLATIONS[:#{locale_code}].\" unless locale.key?(property)\n\n output << \": #{locale[property]}: #{\n case value\n when Array\n \"\\n#{value.map { |item| \"::* #{item}\" }.join(\"\\n\")}\"\n when Hash\n \"\\n#{value.map { |item, item_value| \"::* #{item}: #{item_value}\" }.join(\"\\n\")}\"\n when TrueClass\n locale[:true]\n when FalseClass\n locale[:false]\n else\n value.to_str\n end\n }\\n\"\n end\n output << \"\\n\\n\"\n end\n end\n end\n end\n\n output << <<~EO_MEDIAWIKI\n Back to the [[Hadoop]] / [[Impala]] / [[XAE_Network_Topology]] portal pages\n\n [[Category:My Project]]\n [[Category:Hadoop]]\n [[Category:NoSQL]]\n [[Category:Hosting]]\n [[Category:XAE]]\n [[Category:Server]]\n [[Category:Configuration]]\n [[Category:Chef]]\n EO_MEDIAWIKI\n\n out output\n end", "def init_network_lease_counters\n query = 'SELECT oid,body,pid FROM network_pool WHERE pid<>-1'\n\n @db.fetch(query) do |row|\n doc = nokogiri_doc(row[:body])\n\n parent_vnet = doc.root.at_xpath('PARENT_NETWORK_ID').text.to_i\n\n if row[:pid] != parent_vnet\n # TODO\n end\n\n doc.root.xpath('AR_POOL/AR').each do |ar|\n parent_ar_e = ar.at_xpath('PARENT_NETWORK_AR_ID')\n\n next if parent_ar_e.nil? || parent_ar_e.text.empty?\n\n parent_ar = parent_ar_e.text.to_i\n\n if counters[:vnet][parent_vnet][:ar_leases][parent_ar].nil?\n log_error(\"VNet #{row[:oid]} is using parent \" \\\n \"VNet #{parent_vnet}, AR #{parent_ar}, \" \\\n 'but the AR does not exist', false)\n end\n\n # MAC\n first_mac = mac_s_to_i(ar.at_xpath('MAC').text)\n\n # IP\n unless ar.at_xpath('IP').nil?\n first_ip = IPAddr.new(ar.at_xpath('IP').text.strip,\n Socket::AF_INET)\n end\n\n # IP6\n ipv6 = get_ipv6(ar)\n\n addrs = { :mac => first_mac, :ip => first_ip, :ipv6 => ipv6 }\n\n # Parent vnet has a lease for each address of this reservation\n calculate_leases(ar, row[:oid], addrs, parent_vnet, parent_ar)\n end\n end\n end", "def create_network_equipment(network_uid, network, refapi_path, site_uid = nil)\n network_path = ''\n if site_uid\n network_path = Pathname.new(refapi_path).join(\"sites\", site_uid, \"network_equipments\")\n else\n network_path = Pathname.new(refapi_path).join(\"network_equipments\")\n end\n network_path.mkpath()\n\n write_json(network_path.join(\"#{network_uid}.json\"), network)\nend", "def create_amount_to_bill_report\n\t\t\n\t\treport = {}\n\n\t\t@partners.each do |partner|\n\t\t\tnext if(partner.program_type == :direct) \n\t\t\treport[partner.partner_name] = {}\n\n\t\t\treport[partner.partner_name][:amount_to_bill] = partner.amount_due \n\t\tend\n\n\t\treport\n\tend", "def html_report_header\n @report << '\n <html>\n <head>\n <title> Kismet Wireless Report</title>\n <style>\n body {\n\t font: normal 11px auto \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n\t color: #4f6b72;\n\t background: #E6EAE9;\n }\n #report-header {\n font-weight: bold;\n font-size: 24px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n\n }\n\n #sub-header {\n font-weight: italic;\n font-size: 10px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n\n }\n\n #title {\n font-weight: bold;\n font-size: 16px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n }\n\n th {\n\t font: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n\t color: #4f6b72;\n\t border-right: 1px solid #C1DAD7;\n\t border-bottom: 1px solid #C1DAD7;\n\t border-top: 1px solid #C1DAD7;\n\t letter-spacing: 2px;\n\t text-transform: uppercase;\n\t text-align: left;\n\t padding: 6px 6px 6px 12px;\n }\n\n td {\n\t border-right: 1px solid #C1DAD7;\n\t border-bottom: 1px solid #C1DAD7;\n\t background: #fff;\n\t padding: 6px 6px 6px 12px;\n\t color: #4f6b72;\n }\n\n\n td.alt {\n\t background: #F5FAFA;\n\t color: #797268;\n }\n\n\n\n </style>\n '\n if @options.create_map\n @report << %Q!\n <script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=false\"></script>\n <script type=\"text/javascript\">\n function initialize() {\n var latlng = new google.maps.LatLng(#{@map_centre['lat']}, #{@map_centre['long']});\n var myOptions = {\n zoom: 14,\n center: latlng,\n mapTypeId: google.maps.MapTypeId.ROADMAP\n };\n var map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);\n !\n\n #Yugh this is a hack\n @options.gps_data.each do |bssid,point|\n netname = bssid.gsub(':','')\n\n if @nets_by_bssid[bssid]\n #Next line is present to strip any single quotes from SSID's before putting them into the marker as that causes problems :)\n content_ssid = @nets_by_bssid[bssid]['ssid'].gsub(/['<>]/,'')\n @log.debug(\"About to add \" + content_ssid) if content_ssid\n @report << %Q!\n var contentString#{netname} = '<b>SSID: </b> #{content_ssid} <br />' +\n '<b>BSSID: </b> #{bssid}<br />' +\n '<b>Channel: </b> #{@nets_by_bssid[bssid]['channel']} <br />' +\n '<b>Ciphers: </b> #{@nets_by_bssid[bssid]['cipher']} <br />' +\n '<b>Cloaked?: </b> #{@nets_by_bssid[bssid]['cloaked']} <br />';\n var infowindow#{netname} = new google.maps.InfoWindow({\n content: contentString#{netname}\n });\n !\n end\n @report << %Q!\n var latlng#{netname} = new google.maps.LatLng(#{point['lat']}, #{point['lon']});\n\n var marker#{netname} = new google.maps.Marker({\n position: latlng#{netname},\n map: map\n });\n !\n if @nets_by_bssid[bssid]\n @report << %Q!\n google.maps.event.addListener(marker#{netname}, 'click', function() {\n infowindow#{netname}.open(map,marker#{netname});\n });\n !\n end\n end\n\n @report << %Q!\n }\n </script>\n\n !\n end\n @report << '</head>'\n if @options.create_map\n @report << '<body onload=\"initialize()\">'\n else\n @report << '<body>'\n end\n @report << '<div id=\"report-header\">Kismet Wireless Report</div> <br /> <div id=\"sub-header\"> Report Generated at ' + Time.now.to_s + '<br />'\n @report << 'Files analysed ' + @options.file_names.join(',<br />') + '<br /> <br /></div>'\n end", "def network_overview\n delegate(provider, :network_overview)\n end", "def write_report\n\n end", "def scg_report\n @scg_csv_array = []\n get_resource_list('compute', 'storage-connectivity-groups', 'storage_connectivity_groups', name = 'display_name', id = 'id')\n @resource_id_list.each do |scgid|\n scg = rest_get(\"#{@resource_url}/storage-connectivity-groups/#{scgid}\", @token_id)\n scg_array = JSON.parse(scg)['storage_connectivity_group']\n scg_name = scg_array['display_name']\n scg_auto_add_vios = scg_array['auto_add_vios']\n scg_fc_storage_access = scg_array['fc_storage_access']\n scg_ports_per_fabric_npiv = scg_array['ports_per_fabric_npiv']\n @scg_host_list = []\n @scg_host_array = scg_array['host_list']\n @scg_host_array.each do |host|\n @scg_host_list.push(host['name'])\n end\n @scg_vios_array = scg_array['host_list'][0]['vios_list']\n @scg_vios_names = []\n @scg_vios_array.each do |vios|\n @scg_vios_names.push(vios['name'])\n end\n @scg_csv_headers = %w(SCG_Name SCG_Auto_Add_VIOs SCG_FC_Storage_Access SCG_Ports_per_Fabric SCG_Host_List SCG_VIOs_List)\n @scg_csv_array << [scg_name, scg_auto_add_vios, scg_fc_storage_access, scg_ports_per_fabric_npiv, @scg_host_list, @scg_vios_names]\n end\n end", "def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end", "def print_layout # rubocop:disable Metrics/MethodLength\n [{ code: :address, # section code\n divider: false, # should we have a section divider\n display_title: true, # Is the title to be displayed\n type: :list, # type list = the list of attributes to follow\n list_items: [{ code: :address_line1 },\n { code: :address_line2, label: false, when: :address_line2, is_not: :nil? },\n { code: :address_line3, label: false, when: :address_line3, is_not: :nil? },\n { code: :address_line4, label: false, when: :address_line4, is_not: :nil? },\n { code: :town },\n { code: :county },\n { code: :postcode }] }]\n end", "def configure_vna\n count = 0\n\n server_info('vna').each do |sv|\n count += 1\n\n cloudconductor_vnet_edge sv['hostname'] do\n vna_id \"vna#{count}\"\n hwaddr \"02:00:01:01:00:#{format('%02x', count)}\"\n datapath_id \"0x000200010100#{format('%02x', count)}\"\n end\n end\nend", "def create(network_spec)\n\n #@logger = bosh::Clouds::Config.logger\n # Need to reset between each call so that this class is stateless between jobs\n @network = nil\n @vip_network = nil\n\n networks = []\n network_spec.each_pair do |name, spec|\n #raise bosh::Registry::ConfigError \"'#{spec['type']}' network spec provided is invalid\"\n network_type = spec['type'] || 'dynamic'\n case network_type\n when 'dynamic'\n next if (@network)\n @network = DynamicNetwork.new(@vnet_manager, spec['cloud_properties'])\n check_affinity_group(@network.affinity_group)\n networks << @network\n\n when 'vip'\n next if (@vip_network)\n @vip_network = VipNetwork.new(@vnet_manager, spec['cloud_properties'])\n networks << @vip_network\n\n else\n raise Bosh::Registry::ConfigError \"Invalid network type '#{network_type}' for Azure, \" \\\n \"can only handle 'dynamic' or 'vip' network types\"\n end\n\n # Create the network(s) if they dont exist\n networks.each do |network|\n network.provision\n end\n end\n end", "def createAdvFilCustomView (ixNet, cvName, protocol, grLevel, sortExpr)\r\n puts(\"- creating view \"+cvName+\", with protocol \"+protocol+\", grouping level \"+grLevel)\r\n @ixNet.add(@ixNet.getRoot()+'/statistics', 'view')\r\n @ixNet.commit()\r\n\r\n mv = @ixNet.getList(@ixNet.getRoot(), 'statistics')[0]\r\n view = @ixNet.getList(mv, 'view')[-1]\r\n\r\n @ixNet.setAttribute(view, '-caption', cvName)\r\n @ixNet.setAttribute(view, '-type', 'layer23NextGenProtocol')\r\n @ixNet.setAttribute(view, '-visible', 'true')\r\n @ixNet.commit()\r\n\r\n view = @ixNet.getList(mv, 'view')[-1]\r\n\r\n ################################################################################\r\n # add advanced filtering filter\r\n ################################################################################\r\n puts(\"\\t - add advanced filtering filter ...\")\r\n trackingFilter = @ixNet.add(view, 'advancedCVFilters')\r\n\r\n ################################################################################\r\n # sett protocol for the filter\r\n ################################################################################\r\n puts \"\\t - setting protocol %s for the filter.\" % protocol\r\n @ixNet.setAttribute(trackingFilter, '-protocol', protocol)\r\n @ixNet.commit()\r\n\r\n ################################################################################\r\n # select the grouping level for the filter.\r\n ################################################################################\r\n puts \"\\t - selecting %s for the filter grouping level.\" % grLevel\r\n @ixNet.setAttribute(trackingFilter, '-grouping', grLevel)\r\n @ixNet.commit()\r\n\r\n ################################################################################\r\n # add filter expression and filter sorting stats.\r\n ################################################################################\r\n puts(\"\\t - adding filter expression and filter sorting stats.\")\r\n @ixNet.setAttribute(trackingFilter, '-sortingStats', sortExpr)\r\n @ixNet.commit()\r\n\r\n ################################################################################\r\n # set the filter\r\n ################################################################################\r\n puts(\"\\t - setting the filter.\")\r\n fil = @ixNet.getList(view, 'layer23NextGenProtocolFilter')[0]\r\n @ixNet.setAttribute(fil, '-advancedCVFilter', trackingFilter)\r\n @ixNet.commit()\r\n\r\n ################################################################################\r\n # enable the stats columns to be displayed for the view\r\n ################################################################################\r\n puts(\"\\t - enable the stats columns to be displayed for the view.\")\r\n statsList = @ixNet.getList(view, 'statistic')\r\n for stat in statsList\r\n @ixNet.setAttribute(stat, '-enabled', 'true')\r\n end\r\n @ixNet.commit()\r\n\r\n ################################################################################\r\n # enable the view going and start retrieving stats\r\n ################################################################################\r\n puts(\"\\t - enabling the view going and start retrieving stats.\")\r\n @ixNet.setAttribute(view, '-enabled', 'true')\r\n @ixNet.commit()\r\nend", "def build_summary_annual_report(weeks)\n #weeks = Week.tax_year(tax_year).order(:id)\n self.net_sales = DispenserPeriodNet.create(weeks.first, weeks.last)\n self.fuel_detail = FuelDeliveryDetail.for_range_of_weeks_sales(weeks.first, weeks.last)\n self.grade_profit = GradeProfit.create(net_sales, fuel_detail)\n end", "def build_report_body\n #@output << erb(RAILS_ROOT + \"/app/views/reports/_users.html.erb\") \n pad(10) do\n add_text usernotes\n end\n if timespan == \"Daily\" \n add_text \"Current Tasks and Tasks Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Tasks and Tasks Modified in the last Week\"\n else\n add_text \"Current Tasks\"\n end\n pad(10) do\n draw_table(data, :width => 600)\n end\n if timespan == \"Daily\" \n add_text \"Current Goals and Goals Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Goals and Goals Modified in the last Week\"\n else\n add_text \"Current Goals\"\n end\n pad(10) do\n draw_table(goaldata, :width => 600)\n end\n end", "def get_hardware_network_info(instance)\n networks_array = []\n\n get_vm_nics(instance).each do |nic_profile|\n nic_profile.properties.ip_configurations.each do |ipconfig|\n hostname = ipconfig.name\n private_ip_addr = ipconfig.properties.try(:private_ip_address)\n if private_ip_addr\n networks_array << {:description => \"private\", :ipaddress => private_ip_addr, :hostname => hostname}\n end\n\n public_ip_obj = ipconfig.properties.try(:public_ip_address)\n next unless public_ip_obj\n\n ip_profile = ip_addresses.find { |ip| ip.id == public_ip_obj.id }\n next unless ip_profile\n\n public_ip_addr = ip_profile.properties.try(:ip_address)\n networks_array << {:description => \"public\", :ipaddress => public_ip_addr, :hostname => hostname}\n end\n end\n\n networks_array\n end", "def build_report\n puts \"building performance test comparison report...\"\n puts\n\n # load template\n report = File.read(@template_path)\n\n # metrics result\n result_comparison_table = extract_table_from_csv2html_output(@result_comparison_path)\n\n # atop summary\n atop_summary_comparison_table = extract_table_from_csv2html_output(@atop_summary_comparison_path)\n\n # atop detail\n # TODO: enable\n # atop_detail_comparison_table = extract_table(@atop_detail_comparison_path)\n\n # replace tables (do this first since table data may include parameters)\n report = report.gsub(\"$RESULT_COMPARISON_TABLE\", result_comparison_table)\n report = report.gsub(\"$ATOP_SUMMARY_COMPARISON_TABLE\", atop_summary_comparison_table)\n\n # TODO: enable\n # report = report.gsub(\"$ATOP_DETAIL_TABLE\", atop_detail_table)\n\n # replace parameters\n report = replace_parameters(report)\n\n # write report\n puts \"writing report to #{@output_path}\"\n\n File.write(@output_path, report)\nend", "def gen_nec_config\n config = \"switch :: EtherSwitch; \\\nFromDevice(#{@netif}, PROMISC true) -> [0]switch; \\\nswitch[0] -> Queue -> ToDevice(#{@netif}); \"\n\n i = 1\n @mobiles.each do |mac, client|\n next unless client.ul && client.dl && client.ip\n config << \"AddressInfo(c_#{i} #{client.ip} #{client.mac}); \\\narr_#{i} :: ARPResponder(c_#{i}); \\\narq_#{i} :: ARPQuerier(c_#{i}); \\\n\\\nScript(write arq_#{i}.gateway #{@defgw}, write arq_#{i}.netmask #{@netmask}); \\\n\\\nulgre_#{i} :: FromDevice(#{client.ul}); \\\ndlgre_#{i} :: ToDevice(#{client.dl}); \\\n\\\nswitch[#{i}] -> cf_#{i} :: Classifier(12/0806 20/0001, 12/0806 20/0002, -); \\\ncf_#{i}[0] -> arr_#{i} -> [#{i}]switch; \\\ncf_#{i}[1] -> [1]arq_#{i}; \\\ncf_#{i}[2] -> Strip(14) -> dlgreq_#{i} :: Queue -> dlgre_#{i}; \\\nulgre_#{i} -> GetIPAddress(16) -> arq_#{i} -> [#{i}]switch; \"\n i += 1\n end\n config\n end", "def configure_interfaces\n node_servers.each do |svinfo|\n gretap_interfaces(svinfo).each do |ifname, ifcfg|\n host_name = svinfo['hostname']\n virtual_addr = virtual_address(ifcfg)\n\n cloudconductor_server_interface \"#{host_name}_#{ifname}\" do\n action :create\n hostname host_name\n if_name ifname\n network ifcfg['network']\n security_groups ifcfg['security_groups']\n virtual_address virtual_addr\n end\n end\n end\nend", "def create_pg\n #-----------------------------------------------------------------------\n # Get parameters needed to create the network\n #-----------------------------------------------------------------------\n vlan_id = self['VLAN_ID'] || \"0\"\n pg_name = self['BRIDGE']\n pnics = self['TEMPLATE/PHYDEV']\n sw_name = self['TEMPLATE/VCENTER_SWITCH_NAME']\n mtu = self['TEMPLATE/MTU']\n nports = self['TEMPLATE/VCENTER_SWITCH_NPORTS']\n\n nports = 128 if nports.empty?\n mtu = nil if mtu.empty?\n pnics = nil if pnics.empty?\n\n esxs = []\n newpgs = []\n errors = []\n\n #-----------------------------------------------------------------------\n # Initialize a ESX references for all ESX in all Clusters\n #-----------------------------------------------------------------------\n @clusters.each do |cluster|\n cli = cluster[:cli]\n\n cluster[:ccr]['host'].each do |host|\n esxs << VCenterDriver::ESXHost.new_from_ref(host._ref, cli)\n end\n end\n\n #-----------------------------------------------------------------------\n # Check PG does not exists and create it on all ESX hosts\n #-----------------------------------------------------------------------\n esxs.each do |esx|\n pg = esx.pg_exists(pg_name)\n raise \"Port Group #{pg_name} already exists\" if pg\n end\n\n esxs.each do |esx|\n begin\n apnic = nil\n apnic = esx.available_pnics if pnics\n\n vs = esx.vss_exists(sw_name)\n\n esx.create_vss(sw_name, nports, pnics, mtu, apnic) unless vs\n\n newpgs << esx.create_pg(pg_name, sw_name, vlan_id)\n rescue StandardError => e\n msg = \"\\tHost #{esx['name']}. Reason: \\\"#{e.message}\\\".\\n\"\n msg << \"#{e.backtrace}\\n\" if @debug\n\n errors << msg\n end\n end\n\n #-----------------------------------------------------------------------\n # Sanity Check all new_pg references should be the same\n # Rollback PG creation in case of any error\n #-----------------------------------------------------------------------\n unless errors.empty?\n message = \"Error adding port group to hosts:\\n\"\n message << errors.join\n\n esxs.each do |esx|\n begin\n esx.network_rollback\n rescue StandardError => e\n message << \"Error in rollback for #{esx['name']}: #{e.message}\\n\"\n end\n end\n\n raise message\n end\n\n raise \"Different PG refs!:\\n#{newpgs}\" if newpgs.uniq.length != 1\n\n \"VCENTER_NET_REF = \\\"#{newpgs[0]}\\\"\\n\"\\\n \"VCENTER_INSTANCE_ID = \\\"#{@clusters[0][:uuid]}\\\"\\n\"\n end", "def buildDetails(host)\n # Build options Hash\n options = {}\n\n options[:object] = \"Host - #{host.name}\"\n\n # Set alert to alert description\n options[:alert] = $evm.root['miq_alert_description']\n\n # Get Appliance name from model unless specified below\n appliance = nil\n # appliance ||= $evm.object['appliance']\n appliance ||= $evm.root['miq_server'].ipaddress\n\n # Get signature from model unless specified below\n signature = nil\n signature ||= $evm.object['signature']\n\n # Build Email Subject\n subject = \"#{options[:alert]} | Host: [#{host.name}]\"\n options[:subject] = subject\n\n # Build Email Body\n body = \"Attention,\"\n body += \"<br>EVM Appliance: #{$evm.root['miq_server'].hostname}\"\n body += \"<br>EVM Region: #{$evm.root['miq_server'].region_number}\"\n body += \"<br>Alert: #{options[:alert]}\"\n body += \"<br><br>\"\n\n body += \"<br>Host <b>#{host.name}</b> Properties:\"\n body += \"<br>Host URL: <a href='https://#{appliance}/host/show/#{host.id}'>https://#{appliance}/host/show/#{host.id}</a>\"\n body += \"<br>Hostname: #{host.hostname}\"\n body += \"<br>IP Address(es): #{host.ipaddress}\"\n body += \"<br>CPU Type: #{host.hardware.cpu_type}\"\n body += \"<br>Cores per Socket: #{host.hardware.cpu_total_cores}\"\n body += \"<br>vRAM: #{host.hardware.memory_mb.to_i / 1024} GB\"\n body += \"<br>Operating System: #{host.vmm_product} #{host.vmm_version} Build #{host.vmm_buildnumber}\"\n body += \"<br>SSH Permit Root: #{host.ssh_permit_root_login}\"\n body += \"<br><br>\"\n\n body += \"<br>Power Maangement:\"\n body += \"<br>Power State: #{host.power_state}\"\n body += \"<br><br>\"\n\n body += \"<br>Relationships:\"\n body += \"<br>Datacenter: #{host.v_owning_datacenter}\"\n body += \"<br>Cluster: #{host.v_owning_cluster}\"\n body += \"<br>Datastores: #{host.v_total_storages}\"\n body += \"<br>VM(s): #{host.v_total_vms}\"\n body += \"<br><br>\"\n\n body += \"<br>Host Tags:\"\n body += \"<br>#{host.tags.inspect}\"\n body += \"<br><br>\"\n\n body += \"<br>Regards,\"\n body += \"<br>#{signature}\"\n options[:body] = body\n\n # Return options Hash with subject, body, alert\n options\nend", "def create_outlets\n if self.pack_group_template_outlets.length == 0\n counts = PackGroupsCountsConfig.find_all_by_commodity_code(self.commodity_code,:order => 'position')\n if counts.length == 0\n raise \"No sequence of counts('pack_groups_counts_configs' table) have been defined for commodity '#{self.commodity_code}'.\n <br> Use the program called 'pack_groups_counts_configs'(usually under 'tools') to define the list(and order of) size_counts\n <br>to use for allocating drops to counts per pack_group\"\n end\n \n \n counts.each do |count|\n pgo = PackGroupTemplateOutlet.new\n pgo.pack_group_template_id = self.id\n \n if count.size_code\n pgo.size_code = count.size_code\n else\n pgo.standard_size_count_value = count.standard_size_count_value\n end\n \n pgo.create\n end\n \n end\n \n end", "def create_rep_heading\n\tsave_file(print_date)\n\tsave_file(print_sales_rpt)\nend", "def libvirt_networks(driver)\n libvirt_networks = []\n\n # Iterate over all (active and inactive) networks.\n driver.list_all_networks.each do |libvirt_network|\n\n # Parse ip address and netmask from the network xml description.\n xml = Nokogiri::XML(libvirt_network.xml_desc)\n ip = xml.xpath('/network/ip/@address').first\n ip = ip.value if ip\n netmask = xml.xpath('/network/ip/@netmask').first\n netmask = netmask.value if netmask\n\n dhcp_enabled = if xml.at_xpath('//network/ip/dhcp')\n true\n else\n false\n end\n\n domain_name = xml.at_xpath('/network/domain/@name')\n domain_name = domain_name.value if domain_name\n\n # Calculate network address of network from ip address and\n # netmask.\n network_address = (network_address(ip, netmask) if ip && netmask)\n\n libvirt_networks << {\n name: libvirt_network.name,\n ip_address: ip,\n netmask: netmask,\n network_address: network_address,\n dhcp_enabled: dhcp_enabled,\n bridge_name: libvirt_network.bridge_name,\n domain_name: domain_name,\n created: true,\n active: libvirt_network.active?,\n autostart: libvirt_network.autostart?,\n libvirt_network: libvirt_network\n }\n end\n\n libvirt_networks\n end", "def createVNET(vnet_name)\n puts 'Creating a virtual network'\n vnet_create_params = Azure::ARM::Network::Models::VirtualNetwork.new.tap do |vnet|\n vnet.location = $region_dc\n vnet.address_space = Azure::ARM::Network::Models::AddressSpace.new.tap do |addr_space|\n addr_space.address_prefixes = ['10.0.0.0/16']\n end\n vnet.dhcp_options = Azure::ARM::Network::Models::DhcpOptions.new.tap do |dhcp|\n dhcp.dns_servers = ['8.8.8.8']\n end\n vnet.subnets = [\n Azure::ARM::Network::Models::Subnet.new.tap do |subnet|\n subnet.name = 'Subnet1'\n subnet.address_prefix = '10.0.0.0/24'\n end\n ]\n end\n print_complexitem $vnet = $network_client.virtual_networks.create_or_update($resourcegroupname, vnet_name, vnet_create_params)\nend", "def buildDetails(vm)\n # Build options Hash\n options = {}\n\n options[:object] = \"VM - #{vm.name}\"\n\n # Set alert to alert description\n options[:alert] = $evm.root['miq_alert_description']\n\n # Get Appliance name from model unless specified below\n appliance = nil\n # appliance ||= $evm.object['appliance']\n appliance ||= $evm.root['miq_server'].ipaddress\n\n # Get signature from model unless specified below\n signature = nil\n signature ||= $evm.object['signature']\n\n # Build Email Subject\n subject = \"#{options[:alert]} | VM: [#{vm.name}]\"\n options[:subject] = subject\n\n # Build Email Body\n body = \"Attention,\"\n body += \"<br>EVM Appliance: #{$evm.root['miq_server'].hostname}\"\n body += \"<br>EVM Region: #{$evm.root['miq_server'].region_number}\"\n body += \"<br>Alert: #{options[:alert]}\"\n body += \"<br><br>\"\n\n body += \"<br>VM <b>#{vm.name}</b> Properties:\"\n body += \"<br>VM URL: <a href='https://#{appliance}/VM/show/#{vm.id}'>https://#{appliance}/VM/show/#{vm.id}</a>\"\n body += \"<br>Hostname: #{vm.hostnames.inspect}\"\n body += \"<br>IP Address(es): #{vm.ipaddresses.inspect}\"\n body += \"<br>vCPU: #{vm.cpu_total_cores}\"\n body += \"<br>vRAM: #{vm.mem_cpu.to_i} MB\"\n body += \"<br>Tools Status: #{vm.tools_status}\"\n body += \"<br>Operating System: #{vm.operating_system['product_name']}\"\n body += \"<br>Disk Alignment: #{vm.disks_aligned}\"\n body += \"<br><br>\"\n\n body += \"<br>Power Maangement:\"\n body += \"<br>Power State: #{vm.power_state}\"\n body += \"<br>Last Boot: #{vm.boot_time}\"\n body += \"<br><br>\"\n\n body += \"<br>Snapshot Information:\"\n body += \"<br>Total Snapshots: #{vm.v_total_snapshots}\"\n body += \"<br>Total Snapshots: #{vm.v_total_snapshots}\"\n body += \"<br><br>\"\n\n body += \"<br>Relationships:\"\n body += \"<br>Datacenter: #{vm.v_owning_datacenter}\"\n body += \"<br>Cluster: #{vm.ems_cluster_name}\"\n body += \"<br>Host: #{vm.host_name}\"\n body += \"<br>Datastore Path: #{vm.v_datastore_path}\"\n body += \"<br>Resource Pool: #{vm.v_owning_resource_pool}\"\n body += \"<br><br>\"\n\n body += \"<br>VM Tags:\"\n body += \"<br>#{vm.tags.inspect}\"\n body += \"<br><br>\"\n\n body += \"<br>Regards,\"\n body += \"<br>#{signature}\"\n options[:body] = body\n\n # Return options Hash with subject, body, alert\n options\nend", "def print_vuln_overview\n\t\tFile.open(@options[:output] + \"/vuln_overview.html\", 'w') do |f|\n\t\t\thtml_header(f,\"Vulns Overview\")\n\n\t\t\tclose_html_header(f)\n\n\t\t\tbody = '<a href=\"index.html\">Home</a><br /><div id=\"vulns\" style=\"font-family: Arial, Helvetica, sans-serif\"><h2>Vulnerabilities</h2>'\n\n\t\t\tbody += '<table id=\"vulns_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Severity</th><th>Name</th><th>Family</th><th>Ports</th><th>Number of impacted hosts</th></tr></thead><tbody>'\n\t\t\t@events.each do |k,v|\n\t\t\t\tnext if v[:severity].to_i < @options[:severity].to_i\n\t\t\t\tbody += '<tr><td><a href=\"vuln_' + k.to_s + '.html\">' + k.to_s\n\t\t\t\tbody += '</a></td><td>' + v[:severity].to_s + '<td>' + v[:plugin_name] + '</td>'\n\t\t\t\tbody += '<td>' + v[:family].to_s + '</td><td>'\n\t\t\t\timpacted_hosts = []\n\t\t\t\tv[:ports].each_with_index do |(k2,v2),index|\n\t\t\t\t\tbody += k2.to_s\n\t\t\t\t\tbody += \", \" unless index == v[:ports].length - 1\n\t\t\t\t\tv2[:hosts].each do |h,w|\n\t\t\t\t\t\timpacted_hosts << h\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\timpacted_hosts.uniq!\n\t\t\t\tbody += '</td><td>' + impacted_hosts.count.to_s + '</td></tr>'\n\t\t\tend\n\t\t\tbody += '</tbody></table>'\n\n\t\t\tbody += '<script>$(document).ready(function() { $(\\'#vulns_table\\').dataTable({\"bPaginate\": false,\"aaSorting\": [[0,\"desc\"],[5,\"desc\"]]}); });</script>'\n\t\t\tbody_text(f,body)\n\n\t\t\tclose_all(f)\n\t\tend\n\tend", "def adhoc_report(site)\n start_time = Time.now\n\n report_name = \"reports/#{site.name}.csv\"\n puts \"Generating #{report_name}. Be patient. Get some coffee.\"\n\n query = %q{WITH\nvuln_urls AS (\n SELECT vulnerability_id, array_to_string(array_agg(reference), ' , ') AS references\n FROM dim_vulnerability_reference \n GROUP BY vulnerability_id\n)\n\n\nselect da.ip_address, da.host_name, dos.description as operating_system, dv.title as vuln_title, round(dv.riskscore::numeric,0) as vuln_riskscore, \nCASE\nWHEN (dv.riskscore >= 800) then 'Very High'\nWHEN (dv.riskscore >= 600 AND dv.riskscore <= 799) then 'High'\nWHEN (dv.riskscore >= 400 AND dv.riskscore <= 599) then 'Medium'\nWHEN (dv.riskscore >= 200 AND dv.riskscore <= 399) then 'Low'\nWHEN (dv.riskscore <= 199) then 'Very Low'\nEND AS vuln_severity,\nproofastext(dv.description) as vuln_description, \nproofastext(favi.proof) as vuln_proof, vu.references, favi.port as \"port\", dv.date_added as vuln_date_into_nexpose, \nto_char(favi.date, 'YYYY-mm-dd') as asset_last_scan\n\nFROM fact_asset_vulnerability_instance favi\nJOIN dim_vulnerability dv USING (vulnerability_id)\nJOIN dim_asset da USING (asset_id)\nJOIN dim_operating_system dos USING (operating_system_id)\nJOIN dim_vulnerability_reference dvr USING (vulnerability_id)\nJOIN vuln_urls vu USING (vulnerability_id)\nWHERE dv.riskscore >= 600\nORDER BY dv.riskscore DESC}\n\n report_config = Nexpose::AdhocReportConfig.new(nil, 'sql', site.id)\n report_config.add_filter('version', '2.3.0')\n report_config.add_filter('query', query)\n report_output = report_config.generate(@nsc)\n\n end_time = Time.now\n\n File.open(report_name, \"w+\") do |file|\n file.write report_output\n end\n\n csv_output = CSV.parse(report_output.chomp, { :headers => :first_row })\n file_length = csv_output.entries.count\n\n #calculates duration for file creation\n ttg = ( (end_time - start_time) / 60).round(1)\n puts \"\\t. . . Complete after #{ttg} minutes and is #{file_length} lines long!\"\n report_name\nend", "def run\n super\n\n lookup_string = _get_entity_name.upcase\n\n begin\n search_doc = Nokogiri::XML(http_get_body(\"http://whois.arin.net/rest/orgs;name=#{URI.escape(lookup_string)}*\"));nil\n orgs = search_doc.xpath(\"//xmlns:orgRef\")\n\n # For each netblock, create an entity\n orgs.children.each do |org|\n _log_good \"Working on #{org.text}\"\n net_list_doc = Nokogiri::XML(http_get_body(\"#{org.text}/nets\"))\n\n begin\n nets = net_list_doc.xpath(\"//xmlns:netRef\")\n nets.children.each do |net_uri|\n _log_good \"[!] Net: #{net_uri}\" if net_uri\n\n #page = \"https://whois.arin.net/rest/net/NET-64-41-230-0-1.xml\"\n page = \"#{net_uri}.xml\"\n\n net_doc = Nokogiri::XML(http_get_body(page));nil\n net_blocks = net_doc.xpath(\"//xmlns:netBlocks\");nil\n\n net_blocks.children.each do |n|\n start_address = n.css(\"startAddress\").text\n end_address = n.css(\"endAddress\").text\n description = n.css(\"description\").text\n cidr_length = n.css(\"cidrLength\").text\n type = n.css(\"type\").text\n\n # Do a lookup - important that we get this so we can verify\n # if the block actually belongs to the expected party (via whois_full_text)\n # see discovery strategy for more info\n begin\n whois = ::Whois::Client.new(:timeout => 20)\n answer = whois.lookup(start_address)\n parser = answer.parser\n whois_full_text = answer.content if answer\n rescue ::Whois::ResponseIsThrottled => e\n _log \"Unable to query whois: #{e}\"\n end\n #===================================\n\n _log_good \"Creating net block: #{start_address}/#{cidr_length}\"\n entity = _create_entity \"NetBlock\", {\n \"name\" => \"#{start_address}/#{cidr_length}\",\n \"start_address\" => \"#{start_address}\",\n \"end_address\" => \"#{end_address}\",\n \"cidr\" => \"#{cidr_length}\",\n \"description\" => \"#{description}\",\n \"block_type\" => \"#{type}\",\n \"whois_full_text\" => \"#{whois_full_text}\"\n }\n\n end # end netblocks.children\n end # end nets.children\n\n rescue Nokogiri::XML::XPath::SyntaxError => e\n _log_error \" [x] No nets for #{org.text}\"\n end\n\n end # end orgs.children\n\n rescue Nokogiri::XML::XPath::SyntaxError => e\n _log_error \" [x] No orgs!\"\n end\n\n end", "def net\n\n i = 0\n while i < @datas.count\n i += 1\n new_net = Net.new \n new_net.subnet = DHCPParser::Conf.get_subnet(@datas[\"net#{i}\"])\n new_net.netmask = DHCPParser::Conf.get_netmask(@datas[\"net#{i}\"])\n\n list_option = DHCPParser::Conf.get_list_option(@datas[\"net#{i}\"], true)\n new_net.option = list_option[0]\n new_net.differ = list_option[1]\n\n pool = DHCPParser::Conf.get_pool(@datas[\"net#{i}\"])\n new_net.pool[\"range\"] = pool[\"range\"]\n new_net.pool[\"allow\"] = pool[\"allow\"]\n new_net.pool[\"denny\"] = pool[\"denny\"]\n # set host\n index = 0 \n while index < pool[\"hosts\"].count\n index += 1\n host_name = pool[\"hosts\"][\"host#{index}\"][\"host\"]\n ethernet = pool[\"hosts\"][\"host#{index}\"][\"hardware_ethernet\"]\n address = pool[\"hosts\"][\"host#{index}\"][\"fixed-address\"] \n host = Host.new(host_name, ethernet, address)\n new_net.pool[\"hosts\"] << host\n end\n @array_net << new_net\n end\n return @array_net\n end", "def one_nics_get\n one_item.info if one_item.instance_of?(OpenNebula::VirtualMachine)\n one_item.retrieve_xmlelements('TEMPLATE/NIC')\n end", "def build_network_object\n OOLog.info(\"network_address: #{@address}\")\n address_space = Azure::ARM::Network::Models::AddressSpace.new\n address_space.address_prefixes = [@address]\n\n ns_list = Array.new\n for i in 0..@dns_list.length-1\n OOLog.info('dns address[' + i.to_s + ']: ' + @dns_list[i].strip)\n ns_list.push(@dns_list[i].strip)\n end\n dhcp_options = Azure::ARM::Network::Models::DhcpOptions.new\n if ns_list != nil\n dhcp_options.dns_servers = ns_list\n end\n\n subnet = AzureNetwork::Subnet.new(@creds, @subscription)\n subnet.sub_address = @sub_address\n subnet.name = @name\n sub_nets = subnet.build_subnet_object\n\n virtual_network_properties =\n Azure::ARM::Network::Models::VirtualNetworkPropertiesFormat.new\n virtual_network_properties.address_space = address_space\n virtual_network_properties.dhcp_options = dhcp_options\n virtual_network_properties.subnets = sub_nets\n\n virtual_network = Azure::ARM::Network::Models::VirtualNetwork.new\n virtual_network.location = @location\n virtual_network.properties = virtual_network_properties\n\n virtual_network\n end", "def reports\n \n @paramsforheader = params[:region_report]\n if params[:region_report][:sort] == \"cvalue\"\n @regional = Report.regional_report_by_value(params[:region_report])\n @bench = Report.bench_mark_report_by_value(params[:region_report])\n @report_hash = Report.calculate_merge_active_records(@regional, @bench, params[:region_report][:product])\n else\n @regional = Report.regional_report_by_volume(params[:region_report])\n @bench = Report.bench_mark_report_by_volume(params[:region_report])\n @report_hash = Report.calculate_merge_active_records(@regional, @bench, params[:region_report][:product])\n end\n \n end", "def output\n output = {}\n output['routers'] = {}\n output['switches'] = {}\n @routers.each do |router|\n output['routers'][router.name] = router.output\n end\n @switches.each do |switch|\n output['switches'][switch.name] = switch.output\n end\n output_links(output)\n output\n end", "def create\n if resource[:ipsource] == \"static\"\n ip = resource[:ip]\n netmask = resource[:netmask]\n gateway = resource[:gateway]\n end\n if resource[:snmp]\n snmp = resource[:snmp]\n end\n ipsrc = resource[:ipsource]\n if resource[:vlanid]\n vlanid = resource[:vlanid]\n end\n enable_channel\n\n end", "def define_network_interface(nic_ip_config)\n network_interface_props =\n Azure::ARM::Network::Models::NetworkInterfacePropertiesFormat.new\n network_interface_props.ip_configurations = [nic_ip_config]\n\n network_interface = Azure::ARM::Network::Models::NetworkInterface.new\n network_interface.location = @location\n network_interface.name = Utils.get_component_name(\"nic\",@ci_id)\n network_interface.properties = network_interface_props\n\n OOLog.info(\"Network Interface name is: #{network_interface.name}\")\n network_interface\n end", "def print_vulns\n\t\t@events.each do |id,values|\n\t\t\tnext if values[:severity].to_i < @options[:severity].to_i\n\t\t\tFile.open(@options[:output] + \"/vuln_\" + id.to_s + \".html\", 'w') do |f|\n\t\t\t\thtml_header(f,id.to_s)\n\n\t\t\t\tclose_html_header(f)\n\n\t\t\t\tbody = '<a href=\"index.html\">Home</a><br /><div id=\"vuln\" style=\"font-family: Arial, Helvetica, sans-serif\"><div id=\"overview\">Nessus ID: ' + id.to_s + '<br />Name: ' + values[:plugin_name] + '<br />Severity: ' + values[:severity].to_s + '<br />Family: ' + values[:family] + '<br />Ports: '\n\t\t\t\timpacted_hosts = []\n\t\t\t\tvalues[:ports].each_with_index {|(k,v),index|\n\t\t\t\t\tbody += k.to_s\n\t\t\t\t\tv[:hosts].each do |h,w|\n\t\t\t\t\t\timpacted_hosts << h\n\t\t\t\t\tend\n\t\t\t\t\tbody += \", \" unless index == values[:ports].length - 1\n\t\t\t\t}\n\t\t\t \tbody += '<br /><br />Synopsis:<br />' + values[:synopsis] + '<br /><br />Description:<br />' + values[:description] + '<br /><br />Solution:<br />' + values[:solution] + '<br /><br />See Also:<br />'\n\t\t\t\tvalues[:see_also].each do |val|\n\t\t\t\t\tval.split(\"\\n\").each do |val2|\n\t\t\t\t\t\tbody += '<a href=\"' + val2 + '\">' + val2 + '</a><br />'\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tbody +='<br /><br />CVE: ' + values[:cve].to_s + '<br />CVSS Base Score: ' + values[:cvss_base_score].to_s + '<br />CVSS Vector: ' + values[:cvss_vector].to_s + '</div>'\n\t\t\t\tbody += '</div>'\n\n\t\t\t\tbody += '<div id=\"hosts\" style=\"font-family: Arial, Helvetica, sans-serif\"><h2>Hosts</h2>'\n\n\t\t\t\tbody += '<table id=\"hosts_table\" class=\"display\"><thead><tr><th>Host IP</th><th>Hostname</th><th>OS</th><th>Port</th><th>Result</th></tr></thead><tbody>'\n\n\t\t\t\timpacted_hosts.uniq.each do |host|\n\n\t\t\t\t\tvalues[:ports].each{|k,v|\n\t\t\t\t\t\tv[:hosts].each do |h,w|\n\t\t\t\t\t\t\tif h == host\n\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"host_' + host.to_s + '.html\">' + @hosts[host][:ip] + '</a></td><td>' + @hosts[host][:hostname] + '</td><td>' + @hosts[host][:os] + '</td>'\n\t\t\t\t\t\t\t\tbody += '<td>' + k.to_s + '</td><td>' + w.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\\n\") + \"</td></tr>\\n\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\tend\n\n\t\t\t\tbody += '</tbody></table>'\n\n\t\t\t\tbody += '<script>$(document).ready(function() { $(\\'#hosts_table\\').dataTable({\"bPaginate\": false,\"aaSorting\": [[0,\"asc\"]]}); });</script>'\n\n\t\t\t\tbody_text(f,body)\n\n\t\t\t\tclose_all(f)\n\t\t\tend\n\t\tend\n\tend", "def virtual_guest_template\n template = {\n \"startCpus\" => @cores.to_i,\n \"maxMemory\" => @memory.to_i * 1024, # we let the user specify memory in GB, but the API expects maxMemory in MB.\n \"hostname\" => @hostname,\n \"domain\" => @domain,\n\n # Note : for the values below, we want to use the constants \"true\" and \"false\" not nil\n # the nil value (while false to Ruby) will not translate to XML properly\n \"localDiskFlag\" => !!@use_local_disk,\n \"hourlyBillingFlag\" => !!@hourly\n }\n\n template['dedicatedAccountHostOnlyFlag'] = true if @dedicated_host_only\n template['privateNetworkOnlyFlag'] = true if @private_network_only\n\n template['datacenter'] = {\"name\" => @datacenter.name} if @datacenter\n template['userData'] = [{'value' => @user_metadata}] if @user_metadata\n template['networkComponents'] = [{'maxSpeed'=> @max_port_speed}] if @max_port_speed\n template['postInstallScriptUri'] = @provision_script_URI.to_s if @provision_script_URI\n template['postInstallScriptUri'] = @provision_script_uri.to_s if @provision_script_uri\n template['primaryNetworkComponent'] = { \"networkVlan\" => { \"id\" => @public_vlan_id.to_i } } if @public_vlan_id\n template['primaryBackendNetworkComponent'] = { \"networkVlan\" => {\"id\" => @private_vlan_id.to_i } } if @private_vlan_id\n template['sshKeys'] = @ssh_key_ids.collect { |ssh_key_id| {'id'=> ssh_key_id.to_i } } if @ssh_key_ids\n template['supplementalCreateObjectOptions'] = @supplementalCreateObjectOptions if @supplementalCreateObjectOptions\n\n if @image_template\n template['blockDeviceTemplateGroup'] = {\"globalIdentifier\" => @image_template.global_id}\n elsif @os_reference_code\n template['operatingSystemReferenceCode'] = @os_reference_code\n end\n\n if @disks && !@disks.empty?\n template['blockDevices'] = []\n\n # According to the documentation for +createObject+,\n # device number 1 is reserved for the SWAP disk of the computing instance.\n # So we assign device 0 and then assign the rest starting at index 2.\n @disks.each_with_index do |disk, index|\n device_id = (index >= 1) ? index + 1 : index\n template['blockDevices'].push({\"device\" => \"#{device_id}\", \"diskImage\" => {\"capacity\" => disk}})\n end\n end\n\n template\n end", "def report_for(nodes, locale_code)\n # This method simply provides a report for a given list of nodes in the desired locale.\n # The locale will be one of the supported ones.\n # Generate the report in a file to be uploaded on web10.\n File.write(\n '/tmp/web_report.txt',\n @platforms_handler.known_platforms.map do |platform|\n \"= Inventory for platform #{platform.repository_path} of type #{platform.platform_type}:\\n\" +\n platform.known_nodes.map do |node|\n \"* Node #{node} (IP: #{@nodes_handler.get_host_ip_of(node)}, Hostname: #{@nodes_handler.get_hostname_of(node)}).\"\n end.join(\"\\n\")\n end.join(\"\\n\")\n )\n # Upload the file on our web10 instance\n system 'scp -o StrictHostKeyChecking=no /tmp/web_report.txt root@web10.hpc_tutorial.org:/root/hello_world.txt'\n out 'Upload successful'\n end", "def report_definition\n\t\treport_def = {\n\t\t\tname: {difficulty: 40, approximator: \"none\", field_name:\"name\", max_datum:nil},\n\t\t\tdescription: {difficulty: 40, approximator:\"none\", field_name:\"description\", max_datum:nil},\n\t\t\tis_church: {difficulty: 40, approximiator:\"none\", field_name:\"is_church\", max_datum:nil},\n\t\t\tis_kingdom: {difficulty: 40, approximiator:\"none\", field_name:\"is_kingdom\", max_datum:nil},\n\t\t\tleader: {difficulty: 60, approximator:\"none\", field_name:\"leader_name\", max_datum:nil},\n\t\t\tsuzerain: {difficulty: 60, approximator:\"none\", field_name:\"suzerain_name\", max_datum:nil}\n\t\t}\t\t\t\n\tend", "def collectives_report\n collectives = get_collectives\n\n puts \" %-30s %s\" % [ \"Collective\", \"Nodes\" ]\n puts \" %-30s %s\" % [ \"==========\", \"=====\" ]\n\n collectives[:collectives].sort_by {|key,count| count.size}.each do |collective|\n puts \" %-30s %d\" % [ collective[0], collective[1].size ]\n end\n\n puts\n puts \" %30s %d\" % [ \"Total nodes:\", collectives[:nodes] ]\n puts\n end", "def index\n @security_groups_data = []\n aws = Fog::Compute.new :provider => 'AWS', :aws_access_key_id => \"AKIAIIKBNVJEP4F2KT6Q\", :aws_secret_access_key => \"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\"\n regions = aws.describe_regions.body[\"regionInfo\"].map {|region| region[\"regionName\"]}\n regions.each do |region|\n compute = Fog::Compute.new :provider => 'AWS', :region => 'us-west-2', :aws_access_key_id => \"AKIAIIKBNVJEP4F2KT6Q\", :aws_secret_access_key => \"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\"\n security_groups = SecurityGroup.fetch_all_sgs(compute)\n @security_groups_data << SecurityGroup.fetch_all_inbound_rule(security_groups, region)\n end\n #puts \"@security_groups_data #{@security_groups_data}\"\n end", "def print_layout\n [print_layout_header,\n print_layout_ads_date_of_sale, print_layout_ads_main_address,\n print_layout_non_ads_claiming_amount, print_layout_ads_claiming_amount,\n { code: :taxpayers,\n type: :object },\n print_layout_bank_details,\n print_layout_authenticated_declarations,\n print_layout_unauthenticated_declarations]\n end", "def format_service_template_pool\n config_file = self.class.table_conf\n\n CLIHelper::ShowTable.new(config_file, self) do\n column :ID, 'ID', :size => 10 do |d|\n d['ID']\n end\n\n column :USER, 'Username', :left, :size => 15 do |d|\n d['UNAME']\n end\n\n column :GROUP, 'Group', :left, :size => 15 do |d|\n d['GNAME']\n end\n\n column :NAME, 'Name', :left, :expand => true do |d|\n d['NAME']\n end\n\n column :REGTIME,\n 'Registration time of the Service Template',\n :size => 15 do |d|\n d.extend(CLIHelper::HashWithSearch)\n d = d.dsearch('TEMPLATE/BODY')\n\n OpenNebulaHelper.time_to_str(d['registration_time'])\n end\n\n default :ID, :USER, :GROUP, :NAME, :REGTIME\n end\n end", "def create_vm_nic_config(network_spec)\n @logger.debug(\"Network spec: #{network_spec}\")\n vm_nic_config = []\n # Get available networks\n networks = JSON.parse(@client.get('v2.0', 'networks'))['entities']\n # Iterate through network spec in the config and create network\n # config. spec. for the virtual machine\n network_spec.each do |name, net|\n network ||= {}\n cloud_error(\"[#{name}] Must provide cloud properties.\") if\n net['cloud_properties'].nil?\n # Fetch subnet name from config\n subnet = net['cloud_properties']['subnet']\n cloud_error(\"[#{name}] Must provide subnet name.\") if subnet.nil?\n # Fetch network's uuid from subnet name\n network = networks.find { |n| n['name'] == subnet }\n cloud_error(\"[#{name}] Subnet #{subnet} not found\") if network.nil?\n network_uuid = network['uuid']\n # When static IP is configured\n if net['type'] == 'manual'\n ip = net['ip']\n cloud_error(\"[#{name}:manual] Must provide IP Address.\") if ip.nil?\n network[:request_ip] = true\n network[:requested_ip_address] = ip\n end\n network[:network_uuid] = network_uuid\n # Add this network spec to the list\n vm_nic_config << network\n end\n vm_nic_config\n rescue => e\n raise e\n end", "def getClusterWiseCapacity(envir, zone)\n data = Array.new\n zonedet={\n 'GN7_Prod1'=>'b7fa0802-79ff-4481-b68c-d3541315fee1',\n 'GN7_Dev1' => '7c1b8a2e-9107-4a0c-ba88-c483074d074b',\n 'CN7_Prod1'=>'db8149d8-ebd9-4aa5-97b0-587739e27aa2',\n 'CN7_Dev1' => '9e523e68-35c3-4ec8-be83-0415c25a7bba'\n }\n \n info1 = {'0' => 'Memory', '1' => 'CPU', '2' => 'Storage', '3' => 'Shared Disk', '9' => 'Local Disk'}\n\n cinfo=\"######## Compliant Cluster Usage Information ########\\n\"\n cinfo=cinfo + \"Cluster Name ---- CPU ---- Memory ---- Shared Disk ---- Local Disk \\n\"\n ccpuinfo=\"######## Compliant CPU ########\\n\"\n cmeminfo=\"######## Compliant Memory ########\\n\"\n csharedinfo=\"######## Compliant Shared Disk ########\\n\"\n clocalinfo=\"######## Compliant Local Disk ########\\n\"\n\n ginfo=\"######## General Cluster Usage Information ########\\n\"\n ginfo=ginfo + \"Cluster Name ---- CPU ---- Memory ---- Shared Disk ---- Local Disk \\n\"\n gcpuinfo=\"######## General CPU ########\\n\"\n gmeminfo=\"######## General Memory ########\\n\"\n gsharedinfo=\"######## General Shared Disk ########\\n\"\n glocalinfo=\"######## General Local Disk ########\\n\"\n\n \n if envir == 'prod' or envir == 'dev'\n if envir == 'prod'\n compzoneid=zonedet['CN7_Prod1']\n genzoneid=zonedet['GN7_Prod1']\n elsif envir == 'dev'\n compzoneid=zonedet['CN7_Dev1']\n genzoneid=zonedet['GN7_Dev1']\n end\n\n cmd=\"cloudstack -p compliant listClusters zoneid=#{compzoneid} showcapacities=true\"\n stdin1, stdout1, stderr1, wait_thr1 = Open3.popen3(\"#{cmd}\")\n obj = JSON.parse(stdout1.read.chomp)\n\n cc=obj['listclustersresponse']['count']\n\n for i in 0...cc\n cmem,ccpu,cshd,cloc=0,0,0,0 \n cname=obj['listclustersresponse']['cluster'][i]['name']\n array = obj['listclustersresponse']['cluster'][i]['capacity']\n array.each {|hash|\n tt=hash['type']\n if tt == 0\n cmeminfo = cmeminfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n cmem = hash['percentused']\t\n elsif tt == 1\n ccpuinfo = ccpuinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n ccpu=hash['percentused'] \n elsif tt == 3\n csharedinfo = csharedinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tcshd=hash['percentused']\n elsif tt == 9\n clocalinfo = clocalinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tcloc=hash['percentused']\n end \n }\n cinfo = cinfo + \"#{cname} ---- #{ccpu} ---- #{cmem} ---- #{cshd} ---- #{cloc} \\n\"\n end\n\n cmd1=\"cloudstack -p general listClusters zoneid=#{genzoneid} showcapacities=true\"\n stdin1, stdout1, stderr1, wait_thr1 = Open3.popen3(\"#{cmd1}\")\n obj1 = JSON.parse(stdout1.read.chomp)\n\n cc1=obj1['listclustersresponse']['count']\n\n for i in 0...cc1\n\t \tgmem,gcpu,gshd,gloc=0,0,0,0 \n \tcname=obj1['listclustersresponse']['cluster'][i]['name']\n \tarray1 = obj1['listclustersresponse']['cluster'][i]['capacity']\n \tarray1.each {|hash|\n \t tt1=hash['type']\n if tt1 == 0\n \tgmeminfo = gmeminfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tgmem = hash['percentused']\n elsif tt1 == 1\n \tgcpuinfo = gcpuinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tgcpu = hash['percentused']\n elsif tt1 == 3\n \tgsharedinfo = gsharedinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tgshd = hash['percentused']\n elsif tt1 == 9\n \tglocalinfo = glocalinfo + \"#{cname} ----- #{hash['percentused']} \\n\"\n \tgloc = hash['percentused']\n end\n \t}\n ginfo = ginfo + \"#{cname} ---- #{gcpu} ---- #{gmem} ---- #{gshd} ---- #{gloc} \\n\"\n end\n\n data[0]=cmeminfo\n data[1]=ccpuinfo\n data[2]=csharedinfo\n data[3]=csharedinfo\n\n data[4]=gmeminfo\n data[5]=gcpuinfo\n data[6]=gsharedinfo\n data[7]=gsharedinfo\n\n data[8]=cinfo\n data[9]=ginfo\n\n return data\n else\n puts \"Please pass prod|dev to script\"\n end\n end", "def reports(wspace=workspace)\n\t\twspace.reports\n\tend", "def network_config\n @network_config ||= begin\n raw_config = network_params[\"network_configuration\"] || {\"interfaces\" => []}\n config = NetworkConfiguration.new(raw_config)\n config.add_nics!(device_config, :add_partitions => true) if dell_server?\n config\n end\n end", "def create_dpg\n #-----------------------------------------------------------------------\n # Get parameters needed to create the network\n #-----------------------------------------------------------------------\n vlan_id = self['VLAN_ID'] || \"0\"\n pg_name = self['BRIDGE']\n pnics = self['TEMPLATE/PHYDEV']\n sw_name = self['TEMPLATE/VCENTER_SWITCH_NAME']\n mtu = self['TEMPLATE/MTU']\n nports = self['TEMPLATE/VCENTER_SWITCH_NPORTS']\n\n nports = 128 if nports.empty?\n mtu = nil if mtu.empty?\n pnics = nil if pnics.empty?\n\n #-----------------------------------------------------------------------\n # Use first cluster/dc to check the distributed portgroup\n #-----------------------------------------------------------------------\n dc = @clusters[0][:dc]\n\n raise \"vCenter Dataceter not initialized\" unless dc\n\n net_folder = dc.network_folder\n net_folder.fetch!\n\n dpg = dc.dpg_exists(pg_name, net_folder)\n\n # Disallow changes of switch name for existing pg\n raise \"Port group #{pg_name} already exists\" if dpg\n\n # Get distributed virtual switch if it exists\n dvs = dc.dvs_exists(sw_name, net_folder)\n dvs = dc.create_dvs(sw_name, pnics, mtu) unless dvs\n\n raise \"Cannot create Distributed Virtual Switch\" unless dvs\n\n # Creates distributed port group\n # TODO raise?\n new_dpg = dc.create_dpg(dvs, pg_name, vlan_id, nports)\n\n #-----------------------------------------------------------------------\n # Attach dpg to esxi hosts for each cluster\n #-----------------------------------------------------------------------\n errors = []\n\n @clusters.each do |cluster|\n cli = cluster[:cli]\n\n cluster[:ccr]['host'].each do |host|\n begin\n esx = VCenterDriver::ESXHost.new_from_ref(host._ref, cli)\n\n avail_pnics = nil\n avail_pnics = esx.available_pnics if pnics\n\n esx.assign_proxy_switch(dvs, sw_name, pnics, avail_pnics)\n rescue StandardError => e\n msg = \"\\tHost #{host._ref}. Reason: \\\"#{e.message}\\\".\\n\"\n msg << \"#{e.backtrace}\\n\" if @debug\n\n errors << msg\n end\n end\n end\n\n #-----------------------------------------------------------------------\n # Rollback DPG creation in case of any error\n #-----------------------------------------------------------------------\n unless errors.empty?\n message = \"Error adding distributed port group to hosts:\\n\"\n message << errors.join\n\n dc.network_rollback\n\n raise message\n end\n\n \"VCENTER_NET_REF = \\\"#{new_dpg}\\\"\\n\"\\\n \"VCENTER_INSTANCE_ID = \\\"#{@clusters[0][:uuid]}\\\"\\n\"\n end", "def build_report\n first_page\n second_page\n third_page\n fourth_page\n fifth_page\n sixth_page\n seventh_page\n eighth_page\n ninth_page\n end", "def create_global_report \n @data = return_lines\n @data.each do |x,y|\n timestamp = y.string_between_markers(\"\",\"[[ACTIVE]\")\n user = y.string_between_markers(\"U:\",\"A:\")\n uri = y.string_between_markers(\"URI=[\",\"]\")\n method = y.string_between_markers(\"],\",\"time\")\n time = y.string_between_markers(\"time=\",\"ms\")\n # eliminates invalid entries\n if !timestamp.nil? && !user.nil? && !uri.nil? && !method.nil? && !time.nil?\n $all_user_data[$packet_count][:timestamp] = timestamp.strip unless timestamp.strip.empty? \n $all_user_data[$packet_count][:user] = user.strip unless user.strip.empty? \n $all_user_data[$packet_count][:uri] = uri.strip unless uri.strip.empty? \n $all_user_data[$packet_count][:method] = method.gsub(/,/,'').strip unless method.strip.empty? \n $all_user_data[$packet_count][:time] = time.strip unless time.strip.empty?\n # extracts hour data\n time_t = $all_user_data[$packet_count][:timestamp].split(\" \")\n time_t_2 = time_t[1].split(\":\")\n $all_user_data[$packet_count][:th_hour] = time_t_2[0].to_i + 1\n $packet_count += 1\n end \n end \n #pp $all_user_data \n end", "def get_networks(request)\n # --- Get User's VNETs ---\n network_pool = VirtualNetworkPoolOCCI.new(\n @client,\n POOL_FILTER)\n\n # --- Prepare XML Response ---\n rc = network_pool.info\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n return to_occi_xml(network_pool, :code=>200, :verbose=>request.params['verbose'])\n end", "def generateRegionData()\n firstDayOfFinYear = first_day_of_financial_year(DateTime.now)\n lastDayOfFinYear = last_day_of_financial_year(DateTime.now)\n sectorBudgets = Oj.load(RestClient.get api_simple_log(settings.oipa_api_url + \"budgets/aggregations/?format=json&reporting_organisation_identifier=#{settings.goverment_department_ids}&budget_period_start=#{firstDayOfFinYear}&budget_period_end=#{lastDayOfFinYear}&group_by=recipient_region,sector&aggregations=count,value&recipient_region=298,798,89,589,389,189,679,289,380,998&activity_status=2\"))\n sectorHierarchies = Oj.load(File.read('data/sectorHierarchies.json'))\n sectorBudgets = sectorBudgets[\"results\"]\n sectorBudgets = sectorBudgets.group_by{|key| key[\"recipient_region\"][\"code\"]}\n sectorBudgets.each do |regionData|\n sectorBudgets[regionData[0]].each do |regionLevelSectorData|\n tempDAC5Code = regionLevelSectorData['sector']['code']\n pullHighLevelSectorData = sectorHierarchies.select{|key| key[\"Code (L3)\"] == tempDAC5Code.to_i}.first\n regionLevelSectorData['sector']['code'] = pullHighLevelSectorData[\"High Level Code (L1)\"]\n regionLevelSectorData['sector']['name'] = pullHighLevelSectorData[\"High Level Sector Description\"]\n end\n end\n regionHash = {}\n sectorBudgets.each do |regionData|\n regionHash[regionData[0]] = {}\n sectorBudgets[regionData[0]].each do |countryLevelSectorData|\n if !regionHash[regionData[0]].key?(countryLevelSectorData['sector']['name'])\n regionHash[regionData[0]][countryLevelSectorData['sector']['name']] = {}\n regionHash[regionData[0]][countryLevelSectorData['sector']['name']]['code'] = countryLevelSectorData['sector']['code']\n regionHash[regionData[0]][countryLevelSectorData['sector']['name']]['name'] = countryLevelSectorData['sector']['name']\n regionHash[regionData[0]][countryLevelSectorData['sector']['name']]['budget'] = countryLevelSectorData['value'].to_i\n else\n regionHash[regionData[0]][countryLevelSectorData['sector']['name']]['budget'] = regionHash[regionData[0]][countryLevelSectorData['sector']['name']]['budget'].to_i + countryLevelSectorData['value'].to_i\n end\n end\n end\n regionHash.each do |key|\n regionHash[key[0]] = key[1].sort_by{ |x, y| -y[\"budget\"] }\n end\n regionHash\n end", "def post_network(request)\n # --- Create the new Instance ---\n network = VirtualNetworkOCCI.new(\n VirtualNetwork.build_xml,\n @client,\n request.body,\n @config[:template_location])\n\n # --- Generate the template and Allocate the new Instance ---\n template = network.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n # --- Prepare XML Response ---\n network.info\n return to_occi_xml(network, :code=>201)\n end", "def create_output(descriptions)\n# render view which will create actual mail report\n body = DcApplicationController.new.render_to_string(\n :template => 'models/dump_models',\n :locals => { descriptions: descriptions },\n :layout => 'models' \n ) \n File.open(Rails.root.join('public','models_dump.html'),'w') {|f| f.write(body)}\n#\n body = ''\n descriptions.each do |description|\n collection = description.first\n all_fields = description.last \n body << \"#\\n# == Schema information\\n#\\n\"\n body << \"# Collection name: #{collection['id']} : #{collection['description']}\\n#\\n\"\n \n all_fields.each do |field|\n body << \"# #{field['field'].ljust(20)} #{field['type'].to_s.ljust(20)} #{field['description']}\\n\"\n end\n body << \"\\n\\n\"\n end \n File.open(Rails.root.join('public','description_dump.html'),'w') {|f| f.write(body)}\nend", "def run_on_network_in_zone(zone_name, bridge_name, network_data)\n $log.debug(\"Creating specs for network #{bridge_name}\")\n\n template = SpecTemplatesNetwork.build_template__bridge_exists\n erb = ERB.new(template, nil, '%')\n @spec_code << erb.result(binding)\n\n vlan = network_data[:vlan]\n if vlan\n vlanid = vlan[:id]\n on_trunk = vlan[:on_trunk]\n template = SpecTemplatesNetwork.build_template__bridge_vlan_id_and_trunk\n erb = ERB.new(template, nil, '%')\n @spec_code << erb.result(binding)\n end\n\n # render template for hostip (if any)\n ip = network_data[:hostip]\n if ip\n template = SpecTemplatesNetwork.build_template__ip_is_up\n erb = ERB.new(template, nil, '%')\n @spec_code << erb.result(binding)\n end\n\n # render template for network/port attachments (if any)\n attach_intf = network_data[:attach]\n if attach_intf\n template = SpecTemplatesNetwork.build_template__port_exists\n erb = ERB.new(template, nil, '%')\n @spec_code << erb.result(binding)\n end\n\n # render dhcp spec (if any)\n dhcp_data = network_data[:dhcp]\n if dhcp_data\n ip_start = dhcp_data[:start]\n ip_end = dhcp_data[:end]\n hostip = ip\n template = SpecTemplatesNetwork.build_template__dhcp_is_valid\n erb = ERB.new(template, nil, '%')\n @spec_code << erb.result(binding)\n\n end\n\n $log.debug(\"Done for network #{bridge_name}\")\n end", "def interchange_control_header\n empty_str = ''\n isa_elements = []\n isa_elements << 'ISA'\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << '00'\n isa_elements << trim(empty_str,10)\n isa_elements << 'ZZ'\n isa_elements << trim(payer_id, 15)\n isa_elements << 'ZZ'\n if facility.name.upcase == \"SOLUTIONS 4 MDS\"\n static_value = \"4108\"\n isa_08 = trim(static_value,15)\n else\n if @facility_config.details[:payee_name] && !@facility_config.details[:payee_name].blank?\n isa_08 = trim(@facility_config.details[:payee_name].upcase,15)\n else\n isa_08 = trim(facility.name.upcase, 15)\n end\n end\n isa_elements << isa_08\n isa_elements << Time.now().strftime(\"%y%m%d\")\n isa_elements << Time.now().strftime(\"%H%M\")\n isa_elements << ((!@output_version || @output_version == '4010') ? 'U' : '^')\n isa_elements << ((!@output_version || @output_version == '4010') ? '00401' : '00501')\n isa_elements << (@isa_record.isa_number.to_s.rjust(9, '0') if @isa_record)\n isa_elements << '0'\n isa_elements << 'P'\n isa_elements << ':'\n isa_elements.join(@element_seperator)\n end", "def ip_address_distribution(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"IP Address Distribution\" page.\n begin\n @ff.link(:text, 'IP Address Distribution').click\n self.msg(rule_name, :info, 'IP Address Distribution', 'Reached page \\'IP Address Distribution\\'.')\n rescue\n self.msg(rule_name, :error, 'IP Address Distribution', 'Did not reach \\'IP Address Distribution\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') )then\n # Right,go on.\n else\n self.msg(rule_name,:error,'ip_address_distribution','Some key NOT found.')\n return\n end\n \n # Begin parsing the json file.\n \n # Output the table.\n \n # Find the table.\n sTable = false\n @ff.tables.each do |t|\n if ( t.text.include? 'Name' and \n t.text.include? 'Service' and\n ( not t.text.include? 'IP Address Distribution') and\n ( not t.text.include? 'Close') and\n t.row_count >= 2 )then\n sTable = t\n break\n end\n end\n \n if sTable == false\n # Wrong here\n self.msg(rule_name,:error,'ip_address_distribution','Did NOT find the target table.')\n return\n end\n \n iFlag = 0\n strEntry = \"\"\n \n # Find the row\n sTable.each do |row|\n \n iFlag = iFlag + 1\n \n # not for first line\n if iFlag == 1\n next\n end\n strEntry = \"IP\" + (iFlag - 1).to_s\n \n # Output in to the result.\n self.msg(rule_name,strEntry,'Name',row[1])\n self.msg(rule_name,strEntry,'Service',row[2])\n self.msg(rule_name,strEntry,'Subnet Mask',row[3])\n self.msg(rule_name,strEntry,'Dynamic IP Range',row[4])\n \n end \n\n if info.has_key?('Name')\n case info['Name']\n when 'Network (Home/Office)'\n DoNetworkHomeOfficePage(rule_name, info)\n when 'Broadband Connection (Ethernet)'\n DoBroadbandConnectionEthernetPage(rule_name, info)\n when 'Broadband Connection (Coax)'\n DoBroadbandConnectionCoaxPage(rule_name, info)\n when 'Connection List'\n DoConnectionList(rule_name, info)\n when 'Access Control'\n DoAccessControl(rule_name, info)\n else\n self.msg(rule_name, :error, '', 'No Name undefined')\n end \n else\n self.msg(rule_name, :error, '', 'No layout key found')\n end\n \n # Close the window\n if @ff.text.include?'Close'\n @ff.link(:text,'Close').click\n end\n \n # Output the result\n self.msg(rule_name,:Result_Info,'ip_address_distribution','SUCCESS') \n \n end", "def create_new_report!; end" ]
[ "0.70572907", "0.6266153", "0.5928026", "0.58000946", "0.57995605", "0.55592734", "0.55405647", "0.5443282", "0.5390088", "0.53755814", "0.5340762", "0.53404087", "0.5275468", "0.5241324", "0.52379274", "0.5229627", "0.52271503", "0.52072716", "0.52032423", "0.51805854", "0.5172288", "0.51525754", "0.5151602", "0.5147859", "0.5139927", "0.5117658", "0.511603", "0.51089686", "0.50959355", "0.50956076", "0.509338", "0.5092127", "0.5083517", "0.5081625", "0.507026", "0.5069572", "0.50592643", "0.5057814", "0.50283617", "0.5009753", "0.5009107", "0.49998572", "0.49933222", "0.4968234", "0.49448645", "0.49431604", "0.49424022", "0.49389696", "0.493663", "0.492858", "0.49162933", "0.4880858", "0.48801422", "0.48761213", "0.4869703", "0.48696986", "0.4864359", "0.4862958", "0.48553628", "0.48547497", "0.48509547", "0.48499507", "0.48453796", "0.48449522", "0.48447558", "0.4842995", "0.48358622", "0.48338494", "0.48235962", "0.48220623", "0.48189002", "0.480707", "0.48049575", "0.48001", "0.47993916", "0.47931895", "0.47927126", "0.47882658", "0.47795784", "0.47778273", "0.4771509", "0.47710705", "0.4768689", "0.47679725", "0.47638872", "0.4763335", "0.47575197", "0.47526082", "0.47465727", "0.4742801", "0.47406635", "0.47385988", "0.47359556", "0.4734467", "0.4731637", "0.47295943", "0.4720852", "0.47151485", "0.47136205", "0.4712966" ]
0.7079021
0
Sets up the HTML report for AdHoc Networks
def html_report_adhoc @log.debug("Starting to report ad-hoc networks, there were " + @adhoc_networks.length.to_s + "to report") @report << '<div id="title">Adhoc Networks</div><br /><br />' @adhoc_networks.each do |ssid,bssid| tab = Ruport::Data::Table(%w[bssid channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm]) ssid = "Hidden or Blank" if ssid.length < 1 @report << '<div id="title">SSID: ' + ssid + ' </div>' bssid.each do |net,info| if @options.gps_data[net] point = net @log.debug("attempting to add link") link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')' url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info net = '<a href="' + url + '">' + point + '</a>' end tab << [net, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']] end @report << tab.to_html @report << "<br /> <br />" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_report_inf\n @report << '<div id=\"title\">Infrastructure Networks</div><br /><br />'\n @log.debug(\"Starting reporting Infrastructure networks there were \" + @infrastructure_networks.length.to_s + \" networks to list\")\n @infrastructure_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid num_clients channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['clients'].length.to_s, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def html_report_probe\n @log.debug(\"Starting to report probe networks, there were \" + @probe_networks.length.to_s + \" to report\")\n @report << '<div id=\"title\">Probe Networks</div><br /><br />'\n @probe_tab = Ruport::Data::Table(%w[bssid manufacturer])\n @probe_networks.each do |probe,info|\n if @options.gps_data[probe]\n point = probe\n @log.debug(\"attempting to add link\")\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s\n probe = '<a href=\"' + url + '\">' + point + '</a>'\n end\n @probe_tab << [probe, info['manufacturer']]\n end\n\t @report << @probe_tab.to_html\n\t @report << \"<br /><br />\"\n end", "def html_report\n begin\n require 'ruport'\n rescue LoadError\n abort(\"Couldn't load ruport, suggest that gem install ruport should help\")\n end\n\n unless @options.report_file\n html_report_file_name = 'Kismet-Wireless-Report-' + Time.now.to_s + '.html'\n end\n\n unless @options.report_file =~ /html$/\n html_report_file_name = @options.report_file + '.html'\n end\n\n @report = File.new(html_report_file_name,'w+')\n html_report_header\n html_report_stats\n \n if @options.create_map\n @report << '<hr /><br /><br />'\n html_report_map_body\n end\n @report << '<hr /><br /><br />'\n html_report_inf\n @report << '<hr /><br /><br />'\n html_report_adhoc\n @report << '<hr /><br /><br />'\n html_report_probe\n @report << \"</body>\"\n @report << \"</html>\"\n end", "def html_report_header\n @report << '\n <html>\n <head>\n <title> Kismet Wireless Report</title>\n <style>\n body {\n\t font: normal 11px auto \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n\t color: #4f6b72;\n\t background: #E6EAE9;\n }\n #report-header {\n font-weight: bold;\n font-size: 24px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n\n }\n\n #sub-header {\n font-weight: italic;\n font-size: 10px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n\n }\n\n #title {\n font-weight: bold;\n font-size: 16px;\n font-family: \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n color: #4f6b72;\n }\n\n th {\n\t font: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n\t color: #4f6b72;\n\t border-right: 1px solid #C1DAD7;\n\t border-bottom: 1px solid #C1DAD7;\n\t border-top: 1px solid #C1DAD7;\n\t letter-spacing: 2px;\n\t text-transform: uppercase;\n\t text-align: left;\n\t padding: 6px 6px 6px 12px;\n }\n\n td {\n\t border-right: 1px solid #C1DAD7;\n\t border-bottom: 1px solid #C1DAD7;\n\t background: #fff;\n\t padding: 6px 6px 6px 12px;\n\t color: #4f6b72;\n }\n\n\n td.alt {\n\t background: #F5FAFA;\n\t color: #797268;\n }\n\n\n\n </style>\n '\n if @options.create_map\n @report << %Q!\n <script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=false\"></script>\n <script type=\"text/javascript\">\n function initialize() {\n var latlng = new google.maps.LatLng(#{@map_centre['lat']}, #{@map_centre['long']});\n var myOptions = {\n zoom: 14,\n center: latlng,\n mapTypeId: google.maps.MapTypeId.ROADMAP\n };\n var map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);\n !\n\n #Yugh this is a hack\n @options.gps_data.each do |bssid,point|\n netname = bssid.gsub(':','')\n\n if @nets_by_bssid[bssid]\n #Next line is present to strip any single quotes from SSID's before putting them into the marker as that causes problems :)\n content_ssid = @nets_by_bssid[bssid]['ssid'].gsub(/['<>]/,'')\n @log.debug(\"About to add \" + content_ssid) if content_ssid\n @report << %Q!\n var contentString#{netname} = '<b>SSID: </b> #{content_ssid} <br />' +\n '<b>BSSID: </b> #{bssid}<br />' +\n '<b>Channel: </b> #{@nets_by_bssid[bssid]['channel']} <br />' +\n '<b>Ciphers: </b> #{@nets_by_bssid[bssid]['cipher']} <br />' +\n '<b>Cloaked?: </b> #{@nets_by_bssid[bssid]['cloaked']} <br />';\n var infowindow#{netname} = new google.maps.InfoWindow({\n content: contentString#{netname}\n });\n !\n end\n @report << %Q!\n var latlng#{netname} = new google.maps.LatLng(#{point['lat']}, #{point['lon']});\n\n var marker#{netname} = new google.maps.Marker({\n position: latlng#{netname},\n map: map\n });\n !\n if @nets_by_bssid[bssid]\n @report << %Q!\n google.maps.event.addListener(marker#{netname}, 'click', function() {\n infowindow#{netname}.open(map,marker#{netname});\n });\n !\n end\n end\n\n @report << %Q!\n }\n </script>\n\n !\n end\n @report << '</head>'\n if @options.create_map\n @report << '<body onload=\"initialize()\">'\n else\n @report << '<body>'\n end\n @report << '<div id=\"report-header\">Kismet Wireless Report</div> <br /> <div id=\"sub-header\"> Report Generated at ' + Time.now.to_s + '<br />'\n @report << 'Files analysed ' + @options.file_names.join(',<br />') + '<br /> <br /></div>'\n end", "def html_report(test_report, extra_report_header)\n\n html_report = <<-EOS\n <html>\n EOS\n\n html_style = <<-EOS\n <style>\n body {background-color: #FFFFF0; font-family: \"VAG Round\" ; color : #000080;font-weight:normal;word-break: break-all;}\n #specs-table{font-family:Arial,Helvetica,Sans-serif;font-size:12px;text-align:left;border-collapse:collapse;border-top: 2px solid #6678B1;border-bottom: 2px solid #6678B1;margin:20px;}\n #specs-table th{font-size:13px;font-weight:normal;background:#b9c9fe;border-top:4px solid #aabcfe;border-bottom:1px solid #fff;color:#039;padding:8px;}\n #specs-table td{background:#e8edff;border-top:1px solid #fff;border-bottom:1px solid #fff;color:#039;padding:8px;}\n #specifications{font-family:Arial,Helvetica,Sans-serif;font-size:13px;width:480px;background:#fff;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #specifications th{font-size:14px;font-weight:bold;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}\n #specifications td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #statuspass{font-family:Arial,Helvetica,Sans-serif;font-size:12px;color:green;font-weight:bold;}\n #statusfail{font-family:Arial,Helvetica,Sans-serif;font-size:12px;color:red;font-weight:bold;}\n #tcs{font-family:Arial,Helvetica,Sans-serif;font-size:13px;background:#fff;width:900px;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #tcs th{font-size:14px;font-weight:bold;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}\n #tcs td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #checkpoint{font-family:Arial,Helvetica,Sans-serif;font-size:13px;background:#fff;width:900px;border-collapse:collapse;text-align:left;margin:20px;border:1px solid #ccc;}\n #checkpoint td{border-bottom:1px solid #ccc;color:#009;padding:6px 8px;}\n #container{margin: 0 30px;background: #fff;border:1px solid #ccc;}\n #header{background: #e8edff;padding: 2px;border-bottom: 2px solid #6678b1;}\n #steps{background: #e8edff;font-weight: bold;}\n #dp{font-weight: bold;}\n #validations{font-weight: bold;}\n #content{clear: left;padding: 10px;}\n #footer{background: #e8edff;text-align: right;padding: 10px;}\n </style>\n EOS\n\n title = <<-EOS\n <head><title>#{test_report[:test_suite_title]}</title></head>\n\n <body>\n EOS\n\n html_report += html_style + title\n\n report_header = <<-EOS\n <center>\n\n <a name=#{replace_space_by_dash(test_report[:test_suite_title])}></a>\n <table id=\"specifications\">\n <th align=\"center\">#{test_report[:test_suite_title]}</th>\n <tr><td>Test specification: #{test_report[:test_spec_path]}</td></tr>\n <tr><td>Kadu server: #{test_report[:kadu_server]}</td></tr>\n EOS\n @test_report[:test_cases].each do |tc_id, tc|\n if tc.has_key?(:server_info)\n report_header += <<-EOS\n <tr><td>Kadu branch: #{tc[:server_info][:kadu_branch]}</td></tr>\n <tr><td>Kadu version: #{tc[:server_info][:kadu_version]}</td></tr>\n <tr><td>Kadu index: #{tc[:server_info][:kadu_index]}</td></tr>\n EOS\n break\n end\n end\n if !extra_report_header.nil?\n details = extra_report_header.split(\"\\n\")\n details.each do |line|\n report_header += <<-EOS\n <tr><td>#{line}</td></tr>\n EOS\n end\n end\n test_suite_time_in_secs = Time.parse(test_report[:test_suite_completed_time].to_s) - Time.parse(test_report[:test_suite_start_time].to_s)\n\n report_header += <<-EOS\n <tr><td>Test suite started On: #{test_report[:test_suite_start_time]}</td></tr>\n <tr><td>Duration: #{test_suite_time_in_secs} secs</td></tr>\n <tr><td>Test suite status: <font id=#{status(test_report[:test_suite_result_status])}>#{test_report[:test_suite_result_status]}</font></td></tr>\n </table>\n <br>\n EOS\n report_tc_summary = <<-EOS\n <table id=\"tcs\">\n <tr>\n <th >Test Case</th>\n <th >Test Case Status</th>\n </tr>\n EOS\n\n test_report[:test_cases].each do |tc_id, tc|\n report_tc_summary += <<-EOS\n <tr>\n <td><a href=\"##{tc_id}\">#{tc_id}: #{tc[:title]}</a></td><td><font id=#{status(tc[:test_case_result_status])}>#{tc[:test_case_result_status]}</font></td>\n </tr>\n EOS\n end\n\n report_tc_summary += <<-EOS\n </table>\n <br>\n <h4>#{test_report[:test_suite_description]}</h4>\n <br>\n </center>\n EOS\n test_cases = \"\"\n test_report[:test_cases].each do |tc_id, tc|\n test_case = <<-EOS\n <div id=\"container\" style=\"word-break: break-all;width:100%;\">\n <div id=\"header\">\n <h4>\n <p><a name=\"#{tc_id}\">#{tc_id}: #{tc[:title]}</a></p>\n <p>#{tc[:description]}</p>\n <p>Test result status: <font id=#{status(tc[:test_case_result_status])}>#{tc[:test_case_result_status]}</font></p>\n </h4>\n </div>\n <div id=\"content\">\n <h4>\n Steps to reproduce\n </h4>\n EOS\n\n tc[:test_steps].each do |step_id, step|\n test_steps = <<-EOS\n <p id=\"steps\">#{step_id}</p>\n EOS\n\n if step.has_key?(:action) || step.has_key?(:mt_url)\n test_steps += <<-EOS\n <p style=\"word-break: break-all;\" width=900px >URL: #{step[:action]}</p>\n EOS\n end\n\n if step.has_key?(:dynamic_params)\n test_steps += <<-EOS\n <p id=\"dp\">Dynamic Parameters</p>\n EOS\n\n exclusion_term = \"set @kadu_response\"\n step[:dynamic_params].each do |parameter, expression|\n expression = exclusion_term if expression.to_s.include?(exclusion_term)\n test_steps += <<-EOS\n <p>#{parameter} = #{expression}</p>\n EOS\n end\n end\n\n if step.has_key?(:validation_steps)\n\n test_steps += <<-EOS\n <p id=\"validations\">\n Validations\n </p>\n <table id=\"checkpoint\">\n EOS\n\n step[:validation_steps].each do |vstep, result|\n steps = <<-EOS\n <tr>\n <td colspan=\"2\" width=\"90%\">\n <p>#{vstep}</p>\n <p>#{result[\"test_result_message\"]}</p>\n </td>\n <td width=\"10%\" rowspan=\"1\" align=\"center\"><font id=#{status(result[\"test_result_status\"])}>#{result[\"test_result_status\"]}</font></td>\n </tr>\n EOS\n test_steps += steps\n end\n\n test_steps += <<-EOS\n </table>\n EOS\n\n end\n test_case += test_steps\n end\n test_cases += test_case\n test_cases += <<-EOS\n </div>\n <div id=\"footer\">\n <a href=\"##{replace_space_by_dash(test_report[:test_suite_title])}\">back to test suite</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#summary\">back to summary</a>\n\t </div>\n </div>\n <br>\n EOS\n end\n\n report_footer = <<-EOS\n <br>\n <hr>\n <br>\n </body>\n </html>\n EOS\n\n html_report += report_header + report_tc_summary + test_cases + report_footer\n\n html_report\n end", "def html_report_stats\n @report << '<div id=\"title\"> General Statistics</div>'\n stat_tab = Ruport::Data::Table(%w[Stat Value])\n stat_tab << ['Number of servers Seen', @num_servers]\n stat_tab << ['Number of clients Seen', @num_clients]\n @num_by_cipher.each do |cipher, num|\n stat_tab << ['Encryption: ' + cipher, num]\n end\n @report << stat_tab.to_html\n @report << '<br /><br />'\n end", "def build_report\n puts \"building performance test comparison report...\"\n puts\n\n # load template\n report = File.read(@template_path)\n\n # metrics result\n result_comparison_table = extract_table_from_csv2html_output(@result_comparison_path)\n\n # atop summary\n atop_summary_comparison_table = extract_table_from_csv2html_output(@atop_summary_comparison_path)\n\n # atop detail\n # TODO: enable\n # atop_detail_comparison_table = extract_table(@atop_detail_comparison_path)\n\n # replace tables (do this first since table data may include parameters)\n report = report.gsub(\"$RESULT_COMPARISON_TABLE\", result_comparison_table)\n report = report.gsub(\"$ATOP_SUMMARY_COMPARISON_TABLE\", atop_summary_comparison_table)\n\n # TODO: enable\n # report = report.gsub(\"$ATOP_DETAIL_TABLE\", atop_detail_table)\n\n # replace parameters\n report = replace_parameters(report)\n\n # write report\n puts \"writing report to #{@output_path}\"\n\n File.write(@output_path, report)\nend", "def output_report\n report = \"\"\n report << '<html>'\n report << ' <head>'\n report << \" <title>#{@title}</title>\"\n report << ' </head>'\n report << ' <body>'\n @text.each { |line| report << \" <p>#{line}</p>\" }\n report << ' </body>'\n report << '</html>'\n end", "def run\n\t\tself.print_hosts # generate all the host_*.html files\n\t\tself.print_index # generate the index.html file\n\t\tself.print_vulns # generate all the vuln_*.html files\n\t\tself.print_vuln_overview # generate the vuln_overview.html file\n\tend", "def run\n print_line\n print_status 'Creating HTML report...'\n\n plugins = format_plugin_results( auditstore.plugins )\n @base_path = File.dirname( options['tpl'] ) + '/' +\n File.basename( options['tpl'], '.erb' ) + '/'\n\n title_url = auditstore.options['url']\n begin\n title_url = uri_parse( auditstore.options['url'] ).host\n rescue\n end\n\n params = prepare_data.merge(\n title_url: escapeHTML( title_url ),\n audit_store: auditstore,\n plugins: plugins,\n base_path: @base_path\n )\n\n File.open( outfile, 'w' ) { |f| f.write( erb( options['tpl'], params ) ) }\n\n print_status \"Saved in '#{outfile}'.\"\n end", "def report_network\n self.report('network_report')\n end", "def setup\n @agent = Mechanize.new\n uri = URI.join('file:///', File.absolute_path(\"test/data/view.html\"))\n @page = @agent.get uri.to_s\n @view = PortfolioView.new uri.to_s, @page, \"test mameber\", \"test portfolio\", \"View1\", \"testgroup\"\n\n @analyzer = PortfolioStatistics::DescriptiveViewAnalyzer.new\n end", "def adhoc_report(site)\n start_time = Time.now\n\n report_name = \"reports/#{site.name}.csv\"\n puts \"Generating #{report_name}. Be patient. Get some coffee.\"\n\n query = %q{WITH\nvuln_urls AS (\n SELECT vulnerability_id, array_to_string(array_agg(reference), ' , ') AS references\n FROM dim_vulnerability_reference \n GROUP BY vulnerability_id\n)\n\n\nselect da.ip_address, da.host_name, dos.description as operating_system, dv.title as vuln_title, round(dv.riskscore::numeric,0) as vuln_riskscore, \nCASE\nWHEN (dv.riskscore >= 800) then 'Very High'\nWHEN (dv.riskscore >= 600 AND dv.riskscore <= 799) then 'High'\nWHEN (dv.riskscore >= 400 AND dv.riskscore <= 599) then 'Medium'\nWHEN (dv.riskscore >= 200 AND dv.riskscore <= 399) then 'Low'\nWHEN (dv.riskscore <= 199) then 'Very Low'\nEND AS vuln_severity,\nproofastext(dv.description) as vuln_description, \nproofastext(favi.proof) as vuln_proof, vu.references, favi.port as \"port\", dv.date_added as vuln_date_into_nexpose, \nto_char(favi.date, 'YYYY-mm-dd') as asset_last_scan\n\nFROM fact_asset_vulnerability_instance favi\nJOIN dim_vulnerability dv USING (vulnerability_id)\nJOIN dim_asset da USING (asset_id)\nJOIN dim_operating_system dos USING (operating_system_id)\nJOIN dim_vulnerability_reference dvr USING (vulnerability_id)\nJOIN vuln_urls vu USING (vulnerability_id)\nWHERE dv.riskscore >= 600\nORDER BY dv.riskscore DESC}\n\n report_config = Nexpose::AdhocReportConfig.new(nil, 'sql', site.id)\n report_config.add_filter('version', '2.3.0')\n report_config.add_filter('query', query)\n report_output = report_config.generate(@nsc)\n\n end_time = Time.now\n\n File.open(report_name, \"w+\") do |file|\n file.write report_output\n end\n\n csv_output = CSV.parse(report_output.chomp, { :headers => :first_row })\n file_length = csv_output.entries.count\n\n #calculates duration for file creation\n ttg = ( (end_time - start_time) / 60).round(1)\n puts \"\\t. . . Complete after #{ttg} minutes and is #{file_length} lines long!\"\n report_name\nend", "def report\n super\n\n begin\n puts \"Writing HTML reports to #{@reports_path}\"\n erb_str = File.read(@erb_template)\n renderer = ERB.new(erb_str)\n\n tests_by_suites = tests.group_by { |test| test_class(test) } # taken from the JUnit reporter\n\n suites = tests_by_suites.map do |suite, tests|\n suite_summary = summarize_suite(suite, tests)\n suite_summary[:tests] = tests.sort { |a, b| compare_tests(a, b) }\n suite_summary\n end\n\n suites.sort! { |a, b| compare_suites(a, b) }\n\n result = renderer.result(binding)\n File.open(html_file, 'w') do |f|\n f.write(result)\n end\n\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n puts 'There was an error writing the HTML report'\n puts 'This may have been caused by cancelling the test run'\n puts 'Use mode => :verbose in the HTML reporters constructor to see more detail' if @mode == :terse\n puts 'Use mode => :terse in the HTML reporters constructor to see less detail' if @mode != :terse\n raise e if @mode != :terse\n end\n # rubocop:enable Lint/RescueException\n end", "def set_report\n end", "def execute\n super()\n\n # executes test case info\n\n # workaround pages that need to login to secondary domains\n auth_workarounds()\n\n # Change this to 0 to get retries in buyflow test\n timeout_count = 1 \n \n begin\n puts @report.url\n\n # Navigate to the site\n @page.browser.driver.browser.get @report.url if(@report.url)\n\n\n\n\n\n # ------------ Marketing section, Landing Page ------------ \n\n @report.browser = @page.browser_name\n\n\n # pull the operating System from the user agent or other sources\n @report.os = @page.os_name\n\n # pull the brand from the page variables or domain\n @report.buyflow_report.brand = @page.brand\n\n # pull the uci code from omniture\n @report.uci_report.uci_mp = @page.uci\n\n if(@configuration['Brand'] == 'Marajo' || @configuration['Brand'] == 'smileactives')\n puts \"products hiiiiiiiii\"\n @page = @page.go_to_productpage()\n puts \"done product button\"\n else\n puts \"going to order page\"\n @page = @page.go_to_orderpage()\n puts @page\n puts \"done fetching orderpage\"\n end\n\n # navigate to the SAS page if that page section isn't present.\n # @page = @page.go_to_orderpage()\n\n\n\n\n @report.buyflow_report.lastpagefound = \"sas\"\n\n # ------------ SAS Section ------------ \n\n @report.uci_report.uci_sas = @page.uci\n \n # If an offer is not present in test\n if(@offer == nil)\n # navigate to the cart using default options\n @page = @page.skip_to_cart\n else\n # ...otherwise select the options defined by the offer\n \n @page = @page.select_options(@offer)\n end\n\n # exclude_from_selection_workaround = BrandsExcludedSelectionWorkaround.all.select('brand').collect(&:brand)\n # if(@offer)\n # if(timeout_count == 1 && @offer['OfferCode'])\n # if(exclude_from_selection_workaround.include?(@configuration[\"Brand\"].downcase) == false)\n # selection_workaround(@page.browser)\n # end\n # end\n # end\n\n \n\n\nputs \"Proceed to cart section\"\n\n # ------------ Cart Section ------------ \n\n @report.uci_report.uci_op = @page.uci\n\n @report.buyflow_report.lastpagefound = \"cart\"\n\n @report.buyflow_report.offer_code = @page.offercode\n puts \"offercode\"\n puts @report.buyflow_report.offer_code\n\n @report.grcid = @page.grcid\n puts \"grcid\"\n puts @report.grcid\n\n # catch_and_display_error do\n\n @report.buyflow_report.total_pricing = @page.total_pricing\n puts \"total_pricing\"\n puts @report.buyflow_report.total_pricing\n\n @report.buyflow_report.subtotal_price = @page.subtotal_price\n puts \"subtotal_price\"\n puts @report.buyflow_report.subtotal_price\n\n # pull the pricing for the SAS for any sections still in the same page as the cart\n begin\n @report.buyflow_report.saspricing = @page.check_sas_pricing(@report.buyflow_report.subtotal_price)\n rescue => e\n @report.buyflow_report.saspricing = \"No Offer Associated with this Test\"\n end\n \n @report.buyflow_report.saspricing = '' if @report.buyflow_report.saspricing == nil\n puts \"saspricing\"\n puts @report.buyflow_report.saspricing\n @report.buyflow_report.sasprices = @page.check_sas_prices\n puts \"sasprices\"\n puts @report.buyflow_report.sasprices\n\n # pull the cart description from the order summary section\n @report.buyflow_report.cart_language = @page.cart_description\n puts \"cart description\"\n puts @report.buyflow_report.cart_language\n\n @report.buyflow_report.cart_title = @page.cart_title\n puts \"productname\"\n puts @report.buyflow_report.cart_title\n\n @report.buyflow_report.sas_kit_name = @page.check_sas_kit_name(@report.buyflow_report.cart_title)\n\n @report.buyflow_report.kitnames = @page.cart_title\n\n @report.buyflow_report.cart_quantity = @page.quantity\n puts \"quantity\"\n puts @report.buyflow_report.cart_quantity\n\n if(@report.buyflow_report.cart_quantity.nil?)\n @report.buyflow_report.cart_quantity = \"[Quantity Dropdown Missing] - Locator may be missing\"\n end\n\n @report.buyflow_report.shipping_standard = @page.shipping('Standard')\n puts \"shipping\"\n puts @report.buyflow_report.shipping_standard\n \n # Rush Shipping\n @report.buyflow_report.shipping_rush = @page.shipping('Rush') \n\n # Overnight Shipping\n @report.buyflow_report.shipping_overnight = @page.shipping('Overnight')\n\n @report.buyflow_report.shipping_standard = 'N/A' if @report.buyflow_report.shipping_standard.nil?\n \n @report.buyflow_report.shipping_rush = 'N/A' if @report.buyflow_report.shipping_rush.nil?\n\n @report.buyflow_report.shipping_overnight = 'N/A' if @report.buyflow_report.shipping_overnight.nil?\n\n if(@offer)\n @offer.each do |offer|\n # Continuity Shipping \n @report.buyflow_report.continuity_shipping = @page.continuity(offer)\n puts \"Continuity\"\n puts @report.buyflow_report.continuity_shipping\n end\n end\n # end\n\n # get the shipping selection price\n puts \"cart_shipping_selection_price\"\n cart_shipping_selection_price = @page.current_shipping_cost\n puts cart_shipping_selection_price\n\n @page.place_order(@configuration['ConfEmailOverride'])\n\n # Submit order in order to reach confirmation page\n @page = @page.submit_order\n\n # ------------ Confirmation Page ------------\n\n puts \"proceeding to confirmation page\"\n\n @page.expand_order_details()\n \n # pull the confirmation number\n @report.buyflow_report.confirmation_number = @page.get_confirmation_number\n\n @report.buyflow_report.lastpagefound = \"confirmation page\"\n # pull the uci number for the confirmation page\n @report.uci_report.uci_cp = @page.uci\n\n # Compare the billing and shipping information to the data that was entered in the cart\n check_billing_info(@report.buyflow_report, @page)\n\n # get the offer code from the confirmation page\n @report.buyflow_report.confoffercode = @page.offercode\n\n # get the confirmation page pricing for the main product\n @report.buyflow_report.confpricing = @page.confpricing\n\n # check the shipping price matches the shipping selected in the cart\n puts \"shipping_conf\"\n shipping_conf = @page.conf_shipping_price\n puts shipping_conf\n\n if(shipping_conf == cart_shipping_selection_price)\n @report.buyflow_report.shipping_conf = \"match\"\n @report.buyflow_report.shipping_conf_val = shipping_conf\n @report.buyflow_report.selected_shipping = cart_shipping_selection_price\n else\n begin\n @report.buyflow_report.shipping_conf_val = shipping_conf\n\n rescue\n end\n begin\n @report.buyflow_report.selected_shipping = cart_shipping_selection_price\n rescue\n\n end\n begin\n @report.buyflow_report.shipping_conf = shipping_conf.to_s + \" - expected: \" + cart_shipping_selection_price.to_s\n rescue\n @report.buyflow_report.shipping_conf = \"Problem with gathering data: confirmation - \" + shipping_conf.class.to_s + \" cart - \" + cart_shipping_selection_price.class.to_s\n end\n end\n\n @report.buyflow_report.conf_kit_name = @page.cart_title\n\n # -------- Failure Checks ---------\n if(@report.grcid.nil?)\n fail 'GRCID not found for this page (AKA Campaign Code)'\n end\n\n if(@report.uci_report.uci_mp.nil?)\n fail 'UCI code for Marketing section was not found'\n end\n\n if(@report.uci_report.uci_op.nil?)\n fail 'UCI code for Cart section was not found'\n end\n \n if(@report.uci_report.uci_sas.nil?)\n fail 'UCI code for SAS section was not found'\n end \n \n if(@report.uci_report.uci_cp.nil?)\n fail 'UCI code for Confirmation page was not found'\n end\n\n if(@report.buyflow_report.subtotal_price.nil?)\n fail 'subtotal price was not found'\n end\n\n if(@report.buyflow_report.cart_title.to_s.downcase.include? 'kit')\n if(@report.buyflow_report.cart_language.nil?)\n fail 'cart language was not found'\n end\n end\n\n if(@report.buyflow_report.cart_title.nil?)\n fail 'cart title was not found'\n end\n\n # Check Shipping matches given offer if present\n if(@offer)\n if(@offer.length == 1)\n @offer.each do |offer|\n if(@report.buyflow_report.shipping_standard != offer['StartSH'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Entry -a #{@report.buyflow_report.shipping_standard} -e #{offer['StartSH'].gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_rush != offer['Rush'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Rush -a #{@report.buyflow_report.shipping_rush} -e #{offer['Rush'].gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_overnight != offer['OND'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - OND -a #{@report.buyflow_report.shipping_overnight} -e #{offer['OND'].gsub('$','').strip()}\"\n end\n end\n else\n standard_data = ''\n rush_data = ''\n ond_data = ''\n if((@report.buyflow_report.cart_title.to_s.downcase.include? 'kit') && (@report.buyflow_report.brand == 'Marajo'))\n @offer.each do |offer|\n next unless offer.Offer.to_s.downcase.include? 'kit'\n standard_data = offer['StartSH'].gsub('$','').strip()\n rush_data = offer['Rush'].gsub('$','').strip()\n ond_data = offer['OND'].gsub('$','').strip()\n break\n end\n else\n standard_data = '$0.00'\n @offer.each do |offer|\n rush_data = offer['Rush'].gsub('$','').strip()\n ond_data = offer['OND'].gsub('$','').strip()\n break\n end\n end\n \n if(@report.buyflow_report.shipping_standard != standard_data.gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Entry -a #{@report.buyflow_report.shipping_standard} -e #{standard_data.gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_rush != rush_data)\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Rush -a #{@report.buyflow_report.shipping_rush} -e #{rush_data}\"\n end\n\n if(@report.buyflow_report.shipping_overnight != ond_data)\n fail \"Shipping price did not match - #{offer.Offer.to_s} - OND -a #{@report.buyflow_report.shipping_overnight} -e #{ond_data}\"\n end\n end\n end \n\n if(@report.buyflow_report.conf_kit_name.nil?)\n fail 'confirmation kit name was not found'\n end\n\n if(@report.buyflow_report.confpricing.nil?)\n fail 'confirmation price was not found'\n end\n\n if(@report.buyflow_report.billname == 'FAILED' || @report.buyflow_report.billaddress == 'FAILED' || @report.buyflow_report.billemail == 'FAILED' || @report.buyflow_report.shipaddress == 'FAILED')\n fail 'The billing/shipping info on the confirmation page did not match data input on cart page'\n end\n\n if(@report.buyflow_report.shipping_conf != 'match')\n fail 'Shipping did not match cart on confirmation page' \n end\n\n if(@report.buyflow_report.confoffercode.nil?)\n fail 'Could not find Offer code on the confirmation page'\n end\n\n if(@report.buyflow_report.offer_code.nil?)\n fail 'Could not find Offer code on the cart page'\n end\n\n if(@offer)\n @offer.each do |offer|\n puts @report.buyflow_report.offer_code\n puts @report.buyflow_report.confoffercode\n puts offer.OfferCode.to_s\n if(@report.buyflow_report.expected_offer_code)\n if @report.buyflow_report.offer_code.to_s.downcase.include?(offer.OfferCode.to_s.downcase) == false\n raise \"OfferCode didn't match in cart page\"\n end\n end\n\n if(@report.buyflow_report.expected_offer_code)\n if @report.buyflow_report.confoffercode.to_s.downcase.include?(offer.OfferCode.to_s.downcase) == false\n raise \"OfferCode didn't match in confirmation page\"\n end\n end\n# puts offer.offer_data_detail.offerdesc\n# puts @report.buyflow_report.cart_language\n if(offer.offer_data_detail)\n if(@report.buyflow_report.cart_language)\n if cleanup_format(@report.buyflow_report.cart_language).include?(cleanup_format(offer.offer_data_detail.offerdesc)) == false\n raise \"Cart language did not match\"\n end\n end\n\n if(@report.buyflow_report.cart_title)\n if @report.buyflow_report.cart_title.to_s.downcase.include?(offer.offer_data_detail.offer_title.to_s.downcase) == false\n raise \"Cart title did not match\"\n end\n end\n else\n if(@report.buyflow_report.cart_title)\n if @report.buyflow_report.cart_title.to_s.downcase.include?(offer.Offer.to_s.downcase) == false\n raise \"Cart title did not match\"\n end\n end\n end\n end\n end\n\n # ------- end of testing --------\n\n\n rescue T5::PasswordMatchException => e\n raise e\n\n rescue Net::ReadTimeout, Selenium::WebDriver::Error::UnknownError => e\n net_timeout_timeout = 0\n begin\n net_timeout_timeout += 1\n sleep(5)\n soft_browser_quit()\n # create browser for new attempt\n @browser = BrowserFactory.create_browser(@browsertype)\n\n # instatiate the starting page model\n @page = T5::Marketing.new(@configuration)\n \n # set the browser session to the current one held by the test case\n @page.browser = @browser\n \n # adapt the page based on the configuration settings\n @page = @page.adapt\n\n auth_workarounds()\n exp = @report.buyflow_report.expected_offer_code\n @report.buyflow_report = GRReporting::BuyflowReport.new()\n @report.buyflow_report.expected_offer_code = exp\n rescue => exc\n if net_timeout_timeout < 5\n retry\n else\n raise e\n end\n end\n retry\n rescue => e\n timeout_count += 1;\n # Change the limit of retries here.\n raise e if(timeout_count > 1)\n soft_browser_quit()\n @browser = BrowserFactory.create_browser(@browsertype)\n\n # instatiate the starting page model\n @page = T5::Marketing.new(@configuration)\n \n # set the browser session to the current one held by the test case\n @page.browser = @browser\n \n # adapt the page based on the configuration settings\n @page = @page.adapt\n\n auth_workarounds()\n exp = @report.buyflow_report.expected_offer_code\n @report.buyflow_report = GRReporting::BuyflowReport.new()\n @report.buyflow_report.expected_offer_code = exp\n retry\n end\n end", "def configure!\n ENV[\"KNAPSACK_TEST_FILE_PATTERN\"] ||= \"qa/specs/features/**/*_spec.rb\"\n ENV[\"KNAPSACK_REPORT_PATH\"] = report_path\n\n Knapsack.logger = QA::Runtime::Logger.logger\n\n download_report\n end", "def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end", "def report; end", "def report; end", "def report; end", "def report; end", "def report; end", "def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend", "def to_html\n Report.export(@analysis, :html)\n end", "def network_report\n get_resource_list('network', 'v2.0/networks', 'networks')\n @network_csv_array = []\n @network_print_array = []\n @resource_id_list.each do |networkid|\n network = rest_get(\"#{@resource_url}/v2.0/networks/#{networkid}\", @token_id)\n network_array = JSON.parse(network)['network']\n network_name = network_array['name']\n network_status = network_array['status']\n network_vlanid = network_array['provider:segmentation_id']\n network_physnet = network_array['provider:physical_network']\n network_mtu = network_array['mtu']\n subnet_id = network_array['subnets']\n unless subnet_id.empty?\n subnet_id.each do |subnetid|\n subnet_rest = rest_get(\"#{@resource_url}/v2.0/subnets/#{subnetid}\", @token_id)\n subnet_array = JSON.parse(subnet_rest)['subnet']\n @subnet_enable_dhcp = subnet_array['enable_dhcp']\n @subnet_dns_server = subnet_array['dns_nameservers']\n @subnet_startip = subnet_array['allocation_pools'][0]['start']\n @subnet_endip = subnet_array['allocation_pools'][0]['end']\n @subnet_gateway = subnet_array['gateway_ip']\n @subnet_cidr = subnet_array['cidr']\n end\n end\n @network_csv_array << [network_name, network_status, network_vlanid, network_physnet, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, \\\n @subnet_gateway, @subnet_cidr]\n @network_print_headers = %w(Network_Name Network_VLANid Network_MTU Network_enable_dhcp Network_DNS_Servers Network_Start_IP Network_End_IP Network_Gateway Network_CIDR)\n @network_print_array << [network_name, network_vlanid, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, @subnet_gateway, @subnet_cidr]\n end\n end", "def print_index\n\t\tFile.open(@options[:output] + \"/index.html\",'w') do |f|\n\t\t\thtml_header(f,\"Home\")\n\n\t\t\tbar_js(f,\"bar_graph\",\"Top 20 Hosts\",@hosts.sort_by{|k,v| v[:total_excl_info]}.reverse.take(20))\n\n\t\t\tcrit_total = 0\n\t\t\thigh_total = 0\n\t\t\tmed_total = 0\n\t\t\tlow_total = 0\n\t\t\tinfo_total = 0\n\n\t\t\t@events.each do |k,v|\n\t\t\t\tcrit_total += 1 if v[:severity] == 4\n\t\t\t\thigh_total += 1 if v[:severity] == 3\n\t\t\t\tmed_total += 1 if v[:severity] == 2\n\t\t\t\tlow_total += 1 if v[:severity] == 1\n\t\t\t\tinfo_total += 1 if v[:severity] == 0\n\t\t\tend\n\n\t\t\tpie_data = []\n\t\t\tpie_data << ['Info',info_total.to_i,'blue'] if @options[:severity] <= 0 and info_total.to_i >= 0\n\t\t\tpie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1 and low_total.to_i > 0\n\t\t\tpie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2 and med_total.to_i > 0\n\t\t\tpie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3 and high_total.to_i > 0\n\t\t\tpie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4 and crit_total.to_i > 0\n\n\t\t\tpie_js(f,\"pie_graph\",\"Unique Vulnerability Breakdown\",\"Unique Vuln Breakdown\",pie_data,\"document.location.href = 'vuln_overview.html';\")\n\n\t\t\tcrit_total = 0\n\t\t\thigh_total = 0\n\t\t\tmed_total = 0\n\t\t\tlow_total = 0\n\t\t\tinfo_total = 0\n\n\t\t\t@hosts.each do |id,values|\n\t\t\t\tcrit_total += values[:crit].to_i\n\t\t\t\thigh_total += values[:high].to_i\n\t\t\t\tmed_total += values[:med].to_i\n\t\t\t\tlow_total += values[:low].to_i\n\t\t\t\tinfo_total += values[:info].to_i\n\t\t\tend\n\n\t\t\tpie_data = []\n\t\t\tpie_data << ['Info',info_total.to_i,'blue'] if @options[:severity] <= 0 and info_total.to_i >= 0\n\t\t\tpie_data << ['Low',low_total.to_i,'green'] if @options[:severity] <= 1 and low_total.to_i > 0\n\t\t\tpie_data << ['Medium',med_total.to_i,'orange'] if @options[:severity] <= 2 and med_total.to_i > 0\n\t\t\tpie_data << ['High',high_total.to_i,'red'] if @options[:severity] <= 3 and high_total.to_i > 0\n\t\t\tpie_data << ['Critical',crit_total.to_i,'purple'] if @options[:severity] <= 4 and crit_total.to_i > 0\n\n\t\t\tpie_js(f,\"pie_graph2\",\"Total Vulnerability Breakdown\",\"Total Vuln Breakdown\",pie_data,\"document.location = href= 'vuln_overview.html';\")\n\n\t\t\ttarget_lookup = \"var target_lookup = {\"\n\t\t\t@hosts.each_with_index do |host,index|\n\t\t\t\tif host[1][:hostname] == \"\"\n\t\t\t\t\ttarget_lookup += \"'\" + host[1][:ip] + \"'\"\n\t\t\t\telse\n\t\t\t\t\ttarget_lookup += \"'\" + host[1][:hostname] + \" (\" + host[1][:ip] + \")\" + \"'\"\n\t\t\t\tend\n\t\t\t\ttarget_lookup += \": \" + host[0].to_s\n\t\t\t\ttarget_lookup += \",\" unless index == @hosts.length - 1\n\t\t\tend\n\t\t\ttarget_lookup += \"}\"\n\n\t\t\tf.puts target_lookup\n\n\t\t\tclose_html_header(f)\n\n\t\t\tbody = '<div style=\"width: 800px; margin-left: auto; margin-right: auto; padding-top: 30px;\">'\n\t\t\tbody += '<div id=\"pie_graph\" style=\"min-width: 375px; height: 375px; margin: 0 auto; float: left\"></div>'\n\t\t\tbody += '<div id=\"pie_graph2\" style=\"min-width: 375px; height: 375px; margin: 0 auto; float: left\"></div>'\n\t\t\tbody += '</div>'\n\t\t\tbody += '<div style=\"clear: both;\"></div>'\n\t\t\tbody += '<div id=\"bar_graph\" style=\"min-width: 400px; height: 900px; margin: 0 auto\"></div>'\n\n\t\t\tbody += '<div id=\"allhosts\" style=\"font-family: Arial, Helvetica, sans-serif\"><h3>All Hosts</h3>'\n\n\t\t\tips = []\n\t\t\t@hosts.each do |host|\n\t\t\t\tips << host[1][:ip]\n\t\t\tend\n\n\t\t\tbody += '<table id=\"hosts_table\" class=\"display\"><thead><tr><th>IP</th><th>Hostname</th><th>OS</th><th>Vulnerability Count (Low to Critical)</th></tr></thead><tbody>'\n\t\t\tips.sort_by{|ip| ip.split('.').map{|octet| octet.to_i}}.each do |ip|\n\t\t\t\t@hosts.select{|k,v| v[:ip] == ip}.each do |k,v|\n\t\t\t\t\ttmp_actual_v_count = 0\n\t\t\t\t\ttmp_actual_v_count += v[:info].to_i if @options[:severity] <= 0 and v[:info].to_i >= 0\n\t\t\t\t\ttmp_actual_v_count += v[:low].to_i if @options[:severity] <= 1 and v[:low].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:med].to_i if @options[:severity] <= 2 and v[:med].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:high].to_i if @options[:severity] <= 3 and v[:high].to_i > 0\n\t\t\t\t\ttmp_actual_v_count += v[:crit].to_i if @options[:severity] <= 4 and v[:crit].to_i > 0\n\t\t\t\t\tbody += '<tr><td>'\n\t\t\t\t\tif tmp_actual_v_count > 0\n\t\t\t\t\t\tbody += '<a href=\"host_' + k.to_s + '.html\">' + ip + '</a>'\n\t\t\t\t\telse\n\t\t\t\t\t\tbody += ip\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</td><td>' + v[:hostname] + '</td><td>' + v[:os] + '</td><td>' + v[:total_excl_info].to_s + '</td></tr>'\n\t\t\t\tend\n\t\t\tend\n\t\t\tbody += '</tbody></table>'\n\n\t\t\tbody += '<script>$(document).ready(function() { $(\\'#hosts_table\\').dataTable({\"bPaginate\": false}); });</script>'\n\n\t\t\tbody_text(f,body)\n\n\t\t\tclose_all(f)\n\n\t\tend\n\n\tend", "def generate_webpage(abilities_on_board, ability_statistics, ability_pair_statistics)\n output_filename = \"ADWebpage.html\"\n output_filepath = \"#{__dir__}/#{output_filename}\"\n \n File.delete(output_filepath) if File.exist?(output_filepath) \n\n erb = ERB.new(File.open(\"#{__dir__}/ADWebpageTemplate.html.erb\").read)\n\n template_variables = binding\n template_variables.local_variable_set(:abilities_on_board, abilities_on_board)\n template_variables.local_variable_set(:ability_statistics, ability_statistics)\n template_variables.local_variable_set(:ability_pair_statistics, ability_pair_statistics)\n\n File.write(output_filepath, erb.result(template_variables))\nend", "def adhoc_mailing\n setup_adhoc_render_default\n end", "def report\n \n end", "def show_html\n\t\t# things to be done\n\t\tif @mode == 'saveconf' then\n\t\t\tcase @current_mode\n\t\t\twhen Options\n\t\t\t\tupdate_options\n\t\t\twhen RefList\n\t\t\t\tupdate_tables\n\t\t\tend\n\t\tend\n\n\t\t# update cache\n\t\tif not @setup.secure then\n\t\t\tif not @setup['no_cache'] then\n\t\t\t\tunless @cache then\n\t\t\t\t\t@need_cache_update = true\n\t\t\t\t\t@cache = DispRef2Cache.new( @setup )\n\t\t\t\tend\n\t\t\t\tif not 'never' == @cgi.params['dr2.cache.update'][0] and ('force' == @cgi.params['dr2.cache.update'][0] or @need_cache_update) then\n\t\t\t\t\t@updated_url = @cache.update\n\t\t\t\telsif 'scan' == @cgi.params['dr2.cache.update'][0] then\n\t\t\t\t\t@scanned_url = @cache.scan\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif @setup['no_cache'] then\n\t\t\t\t\t@cache = nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# result\n\t\tr = show_description\n\t\tcase @current_mode\n\t\twhen Options\n\t\t\tr << show_options\n\t\twhen RefList\n\t\t\tr << show_unknown_list\n\t\tend\n\t\tr\n\tend", "def print_vuln_overview\n\t\tFile.open(@options[:output] + \"/vuln_overview.html\", 'w') do |f|\n\t\t\thtml_header(f,\"Vulns Overview\")\n\n\t\t\tclose_html_header(f)\n\n\t\t\tbody = '<a href=\"index.html\">Home</a><br /><div id=\"vulns\" style=\"font-family: Arial, Helvetica, sans-serif\"><h2>Vulnerabilities</h2>'\n\n\t\t\tbody += '<table id=\"vulns_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Severity</th><th>Name</th><th>Family</th><th>Ports</th><th>Number of impacted hosts</th></tr></thead><tbody>'\n\t\t\t@events.each do |k,v|\n\t\t\t\tnext if v[:severity].to_i < @options[:severity].to_i\n\t\t\t\tbody += '<tr><td><a href=\"vuln_' + k.to_s + '.html\">' + k.to_s\n\t\t\t\tbody += '</a></td><td>' + v[:severity].to_s + '<td>' + v[:plugin_name] + '</td>'\n\t\t\t\tbody += '<td>' + v[:family].to_s + '</td><td>'\n\t\t\t\timpacted_hosts = []\n\t\t\t\tv[:ports].each_with_index do |(k2,v2),index|\n\t\t\t\t\tbody += k2.to_s\n\t\t\t\t\tbody += \", \" unless index == v[:ports].length - 1\n\t\t\t\t\tv2[:hosts].each do |h,w|\n\t\t\t\t\t\timpacted_hosts << h\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\timpacted_hosts.uniq!\n\t\t\t\tbody += '</td><td>' + impacted_hosts.count.to_s + '</td></tr>'\n\t\t\tend\n\t\t\tbody += '</tbody></table>'\n\n\t\t\tbody += '<script>$(document).ready(function() { $(\\'#vulns_table\\').dataTable({\"bPaginate\": false,\"aaSorting\": [[0,\"desc\"],[5,\"desc\"]]}); });</script>'\n\t\t\tbody_text(f,body)\n\n\t\t\tclose_all(f)\n\t\tend\n\tend", "def run\n\t\tmy_credentials = {\"user\" => \"test.api\", 'password' => '5DRX-AF-gc4', 'client_id' => 'Test', 'client_secret' => 'xIpXeyMID9WC55en6Nuv0HOO5GNncHjeYW0t5yI5wpPIqEHV'}\n\t\taccess_token = self.class.post('http://testcost.platform161.com/api/v2/access_tokens/', { query: my_credentials })['token']\n\t\theaders = {:headers => {'PFM161-API-AccessToken' => access_token}}\n\t\tadvertiser_reports = self.class.post('https://testcost.platform161.com/api/v2/advertiser_reports/', headers )\n\t\tcreate_local_report advertiser_reports['id']\n\t\tcampaign = self.class.get('https://testcost.platform161.com/api/v2/campaigns/' + campaign_id.to_s, headers )\n\t\tif advertiser_reports['results'] && advertiser_reports['results'].select { |campaign| campaign['campaign_id'] == campaign_id }.present?\n\t\t\tadvertiser_report = advertiser_reports['results'].select { |campaign| campaign['campaign_id'] == campaign_id }\n\t\t\tReportGeneratorCsvBuilder.new({advertiser_report: advertiser_report, campaign: campaign}).build\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def default_report_settings!\n\n #set up default values\n self.network_perf = true\n self.network_perf = true\n self.route_perf_t = true\n self.route_tt_t = true\n self.route_perf_c = true\n self.route_tt_c = true\n self.duration = 86400\n\n #These are used for ScaterPlots and ScatterGroups in \n #report generator. Will add when we get there.\n #@simulation_batches = Array.new\n #@scenarios = Array.new\n # begin\n # params[:sim_ids].each do |s|\n # sb = SimulationBatch.find_by_id(s)\n # @simulation_batches.push(sb)\n # @scenarios.push(Scenario.find_by_id(sb.scenario_id))\n # end\n # rescue NoMethodError\n # \n # end\n\n end", "def setup \n @pdf_name = \"pdf name\"\n @options = { :pdf_layout => \"reports_layout.pdf.erb\", :pdf_template => \"reports/report.pdf.erb\", \n :render_options => {\n :header_right => 'Page [page] of [toPage]',\n :grayscale => true,\n :page_size => 'Letter'} \n } \n @page = \"<html><head><head><body><b>Hello</b> World</body></html>\" \n \n TooRendermonkey.configure = {\n :uri => \"http://localhost:4567/generate\",\n :api_key => \"835a3161dc4e71b\",\n :hash_key => \"sQQTe93eWcpV4Gr5HDjKUh8vu2aNDOvn3+suH1Tc4P4=\"\n } \n end", "def report\n\t\tend", "def build_report\n # build cases\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.testsuites {\n testsuite = xml.testsuite {\n @cases.each do |tc|\n testcase = xml.testcase {\n if tc.result_has_message?\n result_type = xml.send(tc.result)\n result_type[:message] = tc.message if tc.message.present?\n end\n\n if tc.system_out.size > 0\n xml.send('system-out') { xml.text tc.system_out.to_s }\n end\n\n if tc.system_err.size > 0\n xml.send('system-err') { xml.text tc.system_err.to_s }\n end\n }\n\n testcase[:name] = tc.name if tc.name.present?\n testcase[:time] = tc.time if tc.time.present?\n\n testcase[:classname] = package if package.present?\n if tc.classname.present?\n if testcase[:classname].present?\n testcase[:classname] = \"#{testcase[:classname]}.#{tc.classname}\"\n else\n testcase[:classname] = tc.classname\n end\n end\n\n end\n }\n\n testsuite[:name] = name if name.present?\n testsuite[:package] = package if package.present?\n }\n end\n\n builder.parent.root.to_xml\n end", "def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n @reportiumClient = create_reportium_client\n end", "def before\n puts \"webtest before\"\n super()\n # Create a browser instance and store it in the browser class variable\n @browser = BrowserFactory.create_browser(@browsertype)\n puts @browser\n puts \"get session ip\"\n @report.remote_url = GridUtilities.get_session_ip(session: @browser)\n puts @report.remote_url\n puts \"done webtest before\"\n end", "def generate_report\n self.consume_stdin\n self.data_sorter\n\n @drivers.each do |driver|\n driver.total_duration\n driver.distance_calculator\n driver.average_speed\n end\n\n self.compile_report\n end", "def report_body; end", "def report_body; end", "def initialize ()\n\t\t\t\t@template_info =\n\t\t\t\t{\n\t\t\t\t\t:name => \"talking_points\",\n\t\t\t\t\t:author => \"hammackj\",\n\t\t\t\t\t:version => \"0.0.2\",\n\t\t\t\t\t:renderer => \"PDF\",\n\t\t\t\t\t:description => \"Generates a Talking Points NessusReport\"\n\t\t\t\t}\n\t\t\tend", "def build_report_body\n #@output << erb(RAILS_ROOT + \"/app/views/reports/_users.html.erb\") \n pad(10) do\n add_text usernotes\n end\n if timespan == \"Daily\" \n add_text \"Current Tasks and Tasks Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Tasks and Tasks Modified in the last Week\"\n else\n add_text \"Current Tasks\"\n end\n pad(10) do\n draw_table(data, :width => 600)\n end\n if timespan == \"Daily\" \n add_text \"Current Goals and Goals Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Goals and Goals Modified in the last Week\"\n else\n add_text \"Current Goals\"\n end\n pad(10) do\n draw_table(goaldata, :width => 600)\n end\n end", "def report\n require File.join File.expand_path(File.dirname(__FILE__)), \"report\"\n Brakeman::Report.new(self)\n end", "def create_link_to_reports(agency, report_name)\n ENV['RAILS_HOST'] + \"/catalog?utf8=%E2%9C%93&locale=en&agency=#{URI::encode(agency)}\" +\n \"&required_report_name=#{URI::encode(report_name)}\" +\n '&sort=date_published_ssi+desc&search_field=advanced'\n end", "def report_for(nodes, locale_code)\n # This method simply provides a report for a given list of nodes in the desired locale.\n # The locale will be one of the supported ones.\n # Generate the report in a file to be uploaded on web10.\n File.write(\n '/tmp/web_report.txt',\n @platforms_handler.known_platforms.map do |platform|\n \"= Inventory for platform #{platform.repository_path} of type #{platform.platform_type}:\\n\" +\n platform.known_nodes.map do |node|\n \"* Node #{node} (IP: #{@nodes_handler.get_host_ip_of(node)}, Hostname: #{@nodes_handler.get_hostname_of(node)}).\"\n end.join(\"\\n\")\n end.join(\"\\n\")\n )\n # Upload the file on our web10 instance\n system 'scp -o StrictHostKeyChecking=no /tmp/web_report.txt root@web10.hpc_tutorial.org:/root/hello_world.txt'\n out 'Upload successful'\n end", "def feed_list_html(env)\n\tpage = \"\"\n\tpage << '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\t\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n\t\t\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n\t\t<html xmlns=\"http://www.w3.org/1999/xhtml\"\n\t\t xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\t\t xsi:schemaLocation=\"http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd\"\n\t\t xml:lang=\"en\" >\n\t\t\t<head>\n\t\t\t\t<title>WoC scrapped feed list for '+CONFIG[\"host\"].to_s+'</title>\n\t\t\t</head>\n\t\t\t<body>'\n\t\t\tpage << '<dl>'\n\t\t\tfor year in CONFIG[\"years\"] do\n\t\t\t\tpage << \"<dt>#{year[0]}:</dt>\"\n\t\t\t\tpage << '<dd>'\n\t\t\t\tpage << '<dl>'\n\t\t\t\tfor course in CONFIG[\"courses\"] do\n\t\t\t\t\tpage << \"<dt>#{CONFIG[\"course_names\"][course[1]]}</dt>\"\n\t\t\t\t\tpage << \"<dd>\"\n\t\t\t\t\tpage << \"<a href=\\\"http://#{env[\"HTTP_HOST\"]}/#{year[0]}/#{course[0]}/rss.xml\\\">http://#{env[\"HTTP_HOST\"]}/#{year[0]}/#{course[0]}/rss.xml</a>\"\n\t\t\t\t\tpage << \"</dd>\"\n\t\t\t\tend\n\t\t\t\tpage << '</dl>'\n\t\t\t\tpage << '</dd>'\n\t\t\tend\n\t\t\tpage << '</dl>'\n\t\tpage << \t\t\n\t\t\t'</body>\n\t\t</html>'\n\t\treturn page\nend", "def run(runner, user_arguments)\r\n super(runner, user_arguments)\r\n\r\n #use the built-in error checking \r\n if not runner.validateUserArguments(arguments(), user_arguments)\r\n return false\r\n end\r\n\r\n # get sql, model, and web assets\r\n setup = OsLib_Reporting.setup(runner)\r\n model = setup[:model]\r\n sqlFile = setup[:sqlFile]\r\n web_asset_path = setup[:web_asset_path]\r\n\r\n # create an array of tables to loop through in erb file\r\n @tables = []\r\n\r\n # get general building information\r\n @tables << OsLib_Reporting.general_building_information_table(model,sqlFile,runner)\r\n\r\n # get space type breakdown table and pie chart\r\n @tables << OsLib_Reporting.output_data_space_type_breakdown_table(model,sqlFile,runner)\r\n\r\n # get end use table and pie chart\r\n @tables << OsLib_Reporting.output_data_end_use_table_pie_data(model,sqlFile,runner)\r\n\r\n # get end use by electricity table and pie chart\r\n @tables << OsLib_Reporting.output_data_end_use_electricity_table_pie_data(model,sqlFile,runner)\r\n\r\n # get end use by gas table and pie chart\r\n @tables << OsLib_Reporting.output_data_end_use_gas_table_pie_data(model,sqlFile,runner)\r\n\r\n # get end use table and pie chart\r\n @tables << OsLib_Reporting.output_data_energy_use_table_pie_data(model,sqlFile,runner)\r\n\r\n # get advisory messages table\r\n @tables << OsLib_Reporting.advisory_messages_table(model,sqlFile,runner)\r\n\r\n # get space type detail table\r\n @tables << OsLib_Reporting.output_data_space_type_details_table(model,sqlFile,runner)\r\n\r\n # todo - could be nice to add story summary, area per story, count of zones and spaces. Should list air loops on that story, or should air loop list stories it is used on\r\n\r\n # air loop summary\r\n @tables << OsLib_Reporting.output_data_air_loops_table(model,sqlFile,runner)\r\n\r\n # plant loop summary\r\n @tables << OsLib_Reporting.output_data_plant_loops_table(model,sqlFile,runner)\r\n\r\n # zone equipment summary\r\n @tables << OsLib_Reporting.output_data_zone_equipment_table(model,sqlFile,runner)\r\n\r\n # get fenestration data table\r\n @tables << OsLib_Reporting.fenestration_data_table(model,sqlFile,runner)\r\n\r\n # summary of exterior constructions used in the model for base surfaces\r\n @tables << OsLib_Reporting.surface_data_table(model,sqlFile,runner)\r\n\r\n # summary of exterior constructions used in the model for sub surfaces\r\n @tables << OsLib_Reporting.sub_surface_data_table(model,sqlFile,runner)\r\n\r\n # create table for service water heating\r\n @tables << OsLib_Reporting.water_use_data_table(model,sqlFile,runner)\r\n\r\n # todo - update this to be custom load table, ad user arg with default string of \"Elev\"\r\n # elevators from model\r\n #@tables << OsLib_Reporting.elevator_data_table(model,sqlFile,runner)\r\n\r\n # create table for exterior lights\r\n @tables << OsLib_Reporting.exterior_light_data_table(model,sqlFile,runner)\r\n\r\n #reporting final condition\r\n runner.registerInitialCondition(\"Gathering data from EnergyPlus SQL file and OSM model.\")\r\n\r\n # create excel file (todo - turn back on once support gem)\r\n #book = OsLib_Reporting.create_xls()\r\n #@tables.each do |table|\r\n # my_data = OsLib_Reporting.write_xls(table,book)\r\n #end\r\n #file = OsLib_Reporting.save_xls(book)\r\n\r\n # read in template\r\n html_in_path = \"#{File.dirname(__FILE__)}/resources/report.html.erb\"\r\n if File.exist?(html_in_path)\r\n html_in_path = html_in_path\r\n else\r\n html_in_path = \"#{File.dirname(__FILE__)}/report.html.erb\"\r\n end\r\n html_in = \"\"\r\n File.open(html_in_path, 'r') do |file|\r\n html_in = file.read\r\n end\r\n\r\n # configure template with variable values\r\n renderer = ERB.new(html_in)\r\n html_out = renderer.result(binding)\r\n\r\n # write html file\r\n html_out_path = \"./report.html\"\r\n File.open(html_out_path, 'w') do |file|\r\n file << html_out\r\n # make sure data is written to the disk one way or the other\r\n begin\r\n file.fsync\r\n rescue\r\n file.flush\r\n end\r\n end\r\n\r\n #closing the sql file\r\n sqlFile.close()\r\n\r\n #reporting final condition\r\n runner.registerFinalCondition(\"Generated #{html_out_path}.\")\r\n\r\n return true\r\n \r\n end", "def set_info\n @page_header = 'Insight Engine'\n @page_secondary = 'Let\\'s get a view at 10,000 feet.'\n @page_title = 'LeadAccount | Insight Engine'\n @page_icon = 'lightbulb'\n end", "def create_html_summary\r\n puts \"Creating HTML...\"\r\n @dmds = @lists.last\r\n @html = '<html>'\r\n @html += '<head><link rel=\"stylesheet\" href=\"styles.css\"></head>'\r\n @html += '<body>'\r\n @html += \"<h3>Actions</h3>\\n<ul>\"\r\n @html += actions_html\r\n @html += \"</ul>\\n\"\r\n #@html += \"<h3>Prios diff</h3>\\n<ul>\"\r\n #@html += prio_diff_html\r\n #@html += \"</ul>\\n\"\r\n #@html += \"<h3>Closed DMD</h3>\\n<ul>\"\r\n #@html += closed_dmd_html\r\n #@html += \"</ul>\\n\"\r\n @html += \"<h3>Open DM</h3>\"\r\n ano, evo = sas_report\r\n @html += \"<table><tr><td>Nature of changes</td><td>P0</td><td>P1</td><td>P2/P3</td><td>Total</td></tr>\r\n <tr><td>Anomalies</td><td>#{ano['0']}</td><td>#{ano['1']}</td><td>#{ano['2']+ano['3']}</td><td>#{ano['0']+ano['1']+ano['2']+ano['3']}</td></tr>\r\n <tr><td>Evolutions</td><td>#{evo['0']}</td><td>#{evo['1']}</td><td>#{evo['2']+evo['3']}</td><td>#{evo['0']+evo['1']+evo['2']+evo['3']}</td></tr>\r\n <tr><td>Total</td><td>#{ano['0']+evo['0']}</td><td>#{ano['1']+evo['1']}</td><td>#{ano['2']+ano['3']+evo['2']+evo['3']}</td><td>#{ano['0']+evo['0']+ano['1']+evo['1']+ano['2']+ano['3']+evo['2']+evo['3']}</td></tr>\r\n <table>\"\r\n count = prios_hash\r\n @html += \"<h3>Non analysed DMD, by priority</h3><ul>\\n\"\r\n @html += \"<b>Stats</b><ul>TBD: #{count['TBD']}<br/>P0: #{count['0']}<br/>P1: #{count['1']}<br/>P2: #{count['2']}<br/>P3: #{count['3']}<br/></ul>\\n\"\r\n @html += \"#{priority_html(priority_dmd)}</ul>\\n\"\r\n @html += \"<h3>Evo</h3>\\n<ul>#{priority_html(priority_evo)}</ul>\\n\"\r\n @html += \"<h3>Analysed but not batched DMD</h3>\\n<ul>#{analysed_html(analysed_dmd)}</ul>\\n\"\r\n @html += \"<h3>Has workload but not 'analysed' DMD</h3>\\n<ul>#{analysed_html(workload_dmd)}</ul>\\n\"\r\n @html += \"<h3>Decided DMD</h3>\\n<ul>#{decided_html(decided_dmd)}</ul>\\n\"\r\n @html += \"<h3>Last updated</h3>\\n<ul>#{last_updated_html(last_updated_dmd)}</ul>\\n\"\r\n @html += '</body>'\r\n @html += '</html>'\r\n end", "def generate_new_report\n log_info('MI Report generation started...')\n content = CSV.generate do |csv|\n csv << headers\n claims.find_each do |claim|\n ManagementInformationPresenter.new(claim, 'view').present! do |claim_journeys|\n claim_journeys.each { |journey| csv << journey } if claim_journeys.any?\n end\n end\n end\n log_info('MI Report generation finished')\n content\n rescue StandardError => e\n log_error(e, 'MI Report generation error')\n end", "def initialize site_name, options = {}\n @site = site_name\n @export_dir = \".#{site_name}-export-#{$$}\"\n @report = []\n @import = {}\n @stats = {}\n @buffer = options.key?(:buffer) ? !!options[:buffer] : false\n @category_counter = Hash.new(0)\n @section_counter = Hash.new(0)\n end", "def wardreport\n\t\t@wards = Ward.find(:all)\n\n\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"wardreport.pdf\", :type => 'application/pdf')\n\tend", "def send_report(report)\n headers = {\n \"Content-Type\" => \"application/json\",\n \"x-data-collector-auth\" => \"version=1.0\",\n \"x-data-collector-token\" => @token,\n }\n\n all_report_shas = report[:profiles].map { |p| p[:sha256] }\n missing_report_shas = missing_automate_profiles(headers, all_report_shas)\n\n full_report = truncate_controls_results(enriched_report(report), @control_results_limit)\n full_report = strip_profiles_meta(full_report, missing_report_shas, @run_time_limit)\n json_report = Chef::JSONCompat.to_json(full_report, validate_utf8: false)\n\n # Automate GRPC currently has a message limit of ~4MB\n # https://github.com/chef/automate/issues/1417#issuecomment-541908157\n if json_report.bytesize > 4 * 1024 * 1024\n Chef::Log.warn \"Generated report size is #{(json_report.bytesize / (1024 * 1024.0)).round(2)} MB. #{ChefUtils::Dist::Automate::PRODUCT} has an internal 4MB limit that is not currently configurable.\"\n end\n\n unless json_report\n Chef::Log.warn \"Something went wrong, report can't be nil\"\n return false\n end\n\n begin\n Chef::Log.info \"Report to #{ChefUtils::Dist::Automate::PRODUCT}: #{@url}\"\n Chef::Log.debug \"Compliance Phase report: #{json_report}\"\n http_client.post(nil, json_report, headers)\n true\n rescue => e\n Chef::Log.error \"send_report: POST to #{@url} returned: #{e.message}\"\n false\n end\n end", "def generate_scan_report\n freshclam_stderr = IO.read($config[\"freshclam_stderr\"])\n freshclam_stdout = @freshclam_stdout\n template = IO.read(\"views/clamav.html.erb\")\n output = ERB.new(template).result(binding)\n File.open(\"clamav.html\", \"w\") {|file| file.write(output)}\nend", "def report_html\n Report.html_version\n end", "def storeconsumptionreport\n\t\t@storecunsumptions = Storecunsumption.find(:all)\t\t\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"storeconsumptionreport.pdf\", :type => 'application/pdf')\n\tend", "def initialize( html=false, pedigree_width=PEDIGREE_WIDTH)\n @html = html\n pedigree_width\n @colour_chart = [\n \"#000000\", #black\n \"#FF0522\", #Red\n \"#F58309\", #Orange\n \"#FBFF02\", #Yellow\n \"#09C710\", #Green\n \"#02EFF3\", #Light Blue\n \"#FF0CEB\", #Inigo\n \"#052EFF\", #RBlue\n ]\n @n_chart_colours = @colour_chart.length\n @lastspace = ' ' * (pedigree_width - 1)\n @spacebar = ' ' * pedigree_width + '|'\n @spacenobar = ' ' * (pedigree_width + 1)\n @url_base = '/gedserv?record=' #FIXME: probably not what anyone else wants.\n end", "def write_report\n\n end", "def index\n\t\t@debug_vars = []\n\t if(current_user)\n\t @default_email = current_user.email if(current_user.username)\n\t end \n\t\t@headertext = \"#{params[:suitetype]} Test Suites\"\n\t\t@suites = TestSuites.where('scheduledate < ? OR scheduledate IS NULL', Time.now.to_s)\n\t\t@browsers = Browsertypes.where(:active => \"1\")\n\t @brands = Brands.all()\n\t @testrun = Testrun.new()\n\t \n\t \n\t\t@type = params[:suitetype]\n\t\tfiltering_params(params).each do |key, value|\n\t\t\t@suites = @suites.public_send(key, value) if value.present?\n\t\tend\n\t\t@suites = @suites.paginate(:page => params[:page], :per_page => 15).order('id DESC')\n\t\t\n\t\t@debug_vars.push @default_email\n\t @debug_vars.push @suites\n\t @debug_vars.push @browsers\n\t @debug_vars.push @brands\n\t @debug_vars.push @testrun\n\t @debug_vars.push @type\n\t @debug_vars.push params\n\n\t if(params[:formats] == 'json')\n\n\t end\n\tend", "def loanaccountreport\n\t\t@loanaccounts = Loanaccount.find(:all, :order=>\"loanaccountno\")\t\t\n \t html = render :layout => false \n \tkit = PDFKit.new(html)\n \tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n \tsend_data(kit.to_pdf, :filename => \"loanaccountreport.pdf\", :type => 'application/pdf')\n\tend", "def create_global_report\n super\n end", "def reporters; end", "def reporters; end", "def reporters; end", "def reporters; end", "def reporters; end", "def create_report\n\tcreate_rep_heading\n \tcreate_product_data\n \tcreate_brand_data\nend", "def index\n @head = '<script type=\"text/javascript\" src=\"/js/index.js\"></script>'\n @title = \"TinyCDR - FreeSWITCH CDR Reporting\"\n end", "def insert_general_sections(report)\n report.add_field(:client, 'mg')\n report.add_field(:project, 'pcv')\n report.add_field(:section, 'dev1')\n report.add_field(:name, person.name)\n report.add_field(:title_function, person.role)\n\n report.add_field(:header_info, \"#{person.name} - Version 1.0\")\n\n report.add_field(:date, Time.zone.today.strftime('%d.%m.%Y'))\n report.add_field(:version, '1.0')\n report.add_field(:comment, 'Aktuelle Ausgabe')\n end", "def execute!\n make_web_directory\n generate_universe\n generate_html\n print_success_message\n end", "def initialize(report)\n @report = report\n @document = Prawn::Document.new(:page_layout => :landscape,\n :top_margin => in2pt(1),\n :bottom_margin => in2pt(1))\n\n @document.float { draw_graphs }\n\n draw_header\n draw_summary_table\n end", "def parse_wa()\n state = \"WA\";\n url = 'https://www.doh.wa.gov/emergencies/coronavirus'\n\n browser = Watir::Browser.new\n browser.goto(url);\n\n sleep 10\n\n html = browser.html\n doc = Nokogiri::HTML.parse(html)\n \n tnow = DateTime.now().strftime();\n\n output_fn = \"data/\"+tnow+'_USA_'+state+'.html';\n f = File.open(output_fn,\"w\");\n\n f.puts(doc)\n \n# list_of_tables = doc.css(\"//table\");\n\n# for table in list_of_tables\n# f.puts(table)\n# end\n\n f.close();\n browser.close(); \n return ;\nend", "def add_report_xml(parent,servers)\n\t\t\ttest_run = parent.add_element('test_run')\n\t\t\ttr_date = test_run.add_element('date')\n\t\t\ttr_date.add_text Time.now.to_s\n\t\t\ttest_run = add_server_info_to_xml_node(test_run,servers)\n\t\t\tservers.each do |server|\n\t\t\t\tserver_node = test_run.add_element('server')\n\t\t\t\tname = server_node.add_element('name')\n\t\t\t\tname.add_text(server.name)\n\t\t\t\tdomain = server_node.add_element('domain')\n\t\t\t\tdomain.add_text(server.domain)\n\t\t\t\tresult = server_node.add_element('result')\n\t\t\t\tresult.add_text(server.success? ? \"PASSED\" : \"FAILED\")\n\t\t\t\tserver.ports.each do |port|\n\t\t\t\t\tport_node = server_node.add_element('port')\n\t\t\t\t\tnumber = port_node.add_element('number')\n\t\t\t\t\tnumber.add_text(port.number)\n\t\t\t\t\tresult = port_node.add_element('result')\n\t\t\t\t\tresult.add_text(port.success ? \"PASSED\" : \"FAILED\") \n\t\t\t\t\ttime = port_node.add_element('time')\n\t\t\t\t\ttime.add_text(port.time.to_s)\n\t\t\t\tend\n\t\t\t\tserver.urls.each do |url|\n\t\t\t\t\turl_node = server_node.add_element('url')\n\t\t\t\t\turl_url = url_node.add_element('url')\n\t\t\t\t\turl_url.add_text url.url\n\t\t\t\t\tresult = url_node.add_element('result')\n\t\t\t\t\tresult.add_text(url.success ? \"PASSED\" : \"FAILED\")\n\t\t\t\t\ttime = url_node.add_element('time')\n\t\t\t\t\ttime.add_text(url.time.to_s)\n\t\t\t\tend\n\t\t\tend\n\t\t\tparent\n\t\tend", "def create(results, cls, user, custom_body=nil, complete_html= false)\n\t\t@report = WickedCore.new\n\t\t@report.open(results, cls,\"CDISC Terminology Change Report\", \"\", [], user, custom_body, complete_html)\n\t\t@report.close unless complete_html\n\t\treturn @report.html\n\tend", "def generate_standard_report(start_date = nil, end_date = nil)\r\n report_lines = ['Affiliate Unique ID,Event Type,Timestamp,First Review?,Program Name']\r\n report_events(start_date, end_date) do |event|\r\n report_lines.push event.report_line\r\n end\r\n report_lines.join(\"\\n\")\r\n end", "def generate_report()\n system(\"java -cp emma.jar emma report -r html -in coverage.em,coverage.ec\")\nend", "def assemble\n puts \"Started at #{Time.now}\"\n set_page_number 14\n\n # Poster Session 1\n add_session @offering.sessions.for_type_in_group(@poster_session_type_id, 1), :include_heading => false\n start_new_page(true)\n start_new_page(true)\n start_new_page(true)\n \n # Oral Session 1\n add_session @offering.sessions.for_type_in_group(@oral_session_type_id, 1).sort_by(&:identifier)\n start_new_page(true)\n start_new_page(true)\n start_new_page(true)\n \n # Poster Session 2\n add_session @offering.sessions.for_type_in_group(@poster_session_type_id, 2), :include_heading => false\n start_new_page(true)\n start_new_page(true)\n start_new_page(true)\n \n # Oral Session 2\n add_session @offering.sessions.for_type_in_group(@oral_session_type_id, 2).sort_by(&:identifier)\n \n start_new_page(true)\n # Index\n add_index(:people)\n start_new_page(true)\n\n print_skipped_applications\n\n puts \"Ended at #{Time.now}\"\n end", "def generate_report_impressions\n\t\t## we don't do this at the moment.\n\t\t## now for verification.\n=begin\n\t\tself.reports.each do |report|\n\t\t\tif report.impression.blank?\n\t\t\t\treport.impression = \"\"\n\t\t\t\treport.tests.each do |test|\n\t\t\t\t\treport.impression += (\" \" + (test.display_comments_or_inference || \"\"))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n=end\n\tend", "def report_html(tid)\n\t@test = Test.get(tid)\n\t@app = @test.application\n\t\n\trt = RecordType.get(@app.record_type)\n\n\tif(rt.exportFormat.nil? || rt.exportFormat == 0)\n\t\tf = File.open(\"exportTemplates/default.erb\", \"rb\")\n\t\trenderer = ERB.new(f.read)\n\t\treturn renderer.result(binding)\n\telse\n\t\tef = ExportFormat.get(rt.exportFormat)\n\t\tf = ef.erb\n\t\trenderer = ERB.new(f)\n\t\treturn renderer.result(binding)\n\tend\nend", "def finalize(ctx)\n\t\toutput = ctx.variables['__OUTPUT__'] || ''\n\n\t\thtml = \"<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<style type='text/css'>\n\t\t\tbody { font: 10pt sans-serif; }\n\t\t\t.action div { display: inline-block; }\n\t\t\t.cmd { width: 100px }\n\t\t\t.status { float: right; text-align: center; }\n\t\t\t.status .text { width: 100px; font-weight: bold }\n\t\t\t.test { background-color: #DFDFFF; margin-top: 20px }\n\t\t\t.ok .status .text { background-color: #DFFFDF }\n\t\t\t.error .status .text { background-color: #FFDFDF }\n\t\t\t.skip .status .text { background-color: #FFDFFF }\n\t\t\t.capture { border: 1px solid black }\n\t\t\t.capture img { max-width: 100% }\n\t\t\t.odd { background-color: #EEEEEE }\n\t\t\t.summary th { background-color: #DFDFFF; text-align: left }\n\t\t\t.summary td { cursor: pointer; }\n\t\t\t.top { position: absolute; top: 0px; right: 0px; background-color: #DFDFFF; padding: 5px; border-radius: 0px 0px 0px 5px; }\n\n\t\t</style>\n\t\t<script type='text/javascript'>\n\t\t\tfunction show(target) {\n\t\t\t\tvar e = document.getElementById(target+'_content');\n\t\t\t\twindow.location.href = '#'+target;\n\t\t\t}\n\t\t</script>\n\t</head>\n\t<body>\"\n\t\thtml << _d(2, \"<div class='top'>Created using <a href='https://github.com/pzavolinsky/bauxite'>bauxite</a> on #{Time.new}</div>\")\n\t\tif ctx.tests.any?\n\t\t\thtml << _d(2, \"<h1>Test Summary</h1>\")\n\t\t\thtml << _d(2, \"<table class='summary'>\")\n\t\t\thtml << _d(3, \"<tr><th>Name</th><th>Time</th><th>Status</th><th>Error</th></tr>\")\n\n\t\t\tctx.tests.each_with_index do |t,idx|\n\t\t\t\terror = t[:error]\n\t\t\t\terror = error ? error.message : ''\n\t\t\t\thtml << _d(3, \"<tr class='#{t[:status].downcase} #{(idx % 2) == 1 ? 'odd' : 'even'}' onclick='show(\\\"#{t[:name]}\\\")'>\")\n\t\t\t\thtml << _d(4, \"<td>#{t[:name]}</td><td>#{t[:time].round(2)}</td><td class='status'>#{t[:status]}</td><td>#{error}</td>\")\n\t\t\t\thtml << _d(3, \"</tr>\")\n\t\t\tend\n\n\t\t\thtml << _d(2, \"</table>\")\n\t\tend\n\n\t\thtml << _d(2, \"<h1>Test Details</h1>\")\n\t\t@data.each do |test|\n\t\t\tname = test[:name]\n\t\t\tstatus = test[:actions].find { |a| a[:status] == :error } ? :error : :ok\n\t\t\thtml << _d(2, \"<a name='#{name}'></a>\")\n\t\t\thtml << _d(2, \"<div class='test #{status}'>#{name}<div class='status'><div class='text'>#{status.upcase}</div></div></div>\")\n\t\t\thtml << _d(2, \"<div id='#{name}_content' class='test-content'>\")\n\n\t\t\ttest[:actions].each_with_index do |action,idx|\n\t\t\t\thtml << _d(3, \"<div class='action #{action[:status]} #{(idx % 2) == 1 ? 'odd' : 'even'}'>\")\n\t\t\t\thtml << _d(4, \t\"<div class='cmd'>#{action[:cmd]}</div>\")\n\t\t\t\thtml << _d(4, \t\"<div class='args'>#{action[:args].join(' ')}</div>\")\n\t\t\t\thtml << _d(4, \t\"<div class='status'>\")\n\t\t\t\thtml << _d(5, \t\t\"<div class='time'>(#{action[:time].round(2).to_s}s)</div>\")\n\t\t\t\thtml << _d(5, \t\t\"<div class='text'>#{action[:status].upcase}</div>\")\n\t\t\t\thtml << _d(4, \t\"</div>\")\n\t\t\t\thtml << _d(3, \"</div>\")\n\t\t\t\tcapture = action[:capture]\n\t\t\t\tif capture\n\t\t\t\t\thtml << _d(3, \"<div class='capture'>#{_img(output, capture)}</div>\")\n\t\t\t\tend\n\t\t\tend\n\n\t\t\titem = ctx.tests.find { |t| t[:name] == name }\n\t\t\tif item and item[:error]\n\t\t\t\tcapture = item[:error].variables['__CAPTURE__']\n\t\t\t\tif capture\n\t\t\t\t\thtml << _d(3, \"<div class='capture'>#{_img(output, capture)}</div>\")\n\t\t\t\tend\n\t\t\tend\n\n\t\t\thtml << _d(2, \"</div>\")\n\t\tend\n\t\thtml << \"\n\t</body>\n</html>\"\n\t\tfile = ctx.output_path(@file)\n\t\tFile.open(file, 'w') { |f| f.write html }\n\t\tFile.delete(*@imgs) if @imgs.size > 0\n\tend", "def prepare\n insert_recording_reporter\n link_example_groups\n end", "def report_review\n # load report\n @report_html_hash = Hash.new\n @report_html_hash[0] = @service_demand.report_html_as_google_chart(get_time_for_report(Time.now), get_time_for_report(Time.now + INLINE_REPORT_DURATION.day), true)\n\n @service_demand_breakdowns_paged.each do |service_demand_breakdown|\n @report_html_hash[service_demand_breakdown.id.to_s] = service_demand_breakdown.report_html_as_google_chart(get_time_for_report(Time.now), get_time_for_report(Time.now + INLINE_REPORT_DURATION.day), true)\n end\n\n respond_to do |format|\n format.html # report_review.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n\n end", "def initialize(income_expense_report)\n init_chart_labels(income_expense_report)\n init_graphs(income_expense_report)\n #do_test()\n end", "def enriched_report(final_report)\n return unless final_report.is_a?(Hash)\n\n # Remove nil profiles if any\n final_report[:profiles].select! { |p| p }\n\n # Label this content as an inspec_report\n final_report[:type] = 'inspec_report'\n\n # Ensure controls are never stored or shipped, since this was an accidential\n # addition in InSpec and will be remove in the next inspec major release\n final_report.delete(:controls)\n final_report[:node_name] = @node_name\n final_report[:end_time] = Time.now.utc.strftime('%FT%TZ')\n final_report[:node_uuid] = @entity_uuid\n final_report[:environment] = @environment\n final_report[:roles] = @roles\n final_report[:recipes] = @recipes\n final_report[:report_uuid] = @run_id\n final_report[:source_fqdn] = @source_fqdn\n final_report[:organization_name] = @organization_name\n final_report[:policy_group] = @policy_group\n final_report[:policy_name] = @policy_name\n final_report[:chef_tags] = @chef_tags\n final_report[:ipaddress] = @ipaddress\n final_report[:fqdn] = @fqdn\n\n final_report\n end", "def generate_buyflow_table(suite)\n results = suite.testruns\n sum = 0\n failErrorSummary = ''\n color_status = ''\n results.entries.each do |row|\n color_status = \"#009900\" if row[\"result\"].upcase == \"PASS\"\n color_status = \"#FF9900\" if row[\"result\"].upcase == \"ERR\"\n color_status = \"#FF3300\" if row[\"result\"].upcase == \"FAIL\"\n failErrorSummary +=\"\"\"\n <tr>\n <td style='background-color: #{color_status}; color:#FFFFFF; border: 1px solid black;' align='center'><strong><font face='verdana' size='1'>#{row[\"result\"]}</font></strong></td>\n <td style='border: 1px solid black;' align='center'><font face='verdana' size='1'>#{row[\"Brand\"]}</font></td>\n <td style='border: 1px solid black;' align='center'><font face='verdana' size='1'>#{row[\"Campaign\"]}</font></td>\n <td style='border: 1px solid black;' align='center'><font face='verdana' size='1'>#{row[\"ExpectedOffercode\"]}</font></td>\n <td style='border: 1px solid black;' align='center'><font face='verdana' size='1'>#{row[\"ActualOffercode\"]}</font></td>\n <td style='border: 1px solid black;' align='center'><font face='verdana' size='1'>#{row[\"ConfirmationNum\"]}</font></td>\n </tr>\n \"\"\"\n end\n\n errorTable = ''\n unless failErrorSummary == ''\n errorTable = \"\"\"\n <br />\n <br />\n <table border: 1px solid black; bgcolor='#000000' width='100%' color='#FFFFFF' cellpadding='10' cellspacing='0'>\n <tr>\n <td align='center'>\n <b><font face='verdana' size='3' color='#FFFFFF'>\n Test Run results\n </font></b>\n </td>\n </tr>\n </table>\n <table style='border: 1px solid black; table-layout: fixed;' cellpadding='5px' cellspacing='0' bgcolor='#FFFFFF' width='100%'>\n <tr style='text-align: center; color:#ffffff;' bgcolor='#4E5E66'>\n <td style='border: 1px solid black;'>\n <strong>\n Status\n </strong>\n </td>\n <td width='20%' style='border: 1px solid black;'>\n <strong><font size='1' face='verdana'>Test Name</font></strong>\n </td>\n <td style='border: 1px solid black;'>\n <strong><font size='1' face='verdana'>Brand</font></strong>\n </td>\n <td style='border: 1px solid black;'>\n <strong><font size='1' face='verdana'>Expected Offercode</font></strong>\n </td>\n <td style='border: 1px solid black;'>\n <strong><font size='1' face='verdana'>Actual Offercode</font></strong>\n </td>\n <td style='border: 1px solid black;'>\n <strong><font size='1' face='verdana'>Conf #</font></strong>\n </td>\n <td style='border: 1px solid black;'>\n <strong><font size='1' face='verdana'>Notes</font></strong>\n </td>\n </tr>\n #{failErrorSummary}\n </table>\n \"\"\"\n end\n return errorTable\n end", "def all_site_report(ticket_repository, options)\n group = \"#{options[:scan_mode]}s\"\n\n log_message(\"Generating full vulnerability report on user entered #{group}.\")\n items_to_query = Array(options[group.to_sym])\n log_message(\"Generating full vulnerability report on the following #{group}: #{items_to_query.join(', ')}\")\n \n items_to_query.each do |item|\n log_message(\"Running full vulnerability report on item #{item}\")\n initial_scan_file = ticket_repository.generate_initial_scan_data(options,\n item)\n\n log_message('Preparing tickets.')\n nexpose_id = format_id(item)\n ticket_rate_limiter(initial_scan_file, 'create', nexpose_id)\n post_scan(item_id: item, generate_asset_list: true)\n end\n\n log_message('Finished processing all vulnerabilities.')\n end", "def network_report_csv(filename)\n puts 'Creating the Networks report'\n CSV.open(\"#{filename}\", 'ab') do |csv|\n csv << [\"\\n\"]\n csv << %w(Network_List)\n csv << %w(Network_Name Network_Status Network_VLANid Network_Phys_Net Network_MTU Network_enable_dhcp Network_DNS_Servers Network_Start_IP Network_End_IP Network_Gateway Network_CIDR)\n network_report\n csv_array(@network_csv_array, csv)\n end\n puts 'Done'\n end", "def assemble\n @content << preamble\n \n @content << '\\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage . \\clearpage ' + \"\\n\\n\"\n \n # # Poster Session 1\n add_session @offering.sessions.for_type_in_group(@poster_session_type_id, 1), :include_heading => false\n @content << '\\clearpage . \\clearpage . \\clearpage ' + \"\\n\\n\"\n \n # Oral Session 1\n add_session @offering.sessions.for_type_in_group(@oral_session_type_id, 1).sort_by(&:identifier)\n @content << '\\clearpage . \\clearpage ' + \"\\n\\n\"\n \n # # Poster Session 2\n add_session @offering.sessions.for_type_in_group(@poster_session_type_id, 2), :include_heading => false\n @content << '\\clearpage . \\clearpage ' + \"\\n\\n\"\n # \n # # Oral Session 2\n add_session @offering.sessions.for_type_in_group(@oral_session_type_id, 2).sort_by(&:identifier)\n \n @content << '\\clearpage ' + \"\\n\\n\"\n\n # Index\n @content << '\\printindex'\n\n print_skipped_applications\n @content << \"\\n\" + '\\end{document}'\n end", "def run\n super\n\n require_enrichment\n\n url = _get_entity_name\n\n # make request and save response\n response = http_request :get, \"#{url}/menu/guiw?nsbrand=1&protocol=nonexistent.1337\\\">&id=3&nsvpx=phpinfo\"\n unless response && response.code.to_i == 200\n _log \"No response! Failing\"\n return\n end\n\n # grab response headers and body\n response_headers = response.headers\n response_body = response.body_utf8\n\n # check if header and body contain needed values\n if response_headers.has_value?(\"application/x-java-jnlp-file\")\n # header is present, check for response body\n if response_body =~ /\\<jnlp codebase\\=\\\"nonexistent\\.1337\\\"/\n _log \"Vulnerable!\"\n _create_linked_issue \"citrix_netscaler_codeinjection_cve_2020_8194\" , { \"proof\" => response }\n end\n else\n _log \"Not vulnerable!\"\n end\n\n end", "def run_report\n comparison_values.tap do |results|\n display_report(results)\n end\n end", "def report_review\n # load report\n @report_html_hash = Hash.new\n @report_html_hash[0] = @service.report_html_as_google_chart(get_time_for_report(Time.now), get_time_for_report(Time.now + INLINE_REPORT_DURATION.day), true)\n\n @service_pricing_schemes_paged.each do |service_pricing_scheme|\n @report_html_hash[service_pricing_scheme.id.to_s] = service_pricing_scheme.report_html_as_google_chart(get_time_for_report(Time.now), get_time_for_report(Time.now + INLINE_REPORT_DURATION.day), true)\n end\n\n respond_to do |format|\n format.html # report_review.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n\n end", "def init_report\n raise if @report.new_record?\n \n # if not a new record, run it and record viewing\n @report.record_viewing\n \n return run_and_handle_errors\n end", "def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end", "def header\n @io.content_type = content_type if @io.respond_to?(:content_type)\n\n @io << \"<html>\"\n @io << tag(:head) do |headers|\n headers << tag(:title, 'Request-log-analyzer report')\n headers << tag(:style, '\n body {\n \tfont: normal 11px auto \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n \tcolor: #4f6b72;\n \tbackground: #E6EAE9;\n \tpadding-left:20px;\n \tpadding-top:20px;\n \tpadding-bottom:20px;\n }\n\n a {\n \tcolor: #c75f3e;\n }\n\n .color_bar {\n border: 1px solid;\n height:10px;\n \tbackground: #CAE8EA;\n }\n\n #mytable {\n \twidth: 700px;\n \tpadding: 0;\n \tmargin: 0;\n \tpadding-bottom:10px;\n }\n\n caption {\n \tpadding: 0 0 5px 0;\n \twidth: 700px;\t\n \tfont: italic 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n \ttext-align: right;\n }\n\n th {\n \tfont: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n \tcolor: #4f6b72;\n \tborder-right: 1px solid #C1DAD7;\n \tborder-bottom: 1px solid #C1DAD7;\n \tborder-top: 1px solid #C1DAD7;\n \tletter-spacing: 2px;\n \ttext-transform: uppercase;\n \ttext-align: left;\n \tpadding: 6px 6px 6px 12px;\n \tbackground: #CAE8EA url(images/bg_header.jpg) no-repeat;\n }\n\n td {\n \tfont: bold 11px \"Trebuchet MS\", Verdana, Arial, Helvetica, sans-serif;\n \tborder-right: 1px solid #C1DAD7;\n \tborder-bottom: 1px solid #C1DAD7;\n \tbackground: #fff;\n \tpadding: 6px 6px 6px 12px;\n \tcolor: #4f6b72;\n }\n\n td.alt {\n \tbackground: #F5FAFA;\n \tcolor: #797268;\n }\n ', :type => \"text/css\")\n end\n @io << '<body>'\n @io << tag(:h1, 'Request-log-analyzer summary report')\n @io << tag(:p, \"Version #{RequestLogAnalyzer::VERSION} - written by Willem van Bergen and Bart ten Brinke\")\n end", "def create_html(options)\n if(options[:html_template] && options[:html_template] == :scientific) then\n\n if(options[:language] && options[:language] == :english) then\n html = '<h2>Academic Interests<\\/h2>\\r\\n' +\n '<p>Add information about academic fields of interest.<\\/p>\\r\\n' +\n '<h2>Teaching<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li>&lt;Link to programme of study/course&gt;<\\/li>\\r\\n' +\n ' <li>&lt;Link to programme of study/course&gt;<\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Higher education and employment history<\\/h2>\\r\\n' +\n '<p>Brief introduction to previous education and employment.<\\/p>\\r\\n' +\n '<h2>Honoraria<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li>&lt;Name of prize and (if applicable) link 1&gt;<\\/li>\\r\\n' +\n ' <li>&lt;Name of prize and (if applicable) link 2&gt;<\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Appointments<\\/h2>\\r\\n' +\n '<ul>\\r\\n' +\n ' <li>&lt;Title and (if applicable) link 1&gt;<\\/li>\\r\\n' +\n ' <li>&lt;Title and (if applicable) link 2&gt;<\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Cooperation<\\/h2>\\r\\n' +\n '<p>&nbsp;<\\/p>'\n else\n html = '<h2>Faglige interesser<\\/h2>\\r\\n' +\n '<p>Her kan du skrive om faglige interesser.<\\/p>\\r\\n' +\n '<h2>Undervisning<\\/h2>\\r\\n<p>' +\n '&lt;Lenke til studieprogram/emne&gt; <br />\\r\\n' +\n '&lt;Lenke til studieprogram/emne&gt; <br />\\r\\n...<\\/p>\\r\\n' +\n '<h2>Bakgrunn<\\/h2>\\r\\n' +\n '<p>Kort om tidligere arbeidserfaring og utdanning<\\/p>\\r\\n' +\n '<h2>Priser<\\/h2>\\r\\n' +\n '<p>&lt;Navn og eventuelt lenke til pris 1&gt; <br />\\r\\n' +\n '&lt;Navn og eventuelt lenke til pris 2&gt; <br />\\r\\n' +\n '...<\\/p>\\r\\n' +\n '<h2>Verv<\\/h2>\\r\\n<p>' +\n '&lt;Navn og eventuelt lenke til verv 1&gt; <br />\\r\\n' +\n '&lt;Navn og eventuelt lenke til verv 2&gt; <br />\\r\\n...' +\n '<\\/p>\\r\\n' +\n '<h2>Samarbeid<\\/h2>\\r\\n' +\n '<p>&nbsp;<\\/p>'\n end\n else\n\n if(options[:language] && options[:language] == :english) then\n html = '<h2>Tasks performed<\\/h2>\\r\\n' +\n '<p>Add information about job duties, as a short text or a bulleted list:<\\/p>' +\n '\\r\\n<ul>\\r\\n' +\n ' <li>&lt;Task 1&gt;<\\/li>\\r\\n' +\n ' <li>&lt;Task 1&gt;<\\/li>\\r\\n' +\n ' <li>...<\\/li>\\r\\n' +\n '<\\/ul>\\r\\n' +\n '<h2>Background<\\/h2>\\r\\n' +\n '<p>Add information about previous education and employment.<\\/p>'\n else\n html = '<h2>Arbeidsomr&aring;der<\\/h2>\\r\\n' +\n '<p>Her kan du skrive om arbeidsomr&aring;der, ' +\n 'enten som kort tekst eller som listepunkter:</p>' +\n '\\r\\n' +\n '<ul>\\r\\n' +\n ' <li>&lt;Arbeidsomr&aring;de 1&gt;</li>\\r\\n' +\n ' <li>&lt;Arbeidsomr&aring;de 1&gt;</li>\\r\\n' +\n ' <li>...</li>\\r\\n' +\n '</ul>' +\n '\\r\\n' +\n '<h2>Bakgrunn</h2>\\r\\n' +\n '<p>Eventuelt kort om tidligere arbeidserfaring og utdanning.</p>'\n end\n end\n return html\n end", "def create_new_report!\n File.write(report_filename, report_title + report_body)\n end", "def render output\n\t\t\t\treport_classification\n\n\t\t\t\treport_title Report.title\n\t\t\t\treport_subtitle \"Talking Points Report\"\n\t\t\t\treport_author \"This report was prepared by\\n#{Report.author}\"\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t@output.text \"Scan Date:\", :style => :bold\n\t\t\t\t@output.text \"#{Report.scan_date}\"\n\t\t\t\t@output.text \"\\n\"\n\n\t\t\t\t# Number of hosts / score\n\t\t\t\t@output.text \"There were #{Host.count} hosts identified, containing #{Item.critical_risks.to_a.count + Item.high_risks.to_a.count} critical and high risks findings. Of those there were #{Item.critical_risks.to_a.count} Critical risks, and #{Item.high_risks.to_a.count} High risks.\"\n\n\t\t\t\t@output.text \"These critical and highs were discovered on #{Host.unique_hosts_with_critical_and_high_count} unique hosts. #{Item.risk_percent_rounded_text} of the total assessed computers were found to have an critical or high finding.\"\n\n\t\t\t\t# @TODO need vulnerable host count\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Top Hosts with Findings\n\t\t\t\t#@TODO need this call\n\n\t\t\t\t@output.text \"\\n\\n\\n\"\n\n\t\t\t\t# Notable Findings\n\t\t\t\tItem.top_10_table(@output)\n\n\n\t\t\t\t# Plugin_output keyword search?\n\n\t\t\t\t@output.number_pages \"<page> of <total>\", :at => [output.bounds.right - 75, 0], :width => 150, :page_filter => :all\n\t\t\tend", "def hospitalreport\n\t\t@hospitals = Hospital.find (:all)\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"hospitalreport.pdf\", :type => 'application/pdf')\n\tend" ]
[ "0.7459221", "0.7118371", "0.67816055", "0.66127026", "0.65719134", "0.6269927", "0.61325306", "0.59784055", "0.59327596", "0.590996", "0.58450633", "0.58182484", "0.5807827", "0.5747814", "0.57115436", "0.5679135", "0.5674424", "0.56657", "0.565188", "0.565188", "0.565188", "0.565188", "0.565188", "0.5648008", "0.5550334", "0.5525016", "0.55091923", "0.54435164", "0.54423237", "0.54347944", "0.54330367", "0.54234195", "0.5420262", "0.54172885", "0.5406828", "0.5397867", "0.53715754", "0.53636235", "0.5338819", "0.5334138", "0.53039545", "0.53039545", "0.5299379", "0.5293757", "0.52909666", "0.52865523", "0.5281717", "0.5279867", "0.52654916", "0.5261356", "0.5261118", "0.52512324", "0.5249184", "0.5236297", "0.5235855", "0.5234213", "0.5233073", "0.5223157", "0.52174914", "0.52106744", "0.51932335", "0.5181309", "0.51707137", "0.51544124", "0.51544124", "0.51544124", "0.51544124", "0.51544124", "0.5129076", "0.51286876", "0.5123545", "0.51214916", "0.511612", "0.5111132", "0.51022166", "0.5087746", "0.5085884", "0.5083679", "0.50680465", "0.5061918", "0.50586474", "0.50585145", "0.50557786", "0.50483364", "0.5046317", "0.50306875", "0.50255615", "0.5024334", "0.50211275", "0.501509", "0.5014972", "0.5014749", "0.50122213", "0.5012018", "0.5011389", "0.50113857", "0.5007989", "0.50059384", "0.50057834", "0.5002266" ]
0.7710169
0
Sets up the report for Probe Networks
def html_report_probe @log.debug("Starting to report probe networks, there were " + @probe_networks.length.to_s + " to report") @report << '<div id="title">Probe Networks</div><br /><br />' @probe_tab = Ruport::Data::Table(%w[bssid manufacturer]) @probe_networks.each do |probe,info| if @options.gps_data[probe] point = probe @log.debug("attempting to add link") url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s probe = '<a href="' + url + '">' + point + '</a>' end @probe_tab << [probe, info['manufacturer']] end @report << @probe_tab.to_html @report << "<br /><br />" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_report_inf\n @report << '<div id=\"title\">Infrastructure Networks</div><br /><br />'\n @log.debug(\"Starting reporting Infrastructure networks there were \" + @infrastructure_networks.length.to_s + \" networks to list\")\n @infrastructure_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid num_clients channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['clients'].length.to_s, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def report_network\n self.report('network_report')\n end", "def html_report_adhoc\n @log.debug(\"Starting to report ad-hoc networks, there were \" + @adhoc_networks.length.to_s + \"to report\")\n @report << '<div id=\"title\">Adhoc Networks</div><br /><br />'\n @adhoc_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def set_report\n end", "def probe_create\n org_endpoint \"/network/#{network_id}/probe\"\n xml_params(name: name, type: type, probeIntervalSeconds: probeIntervalSeconds, errorCountBeforeServerFail: errorCountBeforeServerFail, successCountBeforeServerEnable: successCountBeforeServerEnable, failedProbeIntervalSeconds: failedProbeIntervalSeconds, maxReplyWaitSeconds: maxReplyWaitSeconds)\n post\n end", "def network_report\n get_resource_list('network', 'v2.0/networks', 'networks')\n @network_csv_array = []\n @network_print_array = []\n @resource_id_list.each do |networkid|\n network = rest_get(\"#{@resource_url}/v2.0/networks/#{networkid}\", @token_id)\n network_array = JSON.parse(network)['network']\n network_name = network_array['name']\n network_status = network_array['status']\n network_vlanid = network_array['provider:segmentation_id']\n network_physnet = network_array['provider:physical_network']\n network_mtu = network_array['mtu']\n subnet_id = network_array['subnets']\n unless subnet_id.empty?\n subnet_id.each do |subnetid|\n subnet_rest = rest_get(\"#{@resource_url}/v2.0/subnets/#{subnetid}\", @token_id)\n subnet_array = JSON.parse(subnet_rest)['subnet']\n @subnet_enable_dhcp = subnet_array['enable_dhcp']\n @subnet_dns_server = subnet_array['dns_nameservers']\n @subnet_startip = subnet_array['allocation_pools'][0]['start']\n @subnet_endip = subnet_array['allocation_pools'][0]['end']\n @subnet_gateway = subnet_array['gateway_ip']\n @subnet_cidr = subnet_array['cidr']\n end\n end\n @network_csv_array << [network_name, network_status, network_vlanid, network_physnet, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, \\\n @subnet_gateway, @subnet_cidr]\n @network_print_headers = %w(Network_Name Network_VLANid Network_MTU Network_enable_dhcp Network_DNS_Servers Network_Start_IP Network_End_IP Network_Gateway Network_CIDR)\n @network_print_array << [network_name, network_vlanid, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, @subnet_gateway, @subnet_cidr]\n end\n end", "def default_report_settings!\n\n #set up default values\n self.network_perf = true\n self.network_perf = true\n self.route_perf_t = true\n self.route_tt_t = true\n self.route_perf_c = true\n self.route_tt_c = true\n self.duration = 86400\n\n #These are used for ScaterPlots and ScatterGroups in \n #report generator. Will add when we get there.\n #@simulation_batches = Array.new\n #@scenarios = Array.new\n # begin\n # params[:sim_ids].each do |s|\n # sb = SimulationBatch.find_by_id(s)\n # @simulation_batches.push(sb)\n # @scenarios.push(Scenario.find_by_id(sb.scenario_id))\n # end\n # rescue NoMethodError\n # \n # end\n\n end", "def configure!\n ENV[\"KNAPSACK_TEST_FILE_PATTERN\"] ||= \"qa/specs/features/**/*_spec.rb\"\n ENV[\"KNAPSACK_REPORT_PATH\"] = report_path\n\n Knapsack.logger = QA::Runtime::Logger.logger\n\n download_report\n end", "def reporters; end", "def reporters; end", "def reporters; end", "def reporters; end", "def reporters; end", "def init(nbr_ipname, nbr_type, ip_ver)\n begin\n ret = esc 'show running-configuration bgp | display-xml'\n bgp = extract(ret, :stdout, 'rpc-reply', :data, :'bgp-router')\n\n raise 'bgp configuration not present.' if !bgp\n\n # Fail if the asn differs at first place\n @property_hash[:asn] = extract(bgp, :vrf, :'local-as-number')\n if @property_hash[:asn] != resource[:asn]\n raise \"asn #{@property_hash[:asn]} differs from #{resource[:asn]}\"\n end\n\n # Fail if there is no neighbor configuration\n nbr = extract_peer(bgp, nbr_ipname, nbr_type)\n raise \"neighbor #{nbr_ipname} not configured.\" if !nbr\n\n @nbr_af = extract(nbr, (ip_ver.to_s + '-unicast').to_sym)\n if !@nbr_af\n # There is no af configuration for the given ip type\n return\n end\n\n @property_hash[:activate] = extract(@nbr_af, :'activate')\n @property_hash[:allowas_in] = extract(@nbr_af, :'allowas-in')\n @property_hash[:add_path] = extract_add_path(@nbr_af)\n\n val = extract(@nbr_af, :'next-hop-self')\n val = :false if !val\n @property_hash[:next_hop_self] = val\n\n val = extract(@nbr_af, :'sender-side-loop-detection')\n val = :true if !val\n @property_hash[:sender_side_loop_detection] = val\n\n val = @nbr_af.has_key? :'soft-reconfiguration-inbound'\n val = :false if !val\n @property_hash[:soft_reconfiguration] = val\n\n val = extract(@nbr_af, :'distribute-list-name-in')\n val = '' if !val\n @property_hash[:distribute_list] = [val]\n\n val = extract(@nbr_af, :'distribute-list-name-out')\n val = '' if !val\n @property_hash[:distribute_list].push(val)\n\n val = extract(@nbr_af, :'route-map-in')\n val = '' if !val\n @property_hash[:route_map] = [val]\n\n val = extract(@nbr_af, :'route-map-out')\n val = '' if !val\n @property_hash[:route_map].push(val)\n\n rescue Exception => e\n err \"Exception in #{__method__}\"\n err e.message\n err e.backtrace[0]\n raise\n end\n end", "def init(ip_name, type)\n begin\n ret = esc 'show running-configuration bgp | display-xml'\n bgp = extract(ret, :stdout, 'rpc-reply', :data, :'bgp-router')\n\n if bgp\n @nbr = extract_peer(bgp, ip_name, type)\n\n if !@nbr\n # There is no neighbor with the given ipaddr/name\n debug \"no neighbor configuration with #{ip_name}\"\n return\n end\n\n # Fail if the asn differs at first place\n\n @property_hash[:asn] = extract(bgp, :vrf, :'local-as-number')\n if @property_hash[:asn] != resource[:asn]\n raise \"asn #{@property_hash[:asn]} differs from #{resource[:asn]}\"\n end\n\n @property_hash[:type] = resource[:type]\n @property_hash[:neighbor] = resource[:neighbor] # neighbor is Key\n @property_hash[:advertisement_interval] = extract(@nbr,\n :'advertisement-interval')\n @property_hash[:advertisement_start] = extract(@nbr,\n :'advertisement-start')\n @property_hash[:connection_retry_timer] = extract(@nbr,\n :'connection-retry-timer')\n @property_hash[:remote_as] = extract(@nbr,\n :'remote-as')\n @property_hash[:remove_private_as] = extract(@nbr,\n :'remove-private-as')\n @property_hash[:shutdown] = extract(@nbr,\n :'shutdown-status')\n @property_hash[:password] = extract(@nbr,\n :password)\n @property_hash[:send_community_standard] = extract(@nbr,\n :'send-community-standard')\n @property_hash[:send_community_extended] = extract(@nbr,\n :'send-community-extended')\n\n @property_hash[:peergroup] = extract(@nbr,\n :'associate-peer-group')\n\n val = extract(@nbr,\n :'ebgp-multihop-count')\n val = '' if !val\n @property_hash[:ebgp_multihop] = val\n\n @property_hash[:fall_over] = @nbr.has_key? :'fall-over'\n\n val = extract(@nbr,\n :'local-as', :'as-number')\n val = '' if !val\n @property_hash[:local_as] = val\n\n val = extract(@nbr,\n :'route-reflector-client')\n val = :absent if !val\n @property_hash[:route_reflector_client] = val\n\n val = extract(@nbr, :weight)\n val = '' if !val\n @property_hash[:weight] = val\n\n if @nbr.has_key? :'timers'\n @property_hash[:timers] = [\n extract(@nbr, :timers, :'config-keepalive'),\n extract(@nbr, :timers, :'config-hold-time')\n ]\n else\n @property_hash[:timers] = []\n end\n end\n rescue Exception => e\n err \"Exception in #{__method__}\"\n err e.message\n err e.backtrace[0]\n raise\n end\n end", "def ProbeRules\n return if @ATTR.size>0\n # SMBIOS Data\n bios = Convert.to_list(SCR.Read(path(\".probe.bios\")))\n\n if Builtins.size(bios) != 1\n Builtins.y2warning(\"Warning: BIOS list size is %1\", Builtins.size(bios))\n end\n\n biosinfo = Ops.get_map(bios, 0, {})\n smbios = Ops.get_list(biosinfo, \"smbios\", [])\n\n sysinfo = {}\n boardinfo = {}\n\n Builtins.foreach(smbios) do |inf|\n if Ops.get_string(inf, \"type\", \"\") == \"sysinfo\"\n sysinfo = deep_copy(inf)\n elsif Ops.get_string(inf, \"type\", \"\") == \"boardinfo\"\n boardinfo = deep_copy(inf)\n end\n end\n\n if Ops.greater_than(Builtins.size(sysinfo), 0)\n @product = Ops.get_string(sysinfo, \"product\", \"default\")\n @product_vendor = Ops.get_string(sysinfo, \"manufacturer\", \"default\")\n end\n\n if Ops.greater_than(Builtins.size(boardinfo), 0)\n @board = Ops.get_string(boardinfo, \"product\", \"default\")\n @board_vendor = Ops.get_string(boardinfo, \"manufacturer\", \"default\")\n end\n\n Ops.set(@ATTR, \"product\", @product)\n Ops.set(@ATTR, \"product_vendor\", @product_vendor)\n Ops.set(@ATTR, \"board\", @board)\n Ops.set(@ATTR, \"board_vendor\", @board_vendor)\n\n #\n # Architecture\n #\n\n @arch = Arch.architecture\n @karch = Ops.get(Kernel.GetPackages, 0, \"kernel-default\")\n\n Ops.set(@ATTR, \"arch\", @arch)\n Ops.set(@ATTR, \"karch\", @karch)\n\n #\n # Memory\n #\n\n memory = 0\n memories = Convert.to_list(SCR.Read(path(\".probe.memory\")))\n memory = Ops.get_integer(\n memories,\n [0, \"resource\", \"phys_mem\", 0, \"range\"],\n 0\n )\n @memsize = Ops.divide(memory, 1024 * 1024)\n Ops.set(@ATTR, \"memsize\", @memsize)\n\n #\n # Disk sizes\n #\n\n storage = Storage.GetTargetMap\n _PhysicalTargetMap = Builtins.filter(storage) do |k, v|\n Storage.IsRealDisk(v)\n end\n @totaldisk = 0\n @disksize = Builtins.maplist(_PhysicalTargetMap) do |k, v|\n size_in_mb = Ops.divide(Ops.get_integer(v, \"size_k\", 0), 1024)\n @totaldisk = Ops.add(@totaldisk, size_in_mb)\n { \"device\" => k, \"size\" => size_in_mb }\n end\n Builtins.y2debug(\"disksize: %1\", @disksize)\n #\n # MAC\n #\n Ops.set(@ATTR, \"mac\", @mac)\n\n #\n # Network\n #\n if Stage.initial\n @hostaddress = Convert.to_string(SCR.Read(path(\".etc.install_inf.IP\")))\n else\n @hostaddress = \"192.168.1.1\" # FIXME\n end\n Ops.set(@ATTR, \"hostaddress\", @hostaddress)\n\n #\n # Hostid (i.e. a8c00101);\n #\n Ops.set(@ATTR, \"hostid\", @hostid)\n\n Ops.set(@ATTR, \"hostname\", getHostname)\n @domain = Convert.to_string(SCR.Read(path(\".etc.install_inf.Domain\")))\n Ops.set(@ATTR, \"domain\", @domain)\n @network = Convert.to_string(SCR.Read(path(\".etc.install_inf.Network\")))\n Ops.set(@ATTR, \"network\", @network)\n @haspcmcia = Convert.to_string(\n SCR.Read(path(\".etc.install_inf.HasPCMCIA\"))\n )\n Ops.set(@ATTR, \"haspcmcia\", @haspcmcia)\n @xserver = Convert.to_string(SCR.Read(path(\".etc.install_inf.XServer\")))\n Ops.set(@ATTR, \"xserver\", @xserver)\n\n @NonLinuxPartitions = Storage.GetForeignPrimary\n @others = Builtins.size(@NonLinuxPartitions)\n\n Builtins.y2milestone(\"Other primaries: %1\", @NonLinuxPartitions)\n\n @LinuxPartitions = Storage.GetOtherLinuxPartitions\n @linux = Builtins.size(@LinuxPartitions)\n\n Builtins.y2milestone(\"Other linux parts: %1\", @LinuxPartitions)\n\n @installed_product = Product.name\n @installed_product_version = Product.version\n Ops.set(@ATTR, \"installed_product\", @installed_product)\n Ops.set(@ATTR, \"installed_product_version\", @installed_product_version)\n\n Builtins.y2milestone(\n \"Installing %1 %2\",\n @installed_product,\n @installed_product_version\n )\n Builtins.y2milestone(\"ATTR=%1\", @ATTR)\n\n nil\n end", "def SetUpNodes\n \n @nodes.each do |node|\n\n if node.type==\"R\" or node.type==\"A\" or node.type==\"G\"\n \t\n\tSetMode(node)\n\n\tEnforceChannels(node)\n\t\n\tSetEssid(node) # after this stage, with omf-5.4 the wlan interface is created.\n\t\n\tSetWifiPower(node)\n\n\tSetMtu(node)\n\t\n\tSetIp(node)\n\t\n\tNode(node.id).exec(\"sysctl -w net.ipv4.conf.all.send_redirects=0\")\n \n EnforceRates(node)\n\t\n end\n #final settings\n #self.GetGroupInterface(node, ifn).txqueuelen=\"10\"\n end\n end", "def prepare\n insert_recording_reporter\n link_example_groups\n end", "def load_report(report)\n report.configuration_source(config_source_1)\n report.configuration_source(config_source_2)\n report.configuration_directive(config_directive, config_directive_value)\n report.scan_passed(scanner_1, scanner_1_passed)\n report.scan_info(scanner_1, scanner_1_info_type_1, scanner_1_info_type_1_message_1)\n report.scan_info(scanner_1, scanner_1_info_type_1, scanner_1_info_type_1_message_2)\n report.scan_info(scanner_1, scanner_1_info_type_2, scanner_1_info_type_2_message_1)\n report.scan_stdout(scanner_1, scanner_1_stdout)\n report.scan_info(scanner_2, scanner_1_info_type_1, scanner_1_info_type_1_message_1)\n report.scan_stderr(scanner_2, scanner_2_stderr)\n report.salus_info(salus_info_type_1, salus_info_type_1_message_1)\n report.salus_info(salus_info_type_1, salus_info_type_1_message_2)\n report.salus_info(salus_info_type_2, salus_info_type_2_message_1)\n report.salus_error(salus_error_1_class, salus_error_1_data)\n report.salus_error(salus_error_2_class, salus_error_2_data)\n report.salus_runtime_error(salus_runtime_error_data)\n report\n end", "def initialize(report)\n @report = report\n\n init\n end", "def DefProperties\n defProperty('env', 'ORBIT', \"testbed to be used: ORBIT, NEPTUNE\")\n defProperty('initialChannels', '', \"initial channels to be used on all the nodes\")\n defProperty('mdebug', '', \"set to yes if you want to enable debug (currently only for l2r)\")\n defProperty('stats', '', \"number of seconds between each collection of statistics. 0 to avoid at all collecting statistics.\")\n defProperty('setAp', '', \"IBSS id to set on interfaces in ad-hoc mode: the following command is called: iwconfig <interface> ap <value_given>\")\n defProperty('startTcpdump', 'no', \"set to yes to have Tcpdump started on nodes\")\n defProperty('channels', nil, \"comma separated list of channels to use\")\n defProperty('stabilizeDelay', '', \"time to wait for the network to stabilize before starting the experiment\")\n defProperty('wifiStandard', '', \"wifi standard (e.g. a or n)\")\n end", "def\trouter_init wash_list = Array.new, ap_probes = Array.new\n\t\n\tnil_wash = false\n\tnil_probes = false\n\t\n\tif wash_list.nil?\n\t\tnil_wash = true\n\t\twash_list = Array.new\n\tend\n\t\n\tif ap_probes.nil?\n\t\tnil_probes = true\n\t\tap_probes = Array.new \n\tend\n\t\n\trouters = Array.new\n\tCSV.foreach(\"scan_out.csv\") do |row|\n\t\t\n\t\tif row[13] != nil && row[13] =~ /\\S/ && row[13].length > 0\n\t\t\tr = Router.new\n\t\t\tr.bssid = row[0]\n\t\t\tr.beacons = row[9].to_i\n\t\t\tr.data = row[10].to_i\n\t\t\tr.channel = row[3].to_i\n\t\t\tr.power = row[8].to_i\n\t\t\tr.privacy = row[5]\n\t\t\tessid = String.new\n\t\t\tfor i in 0..row[13].length - 1\n\t\t\t\tessid << row[13][i] if i > 0\n\t\t\tend\n\t\t\tr.essid = essid\n\t\t\t\n\t\t\tif !nil_probes\n\t\t\t\tap_probes.each do |ap|\n\t\t\t\t\tr.probes = ap[\"probes\"] if r.essid == ap[\"essid\"]\n\t\t\t\tend\t\t\n\t\t\tend\n\t\t\t\n\t\t\tif !nil_wash\n\t\t\t\twash_list.each do |ap|\n\t\t\t\t\tif ap.wps == \"No\"\n\t\t\t\t\t\tap.wps = \"Yes\"\n\t\t\t\t\telsif ap.wps == \"Yes\"\n\t\t\t\t\t\tap.wps = \"No\"\n\t\t\t\t\tend\n\t\t\t\t\tr.wps = ap.wps\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\trouters << r\n\t\tend\n\t\t\t\t\n\tend\n\t\n\tsystem(\"clear\")\n\t\n\treturn routers\nend", "def initialize(nid, start_peer_addr = nil, report_converge_time = false)\n super()\n\n @report_join = report_converge_time\n @start_peer_addr = start_peer_addr\n @config = Configuration::instance.node\n @pad = Scratchpad::instance\n\n analysis_setup_aspects() \n\n extend(@config.maintenance_algorithm)\n extend(Maintenance::Opportunistic)\n opportunistic_setup_aspects()\n extend(Maintenance::IndegreeMaintenanceWalker)\n\n @nid = nid || @link_table.random_id\n @link_table = LinkTable.new(self)\n\n log {\"#{@nid} - using #{@config.maintenance_algorithm.to_s}\"}\n\n # Log\n #puts \"New Node #{@nid}\"\n GoSim::Data::DataSet[:node].log(:new, @nid, @addr)\n\n join()\n start_maintenance()\n end", "def probe_set\n attrs = {}\n vars = [\n :probe_type,\n :probe_dns_host,\n :probe_frequency,\n :probe_port,\n :probe_retry_down,\n :probe_retry_up,\n :probe_timeout,\n :probe_control,\n ]\n if vars.any? { |p| @property_flush.key?(p) }\n # At least one var has changed, get all vals from manifest\n vars.each do |p|\n if @resource[p] == :default\n attrs[p] = @nu.send(\"default_#{p}\")\n else\n attrs[p] = @resource[p]\n attrs[p] = PuppetX::Cisco::Utils.bool_sym_to_s(attrs[p])\n end\n end\n end\n return if attrs.empty?\n @nu.probe_set(attrs)\n end", "def set_probe_configuration\n @probe_configuration = ProbeConfiguration.find(params[:id])\n end", "def do_setup \n config = self.config\n host = config['app']['host']\n port = config['app']['port']\n @url_base = \"http://#{host}:#{port}\"\n puts config.inspect\n @pcap_dir = config.fetch 'pcap_dir'\n @index_dir = config.fetch 'index_dir'\n\n # Extract test pcaps and indexes\n FileUtils.rm_rf '/tmp/pcapr_local_test'\n FileUtils.mkdir_p @pcap_dir\n FileUtils.mkdir_p @index_dir\n\n\n # Recreate test database.\n begin\n couch = config['couch']\n RestClient.delete \"#{couch['uri']}/#{couch['database']}\"\n rescue RestClient::ResourceNotFound\n end\n db = @db = PcaprLocal.get_db(config)\n end", "def setup_metrics\n require 'fog'\n @options = NewRelic::Plugin::Config.config.newrelic\n log.debug 'Establishing connection to New Relic'\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def setup_metrics\n end", "def initialize\n self.report = {}\n self.errors = 0\n self.failures = 0\n self.skips = 0\n self.test_count = 0\n self.assertion_count = 0\n self.verbose = false\n self.reporters = []\n\n @_source_cache = {}\n end", "def initialize(report)\n @report = report\n end", "def init_report\n raise if @report.new_record?\n \n # if not a new record, run it and record viewing\n @report.record_viewing\n \n return run_and_handle_errors\n end", "def report; end", "def report; end", "def report; end", "def report; end", "def report; end", "def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n @reportiumClient = create_reportium_client\n end", "def reporters=(_arg0); end", "def reporters=(_arg0); end", "def reporters=(_arg0); end", "def build_report\n # Zero out all the variables we want to return\n lat_min, lat_avg, lat_max, received, sent, outstanding, node_count, mode = nil\n\n # Ruby's error handling is weird, but this catches in the event that the port is incorrect, unresponsive\n begin\n # Ruby sockets! http://www.ruby-doc.org/stdlib/libdoc/socket/rdoc/index.html\n socket = TCPSocket.open(\"localhost\", \"#{option(:port)}\") \n socket.print(\"srvr\")\n stats = socket.read\n\n # Let's set the variables to the outputs, based on regexes\n stats.each_line do |line|\n # This line is smarter, thanks to Dan's regex-fu\n lat_min, lat_avg, lat_max = $1, $2, $3 if line =~ /^Latency min\\/avg\\/max:\\s+(\\d+)+\\/+(\\d+)+\\/+(\\d+)/\n received = $1 if line =~ /^Received:\\s+(\\d+)/\n sent = $1 if line =~ /^Sent:\\s+(\\d+)/\n outstanding = $1 if line =~ /^Outstanding:\\s+(\\d+)/\n node_count = $1 if line =~ /^Node count:\\s+(\\d+)/\n mode = $1 if line =~ /^Mode:\\s+(\\w+)/\n end\n \n # Build the output report\n counter(:received, received.to_i, :per => :minute)\n counter(:sent, sent.to_i, :per => :minute)\n report({:lat_min => lat_min, :lat_avg => lat_avg, :lat_max => lat_max, \n :outstanding => outstanding, :node_count => node_count, :mode => mode }) \n\n rescue Errno::ECONNREFUSED => e\n error(:subject => 'Unable to connect to zookeeper', :body => \"The zookeeper service is not running on the specified port (#{option(:port)}).\\nFull error is:\\n\" + e)\n end\n\n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def generate_report\n self.consume_stdin\n self.data_sorter\n\n @drivers.each do |driver|\n driver.total_duration\n driver.distance_calculator\n driver.average_speed\n end\n\n self.compile_report\n end", "def report_for(nodes, locale_code)\n # This method simply provides a report for a given list of nodes in the desired locale.\n # The locale will be one of the supported ones.\n # Generate the report in a file to be uploaded on web10.\n File.write(\n '/tmp/web_report.txt',\n @platforms_handler.known_platforms.map do |platform|\n \"= Inventory for platform #{platform.repository_path} of type #{platform.platform_type}:\\n\" +\n platform.known_nodes.map do |node|\n \"* Node #{node} (IP: #{@nodes_handler.get_host_ip_of(node)}, Hostname: #{@nodes_handler.get_hostname_of(node)}).\"\n end.join(\"\\n\")\n end.join(\"\\n\")\n )\n # Upload the file on our web10 instance\n system 'scp -o StrictHostKeyChecking=no /tmp/web_report.txt root@web10.hpc_tutorial.org:/root/hello_world.txt'\n out 'Upload successful'\n end", "def initialize(config_filename=nil,log_filename=nil,xslt=nil)\n\t\t\t@servers = []\n\t\t\t@logfile = log_filename\n\t\t\t@xslt = xslt\n\t\t\t@report = MonitorReport.new\n\t\t\t@success = nil\n\t\t\t@email_addr = []\n\t\t\tload_config(config_filename) if config_filename\n\t\tend", "def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end", "def setup\t\t\r\n\t\t@notFoundHeaders = ['Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB7.1; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.30729; .NET4.0C; .NET CLR 3.0.30729; AskTbFWV5/5.12.2.16749; 978803803','Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22 ( .NET CLR 3.5.30729) Swapper 1.0.4','Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Sky Broadband; GTB7.1; SeekmoToolbar 4.8.4; Sky Broadband; Sky Broadband; AskTbBLPV5/5.9.1.14019)']\r\n\r\n\t\t@h1 = Hash.new\r\n\t\t@h1['user-agent'] = 'Mozilla/5.0 (Linux; U; Android 2.2.2; en-us; SCH-M828C[3373773858] Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'\r\n\t\t@h1['x-wap-profile'] = 'http://www-ccpp.tcl-ta.com/files/ALCATEL_one_touch_908.xml'\r\n\t\t@h1['match'] = 'AlcatelOT-908222'\r\n\r\n\t\t@h2 = Hash.new\r\n\t\t@h2['user-agent'] = 'Mozilla/5.0 (Linux; U; Android 2.2.2; en-us; SCH-M828C[3373773858] Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'\r\n\t\t@h2['match'] = 'SamsungSCH-M828C'\r\n\r\n\t\t@h3 = Hash.new\r\n\t\t@h3['x-wap-profile'] = 'http://www-ccpp.tcl-ta.com/files/ALCATEL_one_touch_908.xml'\r\n\t\t@h3['match'] = 'AlcatelOT-90822'\r\n\r\n\t\t@h4 = Hash.new\r\n\t\t@h4['user-agent'] = 'Mozilla/5.0 (Linux; U; Android 2.3.3; es-es; GT-P1000N Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'\r\n\t\t@h4['x-wap-profile'] = 'http://wap.samsungmobile.com/uaprof/GT-P1000.xml'\r\n\t\t@h4['match'] = 'SamsungGT-P1000'\r\n\r\n\t\t@h5 = Hash.new\r\n\t\t@h5['user-agent'] = 'Opera/9.80 (J2ME/MIDP; Opera Mini/5.21076/26.984; U; en) Presto/2.8.119 Version/10.54'\r\n\t\t@h5['match'] = 'GenericOperaMini'\r\n\r\n\t\t@h6 = Hash.new\r\n\t\t@h6['user-agent'] = 'Opera/9.80 (iPhone; Opera Mini/6.1.15738/26.984; U; tr) Presto/2.8.119 Version/10.54'\r\n\t\t@h6['match'] = 'AppleiPhone'\r\n\r\n\t\t@h7 = Hash.new\r\n\t\t@h7['user-agent'] = 'Mozilla/5.0 (Linux; U; Android 2.1-update1; cs-cz; SonyEricssonX10i Build/2.1.B.0.1) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17'\r\n\t\t@h7['match'] = 'SonyEricssonX10I'\r\n\r\n\t\t@nokiaN95 = \"{\\\"general_vendor\\\":\\\"Nokia\\\",\\\"general_model\\\":\\\"N95\\\",\\\"general_platform\\\":\\\"Symbian\\\",\\\"general_platform_version\\\":\\\"9.2\\\",\\\"general_browser\\\":\\\"\\\",\\\"general_browser_version\\\":\\\"\\\",\\\"general_image\\\":\\\"nokian95-1403496370-0.gif\\\",\\\"general_aliases\\\":[],\\\"general_eusar\\\":\\\"0.50\\\",\\\"general_battery\\\":[\\\"Li-Ion 950 mAh\\\",\\\"BL-5F\\\"],\\\"general_type\\\":\\\"Mobile\\\",\\\"general_cpu\\\":[\\\"Dual ARM 11\\\",\\\"332MHz\\\"],\\\"design_formfactor\\\":\\\"Dual Slide\\\",\\\"design_dimensions\\\":\\\"99 x 53 x 21\\\",\\\"design_weight\\\":\\\"120\\\",\\\"design_antenna\\\":\\\"Internal\\\",\\\"design_keyboard\\\":\\\"Numeric\\\",\\\"design_softkeys\\\":\\\"2\\\",\\\"design_sidekeys\\\":[\\\"Volume\\\",\\\"Camera\\\"],\\\"display_type\\\":\\\"TFT\\\",\\\"display_color\\\":\\\"Yes\\\",\\\"display_colors\\\":\\\"16M\\\",\\\"display_size\\\":\\\"2.6\\\\\\\"\\\",\\\"display_x\\\":\\\"240\\\",\\\"display_y\\\":\\\"320\\\",\\\"display_other\\\":[],\\\"memory_internal\\\":[\\\"160MB\\\",\\\"64MB RAM\\\",\\\"256MB ROM\\\"],\\\"memory_slot\\\":[\\\"microSD\\\",\\\"8GB\\\",\\\"128MB\\\"],\\\"network\\\":[\\\"GSM850\\\",\\\"GSM900\\\",\\\"GSM1800\\\",\\\"GSM1900\\\",\\\"UMTS2100\\\",\\\"HSDPA2100\\\",\\\"Infrared\\\",\\\"Bluetooth 2.0\\\",\\\"802.11b\\\",\\\"802.11g\\\",\\\"GPRS Class 10\\\",\\\"EDGE Class 32\\\"],\\\"media_camera\\\":[\\\"5MP\\\",\\\"2592x1944\\\"],\\\"media_secondcamera\\\":[\\\"QVGA\\\"],\\\"media_videocapture\\\":[\\\"VGA@30fps\\\"],\\\"media_videoplayback\\\":[\\\"MPEG4\\\",\\\"H.263\\\",\\\"H.264\\\",\\\"3GPP\\\",\\\"RealVideo 8\\\",\\\"RealVideo 9\\\",\\\"RealVideo 10\\\"],\\\"media_audio\\\":[\\\"MP3\\\",\\\"AAC\\\",\\\"AAC+\\\",\\\"eAAC+\\\",\\\"WMA\\\"],\\\"media_other\\\":[\\\"Auto focus\\\",\\\"Video stabilizer\\\",\\\"Video calling\\\",\\\"Carl Zeiss optics\\\",\\\"LED Flash\\\"],\\\"features\\\":[\\\"Unlimited entries\\\",\\\"Multiple numbers per contact\\\",\\\"Picture ID\\\",\\\"Ring ID\\\",\\\"Calendar\\\",\\\"Alarm\\\",\\\"To-Do\\\",\\\"Document viewer\\\",\\\"Calculator\\\",\\\"Notes\\\",\\\"UPnP\\\",\\\"Computer sync\\\",\\\"VoIP\\\",\\\"Music ringtones (MP3)\\\",\\\"Vibration\\\",\\\"Phone profiles\\\",\\\"Speakerphone\\\",\\\"Accelerometer\\\",\\\"Voice dialing\\\",\\\"Voice commands\\\",\\\"Voice recording\\\",\\\"Push-to-Talk\\\",\\\"SMS\\\",\\\"MMS\\\",\\\"Email\\\",\\\"Instant Messaging\\\",\\\"Stereo FM radio\\\",\\\"Visual radio\\\",\\\"Dual slide design\\\",\\\"Organizer\\\",\\\"Word viewer\\\",\\\"Excel viewer\\\",\\\"PowerPoint viewer\\\",\\\"PDF viewer\\\",\\\"Predictive text input\\\",\\\"Push to talk\\\",\\\"Voice memo\\\",\\\"Games\\\"],\\\"connectors\\\":[\\\"USB\\\",\\\"MiniUSB\\\",\\\"3.5mm Audio\\\",\\\"TV Out\\\"],\\\"general_platform_version_max\\\":\\\"\\\",\\\"general_app\\\":\\\"\\\",\\\"general_app_version\\\":\\\"\\\",\\\"general_language\\\":\\\"\\\",\\\"display_ppi\\\":154,\\\"display_pixel_ratio\\\":\\\"1.0\\\",\\\"benchmark_min\\\":0,\\\"benchmark_max\\\":0,\\\"general_app_category\\\":\\\"\\\"}\"\r\n\t\t@nokiaN9 = \"{\\\"general_vendor\\\":\\\"nokia\\\",\\\"general_model\\\":\\\"n9\\\",\\\"general_platform\\\":\\\"meego\\\",\\\"general_platform_version\\\":\\\"1.2\\\",\\\"general_browser\\\":\\\"\\\",\\\"general_browser_version\\\":\\\"\\\",\\\"general_image\\\":\\\"\\\",\\\"general_aliases\\\":[\\\"nokia n9-00\\\",\\\"nokia n9 lankku\\\"],\\\"general_eusar\\\":\\\"1.16\\\",\\\"general_battery\\\":[\\\"li-ion 1450 mah\\\",\\\"bv-5jw\\\"],\\\"general_type\\\":\\\"mobile\\\",\\\"general_cpu\\\":[\\\"1.0ghz\\\"],\\\"design_formfactor\\\":\\\"bar\\\",\\\"design_dimensions\\\":\\\"116.45 x 61.2 x 12.1\\\",\\\"design_weight\\\":\\\"135\\\",\\\"design_antenna\\\":\\\"internal\\\",\\\"design_keyboard\\\":\\\"screen\\\",\\\"design_softkeys\\\":\\\"\\\",\\\"design_sidekeys\\\":[\\\"volume\\\",\\\"lock\\\"],\\\"display_type\\\":\\\"amoled\\\",\\\"display_color\\\":\\\"yes\\\",\\\"display_colors\\\":\\\"16m\\\",\\\"display_size\\\":\\\"3.9\\\\\\\"\\\",\\\"display_x\\\":\\\"480\\\",\\\"display_y\\\":\\\"854\\\",\\\"display_other\\\":[\\\"capacitive\\\",\\\"touch\\\",\\\"multitouch\\\",\\\"gorilla glass\\\"],\\\"memory_internal\\\":[\\\"16gb\\\",\\\"64gb\\\",\\\"1gb ram\\\"],\\\"memory_slot\\\":[],\\\"network\\\":[\\\"gsm850\\\",\\\"gsm900\\\",\\\"gsm1800\\\",\\\"gsm1900\\\",\\\"umts850\\\",\\\"umts900\\\",\\\"umts1700\\\",\\\"umts2100\\\",\\\"umts1900\\\",\\\"hsdpa850\\\",\\\"hsdpa900\\\",\\\"hsdpa1700\\\",\\\"hsdpa1900\\\",\\\"hsdpa2100\\\",\\\"nfc\\\",\\\"bluetooth 2.1\\\",\\\"802.11a\\\",\\\"802.11b\\\",\\\"802.11g\\\",\\\"802.11n\\\",\\\"gprs class 33\\\",\\\"edge class 33\\\"],\\\"media_camera\\\":[\\\"8mp\\\",\\\"3264x2448\\\"],\\\"media_secondcamera\\\":[\\\"yes\\\"],\\\"media_videocapture\\\":[\\\"720p@30fps\\\"],\\\"media_videoplayback\\\":[\\\"mpeg4\\\",\\\"h.263\\\",\\\"h.264\\\",\\\"xvid\\\",\\\"wmv\\\",\\\"avi\\\",\\\"3gpp\\\",\\\"flash video\\\"],\\\"media_audio\\\":[\\\"mp3\\\",\\\"aac\\\",\\\"eaac\\\",\\\"aac+\\\",\\\"eaac+\\\",\\\"flac\\\",\\\"wma\\\",\\\"wav\\\",\\\"m4a\\\",\\\"amr\\\",\\\"ogg\\\"],\\\"media_other\\\":[\\\"auto focus\\\",\\\"face detection\\\",\\\"exposure control\\\",\\\"white balance\\\",\\\"digital zoom\\\",\\\"geo-tagging\\\",\\\"continuous autofocus in a video\\\",\\\"video calling\\\",\\\"carl zeiss optics\\\",\\\"touch focus\\\",\\\"dual led flash\\\"],\\\"features\\\":[\\\"unlimited entries\\\",\\\"caller groups\\\",\\\"multiple numbers per contact\\\",\\\"search by both first and last name\\\",\\\"picture id\\\",\\\"ring id\\\",\\\"calendar\\\",\\\"alarm\\\",\\\"to-do\\\",\\\"document viewer\\\",\\\"office 2007 viewer\\\",\\\"office 2003 viewer\\\",\\\"pdf viewer\\\",\\\"other\\\",\\\"open document viewer\\\",\\\"calculator\\\",\\\"mass storage device\\\",\\\"usb charging\\\",\\\"computer sync\\\",\\\"ota sync\\\",\\\"music ringtones (mp3)\\\",\\\"polyphonic ringtones\\\",\\\"vibration\\\",\\\"flight mode\\\",\\\"silent mode\\\",\\\"speakerphone\\\",\\\"accelerometer\\\",\\\"compass\\\",\\\"voice recording\\\",\\\"light sensor\\\",\\\"proximity sensor\\\",\\\"sms\\\",\\\"threaded viewer\\\",\\\"mms\\\",\\\"email\\\",\\\"push email\\\",\\\"im\\\",\\\"microsim card support only\\\",\\\"sns integration\\\",\\\"active noise cancellation with dedicated mic\\\",\\\"dolby digital plus\\\",\\\"word viewer\\\",\\\"excel viewer\\\",\\\"powerpoint viewer\\\",\\\"video/photo editor\\\",\\\"voice memo\\\",\\\"voice command\\\",\\\"voice dialing\\\",\\\"predictive text input (swype)\\\",\\\"games\\\"],\\\"connectors\\\":[\\\"usb 2.0\\\",\\\"microusb\\\",\\\"3.5mm audio\\\",\\\"tv out\\\"],\\\"general_language\\\":\\\"\\\",\\\"general_platform_version_max\\\":\\\"\\\",\\\"general_app\\\":\\\"\\\",\\\"general_app_version\\\":\\\"\\\",\\\"display_ppi\\\":251,\\\"display_pixel_ratio\\\":\\\"1.0\\\",\\\"benchmark_min\\\":0,\\\"benchmark_max\\\":0,\\\"general_app_category\\\":\\\"\\\"}\"\r\n\t\t@AlcatelOT_908222 = '{\"general_vendor\":\"Alcatel\",\"general_model\":\"OT-908\",\"general_platform\":\"Android\",\"general_platform_version\":\"2.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"\",\"general_aliases\":[\"Alcatel One Touch 908\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Ion 1300 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"600Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"110 x 57.4 x 12.4\",\"design_weight\":\"120\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[\"Lock/Unlock\",\"Volume\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"262K\",\"display_size\":\"2.8\\\"\",\"display_x\":\"240\",\"display_y\":\"320\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\"],\"memory_internal\":[\"150MB\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\",\"2GB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS900\",\"UMTS2100\",\"HSDPA900\",\"HSDPA2100\",\"Bluetooth 3.0\",\"802.11b\",\"802.11g\",\"802.11n\",\"GPRS Class 12\",\"EDGE Class 12\"],\"media_camera\":[\"2MP\",\"1600x1200\"],\"media_secondcamera\":[],\"media_videocapture\":[\"Yes\"],\"media_videoplayback\":[\"MPEG4\",\"H.263\",\"H.264\"],\"media_audio\":[\"MP3\",\"AAC\",\"AAC+\",\"WMA\"],\"media_other\":[\"Geo-tagging\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Calculator\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Polyphonic ringtones (64 voices)\",\"Vibration\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Compass\",\"Voice recording\",\"SMS\",\"MMS\",\"Email\",\"Push Email\",\"IM\",\"Stereo FM radio with RDS\",\"SNS integration\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Picasa integration\",\"Organizer\",\"Document viewer\",\"Voice memo\",\"Voice dialing\",\"Predictive text input\",\"Games\"],\"connectors\":[\"USB 2.0\",\"microUSB\",\"3.5mm Headphone\"],\"general_language\":\"\"}'\r\n\t\t@SamsungSCH_M828C = '{\"general_vendor\":\"Samsung\",\"general_model\":\"SCH-M828C\",\"general_platform\":\"Android\",\"general_platform_version\":\"2.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"samsungsch-m828c-1355919519-0.jpg\",\"general_aliases\":[\"Samsung Galaxy Prevail\",\"Samsung Galaxy Precedent\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Ion 1500 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"800Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"113 x 57 x 12\",\"design_weight\":\"108\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"262K\",\"display_size\":\"3.2\\\"\",\"display_x\":\"320\",\"display_y\":\"480\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\",\"Touch Buttons\"],\"memory_internal\":[\"117MB\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\",\"2GB\"],\"network\":[\"CDMA800\",\"CDMA1900\",\"Bluetooth 3.0\"],\"media_camera\":[\"2MP\",\"1600x1200\"],\"media_secondcamera\":[],\"media_videocapture\":[\"QVGA\"],\"media_videoplayback\":[\"MP3\",\"WAV\",\"eAAC+\"],\"media_audio\":[\"MP4\",\"H.264\",\"H.263\"],\"media_other\":[\"Geo-tagging\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Document viewer\",\"Calculator\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Polyphonic ringtones\",\"Vibration\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Voice dialing\",\"Voice recording\",\"SMS\",\"Threaded viewer\",\"MMS\",\"Email\",\"Push Email\",\"IM\",\"Organizer\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Picasa integration\",\"Voice memo\",\"Predictive text input (Swype)\",\"Games\"],\"connectors\":[\"USB\",\"microUSB\",\"3.5mm Headphone\"],\"general_language\":\"\"}'\r\n\t\t@AlcatelOT_90822 = '{\"general_vendor\":\"Alcatel\",\"general_model\":\"OT-908\",\"general_platform\":\"Android\",\"general_platform_version\":\"2.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"\",\"general_aliases\":[\"Alcatel One Touch 908\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Ion 1300 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"600Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"110 x 57.4 x 12.4\",\"design_weight\":\"120\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[\"Lock/Unlock\",\"Volume\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"262K\",\"display_size\":\"2.8\\\"\",\"display_x\":\"240\",\"display_y\":\"320\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\"],\"memory_internal\":[\"150MB\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\",\"2GB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS900\",\"UMTS2100\",\"HSDPA900\",\"HSDPA2100\",\"Bluetooth 3.0\",\"802.11b\",\"802.11g\",\"802.11n\",\"GPRS Class 12\",\"EDGE Class 12\"],\"media_camera\":[\"2MP\",\"1600x1200\"],\"media_secondcamera\":[],\"media_videocapture\":[\"Yes\"],\"media_videoplayback\":[\"MPEG4\",\"H.263\",\"H.264\"],\"media_audio\":[\"MP3\",\"AAC\",\"AAC+\",\"WMA\"],\"media_other\":[\"Geo-tagging\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Calculator\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Polyphonic ringtones (64 voices)\",\"Vibration\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Compass\",\"Voice recording\",\"SMS\",\"MMS\",\"Email\",\"Push Email\",\"IM\",\"Stereo FM radio with RDS\",\"SNS integration\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Picasa integration\",\"Organizer\",\"Document viewer\",\"Voice memo\",\"Voice dialing\",\"Predictive text input\",\"Games\"],\"connectors\":[\"USB 2.0\",\"microUSB\",\"3.5mm Headphone\"],\"general_language\":\"\"}'\t\t\r\n\t\t@SamsungGT_P1000 = '{\"general_vendor\":\"Samsung\",\"general_model\":\"GT-P1000\",\"general_platform\":\"Android\",\"general_platform_version\":\"2.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"samsunggt-p1000-1368755043-0.jpg\",\"general_aliases\":[\"Samsung Galaxy Tab\"],\"general_eusar\":\"1.07\",\"general_battery\":[\"Li-Ion 4000 mAh\"],\"general_type\":\"Tablet\",\"general_cpu\":[\"1000Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"190.1 x 120.45 x 11.98\",\"design_weight\":\"380\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"16M\",\"display_size\":\"7\\\"\",\"display_x\":\"1024\",\"display_y\":\"600\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\",\"Touch Buttons\",\"Gorilla Glass\",\"TouchWiz\"],\"memory_internal\":[\"16GB\",\"32GB\",\"512MB RAM\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS900\",\"UMTS1900\",\"UMTS2100\",\"HSDPA900\",\"HSDPA1900\",\"HSDPA2100\",\"Bluetooth 3.0\",\"802.11b\",\"802.11g\",\"802.11n\",\"GPRS\",\"EDGE\"],\"media_camera\":[\"3.15MP\",\"2048x1536\"],\"media_secondcamera\":[\"1.3MP\"],\"media_videocapture\":[\"720x480@30fps\"],\"media_videoplayback\":[\"MPEG4\",\"H.264\",\"DivX\",\"XviD\"],\"media_audio\":[\"MP3\",\"AAC\",\"FLAC\",\"WMA\",\"WAV\",\"AMR\",\"OGG\",\"MIDI\"],\"media_other\":[\"Auto focus\",\"Video calling\",\"Geo-tagging\",\"LED Flash\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Document viewer\",\"Calculator\",\"DLNA\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Voice commands\",\"Voice recording\",\"SMS\",\"Threaded viewer\",\"MMS\",\"Email\",\"Push Mail\",\"IM\",\"RSS\",\"Social networking integration\",\"Full HD video playback\",\"Up to 7h movie playback\",\"Organizer\",\"Image/video editor\",\"Thinkfree Office\",\"Word viewer\",\"Excel viewer\",\"PowerPoint viewer\",\"PDF viewer\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Picasa integration\",\"Readers/Media/Music Hub\",\"Voice memo\",\"Voice dialing\",\"Predictive text input (Swype)\",\"Games\"],\"connectors\":[\"USB\",\"3.5mm Headphone\",\"TV Out\",\"MHL\"],\"general_language\":\"\"}'\t\t\r\n\t\t@GenericOperaMini = '{\"general_vendor\":\"Generic\",\"general_model\":\"Opera Mini 5\",\"general_platform\":\"\",\"general_platform_version\":\"\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"\",\"general_aliases\":[],\"general_eusar\":\"\",\"general_battery\":[],\"general_type\":\"Mobile\",\"general_cpu\":[],\"design_formfactor\":\"\",\"design_dimensions\":\"\",\"design_weight\":\"\",\"design_antenna\":\"\",\"design_keyboard\":\"\",\"design_softkeys\":\"\",\"design_sidekeys\":[],\"display_type\":\"\",\"display_color\":\"\",\"display_colors\":\"\",\"display_size\":\"\",\"display_x\":\"176\",\"display_y\":\"160\",\"display_other\":[],\"memory_internal\":[],\"memory_slot\":[],\"network\":[],\"media_camera\":[],\"media_secondcamera\":[],\"media_videocapture\":[],\"media_videoplayback\":[],\"media_audio\":[],\"media_other\":[],\"features\":[],\"connectors\":[]}'\r\n\t\t@AppleiPhone = '{\"general_vendor\":\"Apple\",\"general_model\":\"iPhone\",\"general_platform\":\"iOS\",\"general_image\":\"apple^iphone.jpg\",\"general_aliases\":[],\"general_eusar\":\"0.97\",\"general_battery\":[\"Li-Ion 1400 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"ARM 11\",\"412Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"115 x 61 x 11.6\",\"design_weight\":\"135\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[\"Volume\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"16M\",\"display_size\":\"3.5\\\"\",\"display_x\":\"320\",\"display_y\":\"480\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\",\"Gorilla Glass\"],\"memory_internal\":[\"4GB\",\"8GB\",\"16GB RAM\"],\"memory_slot\":[],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"Bluetooth 2.0\",\"802.11b\",\"802.11g\",\"GPRS\",\"EDGE\"],\"media_camera\":[\"2MP\",\"1600x1200\"],\"media_secondcamera\":[],\"media_videocapture\":[],\"media_videoplayback\":[\"MPEG4\",\"H.264\"],\"media_audio\":[\"MP3\",\"AAC\",\"WAV\"],\"media_other\":[],\"features\":[\"Unlimited entries\",\"Multiple numbers per contact\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Document viewer\",\"Calculator\",\"Timer\",\"Stopwatch\",\"Computer sync\",\"OTA sync\",\"Polyphonic ringtones\",\"Vibration\",\"Phone profiles\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Accelerometer\",\"Voice recording\",\"Light sensor\",\"Proximity sensor\",\"SMS\",\"Threaded viewer\",\"Email\",\"Google Maps\",\"Audio/video player\",\"Games\"],\"connectors\":[\"USB\",\"3.5mm Headphone\",\"TV Out\"],\"general_platform_version\":\"1.x\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_language\":\"\"}'\r\n\t\t@SonyEricssonX10I = '{\"general_vendor\":\"SonyEricsson\",\"general_model\":\"X10I\",\"general_platform\":\"Android\",\"general_platform_version\":\"1.6\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"\",\"general_aliases\":[\"SonyEricsson Xperia X10\",\"SonyEricsson X10\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Po 1500 mAh\",\"BST-41\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"1000Mhz\"],\"design_formfactor\":\"Bar\",\"design_dimensions\":\"119 x 63 x 13\",\"design_weight\":\"135\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Screen\",\"design_softkeys\":\"\",\"design_sidekeys\":[\"Volume\",\"Camera\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"65K\",\"display_size\":\"4\\\"\",\"display_x\":\"480\",\"display_y\":\"854\",\"display_other\":[\"Capacitive\",\"Touch\",\"Multitouch\"],\"memory_internal\":[\"1GB\",\"384MB RAM\"],\"memory_slot\":[\"microSD\",\"microSDHC\",\"32GB\",\"8GB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS900\",\"UMTS1700\",\"UMTS2100\",\"HSDPA900\",\"HSDPA1700\",\"HSDPA2100\",\"Bluetooth 2.1\",\"802.11b\",\"802.11g\",\"GPRS Class 10\",\"EDGE Class 10\"],\"media_camera\":[\"8MP\",\"3264x2448\"],\"media_secondcamera\":[],\"media_videocapture\":[\"WVGA@30fps\"],\"media_videoplayback\":[\"MPEG4\"],\"media_audio\":[\"MP3\",\"AAC\",\"AAC+\",\"WMA\",\"WAV\"],\"media_other\":[\"Auto focus\",\"Image stabilizer\",\"Video stabilizer\",\"Face detection\",\"Smile detection\",\"Digital zoom\",\"Geo-tagging\",\"Touch focus\",\"LED Flash\"],\"features\":[\"Unlimited entries\",\"Caller groups\",\"Multiple numbers per contact\",\"Search by both first and last name\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"Document viewer\",\"Calculator\",\"World clock\",\"Stopwatch\",\"Notes\",\"Computer sync\",\"OTA sync\",\"Music ringtones (MP3)\",\"Polyphonic ringtones\",\"Vibration\",\"Flight mode\",\"Silent mode\",\"Speakerphone\",\"Voice recording\",\"Accelerometer\",\"Compass\",\"Timescape/Mediascape UI\",\"SMS\",\"Threaded viewer\",\"MMS\",\"Email\",\"Push email\",\"IM\",\"Google Search\",\"Maps\",\"Gmail\",\"YouTube\",\"Google Talk\",\"Facebook and Twitter integration\",\"Voice memo\",\"Games\"],\"connectors\":[\"USB 2.0\",\"microUSB\",\"3.5mm Headphone\"],\"general_language\":\"\"}'\r\n\t\t@Device_10 = '{\"Device\":{\"_id\":\"10\",\"hd_specs\":{\"general_vendor\":\"Samsung\",\"general_model\":\"SPH-A680\",\"general_platform\":\"\",\"general_platform_version\":\"\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"samsungsph-a680-1403617960-0.jpg\",\"general_aliases\":[\"Samsung VM-A680\"],\"general_eusar\":\"\",\"general_battery\":[\"Li-Ion 900 mAh\"],\"general_type\":\"Mobile\",\"general_cpu\":[],\"design_formfactor\":\"Clamshell\",\"design_dimensions\":\"83 x 46 x 24\",\"design_weight\":\"96\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Numeric\",\"design_softkeys\":\"2\",\"design_sidekeys\":[],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"65K\",\"display_size\":\"\",\"display_x\":\"128\",\"display_y\":\"160\",\"display_other\":[\"Second External TFT\"],\"memory_internal\":[],\"memory_slot\":[],\"network\":[\"CDMA800\",\"CDMA1900\",\"AMPS800\"],\"media_camera\":[\"VGA\",\"640x480\"],\"media_secondcamera\":[],\"media_videocapture\":[\"Yes\"],\"media_videoplayback\":[],\"media_audio\":[],\"media_other\":[\"Exposure control\",\"White balance\",\"Multi shot\",\"Self-timer\",\"LED Flash\"],\"features\":[\"300 entries\",\"Multiple numbers per contact\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"To-Do\",\"Calculator\",\"Stopwatch\",\"SMS\",\"T9\",\"Computer sync\",\"Polyphonic ringtones (32 voices)\",\"Vibration\",\"Voice dialing (Speaker independent)\",\"Voice recording\",\"TTY\\/TDD\",\"Games\"],\"connectors\":[\"USB\"]}}}'\r\n\r\n\t\t@headers = Hash.new\r\n\t\t@headers['AlcatelOT-908222'] = @AlcatelOT_908222\r\n\t\t@headers['SamsungSCH-M828C'] = @SamsungSCH_M828C\r\n\t\t@headers['AlcatelOT-90822'] = @AlcatelOT_90822\r\n\t\t@headers['SamsungGT-P1000'] = @SamsungGT_P1000\r\n\t\t@headers['GenericOperaMini'] = @GenericOperaMini\r\n\t\t@headers['AppleiPhone'] = @AppleiPhone\r\n\t\t@headers['SonyEricssonX10I'] = @SonyEricssonX10I\r\n\r\n\t\t@map = Hash['h1'=>@h1, 'h2'=>@h2, 'h3'=>@h3, 'h4'=>@h4, 'h5'=>@h5, 'h6'=>@h6, 'h7'=>@h7]\r\n\r\n\t\t#@vendors = hd_remote(Configuration.get('vendors') + \".json\", \"\")\r\n\t\t#@vendor = JSON.parse(deviceVendors())\r\n\t\t#@model = JSON.parse(deviceModels('Sagem'))\r\n\t\t#@deviceView = JSON.parse(deviceView(\"Nokia\",\"N95\"))\r\n\t\t#@devicewWhatHas = JSON.parse(deviceWhatHas('network', 'CDMA'))\r\n\t\t#@fetchTrees = JSON.parse(siteFetchTrees())\r\n\t\t#@fetchSpecs = JSON.parse(siteFetchSpecs())\r\n\r\n\t\tRails::logger.debug\r\n\tend", "def configure_vna\n count = 0\n\n server_info('vna').each do |sv|\n count += 1\n\n cloudconductor_vnet_edge sv['hostname'] do\n vna_id \"vna#{count}\"\n hwaddr \"02:00:01:01:00:#{format('%02x', count)}\"\n datapath_id \"0x000200010100#{format('%02x', count)}\"\n end\n end\nend", "def initialize\n super\n\n self.readiness_checks = [\n WebExporter::ExporterCheck.new(self),\n Gitlab::HealthChecks::PumaCheck,\n Gitlab::HealthChecks::UnicornCheck\n ]\n end", "def before\n puts \"webtest before\"\n super()\n # Create a browser instance and store it in the browser class variable\n @browser = BrowserFactory.create_browser(@browsertype)\n puts @browser\n puts \"get session ip\"\n @report.remote_url = GridUtilities.get_session_ip(session: @browser)\n puts @report.remote_url\n puts \"done webtest before\"\n end", "def initialize ()\n\t\t\t\t@template_info =\n\t\t\t\t{\n\t\t\t\t\t:name => \"talking_points\",\n\t\t\t\t\t:author => \"hammackj\",\n\t\t\t\t\t:version => \"0.0.2\",\n\t\t\t\t\t:renderer => \"PDF\",\n\t\t\t\t\t:description => \"Generates a Talking Points NessusReport\"\n\t\t\t\t}\n\t\t\tend", "def start\n setup_files\n create_report\nend", "def server_report\n get_resource_list('compute', 'servers', 'servers')\n @server_csv_array = []\n @server_print_array = []\n @resource_id_list.each do |serverid|\n server = rest_get(\"#{@resource_url}/servers/#{serverid}\", @token_id)\n server_array = JSON.parse(server)['server']\n server_name = server_array['name']\n server_lpar_name = server_array['OS-EXT-SRV-ATTR:instance_name']\n server_lpar_state = server_array['OS-EXT-STS:vm_state']\n server_state = server_array['status']\n server_health = server_array['health_status']['health_value']\n server_host = server_array['OS-EXT-SRV-ATTR:host']\n server_addresses = JSON.parse(server)['server']['addresses']\n @server_ipaddress = ''\n unless server_addresses.empty? || server_state != 'ACTIVE'\n @server_ipaddress = server_addresses.values[0][0]['addr']\n end\n server_flavor = server_array['flavor.original_name']\n server_cpus = server_array['cpus']\n server_memory = server_array['memory_mb']\n server_cpu_util = server_array['cpu_utilization']\n server_cpu_mode = server_array['vcpu_mode']\n server_os = server_array['operating_system']\n server_cpu_pool = server_array['shared_proc_pool_name']\n server_cpu_share_weight = server_array['shared_weight']\n server_compat_mode = server_array['desired_compatibility_mode']\n @server_csv_array << [server_name, server_lpar_name, server_lpar_state, server_state, server_host, server_health, @server_ipaddress, server_flavor, server_cpus, \\\n server_memory, server_cpu_util, server_cpu_mode, server_os, server_cpu_pool, server_cpu_share_weight, server_compat_mode]\n @server_print_headers = %w(Host_Name LPAR_Name LPAR_State OS_Status Machine_Name LPAR_Health IPaddress Template CPU Memory CPU_Util CPU_Mode CPU_Pool Share_Weight)\n @server_print_array << [server_name, server_lpar_name, server_lpar_state, server_state, server_host, server_health, @server_ipaddress, server_flavor, server_cpus, \\\n server_memory, server_cpu_util, server_cpu_mode, server_cpu_pool, server_cpu_share_weight]\n end\n end", "def setup\n config = self.config\n host = config['app']['host']\n port = config['app']['port']\n @url_base = \"http://#{host}:#{port}\"\n\n # Extract test pcaps and indexes\n FileUtils.rm_rf '/tmp/pcapr_local_test'\n test_tar = File.join(File.expand_path(File.dirname(__FILE__)), 'test.tgz')\n if File.exist? test_tar\n puts `tar -C /tmp/ -xzf #{test_tar}`\n end\n\n # Recreate test database.\n begin\n couch = config['couch']\n RestClient.delete \"#{couch['uri']}/#{couch['database']}\"\n rescue RestClient::ResourceNotFound\n end\n db = PcaprLocal.get_db config\n\n # And restore it from datafile.\n if self.datafile\n load_docs self.datafile, db\n end\n\n # Start server.\n config_file = Tempfile.new \"config\"\n config_file.print config.to_json\n config_file.flush\n @pid = fork do \n Process.setpgid $$, $$\n exec \"#{PcaprLocal::ROOT}/bin/startpcapr -f #{config_file.path} -d\" \n end\n\n # And wait for it to be ready.\n wait_for_server host, port\n end", "def metric_config\n # This is bad... but I just want things to work!!!!!\n @mount_dir = ::ArchiveRoot\n\tdefault = Defaults.new\n\tdefault.metric_taxonomy= 'hsa'\n\tdefault.metric_instrument_type = 'ORBI'\n\tdefault\n end", "def set_probe\n @probe = Probe.find(params[:id])\n end", "def setup\r\n setup_wiki\r\n setup_host_map\r\n setup_host\r\n end", "def initialize(filename, report=false)\n @binary = []\n @report = []\n @source = filename\n @labels = {}\n @addr = 0 \n assmeble(report)\n generate\n end", "def gen_airspan_config\n # first of all we declare the main switch element\n # and all the sources/sinks that we're going to use\n config = \"switch :: EtherSwitch; \\\nfrom_bs :: FromDevice(#{@bsif}, PROMISC true); \\\nto_bs :: ToDevice(#{@bsif}); \\\nfrom_net :: FromDevice(#{@netif}, PROMISC true); \\\nto_net :: ToDevice(#{@netif}); \"\n\n # then the two filter compounds for whitelisting\n # clients based on their mac address\n filter_first_output = []\n filter_second_output = []\n network_filter = 'filter_from_network :: { '\n bs_filter = 'filter_from_bs :: { '\n i = 1\n @mobiles.each_key do |mac|\n network_filter << \"filter_#{i} :: HostEtherFilter(#{mac}, DROP_OWN false, DROP_OTHER true); \"\n bs_filter << \"filter_#{i} :: HostEtherFilter(#{mac}, DROP_OWN true, DROP_OTHER false); \"\n filter_first_output << \"filter_#{i}[0]\"\n filter_second_output << \"filter_#{i}[1]\"\n i += 1\n end\n network_filter << 'input -> filter_1; '\n network_filter << filter_first_output.join(', ') << ' -> output; '\n network_filter << filter_second_output.join(' -> ') << ' -> Discard; } '\n bs_filter << 'input -> filter_1; '\n bs_filter << filter_second_output.join(', ') << ' -> output; '\n bs_filter << filter_first_output.join(' -> ') + ' -> Discard; } '\n config << network_filter << bs_filter\n\n # finally we plug everything into the switch\n config << \"from_net -> filter_from_network -> [0]switch[0] -> Queue -> to_net; \\\nfrom_bs -> filter_from_bs -> [1]switch[1] -> Queue -> to_bs;\"\n end", "def report_moab_nodes\n self.report('moab_nodes_report')\n end", "def connect_settings\n sanitize_environment_report\n settings = {\n :pid => $$,\n :port => ::TingYun::Agent.config[:port],\n :host => local_host,\n :appName => ::TingYun::Agent.config.app_names,\n :language => 'Ruby',\n :agentVersion => ::TingYun::VERSION::STRING,\n :env => @environment_report,\n :config => ::TingYun::Agent.config.to_collector_hash\n }\n settings\n end", "def probe_sets\n @probe_sets ||= Array.new\n end", "def report_cpu\n self.report('cpu_report')\n end", "def initialize(income_expense_report)\n init_chart_labels(income_expense_report)\n init_graphs(income_expense_report)\n #do_test()\n end", "def initialize(opts)\n resume = opts[:resume]\n source_host_def = define_source(opts[:config])\n source_host_ssh = CLI.spinner(\"Logging in to #{source_host_def[:host]}\") do\n host_login(source_host_def)\n end\n\n profile = CLI.spinner(\"Checking source host\") do\n profile = Profile.new(source_host_ssh)\n profile.build\n profile\n end\n platform = Platform::V2.new(profile[:cpe])\n\n memory = profile[:memory]\n memory_percent = memory[:mem_used].to_f / memory[:total] * 100\n swapping = memory[:swapping?]\n ftag = \"#{CLI.bold}%15s#{CLI.reset}:\"\n hist_mem = profile[:memory_hist][:mem_used]\n\n puts\n puts \"#{CLI.bold}System Information#{CLI.reset}\"\n puts \"#{ftag} #{platform} (#{profile[:cpe]})\" % \"OS\"\n puts \"#{ftag} #{profile[:arch]}\" % \"Arch\"\n puts \"#{ftag} #{profile[:hostname]}\" % \"Hostname\"\n puts\n\n puts \"#{CLI.bold}CPU Statistics#{CLI.reset}\"\n puts \"#{ftag} %d\" % [\"CPU Count\", profile[:cpu][:count]]\n puts \"#{ftag} %d MHz\" % [\"CPU Speed\", profile[:cpu][:speed]]\n puts \n\n puts \"#{CLI.bold}Memory Statistics#{CLI.reset}\"\n puts \"#{ftag} %d MiB\" % [\"Total RAM\", memory[:total]]\n puts \"#{ftag} %d MiB (%2.1f%%)\" % [\"RAM Used\", memory[:mem_used],\n memory_percent]\n puts \"#{ftag} %d MiB\" % [\"Swap Used\", memory[:swap_used]] if swapping\n puts \"#{ftag} %d%%\" % [\"Hist. RAM Used\", hist_mem] unless hist_mem.nil?\n puts \n\n puts \"#{CLI.bold}Hard Disk Statistics#{CLI.reset}\"\n puts \"#{ftag} %2.1f GB\" % [\"Disk Used\", profile[:disk]]\n puts\n\n puts \"#{CLI.bold}System Statistics#{CLI.reset}\"\n puts \"#{ftag} #{profile[:io][:uptime]}\" % \"Uptime\"\n puts \"#{ftag} #{profile[:io][:wait]}\" % \"I/O Wait\"\n puts\n\n puts \"#{CLI.bold}IP Information#{CLI.reset}\"\n puts \"#{ftag} #{profile[:ip][:public].join(', ')}\" % \"Public\"\n puts \"#{ftag} #{profile[:ip][:private].join(', ')}\" % \"Private\"\n puts\n\n puts \"#{CLI.bold}MySQL Databases#{CLI.reset}\"\n puts \"#{ftag} #{profile[:db][:count]}\" % \"Number\"\n puts \"#{ftag} #{profile[:db][:size]}\" % \"Total Size\"\n puts\n\n puts \"#{CLI.bold}Libraries#{CLI.reset}\"\n puts \"#{ftag} #{profile[:lib][:libc]}\" % \"LIBC\"\n puts \"#{ftag} #{profile[:lib][:perl]}\" % \"Perl\"\n puts \"#{ftag} #{profile[:lib][:python]}\" % \"Python\"\n puts \"#{ftag} #{profile[:lib][:ruby]}\" % \"Ruby\"\n puts \"#{ftag} #{profile[:lib][:php]}\" % \"PHP\"\n unless profile.warnings.empty?\n puts\n print CLI.red + CLI.bold\n profile.warnings.each { |warning| puts warning }\n print CLI.reset\n end\n\n source_host_ssh.logout!\n end", "def initialize_WAN_port(media,ipaddress,netmask,gateway)\n @ip = ipaddress.split('.')\n @nm = netmask.split('.')\n @gw = gateway.split('.')\n # click the my network page\n begin\n @ff.link(:href, /actiontec%5Ftopbar%5FHNM/).click\n @ff.link(:href, /actiontec%5Ftopbar%5FHNM/).click\n rescue\n self.msg(rule_name, :error, 'My Network', 'did not reach page')\n return\n end\n\n # click the Network Connections link\n begin\n @ff.link(:text, 'Network Connections').click\n rescue\n self.msg(rule_name, :error, 'NetworkConnections', 'Did not reach Network Connections page')\n return\n end\n \n begin\n if (@ff.text.include? 'Advanced >>')\n @ff.link(:text,'Advanced >>').click\n end\n rescue\n self.msg(rule_name,:error,'initialize BHR2','Wrong with\\'Advanced >>\\'')\n end\n puts ' Initialize WAN ' +media+ \": ip=\"+ipaddress+\" -- netmask=\"+netmask+\" --gw=\"+gateway \n \n #if ( media =~ /ether/)\n case media \n\n\twhen 'ether'\n\t # click the Network Connections link\n\t # click the 'Broadband Connection(Ethernet)' link \n\t begin\n\t\t@ff.link(:href, 'javascript:mimic_button(\\'edit: eth1..\\', 1)').click\n\t rescue\n\t\tself.msg(rule_name, :error, 'WanEthhernet', 'Did not Broadband Connection(Ethernet) Properties page')\n\t\treturn\n\t end\n\t # and then click 'Settings' link\n\t begin\n\t\t@ff.link(:text, 'Settings').click\n\t rescue\n\t\tself.msg(rule_name, :error, 'WanEthhernet', 'Did not Broadband Connection(Ethernet) Properties page')\n\t\treturn\n\t end\n\n\twhen 'coax' \n\t # click the Network Connections link\n\t # click the 'Broadband Connection(Coax)' link\n\t begin\n\t\t@ff.link(:href, 'javascript:mimic_button(\\'edit: clink1..\\', 1)').click\n\t rescue\n\t\tself.msg(rule_name, :error, 'WanCoax', 'Did not reach Broadband Connection(Coax) page')\n\t\treturn\n\t end\n\t # and then click 'Settings' link\n\t begin\n\t\t@ff.link(:text, 'Settings').click\n\t rescue\n\t\tself.msg(rule_name, :error, 'WanCoax', 'Did not Broadband Connection(Coax) Properties page')\n\t\treturn\n\t end\n\n\twhen 'pppoe'\n\t # click the Network Connections link\n\t # click the 'WAN pppoe' link\n\t begin\n\t\t@ff.link(:href, 'javascript:mimic_button(\\'edit: ppp0..\\', 1)').click\n\t rescue\n\t\tself.msg(rule_name, :error, 'PPPoE', 'Did not reach WAN pppoe page')\n\t\treturn\n\t end\n\t if @ff.contains_text('Enable')\n\t\tputs \"==>Process: Enable WAN \"+ media\n\t\t@ff.link(:text, 'Enable').click\n\t\tsleep 1\n\t\t@ff.link(:text, 'Apply').click\n\t\tsleep 2\n\t\t@ff.link(:href, 'javascript:mimic_button(\\'edit: ppp0..\\', 1)').click\n\t else \n\t\tputs \" Warning: WAN \"+media+\" is already enabled\"\n\t end \n\t # and then click 'Settings' link\n\t begin\n\t\t@ff.link(:text, 'Settings').click\n\t rescue\n\t\tself.msg(rule_name, :error, 'PPPoE', 'Did not WAN pppoe Properties page')\n\t\treturn\n\t end\n\n\twhen 'pppoe2' \n\t # click the Network Connections link\n\t # click the 'WAN pppoe 2' link\n\t begin\n\t\t@ff.link(:href, 'javascript:mimic_button(\\'edit: ppp1..\\', 1)').click\n\t rescue\n\t\tself.msg(rule_name, :error, 'PPPoE 2', 'Did not reach WAN pppoe 2 page')\n\t\treturn\n\t end\n\t if @ff.contains_text('Enable')\n\t\tputs \"==>Process: Enable WAN \"+ media\n\t\t@ff.link(:text, 'Enable').click\n\t\tsleep 1\n\t\t@ff.link(:text, 'Apply').click\n\t\tsleep 2\n\t\t@ff.link(:href, 'javascript:mimic_button(\\'edit: ppp1..\\', 1)').click\n\t else \n\t\tputs \" Warning: WAN \"+media+\" is already enabled\"\n\t end \n\t # and then click 'Settings' link\n\t begin\n\t\t@ff.link(:text, 'Settings').click\n\t rescue\n\t\tself.msg(rule_name, :error, 'PPPoE 2', 'Did not reach WAN pppoe 2 Properties page')\n\t\treturn\n\t end\n\telse\n\t self.msg(rule_name, :error, 'Broadband Connection', 'Did not reach WAN interface page')\n\n end # End of case\n \n # do setup \n if @ff.contains_text('Login User Name')\n\t@ff.text_field(:name,'ppp_username').value=('shqa')\n\t#self.msg(rule_name,:info,'Login User Name','Set \\'Login User Name\\' to \\'shqa\\'')\n end\n if @ff.contains_text('Login Password')\n\tif @ff.contains_text('Idle Time Before Hanging Up')\n\t @ff.text_field(:index,5).set('shqa')\n\telse\n\t @ff.text_field(:index,4).set('shqa')\n\tend\t\n\t#self.msg(rule_name,:info,'Login Password','Set \\'Login Password\\' to \\'shqa\\'')\n end\n if @ff.contains_text('Retype Password')\n\tif @ff.contains_text('Idle Time Before Hanging Up')\n\t @ff.text_field(:index,6).set('shqa')\n\telse\n\t @ff.text_field(:index,5).set('shqa')\n\tend\t\n\t#self.msg(rule_name,:info,'Retype Password','Set \\'Retype Password\\' to \\'shqa\\'')\n end\n \n # Internet Protocol = use the following address\n @ff.select_list(:name, 'ip_settings').select_value('1')\n # IP Address\n if @ff.contains_text('IP Address') \n\t@ff.text_field(:name, 'static_ip0').value=(@ip[0])\n\t@ff.text_field(:name, 'static_ip1').value=(@ip[1])\n\t@ff.text_field(:name, 'static_ip2').value=(@ip[2])\n\t@ff.text_field(:name, 'static_ip3').value=(@ip[3])\n end\n # Subnet Mask\n if @ff.text.include?('Subnet Mask') && (not @ff.contains_text('Override Subnet Mask')) \n\t@ff.text_field(:name, 'static_netmask0').value=(@nm[0])\n\t@ff.text_field(:name, 'static_netmask1').value=(@nm[1])\n\t@ff.text_field(:name, 'static_netmask2').value=(@nm[2])\n\t@ff.text_field(:name, 'static_netmask3').value=(@nm[3])\n end\n # Subnet Mask for PPPoE\n if @ff.contains_text('Override Subnet Mask') \n\t@ff.checkbox(:name,'override_subnet_mask').set\n\t@ff.text_field(:name, 'static_netmask_override0').value=(@nm[0])\n\t@ff.text_field(:name, 'static_netmask_override1').value=(@nm[1])\n\t@ff.text_field(:name, 'static_netmask_override2').value=(@nm[2])\n\t@ff.text_field(:name, 'static_netmask_override3').value=(@nm[3])\n end\n # Default Gateway\n if @ff.contains_text('Default Gateway') \n\t@ff.text_field(:name, 'static_gateway0').value=(@gw[0])\n\t@ff.text_field(:name, 'static_gateway1').value=(@gw[1])\n\t@ff.text_field(:name, 'static_gateway2').value=(@gw[2])\n\t@ff.text_field(:name, 'static_gateway3').value=(@gw[3])\n end\n # Primary DNS Server\n if @ff.contains_text('DNS Server') \n\t@ff.select_list(:id, 'dns_option').select_value('0')\n\t@ff.text_field(:name, 'primary_dns0').value=('8')\n\t@ff.text_field(:name, 'primary_dns1').value=('8')\n\t@ff.text_field(:name, 'primary_dns2').value=('8')\n\t@ff.text_field(:name, 'primary_dns3').value=('8')\n end\n @ff.link(:text, 'Apply').click\n @ff.link(:text, 'Apply').click\n end", "def report\n STATE_DATA.each do |state, population_stats|\n state = VirusPredictor.new(state, population_stats[:population_density], population_stats[:population])\n state.virus_effects\n end\nend", "def report_load\n self.report('load_report')\n end", "def report_start_run\n @run_status = Moto::Reporting::RunStatus.new\n @run_status.initialize_run\n\n @listeners.each do |l|\n l.start_run\n end\n end", "def initialize\n envConfigFile = \"#{$ROOT}/../config/envConfig.yml\"\n @envConfig = loadYAMLFile(envConfigFile)\n stepsFile = \"#{$ROOT}/../config/steps.csv\"\n @steps = loadCSVFile(stepsFile)\n pageObjectsFile = \"#{$ROOT}/../config/pageObjects.csv\"\n @pageObjects = loadCSVFile(pageObjectsFile)\n @reportFolder = generatedReportFolder\n @isProcess = true\n @skipCurrentStep = false\n @report = []\n end", "def setup\r\n puts 'starting a new test: ' + self.name\r\n cfT1 = CustomField.new(\"testField\", \"kuku\")\r\n cfT2 = CustomField.new(\"tester\", \"new_tester\")\r\n @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder\r\n\t .withCustomFields(cfT1, cfT2)\r\n .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest')\r\n .build()))\r\n end", "def build_report\n # build cases\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.testsuites {\n testsuite = xml.testsuite {\n @cases.each do |tc|\n testcase = xml.testcase {\n if tc.result_has_message?\n result_type = xml.send(tc.result)\n result_type[:message] = tc.message if tc.message.present?\n end\n\n if tc.system_out.size > 0\n xml.send('system-out') { xml.text tc.system_out.to_s }\n end\n\n if tc.system_err.size > 0\n xml.send('system-err') { xml.text tc.system_err.to_s }\n end\n }\n\n testcase[:name] = tc.name if tc.name.present?\n testcase[:time] = tc.time if tc.time.present?\n\n testcase[:classname] = package if package.present?\n if tc.classname.present?\n if testcase[:classname].present?\n testcase[:classname] = \"#{testcase[:classname]}.#{tc.classname}\"\n else\n testcase[:classname] = tc.classname\n end\n end\n\n end\n }\n\n testsuite[:name] = name if name.present?\n testsuite[:package] = package if package.present?\n }\n end\n\n builder.parent.root.to_xml\n end", "def add_report\n # TODO: should traverse listener queue for conditions and callbacks\n if @rain == :warning or @rain == :imminent\n @site.reports.create\n end\n end", "def initialize(report)\n @report = report\n @document = Prawn::Document.new(:page_layout => :landscape,\n :top_margin => in2pt(1),\n :bottom_margin => in2pt(1))\n\n @document.float { draw_graphs }\n\n draw_header\n draw_summary_table\n end", "def report\r\n\r\n STATE_DATA.each do |key, value|\r\n\r\n initialize(key, value[:population_density], value[:population]) \r\n virus_effects\r\n end\r\n \r\n end", "def report(properties)\n if (@short_report)\n tags = 0\n @stats.tagged_files.each {|line| tags += line[1] }\n known = 0\n @stats.known_exceptions.each {|line| known += line[1] }\n missing = 0\n @stats.missing_tags.each {|line| missing += line[1] }\n\n puts \"Licenser: scanned #{@stats.file_count} files in #{@stats.dir_count} directories.\"\n printf(\" Licensed files: %5d\\n\", tags)\n printf(\" Known exceptions: %5d\\n\", known)\n printf(\" Missing tags: %5d\\n\", missing)\n else\n puts \"Licenser: run completed at #{DateTime.now.strftime(\"%H:%M:%S on %b %d, %Y\")}\"\n puts \" scanned #{@stats.file_count} files in #{@stats.dir_count} directories.\"\n puts\n puts 'Licensed files'\n @stats.tagged_files.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'Known non-licensed files'\n @stats.known_exceptions.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'Missing tags'\n @stats.missing_tags.sort.each do |line|\n printf(\"%5d %s\\n\", line[1], line[0])\n end\n puts\n puts 'properties:'\n properties.each do |key, value|\n puts \" #{key} = #{value}\"\n end\n end\n end", "def set_statisticreport\n @statisticreport = Statisticreport.all\n end", "def report\n require File.join File.expand_path(File.dirname(__FILE__)), \"report\"\n Brakeman::Report.new(self)\n end", "def initialize site_name, options = {}\n @site = site_name\n @export_dir = \".#{site_name}-export-#{$$}\"\n @report = []\n @import = {}\n @stats = {}\n @buffer = options.key?(:buffer) ? !!options[:buffer] : false\n @category_counter = Hash.new(0)\n @section_counter = Hash.new(0)\n end", "def setup \n @pdf_name = \"pdf name\"\n @options = { :pdf_layout => \"reports_layout.pdf.erb\", :pdf_template => \"reports/report.pdf.erb\", \n :render_options => {\n :header_right => 'Page [page] of [toPage]',\n :grayscale => true,\n :page_size => 'Letter'} \n } \n @page = \"<html><head><head><body><b>Hello</b> World</body></html>\" \n \n TooRendermonkey.configure = {\n :uri => \"http://localhost:4567/generate\",\n :api_key => \"835a3161dc4e71b\",\n :hash_key => \"sQQTe93eWcpV4Gr5HDjKUh8vu2aNDOvn3+suH1Tc4P4=\"\n } \n end", "def initialize(opts)\n c = EzNemo.load_config(opts[:config])\n p = c[:probe]\n EzNemo.logger = eval(p[:logger]) if p[:logger].class == String\n logger = EzNemo.logger\n logger.level = eval(p[:log_level]) if p[:log_level].class == String\n logger.debug 'Loading datastore adapter...'\n require \"eznemo/#{c[:datastore][:type]}\"\n require 'eznemo/datastore'\n logger.debug 'Loading monitoring plugins...'\n require 'eznemo/monitor'\n require 'eznemo/monitor/ping'\n end", "def report\n { :genome => @genome.report,\n :polymerase => @polymerase.report }\n end", "def build_report\n puts \"building performance test comparison report...\"\n puts\n\n # load template\n report = File.read(@template_path)\n\n # metrics result\n result_comparison_table = extract_table_from_csv2html_output(@result_comparison_path)\n\n # atop summary\n atop_summary_comparison_table = extract_table_from_csv2html_output(@atop_summary_comparison_path)\n\n # atop detail\n # TODO: enable\n # atop_detail_comparison_table = extract_table(@atop_detail_comparison_path)\n\n # replace tables (do this first since table data may include parameters)\n report = report.gsub(\"$RESULT_COMPARISON_TABLE\", result_comparison_table)\n report = report.gsub(\"$ATOP_SUMMARY_COMPARISON_TABLE\", atop_summary_comparison_table)\n\n # TODO: enable\n # report = report.gsub(\"$ATOP_DETAIL_TABLE\", atop_detail_table)\n\n # replace parameters\n report = replace_parameters(report)\n\n # write report\n puts \"writing report to #{@output_path}\"\n\n File.write(@output_path, report)\nend", "def add_report_xml(parent,servers)\n\t\t\ttest_run = parent.add_element('test_run')\n\t\t\ttr_date = test_run.add_element('date')\n\t\t\ttr_date.add_text Time.now.to_s\n\t\t\ttest_run = add_server_info_to_xml_node(test_run,servers)\n\t\t\tservers.each do |server|\n\t\t\t\tserver_node = test_run.add_element('server')\n\t\t\t\tname = server_node.add_element('name')\n\t\t\t\tname.add_text(server.name)\n\t\t\t\tdomain = server_node.add_element('domain')\n\t\t\t\tdomain.add_text(server.domain)\n\t\t\t\tresult = server_node.add_element('result')\n\t\t\t\tresult.add_text(server.success? ? \"PASSED\" : \"FAILED\")\n\t\t\t\tserver.ports.each do |port|\n\t\t\t\t\tport_node = server_node.add_element('port')\n\t\t\t\t\tnumber = port_node.add_element('number')\n\t\t\t\t\tnumber.add_text(port.number)\n\t\t\t\t\tresult = port_node.add_element('result')\n\t\t\t\t\tresult.add_text(port.success ? \"PASSED\" : \"FAILED\") \n\t\t\t\t\ttime = port_node.add_element('time')\n\t\t\t\t\ttime.add_text(port.time.to_s)\n\t\t\t\tend\n\t\t\t\tserver.urls.each do |url|\n\t\t\t\t\turl_node = server_node.add_element('url')\n\t\t\t\t\turl_url = url_node.add_element('url')\n\t\t\t\t\turl_url.add_text url.url\n\t\t\t\t\tresult = url_node.add_element('result')\n\t\t\t\t\tresult.add_text(url.success ? \"PASSED\" : \"FAILED\")\n\t\t\t\t\ttime = url_node.add_element('time')\n\t\t\t\t\ttime.add_text(url.time.to_s)\n\t\t\t\tend\n\t\t\tend\n\t\t\tparent\n\t\tend", "def propnet_config\n require 'digest/crc16_ccitt'\n\n if @call and @grid and @band and @phg\n \n # We don't want the carrier wandering around while doing\n # propnet.\n @afc=false\n\n # The carrier for North America is 1500hz. Might be (probably\n # is) different for other places. ToDo: fix this so it's\n # user-settable.\n @carrier=1500\n\n # Transmit frequencies are pre-defined by the propnet folks.\n case @band.to_i\n when 80\n @dial_freq=3598200\n @fsym=\"h0\"\n when 40\n @dial_freq=7103200\n @fsym=\"hd\"\n when 30\n @dial_freq=10138900\n @fsym=\"hg\"\n when 20\n @dial_freq=14097000\n @fsym=\"hk\"\n when 17\n @dial_freq=18105000\n @fsym=\"ho\"\n when 15\n @dial_freq=21098000\n @fsym=\"hr\"\n when 12\n @dial_freq=24924000\n @fsym=\"hu\"\n when 10\n @dial_freq=28118800\n @fsym=\"hy\"\n when 6\n @dial_freq=50291000\n @fsym=\"vb\"\n else\n self.error(\"Invalid propnet band: #{band}\")\n return false\n end\n\n # Figure out how long to sleep based on the supplied PHG value.\n if @phg[7,1].to_i==0\n @delay=nil\n else\n @delay=3600/(@phg[7,1].to_i)\n end\n\n # Construct the actual string to be sent. Do some farting around\n # with case to be consistent with what I actually see on the\n # air.\n tmpmsg=\"#{@call.upcase}>#{@fsym}:[#{@grid.downcase}]#{@phg.upcase}/\"\n tmpcrc=(Digest::CRC16CCITT.hexdigest(tmpmsg)).upcase\n # Make sure the CRC is actually four characters long. Doesn't\n # happen often, but it does happen (and I'm guessing won't be\n # accepted by PropNet).\n while tmpcrc.length<4\n tmpcrc=\"0\"+tmpcrc\n end\n @phgtext=\"\\n\\nFOR INFO: http://www.PropNET.org\\n\"+tmpmsg+\"^\"+tmpcrc+\"\\n\"\n end\n end", "def run_report\n comparison_values.tap do |results|\n display_report(results)\n end\n end", "def to_hash\n # Drop the probes into the report\n probe_sets.inject({}) { |report, set|\n report[set.name.to_s] = set.probes.inject({}) { |memo, (_, probe)|\n # round the values to 2 decimal places\n memo[probe.name] = (probe.value.to_f * 100).round().to_f/100\n memo\n }\n report\n }\n end", "def setup\r\n @patient = patients(:patient_00001)\r\n end", "def setup\n @agent = Mechanize.new\n uri = URI.join('file:///', File.absolute_path(\"test/data/view.html\"))\n @page = @agent.get uri.to_s\n @view = PortfolioView.new uri.to_s, @page, \"test mameber\", \"test portfolio\", \"View1\", \"testgroup\"\n\n @analyzer = PortfolioStatistics::DescriptiveViewAnalyzer.new\n end", "def setup\n @agent = ::Instana::Backend::Agent.new\n @tracer = ::Instana::Tracer.new\n @processor = ::Instana::Processor.new\n @secrets = ::Instana::Secrets.new\n @serverless = ::Instana::Serverless.new\n end", "def setup(params)\n\n\t\t@selected = []\n\t\t@driver = []\n\t\t@errors = []\n\t\t# @output_tmp = Dir.mktmpdir\n\n\tend", "def main\n Puppet.initialize_settings\n metrics_collector_setup\n\n output_file = Time.now.utc.strftime('%Y%m%dT%H%M%SZ') + '.json'\n\n @hosts.each do |host|\n timestamp = Time.now\n dataset = { 'timestamp' => timestamp.utc.iso8601, 'servers' => {} }\n hostkey = host.tr('.', '-')\n dataset['servers'][hostkey] = { @metrics_type => {} }\n url = \"https://#{host}:#{@port}\"\n\n # Puma based services use a different status endpoint and have an additional GC endpoint\n if ['ace', 'bolt'].include?(@metrics_type)\n status_url = URI(\"#{url}/admin/status\")\n\n gc_url = URI(\"#{url}/admin/gc_stat\")\n gc_status_output = get_endpoint(gc_url)\n else\n status_url = URI(\"#{url}/status/v1/services?level=debug\")\n end\n\n status_output = get_endpoint(status_url)\n dataset['servers'][hostkey][@metrics_type] = status_output\n dataset['servers'][hostkey][@metrics_type]['gc_stats'] = gc_status_output if gc_status_output\n\n unless @additional_metrics.empty?\n metrics_array = retrieve_additional_metrics(URI(\"#{url}/metrics/v2/read\"), @metrics_type, @additional_metrics)\n\n metrics_array.each do |metric_hash|\n metric_name = metric_hash['name']\n metric_data = metric_hash['data']\n dataset['servers'][hostkey][@metrics_type][metric_name] = metric_data\n end\n end\n\n dataset['servers'][hostkey][@metrics_type]['error'] = @errors\n dataset['servers'][hostkey][@metrics_type]['error_count'] = @errors.count\n dataset['servers'][hostkey][@metrics_type]['api-query-start'] = timestamp.utc.iso8601\n dataset['servers'][hostkey][@metrics_type]['api-query-duration'] = Time.now - timestamp\n\n filtered_dataset = filter_metrics(dataset, @excludes)\n json_dataset = JSON.generate(filtered_dataset)\n\n unless @output_dir.nil?\n Dir.chdir(@output_dir) do\n Dir.mkdir(host) unless File.exist?(host)\n File.open(File.join(host, output_file), 'w') do |file|\n file.write(json_dataset)\n end\n end\n end\n\n next unless @print\n # Use puts so that data gatherd from each host is written to stdout\n # with a newline separator. This enables parsing of multiple datasets\n # as the output stream is in line-delimited JSON form.\n STDOUT.puts(json_dataset)\n end\nrescue StandardError => e\n STDERR.puts \"Failed to collect #{@metrics_type} metrics: #{e.message}\"\n STDERR.puts e.backtrace\n nil\nend" ]
[ "0.6425803", "0.6419864", "0.5954142", "0.5897921", "0.581064", "0.5745984", "0.56856745", "0.56772435", "0.5655869", "0.5655869", "0.5655869", "0.5655869", "0.5655869", "0.5594677", "0.5581363", "0.55392957", "0.5489171", "0.5442158", "0.5414202", "0.54055125", "0.53828084", "0.5362182", "0.53523976", "0.5347986", "0.53415066", "0.53240216", "0.530039", "0.5279704", "0.5279704", "0.5279704", "0.52719593", "0.52603394", "0.52518636", "0.5251486", "0.5251486", "0.5251486", "0.5251486", "0.5251486", "0.52477777", "0.5223799", "0.5223799", "0.5223799", "0.5190637", "0.5150388", "0.5150388", "0.5150388", "0.5150388", "0.5150388", "0.5150388", "0.5150388", "0.51489097", "0.5147956", "0.51464003", "0.51384544", "0.51320684", "0.51304233", "0.5127866", "0.5126189", "0.51056033", "0.50875074", "0.50837874", "0.5081103", "0.5041057", "0.50077444", "0.5004693", "0.4999996", "0.4999494", "0.49941358", "0.49916363", "0.4991615", "0.49705556", "0.49668926", "0.49652395", "0.49638885", "0.49605024", "0.49588233", "0.49430227", "0.4942172", "0.49401057", "0.4933452", "0.49320334", "0.4902293", "0.48973683", "0.4896486", "0.48964646", "0.48963007", "0.48876044", "0.48839396", "0.4881603", "0.48807353", "0.4872318", "0.48715404", "0.486887", "0.4865568", "0.48508114", "0.4848798", "0.48485032", "0.48484698", "0.484739", "0.48471883" ]
0.7133374
0
GET /time_gliders/1 GET /time_gliders/1.xml
def show @time_glider = TimeGlider.find(params[:id]) respond_to do |format| format.html # show.html.erb # we do not want to use this # format.json { render :json => @time_glider } # because we want to change the json output of a few fields format.json # show.json.erb format.xml { render :xml => @time_glider } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @time_glider = TimeGlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_glider }\n end\n end", "def stats\n @stats = time_data Gig.all\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(Gig.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(Gig.all, :hash) }\n end\n end", "def galtable\n params[:heute] = Time.now.strftime('%b/%d')\n @galeries = Galerie.all\n\n respond_to do |format|\n format.html # galtable.html.erb\n format.xml { render :xml => @galeries }\n end\n end", "def create\n @time_glider = TimeGlider.new(params[:time_glider])\n\n respond_to do |format|\n if @time_glider.save\n format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully created.') }\n format.xml { render :xml => @time_glider, :status => :created, :location => @time_glider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activities_xml(time = nil, filter = nil)\n timestamp = time ? time.to_gnip_bucket_id : 'current'\n if filter\n _name, _endpoint = filter.name, \"#{self.uri}/#{filter.path}/activity/#{timestamp}.xml\"\n else\n _name, _endpoint = self.name, \"#{self.uri}/activity/#{timestamp}.xml\"\n end\n log_action(_name, time, timestamp)\n response, activities_xml = fetch(_endpoint)\n end", "def show\n @daily_grr = DailyGrr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def index\n @countdowns = Countdown.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countdowns }\n end\n end", "def stats\n @stats = time_data SolarReading.all\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(SolarReading.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(SolarReading.all, :hash) }\n end\n end", "def track\n url = Rails.env.development? ? \"http://localhost:8000/stat\" : \"http://stats.universit.as/stat\"\n RestClient.get(url, :params => {\n :ip => request.remote_ip,\n :title => request.referrer\n })\n render :js => ''\n end", "def show\n @timing = Timing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @timing }\n end\n end", "def index\n nb_days = 7\n start = nb_days.days.ago \n dates = [start.to_f] + Delay.all(:conditions => {:created_at => start..0.days.ago, :hospital_id => get_hospital.id}).map{|d| d.created_at.to_f}.reverse + [0.days.ago.to_f] # We add to additional nodes at the beginning and the end of the timespan\n dates2 = dates.map{|d| (d-start.to_f)/20}\n delays = Delay.all(:conditions => {:created_at => start..0.days.ago, :hospital_id => get_hospital.id}, :select => :minutes).map(&:minutes).reverse\n if delays.empty?\n delays2 = [0.0, 0.1]\n else\n delays2 = [delays[0]] + delays + [delays[-1]]\n end\n dates2 = dates2.collect { |d| d * delays2.max / dates2.max if dates2.max > 0 }\n data = [dates2, delays2]\n wdays = ['Sun', 'Sat', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n (0..Date.today.wday+1).each do |i|\n d = wdays.shift\n wdays.push(d)\n end\n @graph_url = Gchart.line_xy(:size => '500x300', \n :title => \"Last weeks waiting time\",\n :data => data,\n :axis_with_label => 'x,y',\n :axis_labels => [wdays.join('|')]\n )\n # We need some extra parameters for the graph axis that is not supported by Gchart...\n @graph_url = @graph_url + \"&chxt=x,y\"\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @delays }\n end\n end", "def index\n @gp40s = Gp40.all\n @gp40s = duration(@gp40s, params)\n end", "def index\n ts_bis = DateTime.parse(params[:ts_bis])\n if params.has_key?(:objekt_id)\n objekt_id = params[:objekt_id].to_i\n else\n objekt_id = nil\n end\n if params.has_key?(:ts_von)\n ts_von = DateTime.parse(params[:ts_von])\n @checklisten_vorlages = ChecklistenVorlage.where(:objekt_id => objekt_id).where(\"updated_at > ? and updated_at <= ?\", ts_von, ts_bis)\n else\n @checklisten_vorlages = ChecklistenVorlage.where(:objekt_id => objekt_id).where(\"updated_at <= ?\", ts_bis)\n end\n proc = Proc.new{|options, record| options[:builder].tag!('ts', record.updated_at.iso8601(9)) }\n respond_to do |format|\n format.html # index.html.erb\n format.xml {render :xml => @checklisten_vorlages, :except => [:updated_at, :created_at], :dasherize => false, root:\"checklisten_vorlages\", :procs => [proc], :include => [:checklisten_eintrags]}\n end\n end", "def index\n @ticket_times = TicketTime.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_times }\n end\n end", "def stats\n year = Analytic.where(\"created_at > ?\", Time.now - 1.year)\n @stats = time_data year\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(year, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(year, :hash) }\n end\n end", "def index\n @datetimes = current_user.datetimes.where [\"DATE(start) = DATE(?)\", Time.now]\n\n if params[:new_tracking_info]\n @desired_activity_name = params[:new_tracking_info][:activity_name]\n end\n\n self.prepare_tracking_data\n\n @tags = current_user.datetimes.tag_counts_on(:tags)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datetimes }\n end\n end", "def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end", "def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end", "def index\n @timeslots = current_event.timeslots.find(:all, :order=>'slot_date, start_time')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @timeslots }\n end\n end", "def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end", "def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end", "def show\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timechart }\n end\n end", "def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end", "def stats\n @stats = time_data Episode.all\n @cloud = word_cloud Episode.pluck(:title)\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(Episode.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(Episode.all, :hash) }\n end\n end", "def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end", "def index\n\t\tgon.metrics = []\n\n\t\t# Get the parameters from the UI, or use defaults.\n\t\tstart = to_epoch(get_param(:start))\n\t\tstop = to_epoch(get_param(:stop))\n\n\t\tstep = params[:step] || (stop - start).to_i / UI_DEFAULTS[:points]\n\t\tgon.start, gon.stop, gon.step = start, stop, step\n\n\t\tgon.clock = params[:clock] || UI_DEFAULTS[:clock]\n\n\t\tbase = obl_qs(:stop, {url: obl_qs(:start) })\n\t\tbase = chg_qs(:time, \"absolute\", {url: base})\n\n\t\tgon.base = base\n\t\n\n\t\t# Get all the metrics, and build up a javascript blob with their useful bits\n\t\tnew_metrics = que_qs(:metric)\n\t\tgon.metrics = []\n\t\t@metrics = []\n\n\t\tnew_metrics.each_with_index do |metric,i|\n\t\t\tm = Metric.new(metric)\n\t\t\t@metrics << m\n\n\t\t\tg = {}\n\t\t\tg[:id] = m.id\n\t\t\tg[:feed_base] = m.feed\n\t\t\tg[:live] = m.live?\n\t\t\tg[:title] = m.titleize\n\t\t\tg[:metadata] = m.metadata\n\t\t\tg[:sourceURL] = m.get_metric_url start, stop, step\n\t\t\tg[:removeURL] = \"javascript:removechart(\\\"#{metric}\\\", \\\"#{rem_qs(:metric, metric)}\\\")\"\n\t\t #\tg[:counter] = true if m.counter? ##TODO Incorporate vaultaire based metadata\n\n\t\t\tgon.metrics << g\n\t\tend\n\n\t\t@gon = gon\n\n\t\t# Validate the times before continuing on\n\t\tif stop < start\n\t\t\tflash.now[:error] = \"Start time has to be before stop time\"\n\t\t\treturn\n\t\tend\n\n\t\tif stop - start < UI_DEFAULTS[:points]\n\t\t\tflash.now[:error] = \"Time range must be at least #{UI_DEFAULTS[:points]} seconds apart.\"\n\t\t\treturn\n\t\tend\n\n\t\t# Everything should be ok from here on out\n\t\t@graph = get_param(:graph)\n\tend", "def traffic id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/traffic?date=#{date}\"\n fetch uri\n end", "def stats\n @stats = time_data Track.all\n @cloud = word_cloud Track.pluck(:artist), split: false, limit: 60\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(Track.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(Track.all, :hash) }\n end\n end", "def new\n @timing = Timing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timing }\n end\n end", "def trends_available\n get(\"/trends/available.json\")\n end", "def show\n @timeband = Timeband.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @timeband }\n end\n end", "def time(&blk)\n if block_given?\n websocket.subscribe :time, &blk\n else\n http.get :time\n end\n end", "def time\n request :public, :get, :time\n end", "def show\n @service = Service.find(params[:id], :conditions => conditions)\n @alerts = Alert.all({\n :conditions => [\"service_id = ? and severity <> 0\", @service.id]\n })\n params[:date] = Date.today.to_s if params[:date].blank?\n @date_range = parse_date_range params[:date]\n @metric = @service.metric \n now = Time.now\n #now = Time.parse(\"2010-6-10 12:00\") #for test\n d = @metric.history({:start => now - 24*60*60, :finish => now})\n if d.size > 0\n @history_views = @service.history_views\n @history_views.each do |view|\n view.data = d\n end\n end\n d = @metric.current \n if d\n @default_view = @service.default_view\n @default_view.data = d if @default_view\n @current_views = @service.views\n @current_views.each do |view|\n view.data = d\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { \n #render :xml => @service.to_xml(:dasherize => false)\n }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @datetime }\n end\n end", "def show\r\n SignalStrength.switch_data(params[:connection], \"daily\")\r\n #@signal_strengths = SignalStrength.find(params[:id])\r\n #@signal_strengths = SignalStrength.find(:all, :origin=>'94531', :within=>10)\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @signal_strengths.to_xml(:dasherize => false) }\r\n end\r\n end", "def index\n @best_laps = BestLap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @best_laps }\n end\n end", "def workload\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html # workload.html.erb\n format.xml { render :xml => @sprint }\n end\n end", "def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def stod2gull\n Apis.client.get('/tv/stod2gull')\n end", "def show\n\t@tag = params[:id]\n @availabilities = Availability.find(:all, :order => :start_time, :include => :tags,\n :conditions => ['tags.tag = :tag and end_time > :end_time',\n {:tag => @tag,:end_time => Time.now.utc}])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @availabilities.to_xml(Availability.render_args)}\n format.js { render :json => @availabilities.to_json(Availability.render_args)}\n format.atom \n end\n end", "def index\n @gauge_graphs = GaugeGraph.all\n end", "def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend", "def index\n cookies[:default_view] = { :value => 'list', :expires => 6.month.from_now }\n @rips = Rip.get(params)\n respond_to do |format|\n format.html\n format.rss\n format.xml { render :xml => @rips.to_xml }\n format.js { render :partial => 'rip', :collection => @rips }\n format.json { render :json => @rips.to_json }\n end\n end", "def request_timestamp(cli,request)\n\t\tprint_status(\"#{cli.peerhost} - #{current_time} - [HTTP GET] - #{request.uri}\")\n\tend", "def time_url\n base_url + time_path + build_query(time_params)\n end", "def index\n if params[:start_time]\n @rough_movs = RoughMovement.where(\"time >= ?\", params[:start_time].to_f).order(\"time\")\n else\n @rough_movs = RoughMovement.order(\"time\")\n end\n\n @rough_movs = @rough_movs.each_slice([@rough_movs.size, 2000].max/2000).map(&:first)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @rough_movs }\n format.json { render :content_type => 'application/json' }\n end\n end", "def index\n @shooting_ranges = ShootingRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_ranges }\n end\n end", "def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end", "def query_times_graphs\n controller = params[:controller_name]\n action = params[:action_name]\n data = redis(logger: true).zrangebyscore(\"request_timings/total/by_action/#{controller}##{action}\",\n 1.month.ago.to_i, '+inf',\n with_scores: true)\n .map { |y, x| [x.to_f, y.to_f] }\n throw 'No Data' if data.nil? || data.empty?\n smoothed = moving_avg(data)\n final = (params[:raw].present? ? data : smoothed).map { |x, y| [Time.at(x.to_i).to_datetime, y] }\n render json: [\n { name: 'Timings', data: final }\n ]\n end", "def votd\n require 'rss'\n\n votd = RSS::Parser.parse('https://www.biblegateway.com/usage/votd/rss/votd.rdf?31', false)\n\n render json: votd\n end", "def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end", "def create_uri\n \"http://www.wunderground.com/\" +\n \"weatherstation/WXDailyHistory.asp?\" + \n \"ID=#{weather_station.callsign}&\" +\n \"graphspan=month&\" + \n \"month=#{start_time.month}&day=1&year=#{start_time.year}\" +\n \"&format=1\"\n end", "def index\n @timecards = Timecard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @timecards }\n end\n end", "def destroy\n @time_glider = TimeGlider.find(params[:id])\n @time_glider.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_gliders_url) }\n format.xml { head :ok }\n end\n end", "def show\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_gap }\n end\n end", "def show\n @minute = Minute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @minute }\n end\n end", "def show\n redirect_to gauge_graphs_url\n end", "def show\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_track }\n end\n end", "def show\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @time_slot }\n end\n end", "def index\n @travel_claim_mileage_rates = TravelClaimMileageRate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @travel_claim_mileage_rates }\n end\n end", "def stats\n request :get, \"_stats\"\n end", "def stats\n request :get, \"_stats\"\n end", "def api_url\n @instant = (1..4).to_a if @instant.empty?\n i = @instant.shift\n return \"http://#{i}-instant.okcupid.com/instantevents?random=#{rand}&server_gmt=#{Time.now.to_i}\"\n end", "def index\n @updates = @vehicle.updates.page(params[:page]).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @updates }\n end\n end", "def update\n @time_glider = TimeGlider.find(params[:id])\n\n respond_to do |format|\n if @time_glider.update_attributes(params[:time_glider])\n format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n render json: {time: Time.now}\n end", "def take_two\n response.headers[\"Content-Type\"] = 'text/xml'\n\n take_two = Program.find_by_slug!('take-two')\n @segments = take_two.episodes.published.first.segments.first(2)\n render template: 'feeds/take_two.xml.builder', format: :xml\n end", "def index\n @nanos = Nano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @nanos.to_xml }\n end\n end", "def show\n render json: @timer\n end", "def new\n @timeband = Timeband.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeband }\n end\n end", "def index\n @tickers = Ticker.find(:all, :order => \"updated_at desc\")\n render :template => 'tickers/index'\n# respond_to do |format|\n# format.html # index.html.erb\n# format.xml { render :xml => @tickers }\n# end\n end", "def index\n @ganglia_graphs = GangliaGraph.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganglia_graphs }\n end\n end", "def make_request_get_response_trend_availible\n @path_trend_availible = '/1.1/trends/available.json'\n @address_trend_availible = URI(\"#{@baseurl}#{@path_trend_availible}\")\n # Set up HTTP. Need ssL to make the connection\n @request_trend_availible = Net::HTTP::Get.new @address_trend_availible.request_uri\n @http = Net::HTTP.new @address_trend_availible.host, @address_trend_availible.port\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # Issue the request.\n @request_trend_availible.oauth! @http, @consumer_key_country, @access_token_country\n @http.start\n @response_trend_availible = @http.request @request_trend_availible\n @response_trend_availible\n end", "def index\n @timers = Timer.all\n @load_push = true\n\n @write_right = userCould :timer\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timers }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @measurement }\n end\n end", "def available_trends\n get(\"/trends/available.json\")\n end", "def test_velocity_metric\n get '/velocity/meter/1/meter'\n assert_equal 200, last_response.status\n end", "def index\n if request.format.json?\n prepare_schichts_json\n else\n prepare_schichts_xml\n end\n # proc = Proc.new{|options, record| options[:builder].tag!('ts', record.updated_at.iso8601(9)) }\n respond_to do |format|\n format.html # index.html.erb\n format.xml #{render :xml => @schichts, :except => [:updated_at, :created_at], :dasherize => false, root:\"schichts\", :procs => [proc]}\n format.json\n end\n end", "def index\n @time_frames = TimeFrame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_frames }\n end\n end", "def galltm\n params[:zz] = -1\n params[:heute] = Time.now.strftime('%b/%d')\n\n if params[:gal_id] \n nil\n else \n params[:gal_id] = 1\n end\n\n @galeries = Galerie.limit(8).order(\"date_galerie desc\")\n @pictures = Picture.where([\"galerie_id = ?\", (params[:gal_id])]).order(\"date_orig\")\n respond_to do |format|\n format.html # galtable.html.erb\n format.xml { render :xml => @galeries }\n end\n \n end", "def request_trending\n base_uri = 'http://localhost:8888/developers'\n response = RestClient.get( base_uri, { params: { language: cleaned_query_param } } )\n @data = JSON.parse(response) \n end", "def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "def show\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timer }\n end\n end", "def index\n @delivery_times = DeliveryTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @delivery_times }\n end\n end", "def index\n p request.inspect\n push_timer :stupid_sleep\n sleep 2\n pop_timer\n\n <<EOF\n<h2>push_timer/pop_timer methods</h2>\nThis example uses push_timer/pop_timer methods\n\n<pre>\n def index\n push_timer :stupid_sleep\n sleep 2\n pop_timer\n end\n</pre>\n\nIf you run 'fn.rb' (bundle exec fn.rb run), you can check this <a href='http://localhost:4242' target='_blank'>link</a> to get the Fnordmetric dashboard.\n<p />\nSorry for the wait... but congratulations won a vanilla Icecream <a href='/icecream'>Icecream</a> ! May be you prefer <a href='/icecream/strawberry'>strawberry</a>. ?\nEOF\n end", "def index\n @visit_stats = VisitStat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @visit_stats }\n end\n end", "def show\n @drop_off_location_time = DropOffLocationTime.find(params[:id])\n @stylesheet = \"edit_drop_off_times\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @drop_off_location_time }\n end\n end", "def index\n @teaching_routes = TeachingRoute.all\n @last_updated = TeachingRoute.first ? \"last updated #{TeachingRoute.first.last_update}\" : 'never updated'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teaching_routes }\n end\n end", "def show\n @eventtime = Eventtime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @eventtime }\n end\n end", "def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end", "def index\n @games = Game.find(:all, :order => 'datetime ASC', :conditions => 'round_number > 1')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end", "def show\n @timeslot = current_event.timeslots.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @timeslot }\n end\n end", "def show\n @ztime = Ztime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ztime }\n end\n end", "def technology id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/technology?date=#{date}\"\n fetch uri\n end", "def index\n @shots = Shot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shots }\n end\n end", "def index\n $twiGetId = Array.new\n @trends = Trend.all\n end", "def stats\n @stats = time_data MonzoTransaction.all\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(MonzoTransaction.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(MonzoTransaction.all, :hash) }\n end\n end", "def index\n @graphics = Graphic.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @graphics }\n end\n end" ]
[ "0.64867616", "0.5644373", "0.55338675", "0.5528827", "0.5517569", "0.5443626", "0.5425797", "0.5420775", "0.53689706", "0.53624874", "0.5358312", "0.5348056", "0.5347751", "0.53411824", "0.5337852", "0.53374267", "0.5333507", "0.53092635", "0.5306529", "0.5298561", "0.5282503", "0.52810055", "0.5280396", "0.5279297", "0.52764714", "0.5276233", "0.52545965", "0.52497023", "0.52404416", "0.5239949", "0.5236758", "0.5235755", "0.5229089", "0.5216905", "0.5211677", "0.5211411", "0.52109516", "0.5209634", "0.5203039", "0.5200226", "0.5197206", "0.5189093", "0.5184904", "0.51811856", "0.51805466", "0.5179615", "0.5178706", "0.5170682", "0.51701194", "0.51698357", "0.5164656", "0.51615584", "0.51554656", "0.51380104", "0.5123356", "0.5121396", "0.5117137", "0.5102637", "0.5098805", "0.50887406", "0.507808", "0.5074358", "0.5074358", "0.5074083", "0.50701785", "0.5062862", "0.50622505", "0.50622183", "0.50581837", "0.50533676", "0.50472367", "0.5043312", "0.5039708", "0.50396025", "0.5039434", "0.5039382", "0.5038505", "0.50368667", "0.5031794", "0.50290465", "0.50273806", "0.5024307", "0.50196993", "0.50196993", "0.5017091", "0.50165206", "0.50121325", "0.50110215", "0.50014764", "0.4998367", "0.49975052", "0.4991724", "0.49906775", "0.4988784", "0.498585", "0.49790943", "0.49730894", "0.496619", "0.49637163", "0.49591047" ]
0.59750324
1
GET /time_gliders/new GET /time_gliders/new.xml
def new @time_glider = TimeGlider.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @time_glider } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @time_glider = TimeGlider.new(params[:time_glider])\n\n respond_to do |format|\n if @time_glider.save\n format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully created.') }\n format.xml { render :xml => @time_glider, :status => :created, :location => @time_glider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @timing = Timing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timing }\n end\n end", "def new\n @datetime = Datetime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datetime }\n end\n end", "def new\n @timeslot = current_event.timeslots.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeslot }\n end\n end", "def new\n @time_slot = TimeSlot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_slot }\n end\n end", "def new\n @minute = Minute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @minute }\n end\n end", "def new\n @time_task = TimeTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_task }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @timeband = Timeband.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeband }\n end\n end", "def new\n @countdown = Countdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countdown }\n end\n end", "def new\n @time_track = TimeTrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_track }\n end\n end", "def new\n @time_gap = TimeGap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_gap }\n end\n end", "def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end", "def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end", "def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end", "def new\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def new\n @polling_station = PollingStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @polling_station }\n end\n end", "def new\n @time_log = TimeLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_log }\n end\n end", "def new\n @ztime = Ztime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ztime }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @get_started_page }\n end\n end", "def new\n @sleep_log = SleepLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sleep_log }\n end\n end", "def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def new\n @travel_log = TravelLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel_log }\n end\n end", "def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @press }\n end\n end", "def new\n @course_time = CourseTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @course_time }\n end\n end", "def new\n @wait_time = WaitTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wait_time }\n end\n end", "def new\n @countdown_ipp = CountdownIpp.new_with_default_times\n @channels = Channel.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countdown_ipp }\n end\n end", "def new\n @lotto_type = LottoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lotto_type }\n end\n end", "def new\n @stylesheet = \"edit_drop_off_times\"\n @drop_off_location = DropOffLocation.find(params[:drop_off_location_id])\n @drop_off_location_time = DropOffLocationTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drop_off_location_time }\n end\n end", "def new\n @time_point = TimePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_point }\n end\n end", "def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tv }\n end\n end", "def new\n @timeline = Timeline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeline }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end", "def new\n @timeunit = Timeunit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeunit }\n end\n end", "def new\n @last_hour = LastHour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @last_hour }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_frame }\n end\n end", "def new\n @event = Event.find(params[:event_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eventtime }\n end\n end", "def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track }\n end\n end", "def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end", "def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end", "def new\n @slitting = Slitting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slitting }\n end\n end", "def new\n @trace = Trace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trace }\n end\n end", "def new\n @lyric = Lyric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @threat = Threat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @threat }\n end\n end", "def new\n @travel_datum = TravelDatum.new\n @travel_datum.start_time = Time.now.beginning_of_day + 9.hours\n @travel_datum.end_of_business_time = Time.now.beginning_of_day+17.hours\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @travel_datum }\n format.xml { render :xml => @travel_data }\n end\n end", "def new\n @delay = Delay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @delay }\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 @meteorological_data = MeteorologicalData.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @meteorological_data }\n end\n end", "def new\n @sticker = Sticker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sticker }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end", "def new\n @company_minute = CompanyMinute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company_minute }\n end\n end", "def new\n @service_learning_position = ServiceLearningPosition.new\n @service_learning_position.organization_quarter_id = @organization_quarter.id\n @service_learning_position.times.build\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_learning_position }\n end\n end", "def new\n @tourpoint = Tourpoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tourpoint }\n end\n end", "def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end", "def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @my_time_trial = MyTimeTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def new\n @tick_track = TickTrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tick_track }\n end\n end", "def new\n @breadcrumb = 'create'\n @time_record = TimeRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_record }\n end\n end", "def new\n @delivery_time = DeliveryTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @delivery_time }\n end\n end", "def new\n @goaltemplate = Goaltemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goaltemplate }\n end\n end", "def new\n @best_lap = BestLap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @best_lap }\n end\n end", "def new\n @event = Event.new(:time_slots => @conference.default_timeslots)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def new\n @venture = Venture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @venture }\n end\n end", "def new\n @groundwater_control = GroundwaterControl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @groundwater_control }\n end\n end", "def new\n @schedule = Schedule.new\n @apps = App.find(:all)\n @tags = Contact.get_tags\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @measurement }\n end\n end", "def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @measurement }\n end\n end", "def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end", "def new\n @rss_slide = RssSlide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rss_slide }\n end\n end", "def new\n @listener = Listener.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listener }\n end\n end", "def new\n @lr40 = Lr40.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr40 }\n end\n end", "def new\n @gauge = Gauge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gauge }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end", "def new\n @shot = Shot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shot }\n end\n end", "def new\n @shooting_range = ShootingRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shooting_range }\n end\n end", "def new\n @interval = Interval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interval }\n end\n end", "def new\n @outcome_timepoint = OutcomeTimepoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @outcome_timepoint }\n end\n end", "def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end", "def new\n @pageview = Pageview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pageview }\n end\n end", "def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end", "def new\n @st_pi = StPi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @st_pi }\n end\n end", "def new\n @planned_time = PlannedTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planned_time }\n end\n end", "def new\n @scratch = Scratch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scratch }\n end\n end", "def new\n @rute = Rute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rute }\n end\n end", "def new\n @lr70 = Lr70.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr70 }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @gear = Gear.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gear }\n end\n end", "def new\n @tour = Tour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tour }\n end\n end", "def new\n @planning_time = PlanningTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planning_time }\n end\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end" ]
[ "0.6850216", "0.67855483", "0.6704627", "0.6657454", "0.66228974", "0.6522187", "0.6490332", "0.64871544", "0.64809793", "0.64335716", "0.64267844", "0.6410622", "0.6407993", "0.6407993", "0.6391954", "0.63864774", "0.63755167", "0.6365471", "0.6358798", "0.63340455", "0.6331923", "0.6310627", "0.63042027", "0.6301041", "0.62937564", "0.6290969", "0.6285008", "0.6268454", "0.6267833", "0.6262991", "0.625484", "0.62420493", "0.62332076", "0.62327725", "0.6228155", "0.6227288", "0.62257165", "0.6221799", "0.62204415", "0.6211679", "0.62078625", "0.62001204", "0.62001204", "0.61990297", "0.6197767", "0.6188273", "0.6186579", "0.6175913", "0.6175747", "0.615741", "0.61485034", "0.61472154", "0.61383647", "0.61361456", "0.61359614", "0.6133428", "0.61333114", "0.61238843", "0.61220914", "0.61218256", "0.6121678", "0.61122674", "0.61116415", "0.610937", "0.6107293", "0.6100129", "0.60995966", "0.60954213", "0.60948014", "0.60940045", "0.6090776", "0.6088431", "0.60842794", "0.60834736", "0.6083435", "0.6083435", "0.6083426", "0.608001", "0.60773766", "0.6074484", "0.60731035", "0.60703737", "0.606857", "0.6068365", "0.606716", "0.6063729", "0.60586894", "0.6057163", "0.6053892", "0.6051745", "0.6048312", "0.6046053", "0.6044751", "0.6037659", "0.60369986", "0.60369986", "0.603623", "0.602971", "0.6027985", "0.6017026" ]
0.76628387
0
POST /time_gliders POST /time_gliders.xml
def create @time_glider = TimeGlider.new(params[:time_glider]) respond_to do |format| if @time_glider.save format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully created.') } format.xml { render :xml => @time_glider, :status => :created, :location => @time_glider } else format.html { render :action => "new" } format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @time_glider = TimeGlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_glider }\n end\n end", "def update\n @time_glider = TimeGlider.find(params[:id])\n\n respond_to do |format|\n if @time_glider.update_attributes(params[:time_glider])\n format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @time_tracker = TimeTracker.new({ started_at: Time.current, status: 'running' }.merge(time_tracker_params))\n\n respond_to do |format|\n if @time_tracker.save\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully created.' }\n format.json { render :show, status: :created, location: @time_tracker }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_gap = TimeGap.new(params[:time_gap])\n\n respond_to do |format|\n if @time_gap.save\n format.html { redirect_to @time_gap, notice: 'Time gap was successfully created.' }\n format.json { render json: @time_gap, status: :created, location: @time_gap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_gap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_timeframe\n # params['data_gatherer']['timeframe']\n if request.xhr?\n\n begin\n @data_gatherer.timeframe = params['data_gatherer']['timeframe'].to_i\n head :ok\n rescue ArgumentError\n head :error # return an error to the xhr call\n end\n\n end\n\n end", "def create\n @slowlogext = Slowlogext.new(slowlogext_params)\n\n respond_to do |format|\n if @slowlogext.save\n format.html { redirect_to @slowlogext, notice: 'Slowlogext was successfully created.' }\n format.json { render :show, status: :created, location: @slowlogext }\n else\n format.html { render :new }\n format.json { render json: @slowlogext.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gauge = Gauge.new(params[:gauge])\n\n respond_to do |format|\n if @gauge.save\n format.html { redirect_to @gauge, notice: 'Gauge was successfully created.' }\n format.json { render json: @gauge, status: :created, location: @gauge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timing = Timing.new(params[:timing].slice(:start, :stop, :days, :parent_class, :parent_id, :active))\n if @timing.save\n render json: @timing\n else\n render json: { error: 'error: could not save timing' }\n end\n end", "def destroy\n @time_glider = TimeGlider.find(params[:id])\n @time_glider.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_gliders_url) }\n format.xml { head :ok }\n end\n end", "def create\n @wait_time = WaitTime.new(params[:wait_time])\n\n respond_to do |format|\n if @wait_time.save\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully created.' }\n format.json { render json: @wait_time, status: :created, location: @wait_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wait_time = WaitTime.new(wait_time_params)\n\n respond_to do |format|\n if @wait_time.save\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully created.' }\n format.json { render :show, status: :created, location: @wait_time }\n else\n format.html { render :new }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tank = @user.tanks.find(params[:tank_id])\n sensor = Sensor.find(params[:reading][:sensor_id])\n @reading = ReadingService.create_manual_reading(@user, sensor, params[:reading][:date], params[:hour], params[:minute], params[:value])\n respond_to do |format| \n if @reading.save!\n format.js { }\n else\n format.js { render json: @reading.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_treinador = TimeTreinador.new(time_treinador_params)\n @time_treinador.treinador = @treinador\n\n respond_to do |format|\n if @time_treinador.save\n format.html { redirect_to @time_treinador, notice: 'Time criado com sucesso' }\n format.json { render :show, status: :created, location: @time_treinador }\n else\n format.html { render :new }\n format.json { render json: @time_treinador.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n nb_days = 7\n start = nb_days.days.ago \n dates = [start.to_f] + Delay.all(:conditions => {:created_at => start..0.days.ago, :hospital_id => get_hospital.id}).map{|d| d.created_at.to_f}.reverse + [0.days.ago.to_f] # We add to additional nodes at the beginning and the end of the timespan\n dates2 = dates.map{|d| (d-start.to_f)/20}\n delays = Delay.all(:conditions => {:created_at => start..0.days.ago, :hospital_id => get_hospital.id}, :select => :minutes).map(&:minutes).reverse\n if delays.empty?\n delays2 = [0.0, 0.1]\n else\n delays2 = [delays[0]] + delays + [delays[-1]]\n end\n dates2 = dates2.collect { |d| d * delays2.max / dates2.max if dates2.max > 0 }\n data = [dates2, delays2]\n wdays = ['Sun', 'Sat', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n (0..Date.today.wday+1).each do |i|\n d = wdays.shift\n wdays.push(d)\n end\n @graph_url = Gchart.line_xy(:size => '500x300', \n :title => \"Last weeks waiting time\",\n :data => data,\n :axis_with_label => 'x,y',\n :axis_labels => [wdays.join('|')]\n )\n # We need some extra parameters for the graph axis that is not supported by Gchart...\n @graph_url = @graph_url + \"&chxt=x,y\"\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @delays }\n end\n end", "def party_time(options)\n self.class.post(\"/open311/v2/requests.json\", query: options, headers: {'api_key' => ENV['API_KEY']})\n end", "def create\n @timer = Timer.new(timer_params)\n\n if @timer.save\n render json: @timer, status: :created, location: @timer\n else\n render json: @timer.errors, status: :unprocessable_entity\n end\n end", "def log(data)\n t = Thread.new do\n uri = URI(\"http://logs-01.loggly.com/inputs/.../tag/ost/\")\n req = Net::HTTP::Post.new(uri)\n req['content-type'] = \"content-type:application/x-www-form-urlencoded\"\n req.body = data.to_json\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n end\nend", "def sprinkle_params\n params.require(:sprinkle).permit(:next_start_time, :base_start_time, :time_input, :duration, :valve_id)\n end", "def create\n @timechart = Timechart.new(params[:timechart])\n\n respond_to do |format|\n if @timechart.save\n format.html { redirect_to @timechart, notice: 'Timechart was successfully created.' }\n format.json { render json: @timechart, status: :created, location: @timechart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timechart.errors, status: :unprocessable_entity }\n end\n end\n end", "def time_tracker_params\n params.require(:time_tracker).permit(:time, :desc)\n end", "def new\n @time_gap = TimeGap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_gap }\n end\n end", "def create\n @time_registration = TimeRegistration.create(time_registration_params)\n respond_to do |format|\n if @time_registration.save\n format.json { render :show, status: :created, location: @time_registration }\n else\n format.json { render json: @time_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_track = TimeTrack.new(params[:time_track])\n\n respond_to do |format|\n if @time_track.save\n format.html { redirect_to @time_track, notice: 'Time track was successfully created.' }\n format.json { render json: @time_track, status: :created, location: @time_track }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_track.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @my_time_trial = MyTimeTrial.new(params[:my_time_trial])\n\n respond_to do |format|\n if @my_time_trial.save\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully created.' }\n format.json { render :json => @my_time_trial, :status => :created, :location => @my_time_trial }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def vestry_minute_params\n params.require(:vestry_minute).permit(:date, :minutes, :body, :submit)\n end", "def create\n @timeslot = current_event.timeslots.new(params[:timeslot])\n \n respond_to do |format|\n if @timeslot.save\n flash[:notice] = 'Timeslot was successfully created.'\n format.html { redirect_to(timeslots_url) }\n format.xml { render :xml => @timeslot, :status => :created, :location => @timeslot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @timeslot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def timecontroll_params\n params.require(:timecontroll).permit(:start, :end, :gap)\n end", "def postSignal( entity_id, country, gen_id, signal_type, data_type, inactive_reason, inactive_description, feedback)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['gen_id'] = gen_id\n params['signal_type'] = signal_type\n params['data_type'] = data_type\n params['inactive_reason'] = inactive_reason\n params['inactive_description'] = inactive_description\n params['feedback'] = feedback\n return doCurl(\"post\",\"/signal\",params)\n end", "def create\n @timing = Timing.new(params[:timing])\n\n respond_to do |format|\n if @timing.save\n flash[:notice] = 'Timing was successfully created.'\n format.html { redirect_to(@timing) }\n format.xml { render :xml => @timing, :status => :created, :location => @timing }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @timing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @timeslot = Timeslot.new(timeslot_params)\n @timeslot.save!\n render :json => @timeslot.as_json\n end", "def create\n @time_slot = TimeSlot.new(params[:time_slot])\n @time_slot.user_id = current_identity.user_id\n\t@recurrence_array = []\n respond_to do |format|\n if @time_slot.save\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully created.' }\n format.json { render json: @time_slot, status: :created, location: @time_slot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_trial = TimeTrial.new(time_trial_params)\n @time_trial.save\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def create\n @tour_visitor = TourVisitor.find(params[:tour_visitor_id])\n @time_visitor = @tour_visitor.time_visitors.create(params[:time_visitor])\n \n redirect_to @tour_visitor\n end", "def create\n @availibility_time_slot = AvailibilityTimeSlot.new(availibility_time_slot_params)\n\n respond_to do |format|\n if @availibility_time_slot.save\n format.html { redirect_to @availibility_time_slot, notice: 'Availibility time slot was successfully created.' }\n format.json { render :show, status: :created, location: @availibility_time_slot }\n else\n format.html { render :new }\n format.json { render json: @availibility_time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @roll = Slider.new(roll_params)\n\n respond_to do |format|\n if @roll.save\n format.html { redirect_to sliders_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @roll }\n else\n format.html { render :new }\n format.json { render json: @roll.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tick = Tick.new(tick_params)\n\n respond_to do |format|\n if @tick.save\n format.html { redirect_to @tick, notice: 'Tick was successfully created.' }\n format.json { render :show, status: :created, location: @tick }\n else\n format.html { render :new }\n format.json { render json: @tick.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @travel_datum = TravelDatum.new\n @travel_datum.start_time = Time.now.beginning_of_day + 9.hours\n @travel_datum.end_of_business_time = Time.now.beginning_of_day+17.hours\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @travel_datum }\n format.xml { render :xml => @travel_data }\n end\n end", "def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend", "def new\n @my_time_trial = MyTimeTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def uptime_params\n params.require(:uptime).permit(:start_time, :end_time, :mission_id)\n end", "def create\n @time_log = TimeLog.new(params[:time_log])\n \n puts \"Creating a new time_log\"\n\n respond_to do |format|\n if @time_log.save\n format.html { redirect_to @time_log, notice: 'Time log was successfully created.' }\n format.json { render json: @time_log, status: :created, location: @time_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def time_tracker_params\n params.require(:time_tracker).permit(:topic, :rate_per_hour, :started_at, :ended_at, :status)\n end", "def collected_datum_params\n params.require(:collected_datum).permit(:turtle_id, :temperature, :deep, :light, :latitude, :longitude, :date)\n end", "def lession_time_params\n params.require(:lession_time).permit(:day, :start_at, :end_at)\n end", "def scrobble( params )\n LastFM.requires_authentication\n # Tracks are passed to the service using array notation for each of the above params\n array_params = {}\n params.each do |hkey, hval|\n hval = hval.to_i if hval.is_a?(Time)\n Array(hval).each_with_index do |aval, index|\n array_params[\"#{hkey}[#{index}]\"] = aval\n end\n end\n LastFM.post( \"track.scrobble\", array_params )\n end", "def index\n p request.inspect\n push_timer :stupid_sleep\n sleep 2\n pop_timer\n\n <<EOF\n<h2>push_timer/pop_timer methods</h2>\nThis example uses push_timer/pop_timer methods\n\n<pre>\n def index\n push_timer :stupid_sleep\n sleep 2\n pop_timer\n end\n</pre>\n\nIf you run 'fn.rb' (bundle exec fn.rb run), you can check this <a href='http://localhost:4242' target='_blank'>link</a> to get the Fnordmetric dashboard.\n<p />\nSorry for the wait... but congratulations won a vanilla Icecream <a href='/icecream'>Icecream</a> ! May be you prefer <a href='/icecream/strawberry'>strawberry</a>. ?\nEOF\n end", "def create\n heart_beat= DateTime.new(params[\"heart_beat\"][\"heart_beat(1i)\"].to_i,\n params[\"heart_beat\"][\"heart_beat(2i)\"].to_i,\n params[\"heart_beat\"][\"heart_beat(3i)\"].to_i,\n params[\"heart_beat\"][\"heart_beat(4i)\"].to_i,\n params[\"heart_beat\"][\"heart_beat(5i)\"].to_i)\n @heart_beat = HeartBeat.new({heart_beat: heart_beat, intensity: params[\"heart_beat\"][\"intensity\"].to_i})\n @heart_beat.person = Person.first\n\n respond_to do |format|\n if @heart_beat.save\n format.html { redirect_to @heart_beat, notice: 'Heart beat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @heart_beat }\n else\n format.html { render action: 'new' }\n format.json { render json: @heart_beat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @training = @runner.trainings.new(training_params)\n @training.time = set_time(training_params) #calculate the total amount of seconds with hours, minutes and seconds\n respond_to do |format|\n if @training.save\n if @training.shoe\n @training.shoe.add_kms(@training.kms)\n end\n format.html { redirect_to runner_trainings_path, notice: '¡Entrenamiento creado!' }\n format.json { render action: 'show', status: :created, location: @training } #Esto hay que cambiarlo creo\n else\n format.html { render action: 'new' }\n format.json { render json: @training.errors, status: :unprocessable_entity }\n end\n #format.js #Para el formulario de Nuevo Entrenamiento en el Show de Runner\n end\n end", "def pipeline_schedule(pipeline_name, options = {})\n options[:accept] = \"text/plain\" # Why is this not Json?\n post \"pipelines/#{pipeline_name}/schedule\", options\n end", "def create\n x = bg_measurement_params\n x[\"user_id\"] = current_user.id\n x[\"measurement_time\"] = Time.now\n x[\"user_email_bg_timestamp\"] = \"#{current_user.email}_#{x['measurement_time'].to_i}\"\n @bg_measurement = BgMeasurement.new(x)\n\n respond_to do |format|\n if @bg_measurement.save\n format.html { redirect_to @bg_measurement, notice: 'Bg measurement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bg_measurement }\n else\n format.html { render action: 'new' }\n format.json { render json: @bg_measurement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n cnt = params[:tutor_availability][:repeat].to_i - 1\n params[:tutor_availability].delete :repeat\n @tutor_availability = TutorAvailability.new(params[:tutor_availability])\n\n respond_to do |format|\n if @tutor_availability.save\n if cnt > 0\n for i in 1..cnt\n new_ta = TutorAvailability.new(params[:tutor_availability])\n new_ta.start_time = @tutor_availability.start_time + 604800*i\n new_ta.save\n end\n end\n format.html { redirect_to tutor_availabilities_path, notice: 'Tutor availability was successfully created.' }\n format.json { render json: @tutor_availability, status: :created, location: @tutor_availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor_availability.errors, status: :unprocessable_entity }\n end\n end\n end", "def push_time_updates\n @log.debug(\"Pushing timelogs.\")\n @ob.static(:Timelog, :push_time_updates, {:oata => self})\n end", "def slowlogext_params\n params.require(:slowlogext).permit(:name, :key, :duration, :date, :value)\n end", "def index\n @stage_id = params[:stage_id].present? ? params[:stage_id] : nil\n @classification = params[:class].present? ? params[:class] : nil\n @time_type = params[:type].present? ? params[:type] : nil\n if @time_type == '1'\n @stage_times = RallyEventStageTime.stage_times(@rally.id, @stage_id, @classification)\n else\n @stage_times = RallyEventStageTime.final_times(@rally.id, @stage_number, @stage_id, @classification)\n end\n end", "def create\n @planning_time = PlanningTime.new(params[:planning_time])\n\n respond_to do |format|\n if @planning_time.save\n format.html { redirect_to @planning_time, notice: 'Planning time was successfully created.' }\n format.json { render json: @planning_time, status: :created, location: @planning_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @planning_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_point = TimePoint.new(params[:time_point])\n\n respond_to do |format|\n if @time_point.save\n format.html { redirect_to @time_point, notice: 'Time point was successfully created.' }\n format.json { render json: @time_point, status: :created, location: @time_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @time_point = TimePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_point }\n end\n end", "def time_type_changed\n session[:time_type] = params[:time_type]\n # Set chart number\n set_chart_number\n end", "def new\n @timing = Timing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timing }\n end\n end", "def form_setup\n\t\t@times = Lovs.time_array(15)\n\tend", "def create\n @time_control = TimeControl.new(time_control_params)\n\n respond_to do |format|\n if @time_control.save\n format.html { redirect_to @time_control, notice: 'Time control was successfully created.' }\n format.json { render action: 'show', status: :created, location: @time_control }\n else\n format.html { render action: 'new' }\n format.json { render json: @time_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gadget = Gadget.new(params[:gadget])\n \n # set the default datetime value.\n @gadget.creatdatetime = DateTime.now\n @gadget.lastupdatetime = DateTime.now\n\n respond_to do |format|\n if @gadget.save\n format.html { redirect_to(@gadget, :notice => 'Gadget was successfully created.') }\n format.xml { render :xml => @gadget, :status => :created, :location => @gadget }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @gadget.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @planned_time = PlannedTime.new(params[:planned_time])\n\n respond_to do |format|\n if @planned_time.save\n format.html { redirect_to @planned_time, notice: 'Planned time was successfully created.' }\n format.json { render json: @planned_time, status: :created, location: @planned_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @planned_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def tracked_datum_params\n params.require(:tracked_datum).permit(:clientIP, :homepageURL, :pageURL, :hour)\n end", "def create\n starts_at = Time.parse(params[:starts_at])\n finishes_at = Time.parse(params[:finishes_at])\n @league = League.new(params[:league].merge(:rounds_played => 0, :starts_at => starts_at, :finishes_at => finishes_at))\n\n respond_to do |format|\n if @league.save\n flash[:notice] = 'Liga bola úspešne vytvorená.'\n format.html { redirect_to(@league) }\n format.xml { render :xml => @league, :status => :created, :location => @league }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @league.errors, :status => :unprocessable_entity }\n end\n end\n end", "def gig_params\n params.require(:gig).permit(:date, :gate_opening, :showtime, :duration, :local, :address, :state, :country, :website, :release)\n end", "def create\n @series = Series.new(params[:series])\n @series.normalize_start_time\n @series.type=determine_series_type(params[:series][:type])\n\n respond_to do |format|\n if @series.save\n flash[:notice] = 'Serie erfolgreich erzeugt.'\n format.html { redirect_to(@series) }\n format.xml { render :xml => @series, :status => :created, :location => @series }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @series.errors, :status => :unprocessable_entity }\n end\n end\n end", "def multi_create\n my_params = params.dup\n my_params.delete :action\n my_params.delete :controller\n recorded_at = begin\n time_code = my_params.delete(:time_code)\n Time.at time_code\n rescue\n Time.new\n end\n family = my_params.delete(:collection)\n my_params.each do |name, value|\n DataPoint.save family, name, value, recorded_at\n end\n\n render :text => 'ok'\n end", "def create\n @rescue_time_chart = RescueTimeChart.new(rescue_time_chart_params)\n\n respond_to do |format|\n if @rescue_time_chart.save\n format.html { redirect_to @rescue_time_chart, notice: 'Rescue time chart was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rescue_time_chart }\n else\n format.html { render action: 'new' }\n format.json { render json: @rescue_time_chart.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_slot = TimeSlot.new(time_slot_params)\n\n if @time_slot.save\n render :show, status: :created, location: @time_slot\n else\n render json: @time_slot.errors, status: :unprocessable_entity\n end\n end", "def new_performance\n\n if not_allowed()\n return\n end\n\n if missing_params(params, ['round_id', 'name', 'web_sock_id'])\n return\n end\n\n begin\n round = Round.find(params[:round_id])\n rescue\n render json: {:result => false, :message => \"Could not find round_id '\" + params[:round_id] + \"'\"}\n return\n end\n\n host = Host.where(host: request.host).take\n poet = host.organization.poets.where(name: params[:name]).first\n\n if poet == nil\n render json: {:result => false, :message => \"Could not find poet '\" + params[:name] + \"'\"}\n return\n end\n\n performance = Performance.new(round_id: round.id, poet_id: poet.id)\n\n # Optional Parameter is passed if the performance is in a cumulative round\n if params.has_key?('previous_performance_id')\n # Let's check that there is a Performance with such an id, if there isn't, this isn't a valid request. \n begin\n previous = Performance.find(params[:previous_performance_id])\n performance.previous_performance_id = previous.id\n rescue\n render json: {:result => false, :message => \"Could not find previous_performance\"}\n return\n end\n end\n\n if performance.save\n\n\n render json: {:result => true, :message => \"New performance: \" + params[:name], :performance_id => performance.id} \n\n# Send event to web socket\n\n event_hash = {};\n event_hash[:event] = \"new_performance\"\n event_hash[:performance_id] = performance.id\n event_hash[:previous_performance_id] = performance.previous_performance_id\n event_hash[:web_sock_id] = params[:web_sock_id]\n event_hash[:poet_name] = poet.name\n event_hash[:round_number] = round.round_number\n\n\n competition = performance.round.competition\n new_event(competition, event_hash)\n else\n# Error\n render json: {result => false, :message => \"Error saving to database\"}\n# TODO Some kind of log.\n\n end\n\n end", "def create\n\n @time_time_report = Time::TimeReport.new(time_time_report_params)\n\n respond_to do |format|\n if @time_time_report.save\n format.html { redirect_to @time_time_report, notice: 'Time report was successfully created.' }\n format.json { render :show, status: :created, location: @time_time_report }\n else\n format.html { render :new }\n format.json { render json: @time_time_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lider = Lider.new(lider_params)\n\n respond_to do |format|\n if @lider.save\n format.html { redirect_to @lider, notice: 'Lider was successfully created.' }\n format.json { render :show, status: :created, location: @lider }\n else\n format.html { render :new }\n format.json { render json: @lider.errors, status: :unprocessable_entity }\n end\n end\n end", "def galtable\n params[:heute] = Time.now.strftime('%b/%d')\n @galeries = Galerie.all\n\n respond_to do |format|\n format.html # galtable.html.erb\n format.xml { render :xml => @galeries }\n end\n end", "def create\n\n if params[:journey_id]\n @journey = Journey.find(params[:journey_id])\n render_403 and return if @journey.user_id != current_user.id\n else\n @journey = Journey.create(user_id: current_user.id)\n end\n\n @url = \"/journeys/#{@journey.id}/legs\"\n @method = :POST\n @journey_leg = JourneyLeg.new(journey_leg_params.merge(journey_id: @journey.id))\n\n respond_to do |format|\n if @journey_leg.save\n format.html { redirect_to @journey, notice: 'Journey leg was successfully created.' }\n format.json { render json: @journey, status: :created, location: @journey }\n format.xml { render xml: @journey, status: :created, location: @journey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @journey_leg.errors, status: :unprocessable_entity }\n format.xml { render xml: @journey_leg.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n GpsJob.perform_later(request_params)\n head(:ok)\n end", "def create\n @event_time_monitoring = EventTimeMonitoring.new(event_time_monitoring_params)\n\n respond_to do |format|\n if @event_time_monitoring.save\n format.html { redirect_to @event_time_monitoring, notice: \"Event time monitoring was successfully created.\" }\n format.json { render :show, status: :created, location: @event_time_monitoring }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event_time_monitoring.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @slider_serv = SliderServ.new(slider_serv_params)\n\n respond_to do |format|\n if @slider_serv.save\n format.html { redirect_to @slider_serv, notice: 'Slider serv was successfully created.' }\n format.json { render :show, status: :created, location: @slider_serv }\n else\n format.html { render :new }\n format.json { render json: @slider_serv.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @garply = Garply.new(garply_params)\n\n respond_to do |format|\n if @garply.save\n format.html { redirect_to @garply, notice: 'Garply was successfully created.' }\n format.json { render :show, status: :created, location: @garply }\n else\n format.html { render :new }\n format.json { render json: @garply.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timing = Timing.new(timing_params)\n\n if @timing.save\n render :show, status: :created, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end", "def create\n @gauge_graph = GaugeGraph.new(gauge_graph_params)\n\n respond_to do |format|\n if @gauge_graph.save\n format.html { redirect_to edit_gauge_graph_path(@gauge_graph), notice: 'Gauge graph was successfully created.' }\n format.json { render :edit, status: :created, location: @gauge_graph }\n else\n format.html { render :new }\n format.json { render json: @gauge_graph.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @wait_time = WaitTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wait_time }\n end\n end", "def create\n @p_time = PTime.new(p_time_params)\n\n respond_to do |format|\n if @p_time.save\n format.html { redirect_to @p_time, notice: 'P time was successfully created.' }\n format.json { render :show, status: :created, location: @p_time }\n else\n format.html { render :new }\n format.json { render json: @p_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @travel_claim_mileage_rate = TravelClaimMileageRate.new(params[:travel_claim_mileage_rate])\n\n respond_to do |format|\n if @travel_claim_mileage_rate.save\n format.html { redirect_to(travel_claim_mileage_rates_url, :notice => t('mileagerates.title2')+\" \"+t('created')) }\n format.xml { render :xml => @travel_claim_mileage_rate, :status => :created, :location => @travel_claim_mileage_rate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @travel_claim_mileage_rate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_time_request\n TimeRequest.create(\n time: [ Time.new(2000, 1, 1, 14, 0, 0, \"+00:00\").utc, Time.new(2000, 1, 1, 13, 0, 0, \"+00:00\").utc, Time.new(2000, 1, 1, 12, 0, 0, \"+00:00\").utc ].sample,\n reservation: Reservation.all.sample,\n check_in: [true, false].sample,\n status: 'pending'\n )\nend", "def schedule(subperiod,year,gs,expiry_date)\n #URL della servlet\n url = URI.parse(CONFIG['servlet']['address'])\n #impostazione del metodo POST\n req = Net::HTTP::Post.new(url.path)\n #parametri di autenticazione\n #req.basic_auth 'jack', 'pass'\n #dati da inviare op = ScheduleJob\n if expiry_date\n data = expiry_date.date\n day = data.day.to_i\n if day < 10\n day = \"0\" + day.to_s\n else\n day = day.to_s\n end\n month = data.mon.to_i\n if month < 10\n month = \"0\" + month.to_s\n else\n month = month.to_s\n end\n date = day + \"-\" + month + \"-\" + data.year.to_s\n req.set_form_data({'op'=>'sj', 'graduate_course' => gs.id.to_s,\n 'year' => year,\n 'subperiod' => subperiod.to_s,\n 'date'=> date\n }, '&')\n else\n req.set_form_data({'op'=>'sj', 'graduate_course' => gs.id.to_s,\n 'year' => year,\n 'subperiod' => subperiod.to_s\n }, '&')\n #connessione alla servlet\n end\n res = Net::HTTP.new(url.host, url.port).start {\n |http| http.request(req)\n }\n #controllo del codice di errore\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n return true\n when Net::HTTPNotAcceptable\n #parametri non corretti.. riportare alla form\n return false\n else\n #errore connessione.. riprovare\n return false\n end\n end", "def create\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n description = params[:description]\n \n timestamp = params[:timestamp]\n total_sleep_seconds = params[:total_sleep]\n deep_sleep_seconds = params[:deep]\n light_sleep_seconds = params[:light]\n awake_seconds = params[:awake]\n \n if timestamp.nil? || total_sleep_seconds.nil?\n \n puts 'timestamp is nil or total_sleep_seconds is nil :('\n \n else\n \n total_sleep = total_sleep_seconds / 60.0\n deep = deep_sleep_seconds / 60.0\n light = light_sleep_seconds / 60.0\n awake = awake_seconds / 60.0\n \n post_to_twitter = false\n post_to_facebook = false\n \n # FellAsleepAt is formatted: August 23, 2013 at 11:01PM\n # Convert to Runkeeper's preferred format: Sat, 1 Jan 2011 00:00:00\n timestamp_datetime = DateTime.parse(timestamp)\n formatted_timestamp = timestamp_datetime.strftime(\"%a, %d %b %Y %H:%M:%S\")\n \n json_hash['timestamp'] = formatted_timestamp\n json_hash['total_sleep'] = deep\n json_hash['deep'] = deep\n json_hash['light'] = light\n json_hash['awake'] = awake\n json_hash['post_to_twitter'] = post_to_twitter\n json_hash['post_to_facebook'] = post_to_facebook\n \n url = 'https://api.runkeeper.com/sleep'\n \n uri = URI.parse(url)\n \n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri)\n request[\"Authorization\"] = \"Bearer \" + RUNKEEPER_ACCESS_TOKEN\n request[\"Content-Type\"] = \"application/vnd.com.runkeeper.NewSleep+json\"\n request.body = json_hash.to_json\n \n response = http.request(request)\n \n puts response.body\n \n end\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n \n end", "def create\n @selected_time = SelectedTime.new(selected_time_params)\n\n respond_to do |format|\n if @selected_time.save\n format.html { redirect_to @selected_time, notice: 'Selected time was successfully created.' }\n format.json { render :show, status: :created, location: @selected_time }\n else\n format.html { render :new }\n format.json { render json: @selected_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stime = Stime.new(stime_params)\n\n respond_to do |format|\n if @stime.save\n format.html { redirect_to @stime, notice: 'Stime was successfully created.' }\n format.json { render :show, status: :created, location: @stime }\n else\n format.html { render :new }\n format.json { render json: @stime.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, params)\n with_monitoring do\n connection.post(path) do |req|\n req.body = Oj.dump(params)\n end\n end\n end", "def postSales_logSyndication( action_type, syndication_type, publisher_id, expiry_date, entity_id, group_id, seed_masheryid, supplier_masheryid, country, reseller_masheryid)\n params = Hash.new\n params['action_type'] = action_type\n params['syndication_type'] = syndication_type\n params['publisher_id'] = publisher_id\n params['expiry_date'] = expiry_date\n params['entity_id'] = entity_id\n params['group_id'] = group_id\n params['seed_masheryid'] = seed_masheryid\n params['supplier_masheryid'] = supplier_masheryid\n params['country'] = country\n params['reseller_masheryid'] = reseller_masheryid\n return doCurl(\"post\",\"/sales_log/syndication\",params)\n end", "def create\n mod_params = entrant_params\n date = entrant_params[:date].to_datetime\n date = date.change(hour: params[:time].split(':')[0].to_i, minute: params[:time].split(':')[1].to_i)\n mod_params[:guess] = date\n mod_params.delete('date')\n mod_params.delete('time')\n @entrant = Entrant.create(mod_params)\n\n # respond_to do |format|\n # if @entrant.save\n # format.html { redirect_to @entrant, notice: 'Entrant was successfully created.' }\n # format.json { render :show, status: :created, location: @entrant }\n # else\n # format.html { render :new }\n # format.json { render json: @entrant.errors, status: :unprocessable_entity }\n # end\n # end\n render json: {entrant: @entrant}, status: 200\n end", "def new\n @time_track = TimeTrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_track }\n end\n end", "def create\n @drop_off_location_time = DropOffLocationTime.new(params[:drop_off_location_time])\n if @drop_off_location_time.save\n respond_to do |format|\n format.html { redirect_to :controller => \"drop_off_locations\", :action => \"index\" }\n end\n end\n end", "def create\n year = params[:year]\n timeframe_type = params[:type]\n\n timeframe = Timeframe.new(year: year, timeframe_type: timeframe_type)\n respond_to do |format|\n if timeframe.save\n TimeframeLog.create_timeframe_log(timeframe.year, timeframe.id, timeframe.timeframe_type)\n format.json { render json: \"Timeframe successfully created!\", status: :ok }\n else\n format.json { render json: \"Error!\", status: :unprocessable_entity }\n end\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_frame }\n end\n end", "def create\n @ride = Ride.new(ride_params)\n @ride.assembly_time = params[:ride][:assembly_time]\n @ride.destination_time = params[:ride][:destination_time]\n @ride.check_points = params[:ride][:check_points]\n if @ride.save\n @ride.delay.call_notification(I18n.t('Notification.ride_created'), I18n.t('Email.ride_created'))\n render json: @ride, status: :created\n else\n render json: @ride.errors, status: :unprocessable_entity\n end\n end", "def set_timer\n request = Request.find_by(pet_id: @pet.id)\n request.schedule = params[\"request\"][\"schedule\"]\n request.save\n flash[:notice] = \"Your feeding has been scheduled. You can schedule another feeding time by clicking 'Schedule a Feeding'\"\n\n add_new_schedule\n\n redirect_to root_path\n end", "def create\n @timeband = Timeband.new(params[:timeband])\n\n respond_to do |format|\n if @timeband.save\n flash[:notice] = 'Timeband was successfully created.'\n format.html { redirect_to(@timeband) }\n format.xml { render :xml => @timeband, :status => :created, :location => @timeband }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @timeband.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.5996065", "0.5393736", "0.5320517", "0.51162815", "0.51122725", "0.5108098", "0.50843936", "0.50840205", "0.5058225", "0.4985661", "0.4940659", "0.49380693", "0.49276495", "0.49202567", "0.48934117", "0.48835707", "0.4879454", "0.48536125", "0.48367503", "0.4827365", "0.4827295", "0.48169774", "0.48120296", "0.48119295", "0.47925907", "0.4791044", "0.47903496", "0.47779852", "0.47776893", "0.47773287", "0.47574902", "0.4755257", "0.47528937", "0.47404084", "0.47399786", "0.469865", "0.4697755", "0.46861494", "0.46774754", "0.46768567", "0.46652025", "0.46607685", "0.46595758", "0.4659439", "0.46590424", "0.46572056", "0.46564525", "0.46561995", "0.46489856", "0.46361917", "0.46360385", "0.46358466", "0.46314523", "0.4625959", "0.462484", "0.4623216", "0.46210882", "0.46210515", "0.46199793", "0.461904", "0.46171084", "0.46106896", "0.46080798", "0.46056566", "0.4602867", "0.46026435", "0.46010613", "0.46009302", "0.45961902", "0.4594515", "0.45934233", "0.45903376", "0.45874497", "0.45860726", "0.45842534", "0.45832625", "0.45767245", "0.45763794", "0.45763642", "0.45763326", "0.45746747", "0.4574297", "0.45741752", "0.457279", "0.45712674", "0.45637506", "0.45635685", "0.45600945", "0.45591435", "0.45584664", "0.4558378", "0.45571482", "0.45565215", "0.4553358", "0.4552958", "0.45506656", "0.45489743", "0.4548166", "0.4546925", "0.45463473" ]
0.6775461
0
PUT /time_gliders/1 PUT /time_gliders/1.xml
def update @time_glider = TimeGlider.find(params[:id]) respond_to do |format| if @time_glider.update_attributes(params[:time_glider]) format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @time_glider = TimeGlider.new(params[:time_glider])\n\n respond_to do |format|\n if @time_glider.save\n format.html { redirect_to(@time_glider, :notice => 'Time glider was successfully created.') }\n format.xml { render :xml => @time_glider, :status => :created, :location => @time_glider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @time_glider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params[:thing][:time] = @thing.time + params[:thing][:time].to_f if @thing.time\n\n respond_to do |format|\n if @thing.update(thing_params)\n format.html { redirect_to things_url, notice: 'The thing was updated.' }\n format.json { render :show, status: :ok, location: @thing }\n\n # Realtime push\n message = {:channel => '/things', :data => { :name => @thing.name, :time => @thing.time}}\n uri = URI.parse(\"http://localhost:9292/faye\")\n Net::HTTP.post_form(uri, :message => message.to_json)\n else\n format.html { render :edit }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @time_glider = TimeGlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_glider }\n end\n end", "def destroy\n @time_glider = TimeGlider.find(params[:id])\n @time_glider.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_gliders_url) }\n format.xml { head :ok }\n end\n end", "def update\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n if @gauge.update_attributes(params[:gauge])\n format.html { redirect_to @gauge, notice: 'Gauge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gauge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|\n if @time_slot.update_attributes(params[:time_slot])\n flash[:notice] = 'TimeSlot was successfully updated.'\n format.html { redirect_to(@time_slot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @time_slot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n if @time_gap.update_attributes(params[:time_gap])\n format.html { redirect_to @time_gap, notice: 'Time gap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_gap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n if @time_track.update_attributes(params[:time_track])\n format.html { redirect_to @time_track, notice: 'Time track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_track.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n @timeslot = current_event.timeslots.find(params[:id])\n respond_to do |format|\n @timeslot.start_time_will_change!\n @timeslot.slot_date_will_change!\n if @timeslot.update_attributes(params[:timeslot])\n flash[:notice] = \"Timeslot was successfully updated.\"\n format.html { redirect_to(timeslots_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @timeslot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params)\n parse_response @client[path].put(params)\n end", "def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\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 put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def update\n @league = League.find(params[:id])\n starts_at = Time.parse(params[:starts_at])\n finishes_at = Time.parse(params[:finishes_at])\n respond_to do |format|\n if @league.update_attributes(params[:league].merge(:starts_at => starts_at, :finishes_at => finishes_at))\n flash[:notice] = 'Liga bola úspešne zmenená.'\n format.html { redirect_to(@league) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @league.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n if @timeslot.update(timeslot_params)\n render :show, status: :ok, location: @timeslot\n else\n render json: @timeslot.errors, status: :unprocessable_entity\n end\n end", "def update\n if @time_slot.update(time_slot_params)\n render :show, status: :ok, location: @time_slot\n else\n render json: @time_slot.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @time_tracker.update(time_tracker_params)\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_tracker }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, params)\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put!\n request! :put\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n if @wait_time.update_attributes(params[:wait_time])\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @availibility_time_slot.update(availibility_time_slot_params)\n format.html { redirect_to @availibility_time_slot, notice: 'Availibility time slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @availibility_time_slot }\n else\n format.html { render :edit }\n format.json { render json: @availibility_time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, parameters = {})\n request(:put, path, parameters)\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def update\n # if @study_spot.is_open\n # # create a new row in the usage_time table\n # UsageTime.create(start: DateTime.now, end: DateTime.now, study_spot_id: @study_spot.id)\n # else\n # # update the end time to be the time the study_spot was made available again\n # UsageTime.where(study_spot_id: @study_spot.id).last.update_attribute(:end, DateTime.now)\n # end\n # status = @study_spot.update_attribute(:is_open, !@study_spot.is_open)\n # respond_to do |format|\n # if status\n # format.html { redirect_to @study_spot.room, notice: 'Study spot was successfully updated.' }\n # format.json { render :show, status: :ok, location: @study_spot }\n # else\n # format.html { render :edit }\n # format.json { render json: @study_spot.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @timer = Timer.find(params[:id])\n\n if @timer.update(timer_params)\n head :no_content\n else\n render json: @timer.errors, status: :unprocessable_entity\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\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 @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to(@shot, :notice => 'Shot was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n if @time_point.update_attributes(params[:time_point])\n format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update engine, time, dt\n end", "def update\n #set_time\n #tiempoActual = @training.time\n zapatillaAnterior = @training.shoe\n if zapatillaAnterior\n logger.info(\"Zapatilla Anterior!!!!!!!!!!!!\")\n logger.info(zapatillaAnterior.nombre)\n end\n kmsAnterior = @training.kms\n @training.time = set_time(training_params)\n respond_to do |format|\n if @training.update(training_params)\n logger.info(\"Zapatilla Nueva!!!!!!!!!!!!\")\n zapatillaNueva = @training.shoe\n logger.info(zapatillaNueva.nombre)\n zapatillaNueva.add_kms(@training.kms) #Sumo los kms a la nueva zapatilla y salvo\n logger.info(\"Kilometros SUMADOS!!!!!!\")\n if zapatillaAnterior\n zapatillaAnterior.subtract_kms(kmsAnterior) #Resto los kms del entreno anterior y salvo\n logger.info(\"Kilometros RESTADOS!!!!!!\")\n end\n format.html { redirect_to runner_trainings_path, notice: 'Entreno actualizado!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @training.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, options={})\n request :put, path, options\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n @timing = Timing.find(params[:id])\n\n respond_to do |format|\n if @timing.update_attributes(params[:timing])\n flash[:notice] = 'Timing was successfully updated.'\n format.html { redirect_to(@timing) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @timing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_slot = TimeSlot.find(params[:id])\n @recurrence_array = @time_slot.recurrence_pattern.split(//)\n respond_to do |format|\n if @time_slot.update_attributes(params[:time_slot])\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_treinador.update(time_treinador_params)\n format.html { redirect_to @time_treinador, notice: 'Time alterado com sucesso' }\n format.json { render :show, status: :ok, location: @time_treinador }\n else\n format.html { render :edit }\n format.json { render json: @time_treinador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_slot.update(time_slot_params)\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_slot }\n else\n format.html { render :edit }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @tick.update(tick_params)\n format.html { redirect_to @tick, notice: 'Tick was successfully updated.' }\n format.json { render :show, status: :ok, location: @tick }\n else\n format.html { render :edit }\n format.json { render json: @tick.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def update\n respond_to do |format|\n if @timeslot.update(timeslot_params)\n format.html { redirect_to @timeslot, notice: 'Timeslot was successfully updated.' }\n format.json { render :show, status: :ok, location: @timeslot }\n else\n format.html { render :edit }\n format.json { render json: @timeslot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @eventtime = Eventtime.find(params[:id])\n\n respond_to do |format|\n if @eventtime.update_attributes(params[:eventtime])\n format.html { redirect_to(@eventtime, :notice => 'Eventtime was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @eventtime.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update\n @shot = Shot.find(params[:id])\n @shot.update_attributes(shot_params)\n respond_with @shot\n end", "def update\n update_resource @ride, ride_params\n end", "def update\n respond_to do |format|\n if @slider_serv.update(slider_serv_params)\n format.html { redirect_to @slider_serv, notice: 'Slider serv was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_serv }\n else\n format.html { render :edit }\n format.json { render json: @slider_serv.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @poi_time.update(poi_time_params)\n format.html { redirect_to @poi_time, notice: 'Poi time was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_time }\n else\n format.html { render :edit }\n format.json { render json: @poi_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @api_method_name = args[:api_method_name] if args.key?(:api_method_name)\n @counter = args[:counter] if args.key?(:counter)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def update\n respond_to do |format|\n if @slider.update(slider_params)\n format.html { redirect_to action: :index, notice: 'Обновлено.' }\n format.json { render :index, status: :ok, location: @slider }\n else\n format.html { render :crop }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n Time.xmlschema(get('posts/update', 'update')[0]['time'])\n end", "def update\n @timing = Timing.find(params[:id])\n if @timing.update_attributes(params[:timing].slice(:start, :stop, :days, :active))\n render json: @timing\n else\n render json: { error: 'error: could not update timing' }\n end\n end", "def update\n respond_to do |format|\n if @slowlogext.update(slowlogext_params)\n format.html { redirect_to @slowlogext, notice: 'Slowlogext was successfully updated.' }\n format.json { render :show, status: :ok, location: @slowlogext }\n else\n format.html { render :edit }\n format.json { render json: @slowlogext.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update\n respond_to do |format|\n if @stime.update(stime_params)\n format.html { redirect_to @stime, notice: 'Stime was successfully updated.' }\n format.json { render :show, status: :ok, location: @stime }\n else\n format.html { render :edit }\n format.json { render json: @stime.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n if @timer.update_attributes(params[:timer])\n format.html { redirect_to @timer, notice: 'Timer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gadget = Gadget.find(params[:id])\n\n isSuccess = @gadget.update_attributes(params[:gadget]) \n @gadget.lastupdatetime = DateTime.now\n @gadget.save\n \n respond_to do |format|\n if isSuccess\n format.html { redirect_to(@gadget, :notice => 'Gadget was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gadget.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tick_track = TickTrack.find(params[:id])\n\n respond_to do |format|\n if @tick_track.update_attributes(params[:tick_track])\n format.html { redirect_to tick_tracks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tick_track.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n flash[:notice] = 'Spot was successfully updated.'\n format.html { redirect_to(@spot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n operation = params[:operation]\n case operation\n when 'set_best_time'\n resp = @@serv.set_best_time(params['escape_room_id'], params['best_time'])\n render json: { success: resp.success, message: resp.message }, status: :ok\n else\n render json: { success: false, message: 'Operation can not be preformed' }, status: :bad_request\n end\n end", "def update\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n if @food_slider.update_attributes(params[:food_slider])\n format.html { redirect_to food_sliders_url, notice: 'Food slider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_slider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_control.update(time_control_params)\n format.html { redirect_to @time_control, notice: 'Time control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n if @timechart.update_attributes(params[:timechart])\n format.html { redirect_to @timechart, notice: 'Timechart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timechart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tour_visitor = TourVisitor.find(params[:tour_visitor_id])\n @time_visitor = TimeVisitor.find(params[:id])\n\n respond_to do |format|\n if @time_visitor.update_attributes(params[:time_visitor])\n format.html { redirect_to tour_visitor_time_visitor_path, notice: 'Time visitor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_visitor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hurdle_time = HurdleTime.find(params[:id])\n\n time = (params[:time][:minutes].to_i * 60) + params[:time][:seconds].to_i\n if params[:hurdle_time]\n params[:hurdle_time].store :time, time\n else\n params[:hurdle_time] = {}.store :time, time\n end\n\n respond_to do |format|\n if @hurdle_time.update_attributes(params[:hurdle_time])\n format.html { redirect_to hurdle_match_hurdle_times_path(@hurdle_time.hurdle_match), notice: 'Hurdle time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hurdle_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def put(path, options = {})\n request(:put, path, options)\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def put(path, data={})\n request(:put, path, data)\n end", "def add_item_value_twenty_four\n response_search = Partay.get('http://shoponline.tescolotus.com/api/v1/search/products?query=Sugar&page=1&sortBy=Relevance', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token})\n puts search_result=JSON(response_search['productItems'][0])\n puts productid =JSON(search_result)[\"product\"][\"id\"]\n items_json_responses = {'items' => [{'id'=>'6071448594','oldValue'=>0.0,'oldUnitChoice'=>'pcs','newUnitChoice'=>'pcs','newValue'=>24.0}]}.to_json\n puts items_json_responses\n response = Partay.put('http://shoponline.tescolotus.com/api/v1/trolley/items/', :headers => {'Content-Type' => 'application/json', 'language' => 'en-GB', 'region' => 'TH', 'userId' => access_token}, :body => items_json_responses)\n puts response\n end" ]
[ "0.6031941", "0.5655149", "0.5546752", "0.553929", "0.55168533", "0.5471335", "0.54589915", "0.5418488", "0.54001623", "0.5378956", "0.5320338", "0.5287878", "0.52556497", "0.52540624", "0.524614", "0.5237099", "0.5237099", "0.5237099", "0.5223671", "0.52046907", "0.5201099", "0.51991916", "0.51925164", "0.51925164", "0.51925164", "0.51925164", "0.51925164", "0.51925164", "0.51925164", "0.51925164", "0.51850045", "0.517341", "0.517341", "0.5170625", "0.51584536", "0.5149036", "0.5145776", "0.5144024", "0.51376367", "0.5128777", "0.51270837", "0.51233226", "0.5118025", "0.5113175", "0.51074845", "0.50993687", "0.509474", "0.50887734", "0.50885147", "0.50830525", "0.50773466", "0.5077244", "0.50771827", "0.50765353", "0.50742793", "0.5070357", "0.5068894", "0.5065865", "0.5063321", "0.50621015", "0.5057429", "0.5057358", "0.5053629", "0.50529516", "0.50508505", "0.50320673", "0.5030447", "0.5026231", "0.5025093", "0.50176644", "0.5015213", "0.5013504", "0.50078744", "0.50059074", "0.500571", "0.49949703", "0.49750638", "0.49697265", "0.49679446", "0.49675298", "0.4961027", "0.4957207", "0.49549854", "0.49549854", "0.4954847", "0.49541846", "0.49523196", "0.49501702", "0.49311507", "0.49307615", "0.49254236", "0.49253216", "0.49230373", "0.49222812", "0.49193248", "0.49177802", "0.49177802", "0.49157685", "0.49148986", "0.49087963" ]
0.6973037
0
DELETE /time_gliders/1 DELETE /time_gliders/1.xml
def destroy @time_glider = TimeGlider.find(params[:id]) @time_glider.destroy respond_to do |format| format.html { redirect_to(time_gliders_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @daily_grr = DailyGrr.find(params[:id])\n @daily_grr.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_daily_grrs_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @datetime.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @timeband = Timeband.find(params[:id])\n @timeband.destroy\n\n respond_to do |format|\n format.html { redirect_to(timebands_url) }\n format.xml { head :ok }\n end\n end", "def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end", "def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @eventtime = Eventtime.find(params[:id])\n @eventtime.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventtimes_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to(snaps_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy\n @timing = Timing.find(params[:id])\n @timing.destroy\n\n respond_to do |format|\n format.html { redirect_to(timings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @time_task = TimeTask.find(params[:id])\n @time_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_tasks_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @minute = Minute.find(params[:id])\n @minute.destroy\n\n respond_to do |format|\n format.html { redirect_to(minutes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @time_gap = TimeGap.find(params[:id])\n @time_gap.destroy\n\n respond_to do |format|\n format.html { redirect_to time_gaps_url }\n format.json { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @vehicle_daily = VehicleDaily.find(params[:id])\n @vehicle_daily.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_dailies_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityOpening_times( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/opening_times\",params)\n end", "def destroy\n @ztime = Ztime.find(params[:id])\n @ztime.destroy\n\n respond_to do |format|\n format.html { redirect_to(ztimes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @course_time = CourseTime.find(params[:id])\n @course_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_times_url) }\n format.xml { head :ok }\n end\n end", "def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rig = Rig.find(params[:id])\n @rig.destroy\n\n respond_to do |format|\n format.html { redirect_to(rigs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @geocache.destroy\n \n #add score to user rank\n del_score_to_rank('upload')\n \n respond_to do |format|\n format.html { redirect_to(geocaches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @travel_log = TravelLog.find(params[:id])\n @travel_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(travel_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n @ganglia_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganglia_graphs_url) }\n format.xml { head :ok }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurements_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def destroy\n @rute = Rute.find(params[:id])\n @rute.destroy\n\n respond_to do |format|\n format.html { redirect_to(rutes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @heartbeat.destroy\n\n head :no_content\n end", "def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @time_log = TimeLog.find(params[:id])\n @time_log.destroy\n\n respond_to do |format|\n format.html { redirect_to time_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sleep_log = SleepLog.find(params[:id])\n @sleep_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(sleep_logs_url) }\n format.xml { head :ok }\n end\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def delete\n delete_from_server single_url\n end", "def destroy\n @timeunit = Timeunit.find(params[:id])\n @timeunit.destroy\n\n respond_to do |format|\n format.html { redirect_to(timeunits_url) }\n format.xml { head :ok }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy; delete end", "def delete\n end", "def delete_all(xpath); end", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @gtd = Gtd.find(params[:id])\n @gtd.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtds_url) }\n format.xml { head :ok }\n end\n end", "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end", "def destroy\n @delivery_time = DeliveryTime.find(params[:id])\n @delivery_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_delivery_times_url) }\n format.xml { head :ok }\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 @recycling_site = RecyclingSite.find(params[:id])\n @recycling_site.destroy\n\n respond_to do |format|\n format.html { redirect_to(recycling_sites_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @time_visitor = TimeVisitor.find(params[:id])\n @time_visitor.destroy\n\n respond_to do |format|\n format.html { redirect_to tour_visitor_time_visitors_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @lab_rack = LabRack.find(params[:id])\n @lab_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to(lab_racks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete\n \n end", "def destroy\n @check = Check.find(params[:id])\n @check.destroy\n\n respond_to do |format|\n format.html { redirect_to(checks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @firearm = Firearm.find(params[:id])\n @firearm.destroy\n\n respond_to do |format|\n format.html { redirect_to(firearms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @time_table = TimeTable.find(params[:id])\n @time_table.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_tables_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pageview = Pageview.find(params[:id])\n @pageview.destroy\n\n respond_to do |format|\n format.html { redirect_to(pageviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @xsbg_tt_datum = XsbgTtDatum.find(params[:id])\n @xsbg_tt_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to xsbg_tt_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measurement_log = current_account.measurement_logs.find(params[:id])\n @measurement_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurement_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bottle = Bottle.find(params[:id])\n @bottle.destroy\n\n respond_to do |format|\n format.html { redirect_to(bottles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @check = Check.find(params[:id])\n @check.destroy\n respond_to do |format|\n format.html { redirect_to(checks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n @checkpoint_removed.destroy\n\n respond_to do |format|\n format.html { redirect_to(checkpoint_removeds_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @rss_slide = RssSlide.find(params[:id])\n @rss_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(rss_slides_url) }\n format.xml { head :ok }\n end\n end", "def delete\n \n end", "def destroy\n @lr45 = Lr45.find(params[:id])\n @lr45.destroy\n\n respond_to do |format|\n format.html { redirect_to(lr45s_url) }\n format.xml { head :ok }\n end\n end", "def db_delete\n assert_privileges(\"db_delete\")\n db = MiqWidgetSet.find(params[:id]) # temp var to determine the parent node of deleted items\n process_elements(db, MiqWidgetSet, \"destroy\")\n g = MiqGroup.find(@sb[:nodes][2].split('_').first)\n # delete dashboard id from group settings and save\n db_order = g.settings && g.settings[:dashboard_order] ? g.settings[:dashboard_order] : nil\n db_order&.delete(db.id)\n g.save\n nodes = x_node.split('-')\n self.x_node = \"#{nodes[0]}-#{nodes[1]}-#{nodes[2].split('_').first}\"\n replace_right_cell(:replace_trees => [:db])\n end", "def destroy\n @ticket_time = TicketTime.find(params[:id])\n @ticket_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_times_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visarequest = Visarequest.find(params[:id])\n @visarequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(visarequests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @old_point_tag = OldPointTag.find(params[:id])\n @old_point_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(old_point_tags_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stepthirteen = Stepthirteen.find(params[:id])\n @stepthirteen.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepthirteens_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.6471717", "0.6219426", "0.6209912", "0.6202102", "0.6158696", "0.6150239", "0.6057133", "0.6049501", "0.60351384", "0.6016927", "0.6010317", "0.59923416", "0.5958226", "0.5954747", "0.59516615", "0.5942058", "0.5929864", "0.59114844", "0.590835", "0.59064096", "0.58981824", "0.58954346", "0.587559", "0.58636916", "0.5851658", "0.58453834", "0.5839123", "0.58302206", "0.58218664", "0.5819287", "0.58181477", "0.5813875", "0.5806213", "0.5805346", "0.5802952", "0.5799967", "0.5795719", "0.5791061", "0.57814604", "0.57780564", "0.57715154", "0.57648396", "0.57615036", "0.575976", "0.57511544", "0.57471555", "0.5742097", "0.57383746", "0.57381195", "0.57361585", "0.5729313", "0.5727038", "0.5724694", "0.5723111", "0.5721417", "0.57131636", "0.5711892", "0.5710631", "0.57103884", "0.5703815", "0.5702861", "0.56984663", "0.56976956", "0.5697061", "0.5697061", "0.5697061", "0.5697061", "0.5696729", "0.5689827", "0.5689557", "0.568905", "0.5685248", "0.56808287", "0.5680515", "0.5678575", "0.5678377", "0.5677107", "0.567584", "0.5668604", "0.5666365", "0.56639886", "0.5663199", "0.56628853", "0.5662042", "0.56618977", "0.56597227", "0.5659381", "0.5659343", "0.56571454", "0.56568563", "0.5656151", "0.5656151", "0.5656151", "0.5656151", "0.5656151", "0.5656151", "0.5656151", "0.5655477", "0.5654724", "0.56538665" ]
0.6922482
0
TODO: Account linking. Example, if a user has signed in via twitter using a login and then signs in via Facebook with the same id, we should link these 2 accounts. Since, we already have Authentication model in place, user should be asked for login credentials and then teh new authentication should be linked. (Gautam)
def create omniauth = request.env['omniauth.auth'] authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid']) if authentication flash[:notice] = "Signed in successfully" sign_in_and_redirect(:user, authentication.user) else user = User.new user.apply_omniauth(omniauth) user.login = omniauth['info'] && omniauth['info']['nickname'] if user.save flash[:notice] = "Successfully registered" sign_in_and_redirect(:user, user) else session[:omniauth] = omniauth.except('extra') session[:omniauth_login] = user.login # Check if login already taken. If so, ask user to link_accounts if user.errors[:login][0] =~ /has already been taken/ # omniauth? TBD # fetch the user with this login id! user = User.find_by_login(user.login) return redirect_to link_accounts_url(user.id) end redirect_to new_user_registration_url end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_link\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider=#{provider}\",\n \"\" ] if browse_everything_controller_debug_verbose\n @auth_link ||= if provider.present?\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller_debug_verbose\n link, data = provider.auth_link(connector_response_url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"link=#{link}\",\n \"data=#{data}\",\n \"\" ] if browse_everything_controller_debug_verbose\n provider_session.data = data\n link = \"#{link}&state=#{provider.key}\" unless link.to_s.include?('state')\n link\n end\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"@auth_link = #{@auth_link}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n @auth_link\n end", "def link_user_accounts\n if self.current_user.nil?\n #register with fb\n User.create_from_fb_connect(facebook_session.user)\n else\n #connect accounts\n self.current_user.link_fb_connect(facebook_session.user.id) unless self.current_user.fb_user_id == facebook_session.user.id\n end\n create_current_login_cookie\n update_balance_cookie\n redirect_back_or_default('/')\n end", "def authenticate_account\n self.password ||= ''\n self.match = Account.find_by_email_address_and_password(self.site_id, self.email_address, self.password)\n if self.match\n self.account_id ||= self.match.id\n end\n end", "def sign_in_link \n find(SIGN_IN_LINK_ID)\n end", "def connect_to_linkedin(auth)\n self.linkedin_profiles.create(\n uid: auth.uid,\n token: auth.credentials.token,\n secret: auth.credentials.secret,\n first_name: auth.info.first_name,\n last_name: auth.info.last_name,\n phone: auth.info.phone,\n location: auth.info.location,\n profile_url: auth.info.urls.public_profile,\n industry: auth.info.industry,\n avatar: auth.info.image)\n # self.provider = auth.provider\n # self.save!\n end", "def associate_auth(source)\n return if user_authentications.where(:provider => source['provider'], :uid => source['uid'].to_s).count > 0\n self.user_authentications.create!(:provider => source['provider'], :uid => source['uid'], :nickname => source[\"user_info\"]['nickname'])\n end", "def link_with_omniauth(auth)\n identities.find_or_initialize_by(provider: auth[:provider], uid: auth[:uid])\n end", "def authenticated_via_link\n self.is_authenticated == true\n end", "def create\n\n\t\t@auth = request.env[\"omniauth.auth\"]\n\n\t\tprovider = @auth.provider\n\t\tuid = @auth.uid\n\t\taccess_token = @auth.credentials.token\n\t\ttoken_secret = @auth.credentials.secret\n\t\tconsumer_key = \"\"\n\t\tconsumer_secret = \"\"\n\n\t\tif provider == \"bitbucket\"\n\t\t\tconsumer_key = @auth.extra.access_token.consumer.key\n\t\t\tconsumer_secret = @auth.extra.access_token.consumer.secret\n\t\tend\n\n\t\t@authentication = Authentication.find_by_provider_and_uid(provider, uid)\n\n\t\tif @authentication.present?\n\t\t\t# The authentication is already there\n\t\t\t# Get the user\n\t\t\tuser = @authentication.user\n\n\t\t\t# And sign him in\n\t\t\tflash[:notice] = \"Signed in successfully\"\n\t\t\tsign_in_and_redirect :user, user\n\n\t\telsif current_user.present?\n\t\t\t# There's no authentication in db, but the user is present\n\n\t\t\t# Create an authentication for the user and redirect\n\t\t\tcurrent_user.authentications.create! :provider => provider, \n\t\t\t\t\t\t\t\t\t\t\t\t :uid => uid, \n\t\t\t\t\t\t\t\t\t\t\t\t :access_token => access_token,\n\t\t\t\t\t\t\t\t\t\t\t\t :token_secret => token_secret,\n\t\t\t\t\t\t\t\t\t\t\t\t :consumer_key => consumer_key,\n\t\t\t\t\t\t\t\t\t\t\t\t :consumer_secret => consumer_secret\n\t\t\tredirect_to deployable_applications_url, :notice => \"Successfully added authentication.\"\n\n\t\telse\n\n\t\t\tredirect_to new_user_registration_url and return\n\n\t\t\t# Uncomment this to make the user log in with integrations\n\n\t\t\t# # There is no @auth and no user\n\t\t\t# # So create a new user\n\t\t\t# user = User.new\n\n\t\t\t# # Create an authentication for the new user\n\t\t\t# user.apply_omniauth(@auth)\n\n\t\t\t# if user.save\n\t\t\t# \t# Sign him in if no errors\n\t\t\t# \tflash[:notice] = \"Signed in successfully\"\n\t\t\t# \tflash[:just_signed_up] = true\n\t\t\t# \tsign_in_and_redirect :user, user\n\t\t\t# else\n\t\t\t# \t# Complete registration if any errors\n\t\t\t# \tsession[:omniauth] = @auth.except('extra')\n\t\t\t# \tredirect_to new_user_registration_url\n\t\t\t# end\n\t\tend\n\n\tend", "def authenticate_account!\n \tif session[:current_account_id]\n \t\t@current_account = Account.where(id: session[:current_account_id]).first\n\n \tend\n \treturn redirect_to accounts_login_path unless @current_account\n \t\n end", "def set_authentication\n @authentication = Authentication.find(params[:id])\n end", "def set_authentication\n @authentication = Authentication.find(params[:id])\n end", "def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:account, authentication.account)\n else\n user = Account.new(password: Devise.friendly_token) # If you create an account with twitter/fb, we don't need a passwod\n user.apply_omniauth(omniauth)\n user.email = get_email_from_omniauth omniauth\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:account, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = Account.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_account_registration_url\n end\n end\n end", "def show\n @authentications = Authentication.find(params[:id]) \n end", "def set_authentication\n @authentication = Authentication.find(params[:id])\n end", "def set_authentication\n @authentication = Authentication.find(params[:id])\n end", "def link_account(m, nick)\n\t\t\t\tnick = CGI::escape(nick)\n\t\t\t\t@backend.set(m.user, nick)\n\t\t\t\tm.reply(\"#{m.user} is now linked with account #{nick}!\")\n\t\t\tend", "def link_with_omniauth!(auth)\n link_with_omniauth(auth)\n save\n end", "def join\n redirect_to '/auth/linkedin'\n end", "def startLinkedInAuth\n require 'oauth2'\n\n client = OAuth2::Client.new('75yetg1f8atx89', 'le39CGDc1yQLCo9U', :site => 'https://www.linkedin.com/', :authorize_url => '/uas/oauth2/authorization')\n #specifies our site url which LinkedIn should redirect back to after the user successfully logs in\n #also includes a random state for security and the LinkedIn data which we will request from the user (basic profile info and their email address)\n redirect_to client.auth_code.authorize_url(:redirect_uri => request.protocol + request.host_with_port + '/access/finishLinkedInAuth') + '&state=' + getRandomState + '&scope=r_basicprofile%20r_emailaddress'\n end", "def set_authentication\n @authentication = current_user.authentications.find(params[:id])\n end", "def set_authentication\n\t\t\t@authentication = Authentication.find(params[:id])\n\t\tend", "def account_link\n return link_to I18n.t('user.show'), user_path(current_user) if current_user?\n link_to I18n.t('navigation.sign_up'), new_user_path\n end", "def link_account(provider, uid)\n self[provider.column.to_sym] = uid\n self.save\n end", "def authentication provider=:identity\n Authentication.where(user_id: id, provider: provider).all.first\n end", "def set_account_link\n @account_link = AccountLink.find(params[:id])\n end", "def login(auth)\n if student = Student.find_by(linkedin_uid: auth.uid)\n login_as(student)\n redirect_to team_path\n else\n redirect_to login_path, notice: \"You haven't joined a competition yet. Please follow the link your professor gave you to join.\"\n end\n end", "def create\n\t # get the authentication parameter from the Rails router\n\t params[:provider] ? authentication_route = params[:provider] : authentication_route = 'No authentication recognized (invalid callback)'\n\n\t # get the full hash from omniauth\n\t omniauth = request.env['omniauth.auth']\n\t \n\t # continue only if hash and parameter exist\n\t if omniauth and params[:provider] == 'identity'\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:identity] = omniauth['uid']\n\t redirect_to root_url, :notice => \"Signed in successfully.\"\n\t \n\t elsif omniauth and params[:provider]\n\t # create a new hash\n\t @authhash = Hash.new\n\t if authentication_route == 'google_oauth2'\n\t omniauth['info']['email'] ? @authhash[:email] = omniauth['info']['email'] : @authhash[:email] = ''\n\t omniauth['info']['name'] ? @authhash[:name] = omniauth['info']['name'] : @authhash[:name] = ''\n\t omniauth['uid'] ? @authhash[:uid] = omniauth['uid'].to_s : @authhash[:uid] = ''\n\t omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = ''\n\t else \n\t # debug to output the hash that has been returned when adding new authentications\n\t render :text => omniauth.to_yaml\n\t return\n\t end\n\t \n\t if @authhash[:uid] != '' and @authhash[:provider] != ''\n\t auth = Authentication.find_by_provider_and_uid(@authhash[:provider], @authhash[:uid])\n\t # if the user is currently signed in, he/she might want to add another account to signin\n\t if logged_in?\n\t if auth\n\t flash[:notice] = 'Your account at ' + @authhash[:provider].capitalize + ' is already connected with this site.'\n\t redirect_to authentications_path\n\t else\n\t current_user.authentications.create!(:provider => @authhash[:provider], :uid => @authhash[:uid], :uname => @authhash[:name], :uemail => @authhash[:email])\n\t flash[:notice] = 'Your ' + @authhash[:provider].capitalize + ' account has been added for signing in at this site.'\n\t redirect_to authentications_path\n\t end\n\t else\n\t if auth\n\t # signin existing user\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:user] = auth.user.id\n\t session[:authentication_id] = auth.id\n\t \n\t flash[:notice] = 'Signed in successfully.'\n\t redirect_to root_url\n\t else\n\t # this is a new user; show signup; @authhash is available to the view and stored in the sesssion for creation of a new user\n\t if Rails.env == \"development\" or @authhash[:email].split('@').include?('intridea.com')\n\t session[:authhash] = @authhash\n\t render signup_authentications_path\n\t end\n\t # render signup_authentications_path\n\t end\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route + '/' + @authhash[:provider].capitalize + '. The authentication returned invalid data for the user id.'\n\t redirect_to login_path\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route.capitalize + '. The authentication did not return valid data.'\n\t redirect_to login_path\n\t end\n\t end", "def process_authentication\n\n omniauth = request.env[\"omniauth.auth\"]\n Rails.logger.info(\"[CNTRL][Authentications] Auth process callback #{params} omniauth #{omniauth}\")\n\n if omniauth.nil?\n #TODO: Send back to sign in\n Rails.logger.info(\"[CNTRL][Authentications] Omni auth is nil, back to home\")\n redirect_to \"/\"\n end\n\n provider = params['provider']\n uid = omniauth['uid']\n\n already_existing_auth = Authentication.find_by_provider_and_uid(provider, uid)\n\n if already_existing_auth.nil?\n Rails.logger.info(\"[CNTRL][Authentications] A new foreign auth\")\n if user_signed_in?\n\n Rails.logger.info(\"[CNTRL][Authentications] User is already signed in #{current_user.full_name}\")\n\n query_hash = {}\n query_hash[provider] = uid \n invite_status = Invite.check_if_invite_exists(query_hash)\n\n \n\n any_existing_auth_for_same_provider = current_user.authentications.find_by_provider(provider)\n if any_existing_auth_for_same_provider.nil?\n Rails.logger.info(\"[CNTRL][Authentications] No existing auth for #{provider} for user\")\n authentication=Authentication.create(:provider=>provider,\n :uid=>uid,\n :token=> omniauth['credentials']['token'],\n :secret=> omniauth['credentials']['secret'],\n :user_id=>current_user.id)\n\n Rails.logger.info(\"[CNTRL][Authentications] Cache the new foreign profile\")\n authentication.foreign_profile = ForeignProfile.new\n authentication.foreign_profile.send(\"import_#{provider}\",omniauth)\n \n #redirect back to where you came from\n #\n \n\n if current_user.get_invited_status() == true\n enable_hash = {\n :user_id => current_user.id,\n :provider => provider,\n :uid => uid\n } \n current_user.enable_service(enable_hash)\n end\n redirect_to session[:return_to] || '/'\n \n else\n Rails.logger.info(\"[CNTRL][Authentications] #{current_user.full_name} already has auth for #{provider}\")\n if current_user.get_invited_status() == true\n enable_hash = {\n :user_id => current_user.id,\n :provider => provider,\n :uid => uid\n }\n current_user.enable_service(enable_hash)\n end\n redirect_to session[:return_to] || '/'\n end\n else\n # New authentication for no signed in user\n Rails.logger.info(\"[CNTRL][Authentications] User is not signed in but auth is new.\")\n\n authentication = Authentication.create( :provider => provider,\n :uid => uid,\n :token=> omniauth['credentials']['token'],\n :secret=> omniauth['credentials']['secret'])\n\n\n Rails.logger.info(\"[CNTRL][Authentications] New foreign profile to cache for new auth no signin.\")\n authentication.foreign_profile = ForeignProfile.new\n authentication.foreign_profile.send(\"import_#{provider}\",omniauth)\n\n\n query_hash = {}\n query_hash[provider] = uid\n \n invite_status = Invite.check_if_invite_exists(query_hash)\n if invite_status \n Invite.mark_invite_accepted(provider, uid)\n end\n\n Rails.logger.info(\"[CNTRL][Authentications] Redirecting to auth signup page.\")\n #if validation does not exist and user is not signed in do not allow access\n\n redirect_to :controller => 'authentications',\n :action => 'auth_signup_provider',\n :provider => provider,\n :uid => uid,\n :key => authentication.salt\n\n end\n else\n #save latest auth token\n Rails.logger.info(\"[CNTRL][Authentications] Renew credentials for an existing auth\")\n already_existing_auth.token = omniauth['credentials']['token']\n already_existing_auth.secret = omniauth['credentials']['secret']\n\n if user_signed_in?\n Rails.logger.info(\"[CNTRL][Authentications] User already signed in for a new auth.\")\n if already_existing_auth.user_id.nil?\n Rails.logger.info(\"[CNTRL][Authentications] User is being connected to auth\")\n already_existing_auth.user_id = current_user.id\n already_existing_auth.save!\n \n if current_user.get_invited_status() == true\n enable_hash = {\n :user_id => current_user.id,\n :provider => provider,\n :uid => uid\n }\n current_user.enable_service(enable_hash) \n end\n\n redirect_to session[:return_to] || '/'\n else\n\n if already_existing_auth.user_id == current_user.id\n Rails.logger.info(\"[CNTRL][Authentications] Auth token being updated for user\")\n already_existing_auth.save!\n end\n Rails.logger.info(\"[CNTRL][Authentications] Going back to where we came from\")\n enable_hash = {\n :user_id => current_user.id,\n :provider => provider,\n :uid => uid\n }\n current_user.enable_service(enable_hash) \n redirect_to session[:return_to] || '/'\n end\n else\n Rails.logger.info(\"[CNTRL][Authentications] A new auth and user is not signed in.\")\n if already_existing_auth.user_id.nil?\n Rails.logger.info(\"[CNTRL][Authentications] Auth is not associated to any user.\")\n already_existing_auth.save!\n\n Rails.logger.info(\"[CNTRL][Authentications] Foreign profile being saved for auth.\")\n already_existing_auth.foreign_profile = ForeignProfile.new\n Rails.logger.info(\"[CNTRL][Authentications] Foreign profile import method call.\")\n already_existing_auth.foreign_profile.send(\"import_#{provider}\",omniauth)\n \n\n Rails.logger.info(\"[CNTRL][Authentications] Redirecting to auth sign in\")\n redirect_to :controller => 'authentications',\n :action => 'auth_signup_provider',\n :provider => provider,\n :uid => uid,\n :key => already_existing_auth.salt\n\n else\n # I know the user, allow him to get in\n Rails.logger.info(\"[CNTRL][Authentications] Known auth, user sign in [user id : #{already_existing_auth.user_id}]\")\n \n if already_existing_auth.user.user_type == AppConstants.user_type_crawled \n Rails.logger.info(\"[CNTRL][Authentications] Cache the new foreign profile\")\n already_existing_auth.foreign_profile = ForeignProfile.new\n already_existing_auth.foreign_profile.send(\"import_#{provider}\",omniauth)\n already_existing_auth.save!\n\n redirect_to :controller => 'authentications',\n :action => 'auth_signup_provider',\n :provider => provider,\n :uid => uid,\n :key => already_existing_auth.salt\n return\n end\n\n\n already_existing_auth.save!\n \n invite_status = already_existing_auth.user.get_invited_status \n if invite_status \n enable_hash = {\n :user_id => already_existing_auth.user.id,\n :provider => provider,\n :uid => uid\n }\n already_existing_auth.user.enable_service(enable_hash) \n end\n sign_in_and_redirect(:user, already_existing_auth.user)\n end\n end\n end\n rescue => e\n Rails.logger.error(\"[CNTRL][Authentications] Save raised exception : #{e}\")\n redirect_to \"/\"\n end", "def user_authentication\n end", "def create_from_omniauth\n auth_hash = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_uid(auth_hash[\"provider\"], auth_hash[\"uid\"]) || Authentication.create_with_omniauth(auth_hash)\n\n # if: previously already logged in with OAuth\n if authentication.user\n user = authentication.user\n authentication.update_token(auth_hash)\n @next = root_url\n @notice = \"Signed in!\"\n # else: user logs in with OAuth for the first time\n else\n user = User.create_with_auth_and_hash(authentication, auth_hash)\n # you are expected to have a path that leads to a page for editing user details\n @next = edit_user_path(user)\n @notice = \"User created. Please confirm or edit details\"\n end\n\n sign_in(user)\n redirect_to @next, :notice => @notice\n end", "def login_link(**options)\n ::Stripe::Account.create_login_link(processor_id)\n rescue ::Stripe::StripeError => e\n raise Pay::Stripe::Error, e\n end", "def select_account_and_user\n Account.current = if Talgud.config.domain\n Account.find_by_domain(Talgud.config.domain)\n else\n Account.first\n end\n Authorization.current_user = current_user\n end", "def login_as\n unless session[:user] && session[:user].admin?\n redirect_to \"/\"\n return\n end\n\n user = params[:login_as]\n new_user = LinkedData::Client::Models::User.find_by_username(user).first\n\n if new_user\n session[:admin_user] = session[:user]\n session[:user] = new_user\n session[:user].apikey = session[:admin_user].apikey\n end\n\n #redirect_to request.referer rescue redirect_to \"/\"\n redirect_to \"/\"\n end", "def linked_account_names\n # user.user explained: first user is local user, second user ir padma_user\n @linked_account_names ||= @user.user.padma_accounts.map(&:name)\n end", "def create \n omniauth = request.env[\"omniauth.auth\"]\n \n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n #directly sign in existing user with existing authentication\n flash[:notice] = \"signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n elsif current_user\n #create a new authentication for currently signed in user\n current_user.authentications.create(:provider => omniauth['provider'], :uid => omniauth['uid']) \n flash[:notice] = \"Authentication successful.\" \n redirect_to authentications_url\n else\n # user does not have an account or is authenticated through a provider\n user = User.new\n user.apply_omniauth(omniauth) \n if user.save\n flash[:notice] = \"Signed in successfully.\" \n sign_in_and_redirect(:user, user) \n else\n session[:omniauth] = omniauth.except('extra') \n redirect_to new_user_registration_url\n end \n end\n end", "def callback\n # first, load the state (redirect_url, access_token)\n state = params[:state] ? LinkedAccount::Base.decode_state(params[:state]) : {}\n\n # set @linked_account, @redirect_url, and optionally @person\n case params.try(:[], :provider)\n when 'github'\n @linked_account = LinkedAccount::Github::User.find_or_create_via_oauth_code params[:code]\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'facebook'\n @linked_account = LinkedAccount::Facebook.find_or_create_via_oauth_code params[:code]\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'twitter'\n @linked_account = LinkedAccount::Twitter.find_or_create_via_oauth_token_and_verifier(params[:oauth_token], params[:oauth_verifier])\n @person = Person.find_by_access_token(state[:access_token])\n @redirect_url = state[:redirect_url]\n\n when 'gittip', 'gratipay'\n @linked_account = LinkedAccount::Gittip.find_by_oauth_token params[:external_access_token]\n @person = Person.find_by_access_token(params[:gittip_access_token] || params[:gratipay_access_token])\n @redirect_url = params.delete :redirect_url\n end\n\n # run through all of the use cases\n if @person && (@person == @linked_account.person)\n # nothing to do... @person is already logged in and linked to this account.\n opts = { status: 'linked', access_token: @person.create_access_token(request) }\n elsif @person && !@linked_account.person\n # should be safe to link this account to the logged in @person\n @linked_account.link_with_person(@person)\n opts = { status: 'linked', access_token: @person.create_access_token(request) }\n elsif @person\n # error! @person logged in but not the same as @linked_account.person\n opts = { status: 'error_already_linked' }\n elsif @linked_account.person\n opts = { status: 'linked', access_token: @linked_account.person.create_access_token(request) }\n\n # Alias Person ID with randomly generated Mixpanel distinct_id.\n unless state[:mp_id].blank?\n begin\n MixpanelAlias.claim(@linked_account.person.id, state[:mp_id])\n rescue MixpanelAlias::AlreadyClaimed\n opts[:reset_mixpanel_id] = true\n end\n end\n\n else\n # nobody logged in, and no person on this account... they need to create an account\n opts = {\n status: 'error_needs_account',\n email_is_registered: !!Person.find_by_email(@linked_account.email),\n account_link_id: \"#{params[:provider]}:#{@linked_account.create_access_token}\",\n first_name: @linked_account.first_name,\n last_name: @linked_account.last_name,\n email: @linked_account.email,\n image_url: @linked_account.image_url,\n display_name: @linked_account.login\n }\n end\n\n # redirect, should be provider-agnostic\n raise MissingRequiredParams, :redirect_url unless Rails.env.development? || (@redirect_url =~ WHITELISTED_REDIRECT_URL)\n\n # tack on params\n redirect_to @redirect_url + (@redirect_url['?'] ? '&' : '?') + opts.to_param\n end", "def ldap_sign_in(user)\n login_as(user, scope: :user)\nend", "def fetch_details_from_linkedin\n\t\t# To Do\n\t\tself.user.has_linkedin = true\n\t\tself.user.save\n\tend", "def create\n auth = request.env[\"omniauth.auth\"]\n user_info = auth[\"info\"] ? auth[\"info\"] : auth[\"user_info\"]\n authentication = Authorization.where(:provider => auth['provider'], :uid => auth['uid']).first\n authentication = Authorization.new(:provider => auth['provider'], :uid => auth['uid']) if !authentication\n session[:fb_token] = auth['credentials']['token'] if auth['credentials']['token'] != nil\n # if the user exists, but does not have a link with the social service\n if !authentication.user && current_user\n authentication.user = current_user\n authentication.save\n end\n # twitter only (gets no email)\n if !authentication.user && !user_info[\"email\"]\n flash[:notice] = \"No user linked to this account. Please sign in or create a new account\"\n redirect_to '/users/sign_up/'\n # if user doesnt exists, register user\n elsif !authentication.user\n user = User.where(email: user_info['email']).first\n if user\n authentication.user = user\n else\n new_user = User.new(email: user_info['email'], username: user_info['name'], first_name: user_info['first_name'], last_name: user_info['last_name'], role: \"registered\")\n new_user.save\n authentication.user = new_user\n end\n authentication.save\n end\n # if user exists, sign in. Gives a Mongoid glitch of not signing in after registration. So double sign in\n if authentication.user\n if !current_user\n sign_in authentication.user\n sign_out authentication.user\n sign_in authentication.user\n # raise \"user signed in? #{user_signed_in?.to_s}\".inspect\n flash[:notice] = \"Authorization successful.\"\n redirect_to root_path\n else\n flash[:notice] = \"Linked successfully.\"\n redirect_to '/users/'+current_user.id\n end\n end\n end", "def open_user_account\n Account.create(user_id: self.id) \t\n end", "def add_authentication(authentication)\n authentications << authentication\n end", "def create\n # Store authentication hash from 3rd party web service \n omniauth = request.env['omniauth.auth']\n logger.debug \"\\n\\n\\t omniauth \\n\\n\"\n logger.debug omniauth\n\n \n # Attempt to find an existing authentication in the database\n authentication = Authentication.\n find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n \n # handle returning user, new authentication for existing user, \n # or new user cases\n if authentication\n # we found an authentication in the database so\n # we know this is a returning user\n flash[:notice] = \"Signed in successfully\"\n # redirect to user's profile\n sign_in_and_redirect(:user, authentication.user)\n elsif current_user\n # We did not find a matching authentication in the \n # database but current_user is defined. This tells\n # us that a currently logged in user is adding a new\n # authentication method to their existing account.\n\n # build new authentication for current_user\n current_user.build_authentication(omniauth)\n\n flash[:notice] = \"Authentication successful\"\n # redirect to the page for managing authentications\n redirect_to authentications_url\n else\n # We did not find a matching authentication and there\n # is no current_user. So, we need to create a new User\n # and a new Authentication.\n\n # Find the invited user by the invitation_token\n user = User.accept_invitation!(:invitation_token => session[:invitation_token])\n\n # Build a new authentication\n user.build_authentication(omniauth)\n \n # try to save the user\n if user.save\n # if we pass the authentications redirect the new user\n # to the user's profile page\n flash[:notice] = \"Signed in successfully.\"\n sign_in_and_redirect(:user, user)\n else\n # if we did not pass the authentications (e.g. the new\n # user did not have an email address) we redirect to \n # the new_user_registration_url so that the new user\n # can give us the information that we need. This is where\n # we collect emails from people who sign up with LinkedIn or \n # Facebook.\n session[:omniauth] = omniauth.except('extra')\n redirect_to new_user_registration_url\n end\n end\n end", "def authenticate_with(identity, next_service, username); end", "def login_as_one\n sign_in(users(:one))\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = ::User.find_by_fb_user_id(fb_user_id)\n #merge the existing account\n unless existing_fb_user.nil?\n merge_with(existing_fb_user)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def after_magic_link_authentication\n end", "def linkedin\n \n @user = User.find_for_linkedin_oauth(omniauth_param, current_user)\n \n if current_user #invite friend from linkedin || connectting with linkedin\n if session[\"linkedin\"] && session[\"linkedin\"][:invite_friends] #invite friend from linkedin\n redirect_to invite_friends_friendships_path(provider: \"linkedin\")\n else\n redirect_to root_path\n end\n\n else #Login/sign up with linkedin\n if @user.persisted?\n flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"LinkedIn\"\n \n sign_in_and_redirect @user, :event => :authentication\n else\n session[\"devise.social_data\"] = omniauth_param\n redirect_to new_user_registration_url\n end\n end\n end", "def login_link\n if !authenticated?\n link = '<li><a href=\"https://github.com/login/oauth/authorize?scope=public_repo,admin:repo_hook&client_id=' + CLIENT_ID + '\">Log in with Github</a></li>'\n else\n link = '<li><a href=\"/logout\">Log out</a></li>'\n end\n end", "def finishLinkedInAuth\n require 'oauth2'\n\n if params[:code].present? && params[:state].present?\n client = OAuth2::Client.new('75yetg1f8atx89', 'le39CGDc1yQLCo9U', :site => 'https://www.linkedin.com/', :token_url => '/uas/oauth2/accessToken')\n token = client.auth_code.get_token(params[:code], :redirect_uri => request.protocol + request.host_with_port + '/access/finishLinkedInAuth')\n\n #use the token to get this user's first-name, last-name, location, industry, num-connections, positions, email-address, and id\n response = token.get('https://api.linkedin.com/v1/people/~:(first-name,last-name,location,industry,num-connections,positions,email-address,id)?format=json', :headers => { 'authorization' => 'Bearer ' + token.token })\n response = ActiveSupport::JSON.decode(response.response.env['body']) #convert that JSON to a ruby array\n\n #search our database to see whether this is a new user\n found_user = User.where(:linkedInId => response['id']).first\n if found_user == nil\n found_user = createNewUser(response)\n else\n found_user = updateUser(response, found_user)\n end\n \n #set their id in the session, which designates them as logged in\n session[:user_id] = found_user.id\n \n #check whether they should be allowed into our site, as long as they have not been reported three or more times\n if found_user.reportedCount >= 3\n #if they have been reported too many times, log them out and redirect them to the locked page\n session[:user_id] = nil\n redirect_to(:action => 'locked')\n else\n redirect_to(:controller => 'home_feed', :action => 'show') #otherwise, redirect them to the home feed\n end\n \n elsif params[:error].present? && params[:error_description].present?\n puts \"Rejected\"\n \n else\n puts \"Unexpected response\"\n end\n end", "def create\n omniauth = request.env['omniauth.auth']\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n if authentication\n flash[:notice] = \"Signed in successfully\"\n sign_in_and_redirect(:user, authentication.user)\n else\n user = User.new\n user.apply_omniauth(omniauth)\n user.email = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n if user.save\n flash[:notice] = \"Successfully registered\"\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n session[:omniauth_email] = omniauth['extra'] && omniauth['extra']['user_hash'] && omniauth['extra']['user_hash']['email']\n\n # Check if email already taken. If so, ask user to link_accounts\n if user.errors[:email][0] =~ /has already been taken/ # omniauth? TBD\n # fetch the user with this email id!\n user = User.find_by_email(user.email)\n return redirect_to link_accounts_url(user.id)\n end\n redirect_to new_user_registration_url\n end\n end\n end", "def log_in(user)\n email = $credentials[user]['email']\n password = $credentials[user]['password']\n case user\n when 'User A'\n transporter.go_to_url(USER_A_HOST)\n set_field('identifier', email)\n click_btn('Next')\n set_field('password', password)\n click_btn('Next')\n when 'User B'\n transporter.go_to_url(USER_B_HOST)\n end\n end", "def sign_in_and_redirect(resource_or_scope, *args); end", "def account\n\n end", "def authentication\r\n AuthenticationController.instance\r\n end", "def linkedin\n linkedin_config = GenericApiRails.config.linkedin_hash\n if linkedin_config.nil?\n logger.error('Linkedin login/signup not configured. For configuration instructions see controllers/generic_api_rails/authentication_controller.rb in the generic_api_rails project')\n render :json => { success: false , error: \"Linkedin login/signup not configured\" }\n return\n end\n\n # Get the \"Real\" authorization code\n temp_access_token = params['access_token']\n\n code_uri = URI('https://www.linkedin.com/uas/oauth2/accessToken')\n oauth_https = Net::HTTP.new(code_uri.host, code_uri.port)\n oauth_https.use_ssl = true\n\n post_data = {\n :grant_type => 'authorization_code',\n :code => temp_access_token,\n :client_id => linkedin_config[:client_id],\n :client_secret => linkedin_config[:client_secret],\n :redirect_uri => params['redirect_uri'] || linkedin_config[:redirect_uri]\n }\n post_data_string = URI.escape(post_data.collect{|k,v| \"#{k}=#{v}\"}.join('&'))\n\n code_response = oauth_https.post(code_uri.path, post_data_string)\n\n if code_response.code.to_s != 200.to_s\n # log the error message if there is one\n if code_response.body\n resp = JSON.parse(code_response.body)\n logger.error(\"Error authenticating user against Linkedin: #{resp['error_description']}\")\n end\n render :json => { success: false , error: \"Could not authenticate using Linkedin\" }\n return\n end\n\n auth_response = JSON.parse(code_response.body)\n access_token = auth_response['access_token']\n\n if access_token.nil?\n render :json => { success: false , error: \"Could not get access token from Linkedin\" }\n return\n end\n\n # Get the user's info\n # user_uri = URI('https://api.linkedin.com/v1/people/~?format=json')\n user_uri =URI('https://api.linkedin.com/v1/people/~:(id,email-address,firstName,lastName)?format=json')\n api_https = Net::HTTP.new(user_uri.host, user_uri.port)\n api_https.use_ssl = true\n\n request = Net::HTTP::Get.new(user_uri.request_uri)\n request['Authorization'] = \"Bearer #{access_token}\"\n\n user_response = api_https.request(request)\n if user_response.code.to_s != 200.to_s\n render :json => { success: false , error: \"Could not get user info from Linkedin\" }\n return\n end\n\n user_info = JSON.parse(user_response.body)\n uid = user_info['id']\n @email = user_info['emailAddress']\n\n person_hash = {\n fname: user_info[\"firstName\"],\n lname: user_info[\"lastName\"]\n #minitial: user_info[\"middle_name\"],\n #profile_picture_uri: profile_pic,\n #birthdate: user_info[\"birthday\"]\n }\n\n # You'll have to define GenericApiRails.config.oauth_with for your\n # particular application\n @results = GenericApiRails.config.oauth_with.call(provider: \"linkedin\", uid: uid, email: @email , person: person_hash)\n\n if @results[0].nil?\n @credential = nil\n else\n @credential = @results[0]\n end\n\n done\n end", "def links\n @creditor_bank_account_links ||= Links.new(@links)\n end", "def common_authenticate(user_name)\n user = User.find_by_ldap_id(user_name)\n if user.nil?\n user = User.new\n user.ldap_id = user_name\n user.save!\n end\n session[:user_id] = user.id\n end", "def sign_in_link\n # note: could test to see if we aren't already signed in, but seems no point\n # TBD: make sure that all references to sign_in have it as a dialog\n link_to( \"#{iconify(:sign_in)}&nbsp;Sign In\".html_safe, new_person_session_path, 'data-rel' => 'dialog')\n end", "def oauth_authentication; end", "def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n #byebug\n klass = mapping.to\n\n if request.headers['X-HC-FB-AUTH'].present?\n # the returned user object will be saved and serialised into the session\n\n decoded = Base64.decode64(request.headers['X-HC-FB-AUTH'])\n user_and_token = decoded.split(':')\n\n users = klass.includes(:identities).where(socify_identities: { uid: user_and_token[0], token: user_and_token[1], provider: \"facebook\"})\n begin\n if users.size == 1\n u = users.first\n identity = u.identities.find_by!(uid: user_and_token[0], token: user_and_token[1], provider: \"facebook\")\n if !identity.expires_at || (identity.expires_at && identity.expires_at > Time.now)\n success! u\n else\n fail! \"token expired\"\n end\n else\n fail! \"invalid uid and/or token\"\n end\n rescue\n fail!\n end\n end\n\n # if we wanted to stop other strategies from authenticating the user\n end", "def mints_user_magic_link_login(hash)\r\n # Login in mints\r\n response = @mints_user.magic_link_login(hash)\r\n if response['data'] && response['data']['redirect_url']\r\n # Set a cookie with the session token\r\n cookies[:mints_user_session_token] = { value: response['data']['api_token'], expires: 1.day, secure: true, httponly: true }\r\n redirect_to response['data']['redirect_url']\r\n else\r\n redirect_to '/'\r\n end\r\n end", "def authenticate_with(identity, next_service, username, key_manager); end", "def create_from_linkedin\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_email(auth['info']['email'])\n if(user)\n\n sign_in user\n client = LinkedIn::Client.new(\"mgdh4gtnqnra\", \"adFWD50VxWY35Yi1\")\n client.authorize_from_access(auth['credentials']['token'],auth['credentials']['secret'])\n user.token = auth['credentials']['token'] \n user.secret = auth['credentials']['secret'] \n\n # Updated the user information\n update_profile(client,user)\n update_educations(client,user)\n update_experiences(client,user)\n redirect_to home_path\nreturn\nend\nredirect_to root_path, :alert=> \"Login with LinkedIn failed!!\"\n end", "def create_link(auth)\n\t\texp = auth['credentials']['expires_at']\n\t\texp = DateTime.strptime(\"#{exp}\",'%s') if exp\n\t\tlinks.create(\n\t\t\tprovider: auth['provider'],\n\t\t\tuid: auth['uid'],\n\t\t\taccess_token: auth['credentials']['token'],\n\t\t\taccess_token_secret: auth['credentials']['secret'],\n\t\t\trefresh_token: auth['credentials']['refresh_token'],\n\t\t\ttoken_expires_at: exp\n\t\t)\n\tend", "def index\n @authentications = Authentication.all\n end", "def simultaneous_login!\n redirect_to root_path if current_admin && current_account\n end", "def authenticate_account\n # authenticate their credentails against sfdc\n sfdc_authentication = Account.new(User.new(:username => params[:user][:username]))\n .authenticate(params[:user][:password])\n # authenticate to sfdc with the admin's access token\n ApiModel.access_token = admin_access_token\n\n # if they authenticated successfully\n if sfdc_authentication.success.to_bool\n # see if the user exists in the database\n user = User.find_by_username(params[:user][:username])\n if user\n sfdc_account = Account.find(params[:user][:username], 'cloudspokes')\n # update their user records from sfdc\n user.access_token = sfdc_authentication.access_token\n user.sfdc_username = sfdc_account.sfdc_username\n user.email = sfdc_account.email\n user.profile_pic = sfdc_account.profile_pic\n user.accountid = sfdc_account.accountid \n # save their record, sign them in and redirect\n if user.save\n sign_in_and_redirect(:user, user)\n else\n flash[:alert] = \"Sorry... there was an error logging you in. #{user.errors.full_messages}\"\n render action: \"new\" # sign_in page\n end\n # user exists in sfdc but not in db so create a new record\n else\n sfdc_account = Account.find(params[:user][:username], 'cloudspokes')\n user = User.new\n # set the sfdc values\n user.access_token = sfdc_authentication.access_token\n user.sfdc_username = sfdc_account.sfdc_username\n user.email = sfdc_account.email\n user.profile_pic = sfdc_account.profile_pic\n user.accountid = sfdc_account.accountid\n user.username = sfdc_account.username\n user.password = params[:user][:password]\n user.skip_confirmation!\n user.create_account\n\n # save their record, sign them in and redirect\n if user.save\n user.update_attribute(:confirmed_at, DateTime.now)\n sign_in_and_redirect(:user, user)\n else\n flash[:alert] = \"Sorry... there was an error creating your user account. #{user.errors.full_messages}\"\n render action: \"new\" # sign_in page\n end\n end \n\n else \n flash[:alert] = 'Invalid username / password combination' # sfdc_authentication.message\n render action: \"new\" # sign_in page\n end\n\n end", "def link_to_user(user)\r\n link_to user.name, :controller => 'account', :action => 'show', :id => user\r\n end", "def auth\n end", "def auth\n end", "def create\n omniauth = request.env[\"omniauth.auth\"]\n\n authentication = Authentication.find_by_provider_and_uid(\n omniauth['provider'],\n omniauth['uid']\n )\n\n if authentication\n\n sign_in_and_redirect(:user, authentication.user)\n\n elsif current_user\n current_user.authentications.create(:provider => omniauth['provider'],\n :uid => omniauth['uid'])\n flash[:notice] = \"Authentication with #{omniauth['provider']} was successful.\"\n redirect_to authentications_url\n else\n # New user\n user = User.new\n\n user.apply_omniauth(omniauth)\n if user.save\n check_event_entry user.authentications[0]\n sign_in_and_redirect(:user, user)\n else\n session[:omniauth] = omniauth.except('extra')\n redirect_to new_user_registration_url\n end\n end\n end", "def mints_user_magic_link_login(hash)\r\n # Login in mints\r\n response = @mints_user.magic_link_login(hash)\r\n if response['data']\r\n # Set a cookie with the session token\r\n cookies[:mints_user_session_token] = { value: response['data']['api_token'], secure: true, httponly: true, expires: 1.day }\r\n redirect_to response['data']['redirect_url'] || '/'\r\n else\r\n redirect_to '/'\r\n end\r\n end", "def create\n omniauth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])\n initial_session(omniauth)\n\n if current_user\n if authentication #if such user with such SN already exists\n accounts_merge(authentication)\n sign_in_and_redirect(:user, authentication.user)\n else\n current_user.authentications.create(:provider => omniauth['provider'], :uid => omniauth['uid'])\n redirect_to authentications_path, :notice => t('authentication.succes')\n end\n elsif authentication\n flash[:notice] = t('authentication.signed_succes')\n sign_in_and_redirect(:user, authentication.user)\n else\n if User.find_by_email(omniauth['info']['email'])\n user = User.new(:email => omniauth['provider'] + \":\" +omniauth['info']['email'])\n else\n user = User.new(:email => omniauth['info']['email'])\n end\n user.authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n set_profile(user, omniauth)\n user.save\n user.save(:validate => false)\n flash[:notice] = t('authentication.signed_succes')\n sign_in_and_redirect(:user, user)\n end\n end", "def signin_link\n view_context.link_to \"Sign In\", view_context.new_session_path(:user)\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = metaclass.send(\"find_by_#{fb_user_name}\", fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.send(\"#{fb_user_name}_id=\", nil)\n existing_fb_user.save(false)\n end\n #link the new one\n self.send(\"#{fb_user_name}_id=\", fb_user_id)\n save(false)\n end\n end", "def authenticate_by_login_or_key(options = {})\n if api_request?\n self.current_account = site_account_by_provider_key\n else\n login_required\n end\n end", "def liaison\n inverse_accounts.last.user\n end", "def social\n @user = current_user\n @links = current_user.external_links\n \n # TWITTER\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n request_token = clientTwitter.request_token(:oauth_callback => TwitterEnv::CALLBACK_URL) \n session[:rtoken_twitter] = request_token.token\n session[:rsecret_twitter] = request_token.secret\n @login_twitter_url = request_token.authorize_url\n end\n \n # FACEBOOK\n @login_facebook_url = Koala::Facebook::OAuth.new.url_for_oauth_code(:permissions => 'read_stream,offline_access')\n \n if params[:code]\n @user.user_content.facebook_token = Koala::Facebook::OAuth.new.get_access_token(params[:code])\n @user.user_content.save\n end\n \n # LINKEDIN\n if params[:oauth_verifier]\n client = LinkedIn::Client.new(LinkedIn::API_KEY, LinkedIn::SECRET_KEY)\n if @user.user_content.linkedin_token.blank?\n pin = params[:oauth_verifier]\n atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)\n @user.user_content.linkedin_token = atoken\n @user.user_content.linkedin_secret = asecret\n @user.user_content.save\n else\n client.authorize_from_access(@user.user_content.linkedin_token, @user.user_content.linkedin_secret)\n end\n else\n client = LinkedIn::Client.new(LinkedIn::API_KEY, LinkedIn::SECRET_KEY)\n request_token = client.request_token(:oauth_callback => LinkedIn::CALLBACK_URL)\n session[:rtoken] = request_token.token\n session[:rsecret] = request_token.secret\n @login_linkedin_url = client.request_token.authorize_url\n end\n \n respond_to do |format| \n if params[:ajax] == \"true\" # Request came from ajax. Respond without layout.\n format.html { render :layout => false } # social.html.erb\n else\n format.html # social.html.erb WITH layout\n end\n end\n end", "def authenticate_account!\n store_bookingsync_account_id if BookingSync::Engine.embedded\n sign_out_if_inactive\n enforce_requested_account_authorized!\n request_authorization! if current_account.nil?\n end", "def accounts\n end", "def login_from_basic_auth\n basic_authentication.authenticate do |email, password|\n self.current_ma_user = MA[:user].authenticate(email, password)\n end\n end", "def comp_signin_link\n click_link 'Sign in'\n end", "def authenticate\n if session[:account].blank?\n @is_login = false\n reset_session\n render \"login/error\"\n else\n @is_login = true\n @user = User.where( \"account = ?\", session[:account] )[0]\n end\n end", "def amend_user\n # we should have a current user.\n user = current_user\n if (user)\n auth = request.env[\"omniauth.auth\"]\n # We should have at most one of these.\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :user_id.ne => nil,\n :master_id => @master.id).order(\"create_at desc\").all\n oauth = nil\n oauths.each do |oa|\n if oa.user == user\n if oauth.nil?\n oauth = oa\n else # masters should all be the same\n # Be proactive resilience here and get rid of this one. We should not have multiples\n logger.error(\"sessions#ammend_customer: getting rid of multiple administrator authentications.\")\n oa.destroy()\n end\n else\n redirect_to edit_master_user_registration_path(user.master, user),\n :alert => \"This authentication belongs to different user.\"\n return\n end\n end\n if oauth\n if @master != oauth.user.master\n # This is really bad. Attempt a fix.\n logger.error \"sessions#amend_user: Authentication has mismatched master for user. Removing.\"\n oauth.destroy()\n end\n redirect_to edit_master_user_registration_path(user.master, user),\n :notice => \"This authentication has already been added.\"\n else\n oauth = Authentication.create_with_omniauth(auth)\n oauth.master = @master\n user.authentications << oauth\n user.save\n redirect_to edit_master_user_registration_path(user.master, user),\n :notice => \"Authentication added.\"\n end\n else\n redirect_to master_user_sign_in_path(@master),\n :alert => \"Need to sign in first.\"\n end\n end", "def create_authentication(omniauth)\n authentications.create! do |a|\n a.provider = omniauth.provider\n a.uid = omniauth.uid\n end\n end", "def index\n\t\t@authentications = Authentication.all\n\tend", "def active_for_authentication?; end", "def active_for_authentication?; end", "def create\n @omniauth = request.env[\"omniauth.auth\"]\n \n authentication = Authentications.find_by_provider_and_uid(@omniauth['provider'], @omniauth['uid'])\n\n if(@@logingIn ==0) \n registering(authentication)\n elsif(@@logingIn ==1)\n signingIn(authentication)\n end\n\nend", "def create_authentication(omniauth)\n authentications.create! do |a|\n a.provider = omniauth.provider\n a.uid = omniauth.uid\n end\n end", "def http_auth_login\n # FIXME: Implement\n end", "def authenticate(scope, authentication = \"basic\")\n @user = User.find_by_login(params[scope][\"login\"])\n if authentication == \"ldap\" && !user_is_root?\n User.ldap_authentication(params[scope][\"login\"], params[scope][\"password\"])\n else\n warden.authenticate(:scope => scope)\n end\n end", "def signingIn (authentication)\n\n if authentication.instance_of?(Authentications)\n user = Customer.where(:id => authentication.user_id).first\n session[:user_id] = user.id\n current_user.sign_in_count +=1\n current_user.last_sign_in_at = Time.now\n current_user.current_sign_in_at = Time.now\n current_user.last_sign_in_ip = request.remote_ip \n current_user.current_sign_in_ip = request.remote_ip \n current_user.save\n @@logingIn=0\n redirect_to root_path, :notice => \"Logged in successfully\"\n else\n @@logingIn=0\n redirect_to root_path, :notice => \"Sorry! You need to register first \"\n\n end\n\n\nend", "def authenticate_account(client, options)\n if options[:application].nil? or options[:username].nil? or options[:password].nil? \n puts \"Missing arguments\"\n return\n end\n\n application = client.applications.get options[:application]\n request = Stormpath::Authentication::UsernamePasswordRequest.new options[:username], options[:password]\n begin\n result = application.authenticate_account request\n puts \"Authentication: SUCCESS\"\n puts \"Account Href: \" + result.account.href\n \n rescue Stormpath::Error => e\n puts \"Authentication: FAILURE\"\n print_error(e)\n end\nend", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def authentication_token\n object.authentication_token if !current_user || object.id == current_user.id\n end" ]
[ "0.6548322", "0.6419949", "0.62457544", "0.61796516", "0.6037554", "0.6034536", "0.5963462", "0.59040344", "0.5897377", "0.5874491", "0.58699167", "0.58399075", "0.58369225", "0.58104926", "0.57875293", "0.5787419", "0.57679725", "0.576345", "0.57521915", "0.5714858", "0.56979483", "0.5693505", "0.5690926", "0.56871426", "0.5682571", "0.56803644", "0.5675732", "0.5670216", "0.56679964", "0.56521666", "0.56489384", "0.56466913", "0.56446016", "0.5615226", "0.56126875", "0.5601172", "0.55729145", "0.5563169", "0.5558763", "0.55542105", "0.5543804", "0.5539497", "0.55333173", "0.55260575", "0.5516493", "0.55107945", "0.5504977", "0.5496827", "0.54944164", "0.5484481", "0.54817367", "0.5480884", "0.5455753", "0.5446109", "0.54416615", "0.543999", "0.54188126", "0.5410037", "0.54069114", "0.5403417", "0.5400797", "0.5399959", "0.5398357", "0.5398173", "0.53943634", "0.5383753", "0.53718376", "0.5363616", "0.53545016", "0.534951", "0.534951", "0.53494614", "0.53488815", "0.53449714", "0.53426003", "0.5340927", "0.53354436", "0.532887", "0.53223544", "0.53179073", "0.53121704", "0.5310228", "0.5309972", "0.5308287", "0.53060395", "0.52957284", "0.52947706", "0.5292658", "0.5292658", "0.52891827", "0.5288999", "0.52854353", "0.527739", "0.52724034", "0.52613455", "0.526087", "0.526087", "0.526087", "0.526087", "0.5260578" ]
0.585085
11
Using a private method to encapsulate the permissible parameters is just a good pattern since you'll be able to reuse the same permit list between create and update. Also, you can specialize this method with peruser checking of permissible attributes.
def user_params params.require(:user).permit(:login) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permitted_params\n policy(resource || resource_class.new).send(\"permitted_#{action_name}_attributes\")\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def permitted_create_params\n fail NotImplementedError\n end", "def form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end", "def permitted_params\n res = attribute_names.map(&:to_sym) - %i[disabled user_id created_at updated_at tracker_id tracker_history_id\n admin_id]\n refine_permitted_params res\n end", "def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end", "def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end", "def permitted_params\n @implementation_class ||= implementation_class\n\n res = @implementation_class.permitted_params\n @implementation_class.refine_permitted_params res\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def permitted_update_params\n fail NotImplementedError\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def permitted?; end", "def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end", "def permit(type,options={})\n raise NameError.new(\"duplicate ability definition\") if @ability.key? type\n ability_object = GraphQL::Authorization::AbilityType.new(type,nil,{})\n if options.key?(:except) && options.key?(:only)\n raise ArgumentError.new(\"you cannot specify white list and black list\")\n end\n if options[:except]\n ability_object.access(type.fields.keys.map(&:to_sym) - options[:except])\n elsif options[:only]\n ability_object.access(options[:only])\n end\n ability_object.execute options[:execute]\n if block_given?\n #note Proc.new creates a proc with the block given to the method\n ability_object.instance_eval(&Proc.new)\n end\n @ability[type] = ability_object\n end", "def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end", "def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def request_permitted?(item)\n true\n end", "def permitted\n {attrib_name => spec.permitted}\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def create\n\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n if current_user.faculty?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today, \n entered_by: current_user.faculty.first_name + \" \" + current_user.faculty.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n elsif current_user.student?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today,\n entered_by: current_user.student.first_name + \" \" + current_user.student.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n end\n authorize @permit\n\n respond_to do |format|\n if @vehiclepermit.save\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @vehiclepermit }\n else\n format.html { render :new }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \n \n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end", "def user_params\n params.require(:user).permit(policy(@user || User).permitted_attributes)\n end", "def formulary_params\n allow = [:responsable_llenado,:cod01,:cod02,:ape01,:ape04,:ape07,:ape02,:ape05,:ape03,:ape06,:api01,:api04,:api02,:ssb01,:api03,:cao01,:cao04,:cao07,:cao10,:tit01,:cao02,:cao05,:cao08,:cao11,:cao03,:cao06,:cao09,:cao12,:uni01,:uni02,:uni03,:ben01,:ben02,:per01,:per02,:user_id]\n params.require(:formulary).permit(allow)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def permitted_params\n\n \n if action_name.to_s == \"update\" && !current_signed_in_resource.is_admin?\n\n \n params.permit({cart_item: [:discount_code,:quantity]},:id)\n\n elsif action_name.to_s == \"create_multiple\"\n params.permit({discount: [:id, {:product_ids => []}]})\n else\n\n params.permit({cart_item: [:product_id,:discount_code,:quantity]},:id)\n\n end\n\n\n end", "def permitted_params\n @permitted_params ||= PermittedParams.new(params, current_user)\n end", "def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def form_params\n params.require(:funding_request).permit(FundingRequest.allowable_params)\n end", "def expected_permitted_parameter_names; end", "def permission_policy_params\n params.require(:permission_policy).permit(:name, :io1, :io2, :io3, :io4)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def access_control_params\n params.require(:access_control).permit(:uuid, :role_id, :ability_to_create_stream, :ability_to_create_discussion, :ability_to_comment, :ability_to_create_question, :ability_to_create_answer, :ability_to_administrate)\n end", "def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end", "def borrowership_params\n params\n .require(:borrowership)\n .permit(*policy(@borrowership || Borrowership.new).permitted_attributes)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def unpermitted_parameters\n fail 'Define me!'\n end", "def allowed_params\n ALLOWED_PARAMS\n end", "def user_params\n params.require(:user).permit(*policy(@user || User).permitted_attributes)\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.require(:user).permit(current_ability.permitted_attributes(:manage, @user))\n end", "def vip_privilege_params\n params[:vip_privilege].permit!\n end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def is_permitted_for?( user )\n ( user.id == self.user.id ) or ( user.privileged? )\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def user_params\n params.permit(User::UPDATABLE_ATTRIBUTES)\n end", "def permitted_params_from_policy(object_or_class, key)\n _params = permitted_params[key]\n _attributes = policy(object_or_class).permitted_attributes\n ::ActionController::Parameters.new(_params).permit(*_attributes)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def users_params\n\t\tparams.require(:user).permit(User::PERMIT_ATTRIBUTES)\n\tend", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def tam_policy_params\n params.require(:tam_policy).permit(TamPolicy.allowable_params)\n end", "def permit(*keys)\n select { |key, _| keys.include?(key) }\n end", "def post_card_params\n params[:post_card].permit!\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def create_permitted?\n acting_user.administrator?\n end", "def create_permitted?\n acting_user.administrator?\n end", "def create_permitted?\n acting_user.administrator?\n end", "def create_permitted?\n acting_user.administrator?\n end", "def privilege_params\n params.require(:privilege).permit(:qDrive, :addSong, :editSong, :deleteSong, :grantPermission, :addUser, :editUser, :deleteUser)\n end", "def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end", "def user_params\n allowed_params = [:username, :email, :jabber_id, :jabber_otr_fingerprint, :avatar]\n allowed_params << [:password, :password_confirmation] unless params[:user][:password].blank?\n allowed_params << [:role] if current_user.moderator_or_admin?\n allowed_params << [:tenant_ids => []] if current_user.admin?\n allowed_params << [:user_ids => []] if current_user.moderator_or_admin?\n params.require(:user).permit(allowed_params)\n end", "def permitted=(_arg0); end", "def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end", "def param_whitelist\n [:role, :title]\n end", "def allow_params_authentication!; end", "def defect_params\n params.require(:defect).permit(Defect.allowable_params)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def object_params\n params.require(resource.name.underscore.to_sym)\n .permit(resource_params)\n end", "def resource_params\n # TODO DANGER!\n params.require(@resource_class.name.underscore.to_sym).permit!\n end", "def resource_params\n deserialized_params.permit!\n end", "def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end", "def update_params\n params.require(:permission_template)\n .permit(:release_date, :release_period, :release_varies, :release_embargo,\n :visibility, :workflow_id, :metadata_context_id,\n access_grants_attributes: %i[access agent_id agent_type id])\n end", "def resource_params\n params.require(resource_name).permit(*permitted_params)\n end", "def permition_params\n params.require(:permition).permit(:act, :information_system_id, :parameter)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def resource_params\n permition = @klazz.attribute_names - [:created_at, :updated_at]\n @metadata.items.each do |entity|\n permition << {\"many_#{entity.name}_attributes\".to_sym =>\n [:id] + entity.many_field.map{|field| field.name.to_sym} - [:created_at, :updated_at]}\n end\n params.require(@resource_sym).permit(*permition)\n end", "def update_permitted?\n\t\tacting_user.administrator?\n\tend", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def allowed?\n raise NotImplementedError, 'please implement #allowed? '\\\n \"for #{self.class.name} which should decide if the action is allowed, \"\\\n 'based on the given attributes'\n end", "def permit?(action)\n case action\n # -- list\n when :list\n permit?(:list_cases)\n\n # -- create\n when :create\n source? && @settings.working_hours?\n when :create_assignment\n agent? || enroller? || governor?\n when :create_note\n agent? || enroller?\n\n # -- edit\n when :edit\n agent? || governor? || enroller?\n when :edit_address\n agent? || source?\n when :edit_contact\n agent? || source?\n when :edit_address_geography\n source?\n when :edit_household\n agent? || governor? || permit?(:edit_household_source)\n when :edit_household_source\n permit?(:edit_household_ownership) || permit?(:edit_household_proof_of_income)\n when :edit_household_size\n agent? || governor?\n when :edit_household_ownership\n (agent? || source?) && requirement?(R::HouseholdOwnership)\n when :edit_household_proof_of_income\n (agent? || source?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :edit_household_dhs_number\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_household_size\n agent? || governor?\n when :edit_household_income\n (agent? || governor?) && proof_of_income?(P::Dhs)\n when :edit_supplier_account\n (agent? || source?) && requirement?(R::SupplierAccountPresent)\n when :edit_supplier\n agent? || (source? && !supplier?)\n when :edit_supplier_account_active_service\n agent? && requirement?(R::SupplierAccountActiveService)\n when :edit_food\n (source? || agent?) && requirement?(R::FoodDietaryRestrictions)\n when :edit_benefit\n agent? || enroller?\n when :edit_benefit_amount\n (agent? || enroller?)\n when :edit_benefit_contract\n (agent?) && requirement?(R::ContractPresent)\n when :edit_documents\n agent?\n when :edit_admin\n agent?\n\n # -- view\n when :view\n agent? || source? || enroller?\n when :view_details\n permit?(:view)\n when :view_details_status\n agent? || enroller?\n when :view_details_enroller\n agent?\n when :view_supplier_account\n permit?(:view) && requirement?(R::SupplierAccountPresent)\n when :view_food\n permit?(:view) && requirement?(R::FoodDietaryRestrictions)\n when :view_household_size\n (agent? || enroller?)\n when :view_household_ownership\n permit?(:view) && requirement?(R::HouseholdOwnership)\n when :view_household_proof_of_income\n (agent? || enroller?) && !requirement?(R::HouseholdProofOfIncomeDhs)\n when :view_household_dhs_number\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_household_income\n (agent? || enroller?) && proof_of_income?(P::Dhs)\n when :view_supplier_account_active_service\n (agent? || enroller?) && requirement?(R::SupplierAccountActiveService)\n\n # -- actions\n when :convert\n agent?\n when :referral\n agent?\n when :complete\n agent? || enroller?\n\n # -- destroy\n when :destroy\n agent?\n when :destroy_assignment\n agent?\n\n # -- archive\n when :archive\n agent?\n else\n super\n end\n end", "def ability_params\n params.require(:ability).permit(:child_id, :skill_id, :status)\n end", "def permitUser\n @member_permitted_name=Member.where(:id=>params[:id]).first.first_name\n Member.update(params[:id], :permitted => 1)\n flash[:notice] = \"User #{@member_permitted_name} allowed to book multiple rooms\"\n redirect_to(:action => 'index' )\n end", "def setting_attribute_is_allowed?(name, user)\n return false unless user.can_write?(self, name)\n (self.whitelisted_attributes && self.whitelisted_attributes.has_key?( name.to_sym)) ||\n (\n self.attribute_names.include?( name.to_s ) &&\n ( self.blacklisted_attributes.nil? ||\n ! self.blacklisted_attributes.has_key?( name.to_sym ) )\n )\n end", "def permitted_params\n []\n end", "def update_sanitized_params\n\t\t\tif \"#{resource_name}\" == \"lecturer\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department,\n\t\t\t\t\t\t:profile_image, :profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"student\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|student| student.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|student| student.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:email, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:current_password, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\tend\n\t\tend", "def build_permissions(perms, other)\n perms.permits! :read\n perms.permits! :write if self == other\n end" ]
[ "0.702188", "0.70113266", "0.6843018", "0.68114007", "0.66923416", "0.66889375", "0.6683361", "0.66692215", "0.663379", "0.66196746", "0.66162926", "0.66047096", "0.6590888", "0.6575546", "0.6571579", "0.65325445", "0.6526505", "0.65232456", "0.65171915", "0.65104216", "0.64713156", "0.64709705", "0.6454387", "0.6430159", "0.6426228", "0.64194876", "0.63889164", "0.63889164", "0.6369552", "0.6360474", "0.6360474", "0.6355095", "0.63529706", "0.6351025", "0.63419586", "0.63336253", "0.63271075", "0.6312574", "0.630402", "0.6302846", "0.62978536", "0.62820834", "0.6274677", "0.6271035", "0.62677425", "0.6238593", "0.6234195", "0.6230994", "0.6230994", "0.62275314", "0.6215399", "0.6213324", "0.6198239", "0.61978745", "0.6196871", "0.6195097", "0.6192779", "0.61797833", "0.6179484", "0.616238", "0.6153397", "0.61524224", "0.614541", "0.61400396", "0.6128611", "0.61282617", "0.61260384", "0.6117254", "0.6111318", "0.610909", "0.610909", "0.610909", "0.610909", "0.61051357", "0.6103037", "0.6087845", "0.6086906", "0.60802925", "0.6073205", "0.607282", "0.6064294", "0.6063634", "0.60515714", "0.60441256", "0.6029782", "0.6019268", "0.601502", "0.60078305", "0.599872", "0.5982905", "0.5977108", "0.59704036", "0.5969358", "0.5967958", "0.5966984", "0.59656227", "0.59614563", "0.59580505", "0.5956138", "0.5955947", "0.5952511" ]
0.0
-1
Use email as a search term to set the delegate_user
def find_email val = @email return if val.nil? val = LdapQuery::Scanner.search(val).as_user_attributes[:email] if val.nil? errors.add :base, 'Email address not found' return false end @email = val xdelegate = User.find_by_email(val.to_s) if xdelegate.nil? errors.add :base, 'Email does not have an account on this website' return false else self.delegate_user_id = xdelegate.id end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_email(email = nil, email_selector = nil, ldap_lookup = nil)\n self.email = email || []\n if email_selector\n # Get the primary email address from the address list\n self.primary_email = email_selector.email(self.email)\n # Get the username from the primary email address\n if ldap_lookup and self.primary_email\n self.username = ldap_lookup.find(self.primary_email)\n else\n self.username = nil\n end\n else\n self.primary_email = nil\n self.username = nil\n end\n end", "def set_FindEmail(value)\n set_input(\"FindEmail\", value)\n end", "def set_FindEmail(value)\n set_input(\"FindEmail\", value)\n end", "def friend_email=(value)\n new_friend = User.find(:first, :conditions => { :email => value })\n raise(ActiveRecord::RecordNotFound) unless(new_friend)\n self.friend = new_friend\n end", "def autocomplete_user_email\n term = params[:term]\n users = User.where(:role_id => current_user.can_mail_to).where(\"lower(email) ILIKE '%#{term}%' OR lower(user_id) ILIKE '%#{term}%'\").order(:email)\n render :json => users.map { |user| {:id => user.id, :label => \"#{user.name} - #{user.email}\", :value => user.name} }\n end", "def authorize_user email\n if USERS.include?(email)\n @user = email\n else \n nil\n end\n end", "def set_email_field(email)\n end", "def set_SearchForUser(value)\n set_input(\"SearchForUser\", value)\n end", "def add_email_or_username(username_or_email)\n\t\temail_or_username_field.set(username_or_email)\n\tend", "def email=(value)\n self.from_email = value\n end", "def search\n # params[:query] populated by query text input field\n # here we search for users that match input email\n @users = User.where(email: params[:query])\n end", "def search_user_by_email\n @users = User.get_all_users(current_user).where(email:params[:email], is_active: true).first\n get_tenants_user(@users)\n end", "def find_user_from_invitee_email\n return if invitee_email.nil?\n\n self.user = ::User.find_by(email: invitee_email)\n errors.add(:invitee_email, 'is not a registered user') if user.nil?\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def email=(value)\n @email = value\n end", "def email=(value)\n @email = value\n end", "def mail_nickname=(value)\n @mail_nickname = value\n end", "def set_user_email\n @user_email = UserEmail.find(params[:id])\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def set_Email(value)\n set_input(\"Email\", value)\n end", "def search_users(wildcard_email_address)\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:email].to_s, wildcard_email_address)\n return search_map_user_fields(filter)\n end", "def email=(value)\n reset_agent\n @email = value\n end", "def parse_user(name, email, trailer)\n link_to_user User.find_by_any_email(email),\n name: name,\n email: email,\n trailer: trailer\n end", "def setUserEmail(userName, email)\n\n if(userName == nil)\n return\n else\n user = loadUser(userName)\n if user != nil\n user[\"email\"] = email\n saveUser(userName, user)\n end\n end\n end", "def ldap_before_save\n self.email = Devise::LDAP::Adapter.get_ldap_param(username, 'mail').first\n end", "def set_username\n return if username?\n return unless email?\n\n base = email.partition('@').first.tr('.', '_')\n\n self.username = generate_username(base)\n end", "def email_login\n end", "def email=(arg)\n raise ArgumentError, \"email expects a string, not a #{arg.class}\" unless arg.is_a?(String)\n @email = arg\n end", "def email=(value)\n if value.present?\n super(value)\n else\n super(nil)\n end\n end", "def email=(value)\n if value.present?\n super(value)\n else\n super(nil)\n end\n end", "def ga_set_user(email)\n @ga_tracker.set(\"&uid\", email)\n end", "def email\n user.present? ? user.email : self[:email]\n end", "def find_user(given_mail=@visitor.email)\n @user = User.first conditions: {:email => given_mail}\nend", "def email\n mentee_user ? mentee_user.email : nil\n end", "def email=(em)\n super em.downcase\n end", "def set_user\n @user = User.find_by(email: params[:session][:email])\n end", "def set_EmailAddress(value)\n set_input(\"EmailAddress\", value)\n end", "def edit_email(user, email)\n if @config.restrictions[:email_regex_restriction]\n unless email =~ @config.restrictions[:email_regex_restriction]\n return false\n end\n end\n user.email = email\n user.save_data\n end", "def user_email\n msg['email'] || entry['email'] || reject['email']\n end", "def email=(email)\n super(email.downcase)\n end", "def email\n userid.try(:match, / <(.*@.*)>/).try(:[], 1)\n end", "def set_email(email)\n @PARAM_HASH['EMAIL'] = email\n end", "def for_user(user)\n find_by(user_email: user.emails)\n end", "def set_email\n @user_email = UserEmail.find(params[:id])\n end", "def email\n query_params&.dig(:email)\n end", "def downcase_email_username\n self.email = email.downcase\n self.username = username.downcase\n end", "def identify(username_or_email)\n return nil if username_or_email.blank? or username_or_email == 'Public'\n \n if username_or_email =~ /@/ \n active.find_by_email(username_or_email)\n else\n active.find_by_username(username_or_email)\n end \n end", "def set_EmailAddress(value)\n set_input(\"EmailAddress\", value)\n end", "def set_user_mail\n @user = User.find(params[:id])\n end", "def match_by_email\n true\n end", "def set_connected_user(email)\n session[:sos_note_email] = email\n end", "def assignee_email= email\n \tself.assigned_to = User.find_by_email(email).id\n end", "def add_member_email(email)\n\n end", "def username_by_email(email)\n request = client.search_users(email)\n if (request[:total_count]).zero?\n raise GithubIntegration::UsernameResolveException, \"User with email '#{email}' was not found\"\n end\n request[:items].first[:login]\n end", "def downcase_email\n self.requester_email = requester_email.downcase\n end", "def email=(value)\n raise TypeError, 'email must be a String or respond to #to_s' unless value.is_a?(String) || respond_to?(:to_s)\n \n value = value.to_s\n raise ArgumentError, 'email must be an email address' unless value.include?(?@)\n \n @email = value\n end", "def determine_default_user_email\n Cadenero.default_user_email = options[\"default-user-email\"].presence ||\n ask(\"What will be the email for the default user owner of the default account? [testy@example.com]\").presence ||\n 'testy@example.com'\n end", "def email\n find_by_type('email')\n end", "def find_user\n login_email = params[:user][:email].downcase\n User.find_by(email: login_email) || AdminUser.find_by(email: login_email)\n end", "def email=(value)\n raise TypeError, 'email must be a String or respond to #to_s' unless value.is_a?(String) || respond_to?(:to_s)\n \n @email = value.to_s\n end", "def downcase_email\n self.email = email.downcase\n end", "def set_ReplyEmail(value)\n set_input(\"ReplyEmail\", value)\n end", "def by_email address, options={}, headers={}\n params = options.merge({ email: address })\n @connection.get \"users/by_email.json\", params, headers\n end", "def email=(email)\r\n @PARAM_HASH['EMAIL'] = email\r\n end", "def email=(email)\r\n @PARAM_HASH['EMAIL'] = email\r\n end", "def email=(v)\n @email = alma_string v\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def matching_user\n User.active.where(email: email).first\n end", "def email\n login\n end", "def email\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def email_set(address)\n self.email.set address\n end", "def downcase_email\n self.user_email = user_email.downcase\n end", "def downcase_email\r\n self.email = email.downcase\r\n end", "def find_email(email)\n @users.select { |user| user[:email].eql? email }.first\n end", "def find_by_email(email)\n sender = Client.get(\"#{path}/find_by_email\", query: { email: email })\n initialize_from_hash(sender['user'])\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end", "def downcase_email\n self.email = email.downcase\n end" ]
[ "0.69874704", "0.66270804", "0.66270804", "0.618256", "0.6155082", "0.6143417", "0.6138992", "0.61259073", "0.6120344", "0.6106986", "0.6105193", "0.6094031", "0.6037938", "0.601037", "0.6009788", "0.5985284", "0.5985284", "0.59808785", "0.5973629", "0.594316", "0.594316", "0.594316", "0.594316", "0.594316", "0.594316", "0.594316", "0.594316", "0.594316", "0.594316", "0.594316", "0.5941538", "0.59360266", "0.5923112", "0.5920185", "0.5917747", "0.59042853", "0.5891783", "0.584849", "0.58481413", "0.584652", "0.584652", "0.5840874", "0.5837652", "0.583269", "0.58222", "0.58153564", "0.5813991", "0.5809527", "0.57957363", "0.57861423", "0.57589984", "0.5755124", "0.57352424", "0.57313335", "0.5707871", "0.5698974", "0.5696659", "0.56926495", "0.5678022", "0.5676884", "0.5668501", "0.56634724", "0.5657828", "0.5656679", "0.5646591", "0.56451935", "0.5643072", "0.56371677", "0.5625798", "0.561601", "0.5615973", "0.561395", "0.5613866", "0.5612978", "0.5611399", "0.5611399", "0.56015056", "0.55994534", "0.55994534", "0.5599365", "0.5586951", "0.5586505", "0.5586324", "0.5583717", "0.557587", "0.55751437", "0.5573876", "0.5557592", "0.5557579", "0.5557579", "0.5557579", "0.5557579", "0.5557579", "0.5557579", "0.5557579", "0.5557579", "0.5557579", "0.5557579", "0.5557579", "0.5557579" ]
0.6881379
1
Overrides auth_handler= so if the authentication changes, the session cookie is cleared.
def auth_handler=(handler) @session_cookie = nil return super(handler) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_logout\n reset_session\n end", "def handle_unverified_request\n super # call the default behaviour which resets the session\n cookies.delete(:remember_token)\n redirect_to :login\n end", "def unobtrusively_authenticate_user!\n if cookies[:user_uid]\n set_user_session_from_cookie\n else\n sign_out_user\n end\n end", "def destroy_auth\n\t\tsession[:user_id] = nil\n\t\tredirect_to root_path\n\tend", "def authenticate_user!(*args)\n if request.get? && !logged_in?\n session[:return_to] = request.fullpath\n session[:return_to_for_new_user] = request.fullpath\n end\n super\n end", "def handle_unverified_request\n super\n cookies.delete(:autologin)\n end", "def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend", "def authenticate_request\n @current_user = nil\n end", "def handle_unverified_request\n sorcery_config.before_unverified_request.each do |callback|\n send(callback)\n end\n @current_user = nil\n super # call the default behaviour which resets the session\n end", "def logout_internal\n self.current_user.forget_me if logged_in?\n reset_session\n cookies.delete :auth_token\n end", "def touch_auth_session\n if logged_in?\n auth_session.touch!\n end\n end", "def after_custom_authentication; end", "def after_authentication\n @initiating_url = session[:initiating_url]\n session[:initiating_url] = nil\n render :'authentication/after_authentication'\n end", "def clear_authentication\n authenticate(nil, nil)\n end", "def auth_logout\n return unless logged_in?\n begin\n http = @http\n path = BSAPI+\"auth\"\n headers = get_default_headers\n http = @http\n resp = http.get(path, headers)\n rescue StandardError\n ensure\n set_logged_out\n end\n end", "def auth_after\n url = session[:auth_redirect] || root_path\n redirect_to url\n end", "def uncookie_user\n cookies.delete :auth, :domain => site_domain\n end", "def deauthenticate\n self.clear_current_user\n redirect_to :root\n end", "def after_custom_authentication\n\n end", "def log_out_behavior\n session[:user_id] = nil\n redirect_to \"/\"\n end", "def log_out\n\t\tsession.delete(:authorization)\n\tend", "def authenticate_once_state\n super\n end", "def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end", "def auth_trap_state\n super\n end", "def hubssolib_log_out\n # Causes the \"hubssolib_current_[foo]=\" methods to run, which\n # deal with everything else.\n self.hubssolib_current_user = nil\n self.hubssolib_current_session = nil\n end", "def authenticate(_)\n super(session_params)\n end", "def login_from_basic_auth\n <%= singular_name %>name, passwd = get_auth_data\n self.current_<%= singular_name %> = <%= class_name %>.authenticate(<%= singular_name %>name, passwd) if <%= singular_name %>name && passwd\n end\n\n # Called from #current_<%= singular_name %>. Finaly, attempt to login by an expiring token in the cookie.\n def login_from_cookie \n <%= singular_name %> = cookies[:auth_token] && <%= class_name %>.find_authenticated_model_with_remember_token(cookies[:auth_token])\n if <%= singular_name %> && <%= singular_name %>.remember_token?\n <%= singular_name %>.remember_me\n cookies[:auth_token] = { :value => <%= singular_name %>.remember_token, :expires => <%= singular_name %>.remember_token_expires_at }\n self.current_<%= singular_name %> = <%= singular_name %>\n end\n end\n \n def reset_session\n session.data.each{|k,v| session.data.delete(k)}\n end\n\n private\n @@http_auth_headers = %w(Authorization HTTP_AUTHORIZATION X-HTTP_AUTHORIZATION X_HTTP_AUTHORIZATION REDIRECT_X_HTTP_AUTHORIZATION)\n\n # gets BASIC auth info\n def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil] \n end\n end\nend", "def clear_session_cookie\n if request.referer.starts_with?(Rails.application.secrets.sso_url)\n reset_session\n end\n render nothing: true\n end", "def unauthenticated\n end", "def reset_session\n Rails.logger.info('SSO: ApplicationController#reset_session', sso_logging_info)\n\n cookies.delete(Settings.sso.cookie_name, domain: Settings.sso.cookie_domain)\n @session_object&.destroy\n @current_user&.destroy\n @session_object = nil\n @current_user = nil\n super\n end", "def delete_cookie\n cookies.delete :auth_token\n end", "def reauthentication\n user_session[:stored_location] = account_url\n user_session[:context] = 'reauthentication'\n\n redirect_to login_two_factor_options_path\n end", "def clear_role_switch_session\n m_logger = MarkusLogger.instance\n\n # The real_uid field of session keeps track of the uid of the original\n # user that is logged in if there is a role switch\n if !session[:real_uid].nil? && !session[:uid].nil?\n # An admin was logged in as a student or grader\n m_logger.log(\"Admin '#{User.find_by_id(session[:real_uid]).user_name}' logged out from '#{User.find_by_id(session[:uid]).user_name}'.\")\n else\n #The user was not assuming another role\n m_logger.log(\"WARNING: Possible break in attempt from '#{current_user.user_name}'.\")\n end\n clear_session\n cookies.delete :auth_token\n reset_session\n redirect_to action: 'login'\n end", "def authenticate\n\n # This suppresses the log in suggestion on subsequent\n # request if the user clicks \"No\"\n if params[:stay_anonymous]\n cookies[:shunt_hint] = 'anonymous'\n logger.info \"Suppressing log in suggestion\"\n redirect_to url_for(params.except!(:stay_anonymous))\n end\n\n if params[:public]\n cookies[:shunt_hint] = 'public'\n redirect_to url_for(params.except!(:public))\n end\n\n if should_force_authentication\n force_authentication\n end\n end", "def log_out\n\t\tsuper\n\t\t@current_user = nil\n\tend", "def logout_user\n cookies.delete(:auth_token)\n end", "def sign_out\n cookies.permanent[:auth_token] = nil\n session[:scope_id] = session[:scope_type] = session[:redirect] = nil\n end", "def clear_login_data\r\n session[:edit_mode] = 0\r\n session[:user_id] = nil\r\n session[:user_name] = nil\r\n session[:user_roles] = nil\r\n cookies.delete :remember_me\r\nend", "def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end", "def destroy\n __log_activity(\"LOGOUT #{current_user}\")\n __debug_route\n __debug_request\n user = current_user&.account&.dup\n opt = BS_AUTH ? { no_revoke: true?(params[:no_revoke]) } : {}\n delete_auth_data(**opt)\n super\n api_clear(user: user)\n set_flash_notice(user: user, clear: true)\n rescue => error\n auth_failure_redirect(message: error)\n end", "def handle_unverified_request\n sign_out\n super\n end", "def log_out\n\t\tsession[:user_id] = nil\n\tend", "def authenticate\n authenticated_session || render_unauthorized\n end", "def handle_unverified_request\n super\n sign_out\n end", "def clear_cookies\n \tcookies.delete(:auth_token)\n end", "def sign_out\n request.session.delete(:authorized)\n end", "def destroy_auth_tkt_cookie\n # reset ticket value of cookie, to log out even if deleting cookie fails\n cookies[:auth_tkt] = { :value => '', :expire => Time.at(0), :domain => DOMAIN }\n cookies.delete :auth_tkt\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def handle_unverified_request\n \tsign_out\n \tsuper\n end", "def authentication_method\n super\n end", "def handle_unverified_request\n# sign_out\n super\n end", "def sign_out\n @username = nil\n @current_user = nil\n\n @modhash = nil\n @cookie = nil\n end", "def log_out\n session.delete(:user_id)\n cookies.delete :user_id\n end", "def authentication_handler\n Metaforce.configuration.authentication_handler\n end", "def handle_unverified_request\n reset_session\nend", "def handle_unverified_request\n\tsign_out\n\tsuper\nend", "def user_authentication\n end", "def logout_keeping_session!\n # Kill server-side auth cookie\n @current_user.forget_me if @current_user.is_a? User\n @current_user = false # not logged in, and don't do it for me\n kill_remember_cookie! # Kill client-side auth cookie\n session[:user_id] = nil # keeps the session but kill our variable\n # explicitly kill any other session variables you set\n end", "def log_out_now\n\tsession[:user_id] = nil\nend", "def log_me_out\n session['user'] = nil\n end", "def destroy\n\t\tcookies.delete(:auth_token)\n\t\tredirect_to root_url\n\tend", "def reset_cookies\n if !user_signed_in?\n cookies.delete(:truck)\n end\n end", "def login\n #If we go to login page we clear all data still in session to force a re-auth\n current_user = nil\n session[:user_id] = nil\n session[\"REMOTE_USER\"] = nil\n env[\"REMOTE_USER\"] = nil\n if params[:redirect_uri].nil? or params[:client_id].nil?\n redirect_to root_path\n else\n @from_application = ClientApplication.find_by_callback_url(params[:redirect_uri])\n if @from_application.nil?\n redirect_to root_path\n end\n end\n\n\n end", "def logout\n cookies.delete SL_CONFIG[:USER_EMAIL_COOKIE]\n cookies.delete SL_CONFIG[:USER_HASH_COOKIE]\n redirect_to Site.full_url\n end", "def callback_phase\n ym_session_id = env['rack.session'][RACK_SESSION_KEY]\n fail!(E_YM_SESSION_ID_BLANK) if ym_session_id.blank?\n ym_session = YourMembership::Session.new(ym_session_id, 100)\n\n begin\n fail! 'Failed To Log In' unless ym_session.authenticated?\n rescue YourMembership::Error => e\n fail! e.error_description\n end\n\n @user_id = ym_session.user_id\n @access_token = ym_session.to_s\n\n super\n end", "def authenticate_user(env)\n session_data = { value: 'authenticated' }\n add_expiry_date!(session_data)\n env['rack.session'][:balrog] = session_data\n end", "def authenticate!\n redirect '/sessions/new' unless logged_in?\nend", "def log_out\n cookies.delete :user_id\n cookies.delete :username\n redirect_to :action => \"sign_in\"\n end", "def log_out\n session[:user_id] = nil\n end", "def auth_level\n GlobalConstant::Cookie.double_auth_prefix\n end", "def handle_unverified_request\n sign_out\n super\n end", "def omit_unchanged_session_cookie\n # Only take this action if not-logged-in and session cookie is unchanged\n return unless !logged_in? && session.to_h == @original_session\n\n request.session_options[:skip] = true\n end", "def logout\n handler = Proc.new do |request|\n if response.code == 204\n clear_session\n else\n case response.code\n when 401 then\n raise Jiralicious::NotLoggedIn.new(\"Not logged in\")\n else\n # Give Net::HTTP reason\n raise Jiralicious::JiraError.new(response)\n end\n end\n end\n\n request(:delete, '/rest/auth/latest/session', :handler => handler)\n end", "def after_hash_token_authentication\n end", "def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend", "def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend", "def handle_unverified_request\n\t\tsign_out\n\t\tsuper\n\tend", "def logout\n if request.headers[\"external\"] == 'true' && !request.xhr?\n CASClient::Frameworks::Rails::Filter.logout(self)\n else\n if User.current.anonymous?\n redirect_to home_url\n elsif request.post?\n logout_user\n redirect_to home_url\n end\n # display the logout form\n end\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end" ]
[ "0.66596895", "0.6402066", "0.63947856", "0.63805807", "0.6358268", "0.63407105", "0.6339492", "0.6312544", "0.63111037", "0.63054043", "0.6297264", "0.6264113", "0.6238354", "0.621536", "0.6194207", "0.6162307", "0.61618036", "0.61444145", "0.61423296", "0.61218655", "0.6108487", "0.6099683", "0.60985285", "0.60831964", "0.6068976", "0.6044174", "0.6038033", "0.60292053", "0.6018711", "0.59683967", "0.5949926", "0.5949024", "0.59192914", "0.5911382", "0.5896539", "0.58919436", "0.5883497", "0.5874014", "0.5866812", "0.5852251", "0.5844845", "0.58396566", "0.5839002", "0.5818618", "0.5817788", "0.5814949", "0.5807615", "0.5804984", "0.5804984", "0.5804984", "0.5804984", "0.5804984", "0.5804984", "0.58015233", "0.5796265", "0.5796128", "0.57943237", "0.578951", "0.57854825", "0.578417", "0.578041", "0.577599", "0.57727796", "0.57671404", "0.576411", "0.57635504", "0.5755908", "0.57393366", "0.5735962", "0.5733628", "0.57305384", "0.572722", "0.5719467", "0.57162446", "0.57151246", "0.5714795", "0.57121783", "0.57105356", "0.5709718", "0.5709718", "0.5709718", "0.57065266", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811", "0.5702811" ]
0.86241615
0
Overrides make_request to handle 302 redirects with a session cookie.
def make_request(method, url, body = '', retries = 4) response = super(method, url, body) if response.status_code == 302 and retries > 0 @session_cookie = response.headers['set-cookie'] return self.make_request(method, url, body, retries - 1) else return response end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_to(url)\n unless already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n fail\n end\n session.store_session(res)\n end", "def redirect_to(url)\n self.res.status = 302\n #how would I know about location\n self.res.header[\"location\"] = url\n session.store_session(self.res)\n\n #self.res.set_redirect(WEBrick::HTTPStatus::TemporaryRedirect, url)\n if already_rendered?\n raise \"Can't render/redirect twice\"\n end\n\n #following might be wrong b/c of no setter\n @already_built_response = true\n nil\n end", "def redirect_to(url)\n raise DoubleRenderError if already_built_response?\n res.header['location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end", "def redirect_to(url)\n raise \"double render error\" if constructed_response?\n\n @response.status = 302\n @response[\"Location\"] = url\n\n @constructed_response = true\n\n session.store_session(@response)\n\n nil\n end", "def redirect_to(url)\n raise \"double render error\" if @already_built_response\n # Issuing a redirect consists of two parts, setting the 'Location'\n # field of the response header to the redirect url and setting the\n # response status code to 302\n @already_built_response = true\n res.location = url\n res.status = 302\n @session.store_session(res)\n end", "def redirect(location, status = '302'); request.redirect(location, status); end", "def redirect_to(url)\n if already_built_response?\n raise\n else\n res.status = 302\n res.header[\"location\"] = url\n end\n @already_built_response = true\n @session.store_session(res) if @session\n @flash.store_flash(res) if @flash\n end", "def authenticate_request\n session[:requested_url] = request.fullpath\n\n url = logged_in? ? shibbolite.access_denied_url : shibbolite.login_url\n\n # redirect to the selected url\n respond_to do |format|\n format.html { redirect_to url }\n format.js { render js: \"window.location.assign('#{url}');\"}\n end\n end", "def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend", "def redirect_original(request, state_params, site)\n response = Rack::Response.new\n # Note that app_callback_url is added by OmniAuth.config.before_request_phase\n # any value provided by a client will be overwritten in that method so that we\n # don't use/trust values sent by the client\n return_url = state_params[\"app_callback_url\"]\n query = query_string(request, SecureRandom.hex(64))\n return_url << \"?\"\n return_url << signed_query_string(query, site.secret)\n response.redirect return_url\n response.finish\n end", "def redirect_to(url)\n raise \"Already delivered response\" if self.already_built_response?\n res.status = 302\n res['Location'] = url\n @already_built_response = true\n self.session.store_session(res)\n self.flash.store_flash(res)\n end", "def follow_redirect!\n unless last_response.redirect?\n raise Error, 'Last response was not a redirect. Cannot follow_redirect!'\n end\n\n if last_response.status == 307\n request_method = last_request.request_method\n params = last_request.params\n else\n request_method = 'GET'\n params = {}\n end\n\n # Compute the next location by appending the location header with the\n # last request, as per https://tools.ietf.org/html/rfc7231#section-7.1.2\n # Adding two absolute locations returns the right-hand location\n next_location = URI.parse(last_request.url) + URI.parse(last_response['Location'])\n\n custom_request(\n request_method,\n next_location.to_s,\n params,\n 'HTTP_REFERER' => last_request.url,\n 'rack.session' => last_request.session,\n 'rack.session.options' => last_request.session_options\n )\n end", "def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end", "def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end", "def redirect_to(url)\n raise \"Double Render Error\" if already_built_response?\n\n # equiv to @res.redirect\n @res.status = 302\n @res.location = url\n\n @already_built_response = true\n\n session.store_session(@res)\n end", "def redirect_to(url)\n if !already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n raise \"exception\"\n end\n session.store_session(res)\n # storing the flash will fail the last spec\n flash.store_flash(res)\n end", "def propagate_session(env, status, headers, response)\n propagate_flag = env.delete(SESSION_PROPAGATE_KEY)\n location = headers[\"Location\"]\n if propagate_flag and location\n # we've been told to rewrite the location header and it is present\n uri = URI::parse(location)\n prefix = uri.query ? \"&\" : \"\"\n # append handshake param to query\n uri.query = [uri.query, prefix, SessionInjector.generate_handshake_parameter(Rack::Request.new(env), propagate_flag[0], propagate_flag[1])].join\n headers[\"Location\"] = uri.to_s\n end\n [ status, headers, response]\n end", "def redirect_original(request, state_params, site)\n response = Rack::Response.new\n # Note that app_callback_url is added by OmniAuth.config.before_request_phase\n # any value provided by a client will be overwritten in that method so that we\n # don't use/trust values sent by the client\n return_url = state_params[\"app_callback_url\"]\n query = OauthStateMiddleware.query_string(request.params, SecureRandom.hex(64))\n return_url << \"?\"\n return_url << signed_query_string(query, site.secret)\n response.redirect return_url\n response.finish\n end", "def redirect_to(url)\n raise 'Already responded' if already_built_response?\n flash.store_flash(res)\n res['Location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end", "def redirect_to(url)\n if already_built_response?\n raise \"DoubleRenderError\" \n else \n @res.status = 302 \n # @res.set_header('Content-Type', content_type)\n @res.set_header('location', url)\n # @res.write(content) \n session.store_session(res)\n # debugger\n @already_built_response = true \n # debugger\n end \n end", "def get(req)\n # TODO: check that we aren't already connected\n session = ::Ebay::Api.session\n Lynr.cache.set(\"#{req.session['dealer_id']}_ebay_session\", YAML.dump(session))\n redirect ::Ebay::Api.sign_in_url(session)\n end", "def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend", "def redirect_to(url)\n raise \"already built response\" if already_built_response?\n @res.status = 302\n @res[\"Location\"] = url\n @already_built_response = true\n self.session.store_session(@res)\n self.flash.store_flash(@res)\n end", "def redirect(url)\n headers['Location'] = url\n self.status = 302\n raise FinishRequest\n end", "def call(env)\n request = Wee::Request.new(env)\n\n if request.session_id\n session = @mutex.synchronize { @sessions[request.session_id] }\n if session and session.alive?\n session.call(env)\n else\n url = request.build_url(:session_id => nil, :page_id => nil)\n Wee::RefreshResponse.new(\"Invalid or expired session\", url).finish\n end\n else\n session = new_session()\n url = request.build_url(:session_id => session.id, :page_id => nil)\n Wee::RedirectResponse.new(url).finish\n end\n end", "def redirect(uri)\n @response.status = 302\n @response.header['Location'] = uri\n @response.body = ''\n halt\n end", "def conditional_redirect\n return unless request.get?\n path = session.delete('app.redirect')\n path = request_parameters if path.is_a?(TrueClass)\n redirect_to(path) if path.present?\n end", "def session!\n redirect(settings.session_fail) unless session? || settings.session_fail == request.path_info\n end", "def request_phase\n session_id = generate_session_id\n redirect ebay_login_url(session_id)\n rescue => ex\n fail!(\"Failed to retrieve session id from ebay\", ex)\n end", "def follow_redirect(response)\n raise MalformedServerResponse.new(self, response) unless response.header.location\n if response.moved_permanently?\n new_uri = response.header.location\n logger.info(\" Permanently redirected to #{new_uri} - Storing new location.\")\n resource.update_uri new_uri\n @header.host = resource.host\n response = fetch_response\n elsif response.see_other? # Always use GET for this redirect, regardless of initial method\n redirected_resource = Resourceful::Resource.new(self.accessor, response.header['Location'])\n response = Request.new(:get, redirected_resource, body, header).fetch_response\n else\n redirected_resource = Resourceful::Resource.new(self.accessor, response.header['Location'])\n logger.info(\" Redirected to #{redirected_resource.uri} - Caching new location.\")\n response = Request.new(method, redirected_resource, body, header).fetch_response\n end\n end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end", "def redirect_to(url)\n check_already_rendered\n session.store_session(response)\n response.status = 302\n response['Location'] = url\n @already_rendered = true\n end", "def send_request(req, uri, login, password_callback=PasswordCallback,loopcounter=0,stopflag=false)\n if loopcounter > 7\n if stopflag\n raise \"Infinite loop detected\"\n else\n warn \"Loop detected. Clearing out cookiefile..\"\n loopcounter = 0\n stopflag = true\n File.open(get_cookiefile(login), 'w') { |file| file.write(nil) }\n end\n end\n cookies = get_cookies_for_uri(get_cookiefile(login), uri)\n if !cookies.empty?\n cookiestring = cookies.collect{|cookie| \"#{cookie[:name]}=#{cookie[:value]}\" }.join('; ')\n puts \"Inserting cookies into request: #{cookiestring}\" if (@debug)\n req['Cookie'] = cookiestring\n end\n\n response = make_http(uri).request(req)\n extract_cookie(response, uri, login)\n\n # Check for signs that the server wants us to authenticate\n password = nil\n if login == 'autoreg'\n password = 'mypassword'\n end\n # nVentory will redirect to the login controller if authentication is\n # required. The scheme and port in the redirect location could be either\n # the standard server or the https variant, depending on whether or not\n # the server administration has turned on the ssl_requirement plugin.\n if response.kind_of?(Net::HTTPFound) &&\n response['Location'] &&\n URI.parse(response['Location']).host == URI.parse(@server).host &&\n URI.parse(response['Location']).path == URI.join(@server, 'login/login').path\n puts \"Server responsed with redirect to nVentory login: #{response['Location']}\" if (@debug)\n loginuri = URI.parse(response['Location'])\n ####################### Fix by darrendao - force it to use https ##########################\n # This is needed because if you're not usign https, then you will get\n # redirected to https login page, rather than being logged in. So the check down there will\n # will.\n loginuri.scheme = 'https'\n loginuri = URI.parse(loginuri.to_s)\n ############################################################################################\n loginreq = Net::HTTP::Post.new(loginuri.request_uri)\n if password_callback.kind_of?(Module)\n password = password_callback.get_password if (!password)\n else\n password = password_callback if !password\n end\n loginreq.set_form_data({'login' => login, 'password' => password})\n # Include the cookies so the server doesn't have to generate another\n # session for us.\n loginreq['Cookie'] = cookiestring\n loginresponse = make_http(loginuri).request(loginreq)\n if @debug\n puts \"nVentory auth POST response (#{loginresponse.code}):\"\n if loginresponse.body.strip.empty?\n puts '<Body empty>'\n else\n puts loginresponse.body\n end\n end\n # The server always sends back a 302 redirect in response to a login\n # attempt. You get redirected back to the login page if your login\n # failed, or redirected to your original page or the main page if the\n # login succeeded.\n if loginresponse.kind_of?(Net::HTTPFound) &&\n URI.parse(loginresponse['Location']).path != loginuri.path\n puts \"Authentication against nVentory server succeeded\" if (@debug)\n extract_cookie(loginresponse, loginuri, login)\n puts \"Resending original request now that we've authenticated\" if (@debug)\n return send_request(req, uri, login, password_callback)\n else\n puts \"Authentication against nVentory server failed\" if (@debug)\n end\n end\n\n # An SSO-enabled app will redirect to SSO if authentication is required\n if response.kind_of?(Net::HTTPFound) && response['Location'] && URI.parse(response['Location']).host == URI.parse(@sso_server).host\n puts \"Server responsed with redirect to SSO login: #{response['Location']}\" if (@debug)\n if login == 'autoreg'\n loginuri = URI.join(@server, 'login/login')\n puts \"** Login user is 'autoreg'. Changing loginuri to #{loginuri.to_s}\" if @debug\n unless loginuri.scheme == 'https'\n loginuri.scheme = 'https'\n loginuri = URI.parse(loginuri.to_s)\n end\n else\n loginuri = URI.parse(response['Location'])\n end\n # update the loginuri to the non-redirect uri of sso\n loginuri.path = '/login'\n loginuri.query = 'noredirects=1'\n loginreq = Net::HTTP::Post.new(loginuri.request_uri)\n if password_callback.kind_of?(Module)\n password = password_callback.get_password if (!password)\n else\n password = password_callback if !password\n end\n loginreq.set_form_data({'login' => login, 'password' => password})\n # It probably doesn't matter, but include the cookies again for good\n # measure\n loginreq['Cookie'] = cookiestring\n # Telling the SSO server we want XML back gets responses that are easier\n # to parse.\n loginreq['Accept'] = 'application/xml'\n loginresponse = make_http(loginuri).request(loginreq)\n # if it's a redirect (such as due to NON-fqdn) loop so that it follows until no further redirect\n while [Net::HTTPMovedPermanently, Net::HTTPFound].include?(loginresponse.class)\n if loginresponse.kind_of?(Net::HTTPFound) && loginresponse['Location'] =~ /sso.*\\/session\\/token.*/\n puts \"** Found session token\" if @debug\n break\n end\n puts \"** Following redirect #{loginresponse.class.to_s} => #{loginresponse['Location'].to_s}\" if @debug\n loginuri = URI.parse(loginresponse['Location'])\n loginreq = Net::HTTP::Post.new(loginuri.request_uri)\n loginreq.set_form_data({'login' => login, 'password' => password})\n loginresponse = make_http(loginuri).request(loginreq)\n end # while loginresponse.kind_of?(Net::HTTPMovedPermanently)\n\n if @debug\n puts \"AUTH POST response (#{loginresponse.code}):\"\n if loginresponse.body.strip.empty?\n puts '<Body empty>'\n else\n puts loginresponse.body\n end\n end\n\n # SSO does a number of redirects until you get to the right domain but should just follow once and get the cookie, will become Net::HTTPNotAcceptable (406).\n if loginresponse.kind_of?(Net::HTTPFound) && loginresponse['Location'] =~ /sso.*\\/session\\/token.*/\n puts \"** Following redirect #{loginresponse.class.to_s} => #{loginresponse['Location'].to_s}\" if @debug\n loginuri = URI.parse(loginresponse['Location'])\n loginreq = Net::HTTP::Get.new(loginuri.request_uri)\n loginresponse = make_http(loginuri).request(loginreq)\n end\n\n # The SSO server sends back 200 if authentication succeeds, 401 or 403\n # if it does not.\n if loginresponse.kind_of?(Net::HTTPSuccess) || (loginresponse.kind_of?(Net::HTTPFound) && loginresponse['Location'] =~ /^#{loginuri.scheme}:\\/\\/#{loginuri.host}\\/$/ ) || loginresponse.kind_of?(Net::HTTPNotAcceptable)\n puts \"Authentication against server succeeded\" if (@debug)\n extract_cookie(loginresponse, loginuri, login)\n puts \"Resending original request now that we've authenticated\" if (@debug)\n loopcounter += 1\n return send_request(req, uri, login, password_callback, loopcounter,stopflag)\n else\n puts \"Authentication against server failed\" if (@debug)\n end\n end\n\n response\n end", "def request_phase\n # Build a new request.\n saml_auth_request = OneLogin::RubySaml::Authrequest.new\n\n # Amend the settings.\n with_settings do |settings|\n # Redirect the user to the federated sign-in page.\n redirect saml_auth_request.create(settings)\n end\n rescue RuntimeError\n fail!(:invalid_response, $!)\n end", "def require_login\n unless logged_in?\n session[:request_uri] = request.request_uri\n redirect_to(new_session_path)\n end\n end", "def redirect_to(url)\n raise Exception.new(\"Already Rendered Response\") if already_built_response?\n @response.status = 302\n @response[\"Location\"] = url\n @session.store_session(@response) if @session\n @flash.store_flash(@response) if @flash\n @already_built_response = true\n end", "def store_location\n session[:redirect] = request.url\n end", "def expect_redirect_sessions_new\n @controller.expects(:redirect_to).with :controller => :sessions,\n :action => :new\n end", "def cookie_fix(env)\n params = @request.params\n \n if params['_session_id']\n session = ActiveSupport::JSON.decode(params['_session_id'])\n\n unless (@request.cookies['fbs_' + Facebook::APP_ID.to_s].present?)\n session = session.map { |key, value| key.to_s + \"=\" + value.to_s }.join(\"&\")\n @response.set_cookie('fbs_' + Facebook::APP_ID.to_s, session)\n end\n end\n\n @response.headers.delete \"Content-Type\"\n @response.headers.delete \"Content-Length\"\n @response.headers.delete \"X-Cascade\"\n\n if defined?(OmniAuth) and defined?(Devise)\n mappings = Devise.mappings[:user]\n\n if mappings.controllers.has_key? :omniauth_callbacks\n path = [mappings.path, 'auth', :facebook.to_s, 'callback'].join('/')\n @response.redirect(path + \"?#{params['redirect_to'].to_query('redirect_to')}\")\n else\n @response.redirect(\"/?#{params['redirect_to'].to_query('redirect_to')}\")\n end\n else\n @response.redirect((params['redirect_to'] ? params['redirect_to'] : '/'))\n end\n\n [302, @response.headers, ['Cookie Setted']]\n end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res[\"Location\"] = url\n @res.status = 302\n @already_built_response = true\n session.store_session(@res)\n flash.store_flash(@res)\n end", "def redirect_to(url)\n response = Rack::Response.new\n response.redirect(url, 301) # moved permanently\n response.finish\n response.to_a\n end", "def process_request(uri, env)\n env['HTTP_COOKIE'] ||= cookie_jar.for(uri)\n @last_request = Rack::Request.new(env)\n status, headers, body = @app.call(env).to_a\n\n @last_response = MockResponse.new(status, headers, body, env['rack.errors'].flush)\n close_body(body)\n cookie_jar.merge(last_response.headers['set-cookie'], uri)\n @after_request.each(&:call)\n @last_response.finish\n\n yield @last_response if block_given?\n\n @last_response\n end", "def store_saml_request_in_session\n session[:SAMLRequest] = request.original_url\n end", "def on_request( request, response )\n \n \n BetterCap::Logger.info \"Hacking http://#{request.host}\"\n # is it a html page?\n if response.content_type =~ /^text\\/html.*/\n \n if request.host =~ /example.com.*/\n response.redirect!(\"https://webtwob.de\")\n \n \n \n #found = false\n #BetterCap::Logger.info \"Redirecting\"\n #for h in response.headers\n # if h.include?(\"Location:\")\n # found = true\n # if !h.include?(\"https://webtwob.de\")\n # h.replace(\"Location: http://webtwob.de\")\n # end\n # end\n #end\n \n #if !found \n # BetterCap::Logger.info \"No Location header found, adding one.\"\n # # Replace HTTP Response code with 302\n # response.headers.\n # # This is an ugly hack to get around github issue #117\n # response.headers.reject! { |header| header.empty? }\n # # This is our payload line that is fine\n # response.headers << \"Location: https://webtwob.de\"\n # # This line is also necessary because of github issue #117\n # response.headers << \"\"\n # \n #end\n end\n \n \n #BetterCap::Logger.info \"Hacking http://#{request.host}#{request.url}\"\n # make sure to use sub! or gsub! to update the instance\n response.body.sub!( '</body>', ' <script> alert(42); </script> </body>' )\n end\n end", "def redirect where, opts={}\n where = current.request.env['HTTP_REFERER'].or('/') if where == :back\n where = \"#{current.request.path}#{where}\" if where[0,1] == '?'\n where = current.host + where unless where.include?('://')\n\n # local redirect\n if where.include?(current.host)\n redirect_var = Lux.config.redirect_var || :_r\n\n url = Url.new where\n url[redirect_var] = current.request.params[redirect_var].to_i + 1\n\n where =\n if opts.delete(:silent)\n url.delete redirect_var\n url.to_s\n else\n url[redirect_var] > 3 ? '/' : url.to_s\n end\n end\n\n @status = opts.delete(:status) || 302\n opts.map { |k,v| flash.send(k, v) }\n\n @body = %[redirecting to #{where}\\n\\n#{opts.values.join(\"\\n\")}]\n\n @headers['location'] = where\n @headers['access-control-expose-headers'] ||= 'Location'\n\n throw :done\n end", "def redirect_login_url(url)\n hash = sha2(url).slice(0,8)\n session[:redirects] ||= {}\n session[:redirects][hash] = url\n \"/login?redirect=#{hash}\"\n end", "def redirect_to(url)\n raise \"double render error\" if already_built_response?\n \n res.status = 302\n res.location = url\n\n if @flash[:persist]\n flash.now # persist false\n flash.store_session(res)\n else\n res.delete_cookie[:flash]\n end\n\n session.store_session(res)\n flash.store_session(res)\n @already_built_response = true\n end", "def follow_redirect?; end", "def handle_unverified_request\n super # call the default behaviour which resets the session\n cookies.delete(:remember_token)\n redirect_to :login\n end", "def handle_unverified_request\n reset_session\nend", "def authenticate(exception)\n session[:return_to] = request.fullpath if request.get?\n redirect_to login_url\n end", "def redirect_client(client, url)\n client.puts(\"HTTP/1.1 302 Found\\r\\nLocation: #{url}\\r\\n\\r\\n\")\nend", "def store_saml_request_in_session\n session[:saml_request_url] = request.original_url\n end", "def store_saml_request_in_session\n session[:saml_request_url] = request.original_url\n end", "def redirect_away(*params)\n session[:original_uri] = request.request_uri\n redirect_to(*params)\n end", "def redirect_away(*params)\n session[:original_uri] = request.request_uri\n redirect_to(*params)\n end", "def redirect_last\n if session[:redirect_to]\n redirect_url = session[:redirect_to]\n session[:redirect_to] = nil\n redirect redirect_url\n else\n redirect '/'\n end\n end", "def redirect_to(url_options = {}, response_options = {})\n response_options[:status] ||= :see_other unless request.get?\n super url_options, response_options\n end", "def redirect(url); end", "def my_redirect url \r\n session[:plugin_redirection] = true if is_request_from_plugin?()\r\n redirect_to(url)\r\n end", "def store_location\n @session['return-to'] = @request.request_uri\n end", "def store_location\n session[:redirect_after_login] = request.request_uri\n end", "def make_http_request(request, follow_redirect = @follow_redirects)\n request.basic_auth @username, @password if @username\n\n http = Net::HTTP.new(@server_ip, @server_port)\n\n if @ssl\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n response = http.request(request)\n case response\n when Net::HTTPRedirection then\n # If we got a redirect request, follow it (if flag set), but don't\n # go any deeper (only one redirect supported - don't want to follow\n # our tail)\n if follow_redirect\n redir_uri = URI.parse(response['location'])\n response = make_http_request(\n Net::HTTP::Get.new(redir_uri.path, false)\n )\n end\n end\n return response\n end", "def redirect_last\n if session[:redirect_to]\n redirect_url = session[:redirect_to]\n session[:redirect_to] = nil\n redirect redirect_url\n else\n redirect \"/\"\n end \n end", "def signin_required\n return if signed_in?\n session[:return_to] = request.path if request.path\n redirect_to \"/auth/twitter\"\n end", "def reconstitute_session(env)\n request = Rack::Request.new(env)\n token = request.params[HANDSHAKE_PARAM]\n return unless token\n\n # decrypt the token and get the session cookie value\n handshake = decrypt_handshake_token(token, env)\n return unless handshake\n\n cookie_value = handshake[:session_id]\n\n # fix up Rack env\n # ensure the cookie string is set\n env[HTTP_COOKIE] = [env[HTTP_COOKIE], \"#{@session_id_key}=#{cookie_value}\"].compact.join(';')\n # Rack request object parses cookies on demand and stores data in internal env keys\n # but the current implementation is not good about writing back through to the env\n # Since requests objects are transient wrappers we have to be prepared to encounter an env\n # that may already be initialized with some state\n # if the cookie string has already been read by Rack, update Rack's internal cookie string variable\n if env[RACK_COOKIE_STRING]\n env[RACK_COOKIE_STRING] = [env[RACK_COOKIE_STRING], \"#{@session_id_key}=#{cookie_value}\"].compact.join(';')\n end\n # if the cookie string has already been read by Rack, update Rack's internal cookie hash variable\n request = Rack::Request.new(env)\n request.cookies[@session_id_key] = cookie_value # call cookies() to make Rack::Request do its stuff\n end", "def store_location\n session['return-to'] = request.request_uri\nend", "def keep_redirect\n return unless request.method == :get\n #FORM posts will return to this address later\n # You can now pass to form urls where you want them to return\n if params[:redirect]\n session['HTTP_REFERER'] = params[:redirect]\n session[:keep_referrer] = true\n end\n# logger.info \"KEEP REDIRECT #{session['HTTP_REFERER']}\"\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def authenticate_user!(*args)\n if request.get? && !logged_in?\n session[:return_to] = request.fullpath\n session[:return_to_for_new_user] = request.fullpath\n end\n super\n end", "def redirect_ok=(follow); end", "def redirect_away(*params)\n Rails.logger.debug(\"* ApplicationController.redirect_away - original uri:#{request.fullpath}, to:#{params.inspect.to_s}\")\n req_method = request.request_method()\n Rails.logger.debug(\"* ApplicationController.redirect_away - req_method:#{req_method}\")\n if req_method.upcase == 'GET'\n session[:original_uri] = request.fullpath()\n # @user_session.set_info(:original_uri, request.fullpath())\n redirect_to(*params)\n else\n Rails.logger.warn(\"* ApplicationController.redirect_away - not a GET, cannot redirect, goes to home\")\n notify_warning(\"Login Session Timeout - Sorry, will lose your place:#{request.fullpath} (not a GET)\")\n session[:original_uri] = home_index_path\n # @user_session.set_info(:original_uri, home_index_path)\n redirect_to(*params)\n end\n end", "def call(env)\n request = ::Rack::Request.new(env)\n if redirect_trailing_slash? && (request.head? || request.get?) && request.path_info[-1] == ?/\n response = ::Rack::Response.new\n response.redirect(request.path_info[0, request.path_info.size - 1], 302)\n response.finish\n else\n @root.call(request) || @default_app.call(request.env)\n end\n end", "def perform_http_request(uri, redirects = []) # :nodoc:\n request = http_request_class.new(uri.request_uri, @headers)\n request.basic_auth(@username, @password) if @username || @password\n http = instantiate_http(uri)\n response = http.start { http.request(request) }\n if @allow_redirects && response.is_a?(Net::HTTPRedirection)\n location = response_location(response)\n if redirects.size >= 5\n raise RedirectError, \"too many redirects\"\n elsif redirects.include?(location)\n raise RedirectError, \"cicular redirect\"\n elsif location.nil?\n raise RedirectError, \"redirect to unknown location\"\n else\n redirects << location\n response = perform_http_request(URI(location), redirects)\n end\n end\n response\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\nend", "def ensure_redirect response, url_matcher\n expect(response.code).to eq('301').or eq('302')\n expect(response.header['location']).to match url_matcher\n # href = document(response.body).css('a').attr('href').value\n # expect(href).to match url_matcher\n response.header['location']\n end", "def request_phase\n redirect ebay_login_url(session['omniauth.ebay.session_id'] = get_session_id(options.runame))\n end", "def client_passive_login\n return_uri = session[:_return_uri]\n session[:_return_uri] = nil\n client_app = client_app(params[:client_id])\n login_path = params[:login_path] || '/users/auth/nyulibraries'\n # If user is signed in\n # redirect to client login\n if user_signed_in? && client_app.present?\n escaped_return_uri = CGI::escape(return_uri) if return_uri.present?\n client_authorize_url = URI.join(URI.parse(client_app.redirect_uri), login_path, \"?origin=#{escaped_return_uri}\")\n redirect_to \"#{client_authorize_url}\"\n # If the user is not signed in but there is a return URI\n # send the user back there\n elsif return_uri.present?\n redirect_to return_uri\n else\n head :bad_request\n end\n end", "def redirect_to_ssl\n url_to_return = params[:return_to] ? CGI.unescape(params[:return_to]).strip : nil\n unless request.ssl? || local_request?\n if url_to_return && url_to_return[0...1] == '/' #return to local url\n redirect_to :protocol => \"https://\", :return_to => url_to_return, :method => request.method, :status => :moved_permanently\n else\n redirect_to :protocol => \"https://\", :method => request.method, :status => :moved_permanently\n end\n end\n end", "def redirect_away(*params)\n session[:original_uri] = request.fullpath\n redirect_to(*params)\n end", "def redirect_away(*params)\n session[:original_uri] = request.fullpath\n redirect_to(*params)\n end", "def get_stage_and_fetch_cookie(request_url = @url , limit = 10)\n # You should choose better exception.\n raise ArgumentError, 'HTTP redirect too deep' if limit <= 0\n puts \"Trying to GET #{request_url}\".yellow\n url = URI.parse(request_url)\n req = Net::HTTP::Get.new(url.request_uri)\n if @cookie != \"\"\n req['Cookie'] = get_cookie\n end\n if @host_url \n req.add_field(\"Host\", @host_url)\n end\n use_ssl = false\n if url.instance_of? URI::HTTPS\n use_ssl = true\n end\n begin\n response = Net::HTTP.start(url.host, url.port, use_ssl: use_ssl, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http| http.request(req) }\n if response['set-cookie']\n @cookie = response['set-cookie'].split('; ')[0]\n response['set-cookie'].split(';').each do |part|\n if ((part and part.include? \"atl.xsrf.token\") and (part.match(/atl.xsrf.token=(.*)/)))\n # parse only the token\n @atl_token = part.match(/atl.xsrf.token=(.*)/).captures[0]\n break\n end\n end\n puts \"Found new cookie #{get_cookie}\".yellow\n end\n if response['location']\n redirection_url = compose_redirection_url(response['location'])\n puts \"Redirected to: #{redirection_url}\".yellow\n else\n @current_url = url.request_uri\n puts \"Ended in: #{@current_url}\".yellow\n end\n case response\n when Net::HTTPSuccess then response.code.to_i\n when Net::HTTPRedirection then get_stage_and_fetch_cookie(redirection_url, limit - 1)\n else\n puts response.body\n puts response.code.to_s\n response.code.to_i\n end\n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Errno::ECONNREFUSED,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n @current_url = request_url\n 404\n end\n end", "def session\n @session ||= Session.new(req)\n# Implement a method ControllerBase#session which constructs a\n# session from the request. Lazily assign this in to an ivar,\n# (@session; use ||=) that can be returned on subsequent calls to\n# #session.\n# Make sure that the #redirect_to and #render_content methods call\n# Session#store_session so that the session information is stored in the\n# cookie after the response is built.\n end", "def require_user\n \n #First, check to see if user is already logged in\n unless current_user \n \n # Second, check to see if session negotiation is ongoing \n if params[:session_action]\n if params[:request_url] # preserve a passed along request url\n redirect_to new_user_path(:request_url => params[:request_url]) and return if params[:session_action]==\"new_user\"\n else\n redirect_to new_user_path and return if params[:session_action]==\"new_user\" \n end\n end \n \n # Third, check to see if this is a logged-in, existing user (w/signed approval form Hot Ink) or a request_token authorization callback response\n if params[:oauth_token]\n if params[:sig]\n \n # This is where we actually authenticate\n access_token = OauthToken.find_by_token(params[:oauth_token])\n \n if access_token&&params[:sig]==Digest::SHA1.hexdigest(access_token.token + access_token.secret)\n \n # Signature matches, it's really Hot Ink and the user checks out. Log 'em in.\n UserSession.create!(access_token.user)\n \n # If a request url was forwarded along, send them there. \n # This will preserve any query-string values set by Hot Ink. \n if params[:request_url] \n redirect_to(params[:request_url])\n return\n end\n \n else\n # Either Hot Ink is confused, or someone's trying to break in\n render :text => \"Oauth verification not accepted.\", :status => 401\n return\n end\n \n else\n redirect_to new_user_path(:oauth_token => params[:oauth_token], :request_url => params[:request_url])\n return\n end \n end\n \n \n \n # Last resort, this must be a fresh user request. Forward along to Hot Ink to authenticate.\n redirect_to \"#{HOTINK_SETTINGS.site}/remote_session/new?key=#{HOTINK_SETTINGS.token}&request_url=#{request.request_uri}\"\n return false\n end\n end", "def handle_302_found(response,request_url,redirects)\n raise \"Too many redirects followed to redirect again for 302 response: followed (#{redirects}) redirects while retrieving #{request_url}\" unless redirects > 0\n handle_301_moved_permanantly(response,request_url,redirects)\n end", "def store_location\nsession[:forwarding_url] = request.url if request.get?\nend", "def store_location\n session[:redirect_path] = request.path\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def follow_redirect\n get extract_redirection_url\n end", "def set_third_party_cookie_fix\n cookies['safari_cookie_fix'] = params[:_session_id]\n redirect_to params[:redirect_to] \n end", "def make_http_request(request, follow_redirect = @follow_redirects)\n request.basic_auth @username, @password if @username\n request['Cookie'] = @cookies if @cookies\n\n if @proxy_ip\n case @proxy_protocol\n when 'http'\n http = Net::HTTP::Proxy(@proxy_ip, @proxy_port).new(@server_ip, @server_port)\n when 'socks'\n http = Net::HTTP::SOCKSProxy(@proxy_ip, @proxy_port).new(@server_ip, @server_port)\n else\n raise \"unknown proxy protocol: '#{@proxy_protocol}'\"\n end\n else\n http = Net::HTTP.new(@server_ip, @server_port)\n end\n\n if @ssl && @pkcs_file_path\n http.use_ssl = true\n pkcs12 =OpenSSL::PKCS12.new(File.binread(@pkcs_file_path), @pass_phrase!=nil ? @pass_phrase : \"\")\n http.cert = pkcs12.certificate\n http.key = pkcs12.key\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n elsif @ssl\n http.use_ssl = true\n\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.ca_file = @ca_file if @ca_file\n end\n http.open_timeout = @http_open_timeout\n http.read_timeout = @http_read_timeout\n\n response = http.request(request)\n case response\n when Net::HTTPRedirection then\n # If we got a redirect request, follow it (if flag set), but don't\n # go any deeper (only one redirect supported - don't want to follow\n # our tail)\n if follow_redirect\n redir_uri = URI.parse(response['location'])\n response = make_http_request(\n Net::HTTP::Get.new(redir_uri.path, false)\n )\n end\n end\n\n # Pick out some useful header info before we return\n @jenkins_version = response['X-Jenkins']\n @hudson_version = response['X-Hudson']\n\n return response\n end", "def cas_proxy_authentication(request, session)\n if !cas_logged_in?(request, session)\n cas_base_url = SETTINGS.cas[:host]\n client = CASClient::Client.new(\n :cas_base_url => cas_base_url\n )\n client.configure(\n :username_session_key => :access_token,\n :cas_base_url => cas_base_url\n )\n service_url = read_service_url(request)\n url = client.add_service_to_login_url(service_url)\n redirect url\n return true\n end\n end", "def be_redirected\n BeRedirected.new\nend", "def store_location\n session[:forwarding_url] = request.url if request.get? # only for get requests. A user could technically delete their cookie then submit a form\n end", "def redirect_to(url, options={})\n full_url = absolute_url(url, options)\n response[LOCATION] = full_url\n respond_with 302\n full_url\n end", "def test_ssl_redirect_with_ssl_host\n SslRequirement.ssl_host = @ssl_host_override\n assert_not_equal \"on\", @request.env[\"HTTPS\"]\n get :a\n assert_response :redirect\n assert_match Regexp.new(\"^https://#{@ssl_host_override}\"),\n @response.headers['Location']\n SslRequirement.ssl_host = nil\n end", "def http_get_with_redirect(url:, limit: 5, verify_mode: OpenSSL::SSL::VERIFY_PEER)\n limit = Integer(limit)\n raise ArgumentError, 'limit cannot be negative' if limit < 0\n raise 'too many HTTP redirects' if limit.zero?\n\n # configure Net::HTTP\n http = Net::HTTP.new(url.host, url.port)\n http.open_timeout = fetch :http_open_timeout\n http.read_timeout = fetch :http_read_timeout\n if url.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = verify_mode\n end\n request = Net::HTTP::Get.new(url.path) # build request\n response = http.request(request) # call url\n if response.is_a? Net::HTTPRedirection\n # Does not handle multiple redirects. Code/idea from http://stackoverflow.com/a/7210600/1796645\n location = URI.parse(response.header['location'])\n info \"redirected to #{location}\"\n response = http_get_with_redirect(url: location, limit: limit - 1, verify_mode: verify_mode)\n end\n response\n end" ]
[ "0.6412441", "0.6408488", "0.63788223", "0.63478845", "0.63209844", "0.63020784", "0.61808676", "0.61748534", "0.6166617", "0.6151097", "0.61457163", "0.6100367", "0.6086163", "0.60827416", "0.60687", "0.6057229", "0.6051553", "0.6028398", "0.6012906", "0.5994556", "0.59768945", "0.59448403", "0.59221715", "0.5914107", "0.5904804", "0.5883889", "0.58774847", "0.5873582", "0.5865544", "0.58045554", "0.57729274", "0.576", "0.5700033", "0.5675754", "0.56740505", "0.56680644", "0.5654119", "0.56214076", "0.56018895", "0.558493", "0.5581329", "0.55581826", "0.55320615", "0.55259186", "0.5517787", "0.5510069", "0.5509223", "0.5483947", "0.54718715", "0.54614526", "0.5461308", "0.545944", "0.54566073", "0.54566073", "0.5445958", "0.5445958", "0.5441118", "0.5432263", "0.54288274", "0.53795326", "0.53735673", "0.53636706", "0.5347418", "0.53459495", "0.5330558", "0.5324366", "0.53231007", "0.53206575", "0.530355", "0.5301649", "0.52791494", "0.5273749", "0.52722436", "0.5270982", "0.5269026", "0.5254269", "0.5252941", "0.52526003", "0.5249731", "0.5248521", "0.5248521", "0.5247653", "0.5243369", "0.5243072", "0.52414346", "0.5238354", "0.5230839", "0.5230472", "0.5230472", "0.5230472", "0.5230472", "0.522689", "0.52129525", "0.5212433", "0.521047", "0.5203183", "0.5198825", "0.5193576", "0.51896906", "0.5184538" ]
0.74002177
0
Custom prepare_headers to include the session cookie if it exists
def prepare_headers if @session_cookie @headers['cookie'] = @session_cookie end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_to_headers\n unless @session.nil?\n response.headers['sid'] = @session.id\n response.headers['utoken'] = @session.utoken\n end\n end", "def set_headers! session = nil\n response.headers['sid'] = session.id\n response.headers['utoken'] = session.utoken\n end", "def request_headers\n return nil unless @response\n Hash[\n 'Cookie' => %Q!mansession_id=\"#{@response.session_id}\"!\n ]\n end", "def add_cookie_if_needed(req)\n req.headers = { \"Cookie\" => conn.headers[\"Cookie\"] } unless conn.headers[\"Cookie\"].nil?\n end", "def login_headers(request)\n if @cookie\n request['Cookie'] = @cookie\n else\n request['Fastly-Key'] = config[:key]\n end\n\n request\n end", "def extract_headers(controller_defaults = {})\n defaults = @_cookie_defaults.merge(controller_defaults)\n cookies = []\n self.each do |name, value|\n # Only set cookies that marked for inclusion in the response header. \n next unless @_options_lookup[name]\n options = defaults.merge(@_options_lookup[name])\n if (expiry = options[\"expires\"]).respond_to?(:gmtime)\n options[\"expires\"] = expiry.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)\n end\n secure = options.delete(\"secure\")\n kookie = \"#{name}=#{Merb::Parse.escape(value)}; \"\n # WebKit in particular doens't like empty cookie options - skip them.\n options.each { |k, v| kookie << \"#{k}=#{v}; \" unless v.blank? }\n kookie << 'secure' if secure\n cookies << kookie.rstrip\n end\n cookies.empty? ? {} : { 'Set-Cookie' => cookies }\n end", "def make_headers(user_headers); end", "def default_headers\n headers = { 'Content-Type': 'application/json; charset=utf-8' }\n\n headers['Cookie'] = \"ap_session=#{@session.session_id}\" if @session\n\n headers\n end", "def session_headers(response=nil)\n hdrs = {\"Content-Type\" => 'application/json',\n \"Accept\" => \"application/json, text/javascript, */*; q=0.01\"}\n @headers.merge!(hdrs)\n end", "def prepare_session(env)\n session_was = env[ENV_SESSION_KEY]\n env[ENV_SESSION_KEY] = SessionHash.new(self, env)\n env[ENV_SESSION_OPTIONS_KEY] = OptionsHash.new(self, env, @default_options)\n env[ENV_SESSION_KEY].merge! session_was if session_was\n end", "def create_session_cookie_if_needed\n if !params[:fb_sig_in_iframe].blank? && cookies[ActionController::Base.session_options[:key]].nil?\n @handle_url = url_for(\"/fb_session/set?request_path=\" + URI::escape(non_fb_params, \"/=!?&\"))\n render :layout => \"fb_session\", :template => \"fb_session/cookie_handling\"\n end\n end", "def build_headers(headers)\n headers.select do |key, value|\n !(key.to_s =~ /cookie/i)\n end.inject([]) do |memo, header|\n memo << {\n :name => header[0].to_s.split('_').map(&:capitalize).join('-'),\n :value => header[1].to_s\n }\n end\nend", "def commit_session( headers )\n \n # store in environment\n cookie = { }\n cookie[ :value ] = session_cookie\n cookie[ :expires ] = Time.now + expire_after if expire_after\n\n ::Rack::Utils.set_cookie_header!( headers, SessionKey, cookie.merge( @options ) )\n\n return true\n \n end", "def add_headers; end", "def update_token_headers\n if user_signed_in?\n response.headers['sid'] = request.headers['sid']\n response.headers['utoken'] = request.headers['utoken']\n end\n end", "def with_headers(tmp_headers)\n current_headers = @headers\n add_headers(tmp_headers)\n yield\n ensure\n add_headers(current_headers)\n end", "def with_headers(tmp_headers)\n current_headers = @headers\n add_headers(tmp_headers)\n yield\n ensure\n add_headers(current_headers)\n end", "def set_request_headers!(request); end", "def fill_header(response); end", "def _initialize_headers\n {}\n end", "def with_headers(tmp_headers)\n current_headers = @headers\n set_headers(tmp_headers)\n yield\n ensure\n set_headers(current_headers)\n end", "def headers(options)\n rslt = {'Authorization' => basic_auth_header(options[:user], options[:password])}\n rslt['Cookie'] = \"#{SESSION_COOKIE_NAME}=#{session_id}\" if !session_id.nil? and !options[:no_session]\n rslt['Content-Type'] = options[:content_type] if options.include? :content_type\n rslt['User-Agent'] = user_agent unless user_agent.nil?\n rslt\n end", "def reconstitute_session(env)\n request = Rack::Request.new(env)\n token = request.params[HANDSHAKE_PARAM]\n return unless token\n\n # decrypt the token and get the session cookie value\n handshake = decrypt_handshake_token(token, env)\n return unless handshake\n\n cookie_value = handshake[:session_id]\n\n # fix up Rack env\n # ensure the cookie string is set\n env[HTTP_COOKIE] = [env[HTTP_COOKIE], \"#{@session_id_key}=#{cookie_value}\"].compact.join(';')\n # Rack request object parses cookies on demand and stores data in internal env keys\n # but the current implementation is not good about writing back through to the env\n # Since requests objects are transient wrappers we have to be prepared to encounter an env\n # that may already be initialized with some state\n # if the cookie string has already been read by Rack, update Rack's internal cookie string variable\n if env[RACK_COOKIE_STRING]\n env[RACK_COOKIE_STRING] = [env[RACK_COOKIE_STRING], \"#{@session_id_key}=#{cookie_value}\"].compact.join(';')\n end\n # if the cookie string has already been read by Rack, update Rack's internal cookie hash variable\n request = Rack::Request.new(env)\n request.cookies[@session_id_key] = cookie_value # call cookies() to make Rack::Request do its stuff\n end", "def setup_header\n orig_setup_header\n unless chunked? || @header['content-length']\n @header['connection'] = \"close\"\n @keep_alive = false\n end\n end", "def setup_header\n orig_setup_header\n unless chunked? || @header['content-length']\n @header['connection'] = \"close\"\n @keep_alive = false\n end\n end", "def passive\n m=[]\n m << {:name=>\"CAKEPHP Cookie\" } if @headers[\"set-cookie\"] =~ /CAKEPHP=.*/\n m\nend", "def resolve_headers(view_context); end", "def make_request_headers(opts)\n headers = opts.headers\n\n # Tell the server to keep the conn open\n headers[Headers::CONNECTION] = default_options.persistent? ? Connection::KEEP_ALIVE : Connection::CLOSE\n\n cookies = opts.cookies.values\n\n unless cookies.empty?\n cookies = opts.headers.get(Headers::COOKIE).concat(cookies).join(\"; \")\n headers[Headers::COOKIE] = cookies\n end\n\n headers\n end", "def headers\n @headers.tap do |headers|\n headers[:algorithm] = configuration.algorithm if verification?\n case configuration.claim\n when CLAIM_EXPIRATION_TIME\n headers.merge!(exp_headers)\n when CLAIM_NOT_BEFORE_TIME\n headers.merge!(nbf_headers)\n end\n end\n end", "def add_cookies(headers)\n cookies = headers[:cookie]\n cookies_hash = Hash.new\n return false unless cookies\n cookies.split('&').each do |string|\n k,v = string.split('=')\n cookies_hash[convert_key(k)] = v\n end\n @params[:cookie] = cookies_hash\n end", "def collect_cookies_from_response; end", "def processed_headers; end", "def headers\r\nHttp::Headers.new(@env)\r\nend", "def headers; return {}; end", "def headers; return {}; end", "def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers[\"Content-Type\"] = \"application/json\"\n default_headers.merge(headers)\n end", "def skip_set_cookies_header\n reset_session\n end", "def get_headers(r_name = nil)\n opts = {}\n if current_service_session\n opts[:l_firm] = current_service_session.assignment.nil? ? current_service_session.user.company_full_name : current_service_session.assignment.user.company_full_name\n opts[:lawyer] = current_service_session.assignment.nil? ? current_service_session.user.try(:full_name) : current_service_session.assignment.try(:user).try(:full_name)\n else\n opts[:l_firm] = current_user.end_user.company.name\n opts[:lawyer] = current_user.end_user.try(:full_name)\n end\n opts[:r_name] = r_name\n opts[:user] = current_user.name.try(:capitalize) if current_user\n opts\n end", "def get_headers\n @headers = headers\n @headers\n end", "def headers\n @headers || true if @use_headers\n end", "def api_user_headers\n user = create(:user)\n headers = api_user_login(user.email, user.password)\n request.headers['access-token'] = headers['access-token']\n request.headers['client'] = headers['client']\n request.headers['uid'] = headers['uid']\n end", "def normalize_headers(headers)\n result = headers.inject({}) do |h, (k, v)|\n # value is in raw form as array of sequential header values\n h[normalize_header_key(k)] = v\n h\n end\n\n # eliminate headers that interfere with playback or don't make sense to\n # record.\n %w(\n connection status host user_agent content_encoding\n ).each { |key| result.delete(key) }\n\n # always obfuscate cookie headers as they won't be needed for playback and\n # would be non-trivial to configure for each service.\n %w(cookie set_cookie).each do |k|\n if cookies = result[k]\n if cookies.is_a?(::String)\n cookies = cookies.split(';').map { |c| c.strip }\n end\n result[k] = cookies.map do |cookie|\n if offset = cookie.index('=')\n cookie_name = cookie[0..(offset-1)]\n \"#{cookie_name}=#{HIDDEN_CREDENTIAL_VALUE}\"\n else\n cookie\n end\n end\n end\n end\n result\n end", "def return_headers?() @return_headers end", "def setup_proxy_header(req, res)\n # Choose header fields to transfer\n header = Hash.new\n choose_header(req, header)\n set_via(header)\n return header\n end", "def cache_headers!\n # generate defaults for the \"easy\" headers\n headers = (ALL_HEADERS_BESIDES_CSP).each_with_object({}) do |klass, hash|\n config = fetch(klass::CONFIG_KEY)\n unless config == OPT_OUT\n hash[klass::CONFIG_KEY] = klass.make_header(config).freeze\n end\n end\n\n generate_csp_headers(headers)\n\n headers.freeze\n @cached_headers = headers\n end", "def prepare_custom_headers(header)\n header.end_with?(\"__c\") ? header.slice(0..-4).downcase : header.downcase\n end", "def set_response_headers\n response.set_header('Cache-Control', 'no-cache,no-store')\n response.set_header('Pragma', 'no-cache')\n response.set_header('Expires', 'Tue, 01 Jan 1980 00:00:00 GMT')\n response.set_header('Cross-Origin-Embedder-Policy', 'require-corp')\n response.set_header('Cross-Origin-Opener-Policy', 'same-origin')\n response.set_header('Cross-Origin-Resource-Policy', 'same-origin')\n end", "def setup(request)\n session = self.new(Merb::SessionMixin.rand_uuid,\n request.session_cookie_value, request._session_secret_key)\n session._original_session_data = session.to_cookie\n request.session = session\n end", "def dynamic_headers\n {\n 'Authorization' => token,\n 'RequestID' => request_id,\n }\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", "def headers(sending_object = nil, opts = {})\n sending_object = sending_object.attributes unless sending_object.is_a? Hash\n sending_object = sending_object.with_indifferent_access\n unless opts[:avatar_key]\n sending_object[:avatar_key] = User.find(sending_object[:user_id]).avatar_key\n end\n opts[:auth_time] ||= Time.now.to_i\n digest = Digest::SHA1.hexdigest(\n opts[:auth_time].to_s + api_key(sending_object, opts)\n )\n headers = {\n 'HTTP_X_SECONDLIFE_SHARD' => 'Production',\n 'HTTP_X_AUTH_TIME' => opts[:auth_time],\n 'HTTP_X_AUTH_DIGEST' => digest\n }\n\n headers['HTTP_X_SLAPP_PASSWORD'] = opts[:password] if opts[:password]\n position = JSON.parse(sending_object[:position])\n headers['HTTP_X_SECONDLIFE_LOCAL_POSITION'] = \"(#{position['x']}, \" \\\n \"#{position['y']}, \" \\\n \"#{position['z']})\"\n\n second_life_header_map.each do |header, attr|\n headers[header] = if sending_object\n opts[attr].nil? ? sending_object[attr] : opts[attr]\n else\n opts[attr]\n end\n end\n headers\nend", "def request_headers=(_arg0); end", "def set_third_party_cookie_fix\n cookies['safari_cookie_fix'] = params[:_session_id]\n redirect_to params[:redirect_to] \n end", "def set_surrogate_key_header(*surrogate_keys)\n # request.session_options[:skip] = true # No Set-Cookie\n response.headers['Surrogate-Key'] = surrogate_keys.join(' ')\n end", "def initialize\n @headers = {\"User-Agent\" => \"cookies\"}\n end", "def add_cache_control_headers(max_age = 10.minutes.to_s)\n request.session_options[:skip] = true # removes session data\n response.headers['Cache-Control'] = \"public, max-age=#{max_age}\"\n end", "def request_headers; end", "def request_headers; end", "def headers(headers); end", "def build_cookie_header cookies\r\n cookies.to_a.map { |a| a.join '=' }.join '; '\r\n end", "def resolve_headers(view_context)\n all_headers = DEFAULT_HEADERS.merge(headers)\n\n if csrf\n all_headers = all_headers.merge(CSRF_TOKEN_HEADER)\n end\n\n all_headers.each_with_object({}) do |(key, value), memo|\n memo[key] = value.call(view_context)\n end\n end", "def set_header_insert(opts)\n opts = check_params(opts,[:headers])\n super(opts)\n end", "def auth_headers\n {\n username: request.headers[\"X-USER-USERNAME\"], \n authentication_token: request.headers[\"X-USER-TOKEN\"]\n }\n end", "def auth_headers(account)\n if config.pre_shared_key.present? && account.present?\n {\n 'x-rh-receptor-controller-psk' => config.pre_shared_key,\n 'x-rh-receptor-controller-client-id' => \"topological-inventory\",\n 'x-rh-receptor-controller-account' => account\n }\n else\n identity_header || {}\n end\n end", "def prepare_request(request, soap, args)\n super(request, soap, args)\n soap.header[:attributes!] ||= {}\n header_name = prepend_namespace(@element_name)\n soap.header[:attributes!][header_name] ||= {}\n soap.header[:attributes!][header_name]['xmlns'] = @auth_namespace\n end", "def set_cookies\n session_key = request.session_options[:id]\n\n if(!session_key.nil?)\n # Set the cookie the standard way (Set-Cookie)\n response.set_cookie(MOBILE_KEY, session_key)\n # Set the cookie the way the Android client expects it (set-cookie)\n headers[\"set-cookie\"] = headers[\"Set-Cookie\"]\n end\n end", "def add_conditional_headers(req, opts)\n\n # if path is cached send since and/or match\n\n e = @cache[opts[:c_uri]]\n\n return unless e # not cached\n\n req['If-Modified-Since'] = e.lastmod if e.lastmod\n req['If-None-Match'] = e.etag if e.etag\n\n opts[:c_cached] = e\n end", "def set_headers(parsed_response)\n headers['expire_at'] = parsed_response[\"exp\"].to_s\n end", "def remove_headers!\n response.headers['sid'] = nil\n response.headers['utoken'] = nil\n end", "def headers(request)\n raise NotImplementedError\n end", "def request_headers=(request_headers); end", "def headers\n @headers ||= {}\n end", "def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"User-Agent\"] = \"CloudServers Ruby API #{VERSION}\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers.merge(headers)\n end", "def aggregate_response_header(request_header, response_header)\n if @unlogged_info.any?\n p \"here at unlogged info: #{@unlogged_info}\"\n p insert_unlogged_uid\n insert_to_header(response_header, insert_unlogged_uid)\n elsif no_visit_cookie?(request_header)\n insert_to_header(response_header, create_visit_cookie)\n else\n insert_to_header(response_header, add_to_visit_count(request_header))\n end\n end", "def set_cookie(env, headers, cookie)\n request = Rack::Request.new(env)\n if request.cookies[@key] != cookie[:value] || cookie[:expires]\n Utils.set_cookie_header!(headers, @key, cookie)\n end\n end", "def headers_to_store(headers)\n ignored_headers = headers.except('X-Storehouse', 'X-Storehouse-Expires-At')\n ignored_headers = ignored_headers.except(*Storehouse.ignore_headers)\n\n ignored_headers\n end", "def headers\n call_once\n @headers\n end", "def add_authentication(_, request)\n request.headers['X-User-Email'] = self.class.api_user_email\n request.headers['X-User-Token'] = self.class.api_token\n end", "def call(env)\n result = Cookiefilter.filter_request_cookies(env['HTTP_COOKIE'])\n env['HTTP_COOKIE'] = result[:header]\n status, headers, body = @app.call(env)\n response = Rack::Response.new body, status, headers\n header = Cookiefilter.filter_response_cookies(\n env['HTTP_HOST'],\n response.header['Set-Cookie'],\n result\n )\n response.header['Set-Cookie'] = header\n response.finish\n end", "def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"User-Agent\"] = \"OpenStack::Compute Ruby API #{VERSION}\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers.merge(headers)\n end", "def build_headers(token)\n headers = {'Content-Type' =>'application/json'}\n unless token.nil? \n headers['X-Auth-Token'] = token\n end\n return headers\n end", "def set_sasc_request_headers(api_version = nil)\n sasc_request_headers(api_version).each { |header, value| request.headers[header] = value }\n end", "def extract(env)\n hash = env[COOKIE_HASH_KEY] ||= {}\n string = env[HTTP_HEADER]\n\n return hash if string == env[COOKIE_STRING_KEY]\n # TODO Next Rack 1.7.x ?? version will have ::Rack::Utils.parse_cookies\n # We can then replace the following lines.\n hash.clear\n\n # According to RFC 2109:\n # If multiple cookies satisfy the criteria above, they are ordered in\n # the Cookie header such that those with more specific Path attributes\n # precede those with less specific. Ordering with respect to other\n # attributes (e.g., Domain) is unspecified.\n cookies = ::Rack::Utils.parse_query(string, COOKIE_SEPARATOR) { |s| ::Rack::Utils.unescape(s) rescue s }\n cookies.each { |k,v| hash[k] = Array === v ? v.first : v }\n env[COOKIE_STRING_KEY] = string\n hash\n end", "def passive\n m = [] \n \n m << {:name=>\"PLBSID cookie\" } if @headers[\"set-cookie\"] =~ /PLBSID=/i \n m << {:name=>\"server header\" } if @headers[\"server\"] =~ /Profense/i \n \n m\n\nend", "def headers=(_arg0); end", "def headers=(_arg0); end", "def headers=(_arg0); end", "def headers=(_arg0); end", "def remove_session_cookie\n headers['Set-Cookie'] = session_cookie \"x; expires=#{Time.at(0).httpdate}\"\n end", "def set_headers\n not_found = set_not_found_header\n no_bits = set_permission_denied_header\n is_extinct = set_not_exist_header\n return false if not_found || no_bits || is_extinct\n true\n end", "def initalize(mock_session)\n @headers = {}\n\n if mock_session.is_a?(MockSession)\n @rack_mock_session = mock_session\n else\n @rack_mock_session = MockSession.new(mock_session)\n end\n @default_host = @rack_mock_session.default_host\n end", "def cookie_fix(env)\n params = @request.params\n \n if params['_session_id']\n session = ActiveSupport::JSON.decode(params['_session_id'])\n\n unless (@request.cookies['fbs_' + Facebook::APP_ID.to_s].present?)\n session = session.map { |key, value| key.to_s + \"=\" + value.to_s }.join(\"&\")\n @response.set_cookie('fbs_' + Facebook::APP_ID.to_s, session)\n end\n end\n\n @response.headers.delete \"Content-Type\"\n @response.headers.delete \"Content-Length\"\n @response.headers.delete \"X-Cascade\"\n\n if defined?(OmniAuth) and defined?(Devise)\n mappings = Devise.mappings[:user]\n\n if mappings.controllers.has_key? :omniauth_callbacks\n path = [mappings.path, 'auth', :facebook.to_s, 'callback'].join('/')\n @response.redirect(path + \"?#{params['redirect_to'].to_query('redirect_to')}\")\n else\n @response.redirect(\"/?#{params['redirect_to'].to_query('redirect_to')}\")\n end\n else\n @response.redirect((params['redirect_to'] ? params['redirect_to'] : '/'))\n end\n\n [302, @response.headers, ['Cookie Setted']]\n end", "def headerprep(headers = {}) # :nodoc:\n default_headers = {}\n default_headers[\"X-Auth-Token\"] = @authtoken if (authok? && @account.nil?)\n default_headers[\"X-Storage-Token\"] = @authtoken if (authok? && !@account.nil?)\n default_headers[\"Connection\"] = \"Keep-Alive\"\n default_headers[\"Accept\"] = \"application/json\"\n default_headers[\"Content-Type\"] = \"application/json\"\n default_headers[\"User-Agent\"] = \"Cloud Databases Ruby API #{CloudDB::VERSION}\"\n default_headers.merge(headers)\n end", "def request_headers(user = nil)\n return {} unless user\n { 'REMOTE_USER' => user.login }\n end", "def make_request_headers(opts); end", "def headers(_context)\n {}\n end", "def request_headers(headers = {}, auth: true, gzip: true)\n headers = default_headers.merge(headers)\n headers.merge!(bearer_authorization_header) if auth\n headers[ACCEPT_ENCODING] = GZIP if gzip\n headers.reject{|_,v| v.nil? || (v.respond_to?(:empty?) && v.empty?)}\n end", "def update_token_auth_headers(response)\n self.token_auth_headers ||= {}\n ['access-token','client','uid','expiry'].each do |header_name|\n self.token_auth_headers[header_name] = response.headers[header_name] unless response.headers[header_name].nil?\n end\n return token_auth_headers\n end", "def use_cookies= bool\n if bool && (!@headers['Cookie'] || @headers['Cookie'].empty?)\n cookie = Kronk.cookie_jar.get_cookie_header @uri.to_s\n @headers['Cookie'] = cookie unless cookie.empty?\n\n else\n @headers.delete 'Cookie'\n end\n\n @use_cookies = bool\n end", "def headers(header = nil)\n @response.headers.merge!(header) if header\n @response.headers\n end" ]
[ "0.71643215", "0.7054277", "0.6570502", "0.6477382", "0.64709556", "0.6415803", "0.6275893", "0.62065095", "0.6184406", "0.6075642", "0.5982159", "0.58962125", "0.5852985", "0.5823074", "0.5819162", "0.5806698", "0.5806698", "0.5801525", "0.57906514", "0.57838815", "0.5775405", "0.5743101", "0.571319", "0.5702014", "0.5702014", "0.5679511", "0.5669859", "0.5657557", "0.5629795", "0.561703", "0.56149596", "0.56120604", "0.55997884", "0.559646", "0.559646", "0.5591894", "0.55690074", "0.5561854", "0.5558468", "0.55538696", "0.55507004", "0.55505127", "0.5539516", "0.5524294", "0.55166525", "0.5516625", "0.5508327", "0.5498831", "0.54901594", "0.5485177", "0.54838496", "0.54811037", "0.5479708", "0.54759794", "0.5475088", "0.54690194", "0.5462958", "0.5462958", "0.5461481", "0.54599625", "0.54396504", "0.5436363", "0.5434542", "0.54342556", "0.543157", "0.54216856", "0.54072136", "0.538957", "0.5387027", "0.5382242", "0.53707254", "0.5367918", "0.5362391", "0.53521895", "0.53454345", "0.5341473", "0.5341427", "0.5340677", "0.5340525", "0.53362876", "0.533226", "0.5331451", "0.5326478", "0.53138936", "0.5304854", "0.5304854", "0.5304854", "0.5304854", "0.53045785", "0.5302314", "0.5300391", "0.5297053", "0.528754", "0.52831686", "0.5280434", "0.5278978", "0.52788985", "0.5278776", "0.5267284", "0.5264261" ]
0.8758742
0
Run this as one before action on any controller that requires a paid, logged in user.
def check_active_user if !current_user.active? current_user.plan = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend", "def before_filter\n if current_user\n true\n end\n end", "def setup \n @user = current_user\n end", "def before_request\n self.login if require_login? && !@authenticating\n end", "def require_no_user(options = {})\n self.before_filter options do |controller|\n controller.send(:require_no_user)\n end\n end", "def defer_user\n\t\tif(current_user)\n\t\t\tredirect_to(user_path(current_user))\n\t\tend\n\tend", "def login_required\n not_authorized unless current_user\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def require_current_user\n if !current_user?(@user)\n redirect_to root_path\n end\n end", "def require_user\n\t\tredirect_to \"/login\" unless current_user\n\tend", "def set_current_user\n current_user\n authorize\n end", "def enforce_logged_in\n bounce unless current_user\n end", "def before_each(req)\n if dealership(req).nil? then not_found\n elsif !authenticated?(req) then unauthenticated\n elsif !authorized?(role(req), session_user(req)) then unauthorized\n else super\n end\n end", "def require_user\r\n if ##LOGIC##\r\n redirect_to '/user/sign_in'\r\n end\r\n end", "def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def client_account_required\n if logged_in? && !current_user.person.is_a?(Client)\n redirect_to account_path\n return\n end\n end", "def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end", "def declared_user\n if logged_in?\n if Protege.find_by(user_id: current_user.id.to_i).nil? and Trainer.find_by(user_id: current_user.id.to_i).nil?\n redirect_to root_path\n end\n else\n redirect_to root_path\n end\n end", "def ensure_user_logged_in\n bounce_user unless current_user\n end", "def require_user\n if !is_logged_in\n flash[:danger] = 'You must be logged in to perform this action'\n redirect_to root_path\n end\n end", "def require_user\n\t\tif !logged_in?\n\t\t\tflash[:notice] = \"You must be logged in to perform this action\"\n\t\t\tredirect_to login_path\n\t\tend\n\tend", "def declared_user\n if logged_in?\n if Protege.find_by(user_id: current_user.id.to_i).nil?\n redirect_to root_path, :alert => \"Access denied.\"\n end\n else\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def pro_only!\n\tif !current_user || !current_user.pro\n\t\tredirect \"/\"\n\tend\nend", "def require_user\n if current_user\n return true\n end\n redirect_to root_url\n end", "def require_user\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def require_user\n redirect_to '/login' unless current_user\n end", "def require_user\n redirect_to '/login' unless current_user\n end", "def permit_user\n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to see all orders.'\n respond_to do |format| \n format.html {redirect_to(root_url)}\n end\n end\n end", "def require_user\n if current_user?\n if (is_admin?||is_manager_for?(@account.account_resource_id))\n true\n else\n render :text => \"unauthorized!\", :status => 401\n return\n end\n else\n redirect_to \"/sso/login?return_to=#{request.url}\"\n false\n end\n end", "def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end", "def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end", "def require_user\n logger.debug \"ApplicationController::require_user\"\n if current_user\n return true\n else\n flash[:error] = \"You must be logged in to access this page.\"\n if Rails.env.development? || ENV['DEBUG_ACCESS'].present?\n redirect_to \"/users/auth/developer\"\n else\n redirect_to user_omniauth_authorize_path(:saml)\n end\n return false\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to permform this action\"\n redirect_to root_path\n end\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform the action\"\n redirect_to login_path\n end\n end", "def require_login\n not_authorized(\"Please sign up or log in above to access this resource.\") unless current_user\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end", "def require_user \n redirect_to '/login' unless current_user \n end", "def require_user \n redirect_to '/login' unless current_user \n end", "def require_current_user\n \tunless User.find(params[:id]) == current_user\n \t\tflash[:error] = \"Sorry! Viewing not authorized.\"\n \tend\n end", "def run_filters\n set_user\n authorize\n end", "def setup_current_user\n @current_user = User.find(session[:user_id]) unless session[:user_id].nil?\n end", "def require_user\n if !logged_in?\n # flash message\n flash[:danger] = \"You must be logged in to perform that action.\"\n # and redirect to index page\n redirect_to root_path\n end\n end", "def require_ownership\n\t\tunless current_user\n\t\t\tredirect_to login_path\n\t\tend\n\tend", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def before_dispatch(env); end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def set_user\n authorize\n @user = current_user\n end", "def check_user\n\n redirect_to root_path if current_user == nil\n if current_user \n redirect_to root_path if current_user.vendor == false\n end\n end", "def require_user\n if session[:uid].blank?\n redirect_to signin_url, :notice => \"Please sign in first.\"\n return\n end\n @user = current_user\n end", "def ensure_current_user\n unless current_user\n redirect_to root_path\n # otherwise redirect somewhere root_path\n end\n end", "def require_logged_in_user\n if !current_user\n head 403\n end\n end", "def verify_action\n if current_user.customer?\n redirect_to root_url\n end\n end", "def rollcall_required\n if current_user.is_rollcall_user?\n return true\n else\n redirect_to :action => \"unauthorized\", :controller => 'rollcall/rollcall_app'\n return false\n end\n end", "def require_login\n redirect_to login_path, notice: 'The requested action requires you to log in' unless session[:user_id]\n end", "def require_user\n # @user = User.find_by(code_token: params[:api_token])\n if @order\n user_id = @order.user_id\n else\n user_id = params[:user_id]? params[:user_id] : params[:order][:user_id]\n end\n @user = User.find(user_id)\n token = request.env['HTTP_API_TOKEN']? request.env['HTTP_API_TOKEN'] : params[:api_token]\n unless @user.authenticate(token)\n render json: {message: \"Authentication problem\"}, status: :unprocessable_entity\n end\n end", "def require_user\n unless current_user\n flash[:error] = 'Es necesario que te identifiques primero.'\n redirect_to root_path\n end\n end", "def set_user_and_verify #TODO: Make this common to both items and tags\n @user = User.find_by(id: params[:user_id])\n if @user.blank?\n head :forbidden\n end\n end", "def require_user\n unless user_logged_in?\n flash[:danger] = 'You must sign in to view this page.'\n redirect_to root_path and return\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform this action\"\n redirect_to :back\n end\n end", "def authorize_user!\n # binding.pry\n unless can?(:crud, @question)\n flash[:alert] = \"Access Denied!\"\n redirect_to root_path\n\n # `head` is a method similar to `render` or `redirect_to`. It finalizes\n # the response. However, it will add content to the response. It will simply\n # set the HTTP status of the response. (e.g. head :unauthorized sets the\n # the status code to 401)\n # For a list of available status code symbols to use with `head` go to:\n # http://billpatrianakos.me/blog/2013/10/13/list-of-rails-status-code-symbols/\n # head :unauthorized\n end\n end", "def set_fake_env\n if current_user.nil?\n @current_account = if params[:account_id].blank?\n Account.first\n else\n Account.find(params[:account_id])\n end\n\n @current_user = @current_account.permissioned_users.first\n end\n end", "def ensure_user!\n unless current_user\n redirect_to root_url\n flash[:danger] = \"You are not permitted\"\n end\n end", "def authorize!(current_user)\n RailsMiniProfiler::User.current_user = current_user\n end", "def own_user_or_admin_required\n if current_user\n if (current_user.id == params[:id]) || current_user.admin\n return\n end\n end\n redirect_to \"/login\", notice: 'Logga in som denna användare för att ändra uppgifter.'\n end", "def check_user_before_membership\n if current_user\n ncm_membership = current_user.get_membership(@mother)\n epicenter = Epicenter.find_by_slug(params['epicenter_id'])\n\n if epicenter != @mother and not ncm_membership\n session[:new_ncm_membership] = { \n :epicenter_id => params['epicenter_id'], \n :membership_id => params['membership_id'],\n :t => Time.now\n }\n #\n redirect_to new_epicenter_subscription_path(@mother)\n end\n else\n # it's possible that we can put the logic from \"authenticate\" method below here\n redirect_to epicenters_path\n end\n end", "def before_payment\n #remove any payments if you are updatind\n # current_order.payments.destroy_all if request.put?\n if current_user\n @order.bill_address ||= Address.default\n @order.bill_address.user = current_user\n else\n @order.bill_address ||= Address.default\n end\n end", "def authenticate_setup_owner!\n render \"errors/404\" unless Setup.find(params[:category][:setup_id]).venture.user_id == current_user.id\n end", "def require_login\n\t\tunless current_user\n\t\t\tredirect_to login_url\n\t\tend\n\tend", "def set_order_and_authorize\n @order = Order.find(params[:id])\n if !(current_user.admin or current_user.is_provider) and current_user != @order.user\n render json: {\"error\":\"You are not authorized for this action\"}, :status => 401 and return\n end\n end", "def current_user\n # authorization initialization if not run yet\n # (in the case of paper_trial it might not have run)\n authorization_init\n @logged_in_user\n end", "def before_payment\n if try_spree_current_user && try_spree_current_user.respond_to?(:payment_sources)\n @payment_sources = try_spree_current_user.payment_sources\n end\n end", "def set_and_authorize_user!\n @user = User.find(params[:id])\n authorize_user_action!\n end", "def require_correct_user\n if session[:donor_id]\n user = Donor.find(params[:id])\n end\n if session[:charityRep_id]\n user = CharityRep.find(params[:id])\n # binding.pry - adds a breakpoint to debug in console\n end\n redirect_to \"/\" if current_user != user || current_user == nil\n end", "def require_current_user!\n redirect_to new_session_url if current_user.nil?\n end", "def set_user\n @user = User.find(params[:user_id]) unless params[:user_id].blank?\n @user ||= current_user\n\n authorize(@user, :user_donations?)\n @user = @user.decorate\n end", "def curator_required\n unless logged_in? && current_user.is_curator?\n flash[:notice] = t(:only_curators_can_access_that_page)\n if session[:return_to] == request.fullpath\n redirect_to root_url\n else\n redirect_back_or_default(root_url)\n end\n end\n end", "def require_authentication\n\n # No matter what the app does a user can always login, forgot\n # password and register. The controllers provided by this\n # plugin alreaddy have these controllers/actions on an\n # exception list but this prevents a mistake an overridden\n # controller from preventing the normal login behavior.\n %w(session password user).each do |c|\n \t %w(new create).each do |a|\n return if (controller_name == c) && (action_name == a)\n end\n \t end\n\n # If we cannot get the current user store the requested page\n # and send them to the login page.\n if current_user.nil? or current_user.anonymous?\n redirect_to login_url(:return_to => request.url) and false\n end\n end", "def require_owner\n unless @product.owned_by?(current_user)\n flash[:alert] = \"Access denied\"\n redirect_to root_path\n end\n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n \n end", "def my_login_required\n login_required unless User.count==0\n end", "def require_user\n if current_user.blank?\n respond_to do |format|\n format.html { authenticate_user!}\n format.all { head(:unauthorized) }\n end\n else\n setup_api_client\n end\n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end", "def require_user\n if current_user\n force_redirects\n true\n else\n Rails.logger.debug('User needs to be logged in')\n redirect_to login_url\n false\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to do that.\"\n redirect_to login_path\n end\n end", "def require_user\n #If not logged in display message then return to home page\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def authorize_user!\n user = Circle.find(params[:id]).user\n if current_user != user\n flash[:notices] = \"Unathorized action\"\n redirect_to user_url(user.id)\n end\n end", "def authorize\n unless User.find_by(id: session[:user_id])\n redirect_to tasks_index_path, notice: \"Please log in\"\n end\n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n end", "def require_login\n if !current_user\n flash[:error] = \"You must be logged in to access this section\"\n redirect_to main_app.root_path # halts request cycle\n end\n end", "def authorize_user\n debt = Debt.find_by_id(params[:id])\n\n if (not current_user.id == debt.owner.id)\n flash[:error] = \"You cannot pay the person's debt.\"\n redirect_to root_url\n end\n end", "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def authorize_user_as_member_of_paid_account!\n railse CanCan::AccessDenied if current_user.nil? || (!current_user.has_role?(:system_administrator) && !current_user.member_of_paid_account?) \n # handle_unauthorized_access if current_user.nil? || (!current_user.has_role?(:system_administrator) && !current_user.member_of_paid_account?)\n end", "def require_user\n return if current_uid\n\n store_location\n flash[:notice] = 'You must be logged in to access the page you requested'\n ret = url_for_with_proto({ controller: 'user_sessions', action: 'guest_login' })\n redirect_to(ret) && return\n end", "def login_required\n call(Rs(:login)) unless logged_in?\n end", "def require_user \n redirect(to('/')) unless current_user \nend", "def first_time_user\n redirect_to_setup_path if current_user.first_time_user?\n end", "def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end" ]
[ "0.7031892", "0.6540167", "0.6490533", "0.6321686", "0.63136125", "0.62753975", "0.618046", "0.61487734", "0.61371857", "0.61359954", "0.6123202", "0.6118476", "0.6094004", "0.60747874", "0.60459995", "0.6045566", "0.60415816", "0.6040817", "0.603951", "0.603837", "0.6033335", "0.60193145", "0.6006889", "0.6005364", "0.60031414", "0.5998795", "0.59956354", "0.5986711", "0.5986711", "0.59862125", "0.5961123", "0.59578866", "0.5955596", "0.593835", "0.5938152", "0.5927108", "0.58990043", "0.58953613", "0.5888952", "0.5884149", "0.5884149", "0.5870855", "0.5866952", "0.586369", "0.58609927", "0.5855223", "0.5852898", "0.5845335", "0.5842674", "0.58419883", "0.5826442", "0.5825581", "0.58249384", "0.58234036", "0.5808434", "0.58039725", "0.5802882", "0.58023626", "0.57983226", "0.5796975", "0.57968855", "0.5785288", "0.5781348", "0.5772335", "0.5760763", "0.5759112", "0.5742299", "0.57418376", "0.57413185", "0.5741104", "0.57247555", "0.5716673", "0.5712427", "0.5704751", "0.57024777", "0.5700239", "0.5695752", "0.5692114", "0.5691955", "0.5687715", "0.56843734", "0.56828105", "0.56823426", "0.56797", "0.56636584", "0.5661889", "0.56548274", "0.5650732", "0.56504583", "0.5644356", "0.5639646", "0.5636785", "0.5636785", "0.56334156", "0.5629753", "0.5627272", "0.5619854", "0.56196475", "0.5618492", "0.56138325", "0.5603838" ]
0.0
-1
Method that test the dark roast class
def test_dark_roast beverage = DarkRoast.new beverage = Milk.new(beverage) beverage = Mocha.new(beverage) beverage = Mocha.new(beverage) beverage = Whip.new(beverage) assert_equal("Dark Roast Coffee, Milk, Mocha, Mocha, Whip", beverage.description) assert_equal(1.59, beverage.cost) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\", \n beverage.description)\n assert_equal(1.59, beverage.cost)\n end", "def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\",\n beverage.description)\n assert_equal(1.59, beverage.cost)\n end", "def test_rocket_lifts_off\n test_rocket = Rocket.new\n test_rocket.lift_off\n assert test_rocket.flying?, 'Rocket should be flying after lift off.'\n end", "def test_gold_rush_is_gold_rush\n assert @gold_rush.is_a?(GoldRush)\n end", "def test_espresso_more_effective\n hipster = Human.new \"Hipster\"\n espresso = Espresso.new \"Espresso\"\n\n hipster.buy espresso\n assert espresso.drinks_before_empty == 1\n\n hipster.drink!\n assert (hipster.alertness > 0.4)\n\n end", "def test_truth\n april = riders(:rider_1)\n assert_equal \"April Jones\", april.name\n trigger = horses(:horse_1)\n assert_equal \"Trigger\", trigger.name\n event2 = events(:event_2)\n assert_equal \"5 Horse Scramble\", event2.name\n \n end", "def test_battle_variables\n @battle.coin_toss(1, @karl.llama_atts, @sloth.sloth_atts, @karl.name, @sloth.name)\n @battle.toss_match = false\n assert_equal(@battle.starter, @sloth.sloth_atts)\n end", "def test_if_status_flying_rocket_flying\n @rocket = Rocket.new(:flying => true)\n assert_equal @rocket.status, \"Rocket #{@rocket.name} is flying through the sky!\"\n end", "def test_roar\n t = Tigger.instance\n assert_equal('Grrr!', t.roar)\n end", "def test_plane_can_take_off\n @plane.fly!\n assert @plane.flying == true\n end", "def test_bear_roar\n assert_equal(\"roar\", @bear.bear_roar)\n end", "def test_magic_ball_silent_shake\n magic_ball = Predictor.new\n assert_silent { magic_ball.shake() }\n end", "def test_fish_in_river()\n assert_equal(0, @river.fish_in_river())\n end", "def test_turn_lights_off\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n actual = house.lights\n assert_equal(true, actual, \"'true' as a boolean should be returned\")\n\n house.lights_off\n actual = house.lights\n assert_equal(false, actual, \"'false' as a boolean should be returned\")\n end", "def test_turn_lights_off_return\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n actual = house.lights_off\n assert_equal('House lights are off!', actual, \"'House lights are on!' as a string should be returned\")\n end", "def test_hunt__success()\n river = River.new(\"Nile\", [\"Tuna\", \"Shark\"])\n @bear.hunt(river)\n assert_equal(1, @bear.fish_in_stomach)\n end", "def test_turn_lights_on\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: false, safe_mode:true)\n house.lights_on\n actual = house.lights\n assert_equal(true, actual, \"'true' as a boolean should be returned\")\n\n house.lights_on\n actual = house.lights\n assert_equal(true, actual, \"'true' as a boolean should be returned\")\n end", "def test_check_fish\n assert_equal(0, @river1.check_fish)\n end", "def test_bear_take_fish\n @bear1 = Bears.new(\"Nate\",\"brown\")\n @river1.add_fish(@fish1)\n @river1.add_fish(@fish2)\n @bear1.bear_take_fish(@fish1)\n @river1.lose_fish(@fish1)\n assert_equal(1,@river1.check_fish)\n assert_equal(1,@bear1.check_stomach)\n end", "def test_turn_lights_on_return\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: false, safe_mode:true)\n actual = house.lights_on\n assert_equal('House lights are on!', actual, \"'House lights are on!' as a string should be returned\")\n end", "def self_test; end", "def self_test; end", "def test_robot_obstacle\n world = World.new(5, 5, [{:x => 1, :y => 1}])\n rover = MarsRover.new(1,0,'N', world)\n assert_equal(\"Obstacle found at x:1 y:1\", rover.command('F'))\n end", "def test_color\n assert_equal(@test_car.color, TEST_CAR_COLOR)\n assert_equal(@test_car.repaint.color, 'primer')\n assert_equal(@test_car.repaint('qwerty').color, 'qwerty')\n end", "def test_yellow_and_violet_and_white\n assert_equal \"Resistor value: 47 gigaohms\",\n ResistorColorTrio.new(%w[yellow violet white]).label\n end", "def test_truth\n end", "def test_move_turns_duck_type_beach\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turn=10\n ruby_rush.random(ruby_rush.seed)\n ruby_rush.move_turns_duck_type_beach\n assert_includes ['Enumerable Canyon', 'Matzburg'], ruby_rush.city\n end", "def test_if_it_takes_a_turn\n new_turn = @round.take_turn(\"Juneau\")\n assert_equal Turn, new_turn.class\n end", "def test_random_rubies\n loc1 = Location.new(\"location 1\", 10, 1000)\n res = loc1.random_rubies\n assert res >= 0 && res <= 10\n end", "def test_bear_takes_fish_out_of_river\n @bear1.bear_catches_and_eats_fish(@river1)\n assert_equal(1,@bear1.amount_in_stomach())\n assert_equal(1,@river1.number_of_fishes())\n end", "def test_rub_per_round\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.real_rubies_found(7)\n\t\ttest_main.rub_per_round(mocked_Graph)\n\t\tassert mocked_Graph\n\tend", "def test_giving_a_house_a_computer\n ryans_house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n ryans_pc = Computer.new(make: \"Lenovo\", model: \"Yoga 2 Pro\", operating_system: \"Linux 14.4\")\n\n # Expect the house to have no computer\n assert_nil(ryans_house.computer)\n\n # Give the house a computer\n ryans_house.computer=(ryans_pc)\n\n # Expect the bear to NOT have no farm\n refute_nil(ryans_house.computer)\n end", "def test_random_fake_rubies\n loc1 = Location.new(\"location 1\", 1000, 10)\n res = loc1.random_fake_rubies\n assert res >= 0 && res <= 10\n end", "def test_alcohol_level_of_drink\n assert_equal(5, @drink3.alcohol_level())\n end", "def it_has_war_type\n card1 = Card.new(:heart, 'Jack', 11)\n card2 = Card.new(:heart, '10', 10)\n card3 = Card.new(:heart, '9', 9)\n card4 = Card.new(:diamond, 'Jack', 11)\n card5 = Card.new(:heart, '8', 8)\n card6 = Card.new(:diamond, 'Queen', 12)\n card7 = Card.new(:heart, '3', 3)\n card8 = Card.new(:diamond, '2', 2)\n deck1 = Deck.new([card1, card2, card5, card8])\n deck2 = Deck.new([card4, card3, card6, card7])\n player1 = Player.new(\"Megan\", deck1)\n player2 = Player.new(\"Aurora\", deck2)\n turn = Turn.new(player1, player2)\n\n assert_equal :war, turn.type\n end", "def test_chess\r\n assert_nil(game.setup, \"This is not nil.\")\r\n assert_match(/king|queen|bishop|knight|rook|pawn/, game.promote(nil, nil), \"This is not a piece of chess.\")\r\n assert_match(/black|white/, game.take_turn, \"This is not black or white.\")\r\n assert_match(/black|white/, game.switch_players, \"This is not black or white.\")\r\n assert_match(/true|false/, game.checkmate?.to_s, \"No pass test\")\r\n assert_match(/true|false/, game.check?.to_s, \"No pass test\")\r\n\r\n assert_match(\"[\\\"+ \\\", \\\"BP \\\", \\\"+ \\\", \\\"+ \\\", \\\"+ \\\", \\\"+ \\\", \\\"+ \\\", \\\"+ \\\"]\",\r\n board.move(\"B1\", \"C1\").to_s, \"No pass test\")\r\n assert_match(/true|false/, board.king_threatened?(nil, nil).to_s, \"No pass test\")\r\n\r\n end", "def test_get_color\n assert_equal \"X\", @player.color\n end", "def test_move_turns_enumerable_canyon_to_duck_type_beach\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turn=10\n ruby_rush.random(ruby_rush.seed)\n ruby_rush.move_turns_enumerable_canyon\n assert_includes ['Duck Type Beach', 'Monkey Patch City'], ruby_rush.city\n \n end", "def test_class_world_has_create_random_method\n assert_respond_to World, 'create_random'\n end", "def test_for_winner\n game = Hangman.new(\"debit\")\n game.word = \"debit\"\n game.correct_guesses = \"debit\"\n assert_equal(true, game.won?)\n end", "def test_has_a_turn_method\n assert_respond_to @world, 'turn'\n end", "def test_should_detect_white_kingside_back_rank_mate\n e = RulesEngine.new\n place_pieces(e, \"\n K - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - - \n - - - - - - - - \n - - - - - p p p \n - - - R - - k - \n \")\n assert(e.checkmate?(Colour::WHITE))\n end", "def test_move_turns_matzburgh\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turn=10\n ruby_rush.random(ruby_rush.seed)\n ruby_rush.move_turns_matzburgh\n assert_includes ['Monkey Patch City', 'Duck Type Beach', 'Hash Crossing', 'Dynamic Palisades'], ruby_rush.city\n end", "def test_truth\n assert_kind_of Obra, obras(:first)\n end", "def test_yellow_and_violet_and_blue\n assert_equal \"Resistor value: 47 megaohms\",\n ResistorColorTrio.new(%w[yellow violet blue]).label\n end", "def test_bear_eats_from_river__full()\n river1 = River.new(\"Tweed\", [@fish1, @fish2])\n @bear.bear_eats_from_river(river1)\n assert_equal(2, @bear.bear_stomach())\n assert_equal(0, river1.fishes_count())\n end", "def testing\n # ...\n end", "def test_create_rectangle\n game=GameOfLife.new(4,6)\n measure_universe game.state,4,6\n\n game.populate(7,5)\n measure_universe game.state,7,5\n end", "def test_victorious\n\t\tp = Print.new\n\t\tassert_output(\"Going home victorious!\\n\") {p.print_game_win_or_lose(16)}\n\tend", "def test_truth\n assert_kind_of Standard, @standard\n end", "def test_fake_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.fake_rubies_found(7)\n\t\ttest_main.fake_rubies_found(7)\n\t\tassert test_main.num_fake_rubies, 14\n\tend", "def test_real_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.real_rubies_found(7)\n\t\ttest_main.real_rubies_found(7)\n\t\tassert test_main.num_real_rubies, 14\n\tend", "def test_get_color\n assert_equal \"X\", @disc.color\n end", "def test_bear_take_fish\n @river1.add_fish(@fish1)\n @river1.add_fish(@fish2)\n @bear1.bear_take_fish(@fish1)\n assert_equal(1,@bear1.check_stomach)\n end", "def test_GC_ClassMethods_stree=\n\t\tassert_equal(false, GC.stress)\n\tend", "def test_no_correcto\n\t\tassert_equal(10, @circle.rad(75.36) )\n\tend", "def test_nil_town_search_found_something\n ruby_rush=RubyRush.new(1, 2, 3)\n doubled_prng = Minitest::Mock.new('doubled prng')\n def doubled_prng.rand(seed); 3; end\n ruby_rush.prng=doubled_prng\n ruby_rush.cur_fake_rb=3\n ruby_rush.fake_sp='rubies'\n assert_output(\"\\tFound #{ruby_rush.cur_fake_rb} fake #{ruby_rush.fake_sp} in #{ruby_rush.city}.\\n\" ) {ruby_rush.nil_town_search}\n end", "def love_test\nend", "def test_amount_gold_silver\n\tassert_equal 0, @gold_rush.prospector.num_gold\n\tassert_equal 0, @gold_rush.prospector.num_silver\n end", "def test_lose_game_when_chances_used_up\n\t\th = Hangman.new(word)\n\t\tassert_equal true, h.lose_game?\n\tend", "def test_it_has_a_standard_royal_family\n assert_equal [\"Jack\", \"Queen\", \"King\"], @card_generator.royal\n end", "def test_move_turns_dynamic_palisades\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.turn=10\n ruby_rush.random(ruby_rush.seed)\n ruby_rush.move_turns_dynamic_palisades\n assert_includes ['Matzburg', 'Hash Crossing'], ruby_rush.city\n end", "def test_way_generator\n \tassert_equal 1, @gold_rush.way_generator(1)\n end", "def test_turn_safe_mode_on_return\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n actual = house.safe_mode_on\n assert_equal('Your house is in SAFEMODE!', actual, \"'Your house is in SAFEMODE!' as a string should be returned\")\n end", "def test_magic_ball_new_not_nil\n magic_ball = Predictor.new\n refute_nil magic_ball\n end", "def test_truth\n assert_kind_of Leader, @leader\n end", "def test_poor_predictable_bart()\n assert_equal(\"Paper wins!\", Game.play(\"paper\", \"rock\"))\n end", "def test_guess_is_correct\n card = Card.new(\"What is the capital of Alaska?\", \"Juneau\", :Geography)\n turn = Turn.new(\"Juneau\", card)\n\n assert turn.correct?\n end", "def assert_equal_light expected_number, expected_colour, expected_time, light\n assert_equal expected_colour, light.colour\n assert_equal expected_time , light.time\n assert_equal expected_number, light.number\n end", "def test_truth\n assert_kind_of Barista, baristas(:first)\n end", "def test_print_out_mood\n ruby_rush=RubyRush.new(1, 2, 3)\n ruby_rush.real_rb=10\n assert_output(\"Going home victorious!\\n\") {ruby_rush.print_out_mood}\n ruby_rush.real_rb=9\n assert_output(\"Going home sad.\\n\") {ruby_rush.print_out_mood}\n ruby_rush.real_rb=0\n assert_output(\"Going home empty-handed.\\n\") {ruby_rush.print_out_mood}\n end", "def test_mine\n t = Town::new 'Dynamic Palisades', ['Matzburg', 'Hash Crossing'], 2, 2\n create_seed 8\n dig_results1 = t.mine\n create_seed 8\n dig_results2 = t.mine\n assert_equal dig_results1, dig_results2\n end", "def test_mogul_does_not_laugh_at_richer_mogul\n richer_mogul = Mogul.new(\"Bill Gates (no relation)\", 42)\n assert_equal @mogul.laughs_at?(richer_mogul), false\n end", "def test_random_rubies_zero\n loc1 = Location.new(\"location 1\", 0, 100)\n assert_equal 0, loc1.random_rubies\n end", "def test_for_not_museum\n testLocation = LocationNode.new(\"Hillman\",nil,nil,nil,nil)\n assert_equal false, incrementToy(testLocation)\n end", "def test_bear_eats_fish\n @bear.eats\nend", "def test_should_detect_simple_check\n e = RulesEngine.new\n place_pieces(e, \"\n - - - - - - - K\n - - - - - - - -\n - - - - - - - -\n - - - R - - - -\n - - - - - - - - \n - - - - - - - - \n - - - - - - - - \n - - - k - - - - \n \")\n e.calculate_colour_attack(Colour::BLACK)\n assert(e.in_check?(Colour::WHITE))\n end", "def test_it_can_get_outcome\n assert_equal :home_win, @game_1.outcome\n end", "def test_top_wrap\n rover = MarsRover.new(0,4,'S', world=World.new(5,5))\n rover.command('B')\n assert_equal([0,0,'S'], rover.position)\n end", "def determineWinner() \n\n end", "def test_correcto\n\t\tassert_equal(12, @circle.rad(75.36) )\n\tend", "def test_guess_is_incorrect\n card = Card.new(\"Which planet is closest to the sun?\", \"Mercury\", :STEM)\n turn = Turn.new(\"Saturn\", card)\n\n refute turn.correct?\n end", "def test_avenue_connection\r\n\t\thillman = Location::new(\"Hillman\", nil , \"Fifth Ave.\")\r\n\t\tassert_equal \"Fifth Ave.\", hillman.avenue\r\n\t\r\n\tend", "def test_right_wrap\n rover = MarsRover.new(4,0,'N', world=World.new(5,5))\n rover.command('RF')\n assert_equal([0,0,'E'], rover.position)\n end", "def dark; end", "def dark; end", "def test_1_good_basic_instantiation\n\n assert_nothing_raised do\n @app = Rouster.new(:name => 'app', :unittest => true)\n end\n\n assert_equal('app', @app.name)\n assert_equal(false, @app.is_passthrough?())\n assert_equal(true, @app.uses_sudo?())\n end", "def test_current_gold_silver\n \t@gold_rush.prospector.num_gold = 2\n \t@gold_rush.prospector.num_silver = 3\n \tassert_equal 3, @gold_rush.prospector.num_gold\n \tassert_equal 2, @gold_rush.prospector.num_silver\n end", "def test_returns_stength_value_for_human\n # write a function hero_movement (race)\n # variable will be race = human/elf/dwarf\n # generate a dice roll using rand(1..6)\n dice_roll = rand(1..6)\n result = hero_movement(dice_roll, \"human\")\n assert_equal(dice_roll, result)\n end", "def test_gold_rush_new_not_nil\n refute_nil @gold_rush\n end", "def test_is_steam_when_above_100\n water_state = water_description(101)\n assert_equal(\"steam\", water_state)\n end", "def test_it_produces_a_new_secret_each_new_game #There's a small chance these actually will be the same and the test will fail\n\t\tother_game = Mastermind.new\n\t\tassert other_game.secret != mm.secret\n\t\tgame3 = Mastermind.new\n\t\tassert game3.secret != mm.secret\n\tend", "def test_hero_is_invincible\n end", "def test_is_steam_when_above_100\n state = water_description(120)\n assert_equal(\"steam\", state)\n end", "def test_take_fish_from_river\n @bear.take_fish_from_river(@river)\n assert_equal(1, @bear.food_count)\n end", "def test_barely_victorious\n\t\tp = Print.new\n\t\tassert_output(\"Going home victorious!\\n\") {p.print_game_win_or_lose(10)}\n\tend", "def test_team_win\n @team.was_the_match_a_victory(true)\n assert_equal(1, @team.points)\n @team.was_the_match_a_victory(true)\n @team.was_the_match_a_victory(true)\n @team.was_the_match_a_victory(false)\n @team.was_the_match_a_victory(true)\n assert_equal(4, @team.points)\n end", "def test_initialize_edge\n\n dummy_loc = MiniTest::Mock.new('test_loc')\n #dummy_game = MiniTest::Mock.new('test_game')\n def dummy_loc.name; 'Test Location'; end\n #def dummy_game.print; print_day; end\n g_test = Game.new(dummy_loc, -2, -5)\n # Assert that print_day catches and reports edge case\n assert_equal -1, g_test.print_day(dummy_loc, -2, -5)\n end", "def test_house_blend\n beverage = HouseBlend.new\n beverage = Soy.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"House Blend Coffee, Soy, Mocha, Whip\", \n beverage.description)\n assert_equal(1.34, beverage.cost)\n end", "def test_shake_shake_shake_shake\n magic_ball = Predictor.new\n assert_equal \"SHAKE SHAKE SHAKE\", magic_ball.shake\n end" ]
[ "0.6940778", "0.69158936", "0.6380528", "0.63674176", "0.628433", "0.6283115", "0.62816167", "0.62688184", "0.6238262", "0.6223462", "0.62120193", "0.6193525", "0.61556214", "0.61370224", "0.61171836", "0.6112152", "0.61099803", "0.607291", "0.60441893", "0.5992969", "0.5991879", "0.5991879", "0.5982188", "0.5976734", "0.5973798", "0.5953557", "0.5947332", "0.5930921", "0.5926109", "0.5923467", "0.59182537", "0.5900409", "0.58657783", "0.58510774", "0.5844286", "0.58366954", "0.5827447", "0.5823914", "0.5822057", "0.58150107", "0.58149475", "0.5805404", "0.5804465", "0.57961774", "0.57829714", "0.578241", "0.5777328", "0.57720613", "0.5770246", "0.57481694", "0.5740953", "0.573438", "0.5730711", "0.57243294", "0.5722944", "0.5722474", "0.57205", "0.57189107", "0.57089895", "0.57072866", "0.5698613", "0.5697011", "0.568749", "0.56860363", "0.56764024", "0.56660813", "0.5660471", "0.5650773", "0.5647538", "0.564227", "0.5641272", "0.5640955", "0.56392694", "0.5635418", "0.5635165", "0.56345266", "0.56332827", "0.562618", "0.5624132", "0.5622202", "0.5622075", "0.56122524", "0.5606888", "0.560618", "0.5591986", "0.5591986", "0.5590041", "0.5587429", "0.5582626", "0.5582548", "0.5580072", "0.5580053", "0.5576187", "0.5573444", "0.55714285", "0.55622756", "0.5558224", "0.5555314", "0.5543144", "0.5541794" ]
0.69537795
0
Method that test the house blend class
def test_house_blend beverage = HouseBlend.new beverage = Soy.new(beverage) beverage = Mocha.new(beverage) beverage = Whip.new(beverage) assert_equal("House Blend Coffee, Soy, Mocha, Whip", beverage.description) assert_equal(1.34, beverage.cost) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_house_blend\n beverage = HouseBlend.new\n beverage = Soy.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"House Blend Coffee, Soy, Mocha, Whip\", \n beverage.description)\n assert_equal(1.34, beverage.cost)\n end", "def test_house_blend\n beverage = HouseBlend.new\n beverage = Soy.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"House Blend Coffee, Soy, Mocha, Whip\",\n beverage.description)\n assert_equal(1.34, beverage.cost)\n end", "def test_giving_a_house_a_computer\n ryans_house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n ryans_pc = Computer.new(make: \"Lenovo\", model: \"Yoga 2 Pro\", operating_system: \"Linux 14.4\")\n\n # Expect the house to have no computer\n assert_nil(ryans_house.computer)\n\n # Give the house a computer\n ryans_house.computer=(ryans_pc)\n\n # Expect the bear to NOT have no farm\n refute_nil(ryans_house.computer)\n end", "def test_create_rectangle\n game=GameOfLife.new(4,6)\n measure_universe game.state,4,6\n\n game.populate(7,5)\n measure_universe game.state,7,5\n end", "def house; end", "def house; end", "def test_turn_lights_on\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: false, safe_mode:true)\n house.lights_on\n actual = house.lights\n assert_equal(true, actual, \"'true' as a boolean should be returned\")\n\n house.lights_on\n actual = house.lights\n assert_equal(true, actual, \"'true' as a boolean should be returned\")\n end", "def test_turn_lights_on_return\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: false, safe_mode:true)\n actual = house.lights_on\n assert_equal('House lights are on!', actual, \"'House lights are on!' as a string should be returned\")\n end", "def test_espresso_more_effective\n hipster = Human.new \"Hipster\"\n espresso = Espresso.new \"Espresso\"\n\n hipster.buy espresso\n assert espresso.drinks_before_empty == 1\n\n hipster.drink!\n assert (hipster.alertness > 0.4)\n\n end", "def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\", \n beverage.description)\n assert_equal(1.59, beverage.cost)\n end", "def test_plane_can_take_off\n @plane.fly!\n assert @plane.flying == true\n end", "def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\",\n beverage.description)\n assert_equal(1.59, beverage.cost)\n end", "def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\",\n beverage.description)\n assert_equal(1.59, beverage.cost)\n end", "def testing\n # ...\n end", "def test_magic_ball_silent_shake\n magic_ball = Predictor.new\n assert_silent { magic_ball.shake() }\n end", "def test_creating_your_own_chair\n your_chair = Chair.new\n your_chair.build_chair(__, __, __)\n your_chair.paint_the_chair\n\n assert_equal 10, your_chair.tell_me_your_tall\n\n assert_equal 7, your_chair.tell_me_your_width\n end", "def setup\n @bike = @object = RoadBike.new(tape_color: 'red')\n end", "def test_turn_lights_off\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n actual = house.lights\n assert_equal(true, actual, \"'true' as a boolean should be returned\")\n\n house.lights_off\n actual = house.lights\n assert_equal(false, actual, \"'false' as a boolean should be returned\")\n end", "def test_bear_takes_fish_out_of_river\n @bear1.bear_catches_and_eats_fish(@river1)\n assert_equal(1,@bear1.amount_in_stomach())\n assert_equal(1,@river1.number_of_fishes())\n end", "def test_hero_is_invincible\n end", "def test_bear_eats_from_river__full()\n river1 = River.new(\"Tweed\", [@fish1, @fish2])\n @bear.bear_eats_from_river(river1)\n assert_equal(2, @bear.bear_stomach())\n assert_equal(0, river1.fishes_count())\n end", "def test_turn_lights_off_return\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n actual = house.lights_off\n assert_equal('House lights are off!', actual, \"'House lights are on!' as a string should be returned\")\n end", "def test_alcohol_level_of_drink\n assert_equal(5, @drink3.alcohol_level())\n end", "def test_person_harness_dragon\n # Assert a raise here on person.harnessed\n harness trainer: @person, animal: @dragon do; end\n assert @person.harnessed?(@dragon)\n end", "def test_full_room()\n @room2.guest_enter(@guest)\n @room2.guest_enter(@guest)\n assert_equal(true, @room2.full_room)\n end", "def test_truth\n april = riders(:rider_1)\n assert_equal \"April Jones\", april.name\n trigger = horses(:horse_1)\n assert_equal \"Trigger\", trigger.name\n event2 = events(:event_2)\n assert_equal \"5 Horse Scramble\", event2.name\n \n end", "def test_bake_loaves\n @bakery.bake_loaves(1, \"rye loaf\")\n assert_equal(24, @bakery.get_loaf_stock(\"rye loaf\"))\n assert_equal(6.4, @bakery.get_raw_material_qty(\"flour\"))\n assert_equal(0.3, @bakery.get_raw_material_qty(\"yeast\"))\n assert_equal(0.43, @bakery.get_raw_material_qty(\"salt\"))\n end", "def test_partial_game_1\n \t@game = Bowling::Game.new '10,10'\n \tassert_equal(30, @game.scores)\n end", "def test_lose_game_when_chances_used_up\n\t\th = Hangman.new(word)\n\t\tassert_equal true, h.lose_game?\n\tend", "def test_game_loop\n\t\tg = Game.new(0,0,0)\n\t\tmocked_miner = Minitest::Mock.new(\"mocked miner\")\n\t\tdef mocked_miner.current_city; 0; end\n\t\tdef mocked_miner.increase_rubies(x,y); nil; end\n\t\t\n\t\tmocked_city = Minitest::Mock.new(\"mocked city\")\n\t\tdef mocked_city.get_rubies(x); [0,0]; end\n\t\tdef mocked_city.name; 'Town'; end\n\t\n\t\tmocked_printer = Minitest::Mock.new(\"mocked printer\")\n\t\tdef mocked_printer.print_day(x,y); nil; end\t\n\t\t\n\t\tassert_equal(1,g.game_loop(mocked_miner, 1 ,mocked_printer, [mocked_city]))\n\tend", "def test_total_turns_1\n \tpro = Prospector.new(1)\n \tpro.prospect_move(1)\n \tassert pro.total_rubies == 0\n \tassert pro.total_fake_rubies == 0\n end", "def test_it_can_return_when_human_wins\n board = Board.new\n cruiser = Ship.new(\"Cruiser\", 3)\n sub = Ship.new(\"Submarine\", 2)\n game_play = GamePlay.new\n cell_1 = Cell.new(\"B2\")\n cell_2 = Cell.new(\"B3\")\n cell_3 = Cell.new(\"B4\")\n board.place(cruiser, [\"A1\", \"A2\", \"A3\"])\n end", "def test_guest_tab_increases_if_room_serves_them_drink\n @room1.add_drinks_to_stock(@drink1)\n @room1.add_drinks_to_stock(@drink2)\n @room1.serve_drink_to_guest(@guest2, @drink2)\n assert_equal(1.50, @guest2.show_tab())\n end", "def test_way_generator\n \tassert_equal 1, @gold_rush.way_generator(1)\n end", "def test_the_round_exists\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n assert_instance_of Round, round\n end", "def test_guest_cannot_buy_drink_if_they_have_insufficient_funds\n @room1.add_drinks_to_stock(@drink1)\n @room1.add_drinks_to_stock(@drink2)\n guest6=Guest.new(\"Kaka\", 1.00, \"Always look on the bright side of life.\")\n guest6.show_tab\n expected = \"You can't afford this drink.\"\n assert_equal(expected, @room1.refuse_guest_drink_if_they_cannot_afford_it(guest6, @drink1))\n end", "def test_attributes\n assert_equal \"Gallery 1\", @gallery.title\n assert @gallery.active?\n assert_equal \"f82dd0bd-4711-4578-ac47-4661257e69a6\", @gallery.guid\n end", "def battletest_setup\r\n # Set up party for battle test\r\n $game_party.setup_battle_test_members\r\n # Set troop ID, can escape flag, and battleback\r\n $game_temp.battle_troop_id = $data_system.test_troop_id\r\n $game_temp.battle_can_escape = true\r\n $game_map.battleback_name = $data_system.battleback_name\r\n end", "def test_battle_variables\n @battle.coin_toss(1, @karl.llama_atts, @sloth.sloth_atts, @karl.name, @sloth.name)\n @battle.toss_match = false\n assert_equal(@battle.starter, @sloth.sloth_atts)\n end", "def test_bear_take_fish\n @river1.add_fish(@fish1)\n @river1.add_fish(@fish2)\n @bear1.bear_take_fish(@fish1)\n assert_equal(1,@bear1.check_stomach)\n end", "def test_blend_mode=\n assert @br.blend_mode = :diff\n assert @br.blend_mode = 10\n end", "def test_amount_gold_silver\n\tassert_equal 0, @gold_rush.prospector.num_gold\n\tassert_equal 0, @gold_rush.prospector.num_silver\n end", "def test_prospect_gold_positive\n\t prng = Minitest::Mock.new\n\t def prng.rand(num); 1; end\n\t\tcity = City.new(\"Fake City\", 7, 0, prng)\n\t\tcheck = city.prospect_gold\n\t\tassert_includes (0..7), check\n\tend", "def test_shake_shake_shake_shake\n magic_ball = Predictor.new\n assert_equal \"SHAKE SHAKE SHAKE\", magic_ball.shake\n end", "def setup\n\n bikeSizes = {size: 12,tire_size: 3.0}\n @road = RoadBike.new(bikeSizes.merge({tape_color: \"blue\"}))\n @mountainBike = MountainBike.new(bikeSizes.merge({front_shock: 20,rear_shock: 30}))\n\n # @mountain_bike = MountainBike.new({})\n\n\n end", "def self_test; end", "def self_test; end", "def setup_castle\r\n randomnums = Random.new\r\n zero_out\r\n treasures_allot\r\n terrors_allot\r\n set_at_room(4,6, 100 + randomnums.rand(1...100))\r\n set_at_room(16,6, 100 + randomnums.rand(1...100))\r\nend", "def test_sell_loaves\n @bakery.sell_loaves(4,\"sourdough\")\n assert_equal(20, @bakery.get_loaf_stock(\"sourdough\"))\n assert_equal(66, @bakery.get_cash)\n end", "def test_partial_game_2\n \t@game = Bowling::Game.new '10,10,10'\n \tassert_equal(60, @game.scores)\n end", "def test_can_check_room_is_full_and_enter()\n @room1.guest_enter(@guest)\n @guest.venue_fee(10)\n assert_equal(1, @room1.guest.length)\n assert_equal(0, @guest.money)\n end", "def test_class_world_has_create_random_method\n assert_respond_to World, 'create_random'\n end", "def test_it_can_get_outcome\n assert_equal :home_win, @game_1.outcome\n end", "def test_turn_safe_mode_on_return\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n actual = house.safe_mode_on\n assert_equal('Your house is in SAFEMODE!', actual, \"'Your house is in SAFEMODE!' as a string should be returned\")\n end", "def test_me\n puts Wisdom.new('[Initial]')\nend", "def test_bear_take_fish\n @bear1 = Bears.new(\"Nate\",\"brown\")\n @river1.add_fish(@fish1)\n @river1.add_fish(@fish2)\n @bear1.bear_take_fish(@fish1)\n @river1.lose_fish(@fish1)\n assert_equal(1,@river1.check_fish)\n assert_equal(1,@bear1.check_stomach)\n end", "def test_live_cell_with_two_neighbors_lives\n assert @life.will_live?(true, 2)\n end", "def test_puts_tape_color_in_local_spares\n assert_equal 'red', @bike.local_spares[:tape_color]\n end", "def test_avenue_connection\r\n\t\thillman = Location::new(\"Hillman\", nil , \"Fifth Ave.\")\r\n\t\tassert_equal \"Fifth Ave.\", hillman.avenue\r\n\t\r\n\tend", "def test_init_game()\n # Test Game has Track\n assert_equal(true, @game.track().is_a?(Track))\n # Test Game has 2 players\n assert_equal(2, @game.get_num_players())\n # Test game has 1 die\n assert_equal(true, @game.dice().is_a?(Dice))\n # Test game has selected first player to play\n assert_equal(true, @game.first_player().is_a?(Player))\n # Test game has current player\n assert_equal(true, @game.current_player().is_a?(Player))\nend", "def test_color\n assert_equal(@test_car.color, TEST_CAR_COLOR)\n assert_equal(@test_car.repaint.color, 'primer')\n assert_equal(@test_car.repaint('qwerty').color, 'qwerty')\n end", "def test_window_1\n skip_default\n cleaned do\n w1 = register(Window.new)\n w1.back_opacity = 255\n w1.windowskin = Bitmap.new(\"#@@imgdir/windowskin1.png\")\n w1.x = 120\n w1.y = 100\n w1.width = 314\n w1.height = 250\n\n snap = Graphics.snap_to_bitmap\n assert_bitmap_equal2(\"test_window_1\", snap)\n end\n end", "def test_simpleArmor\n w = Window_EquipDetails.new(0,192,640,96,$data_armors[1])\n @windows.push(w)\n return true\n end", "def spec; end", "def spec; end", "def test_bill\n assert_equal(190.00, @room1.bill(@guest1,@bar1))\n assert_equal(160.00, @room2.bill(@guest3,@bar2))\n\n end", "def test_bot_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 5 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def setup_check_cover\n return if area_flag\n get_scene.tsbs_apply_substitute(target, item_in_use, self)\n end", "def test_fish_in_river()\n assert_equal(0, @river.fish_in_river())\n end", "def test_should_give_birth_if_3_neighbours\n @game.state = [[1,0,0],[1,1,0],[0,0,0]]\n after = @game.evolve\n assert_equal [[1,1,1],[1,1,1],[1,1,1]],after\n end", "def tests; end", "def tests; end", "def test_seed\n @game.populate(3,3,50,0)\n zero=@game.state\n\n @game.populate(3,3,50,1)\n assert_not_equal zero,@game.state\n\n @game.populate(3,3,50,0)\n assert_equal zero,@game.state\n end", "def test_how_many_lives\n assert_equal(2,how_many_lives?(1,1))\n assert_equal(2,how_many_lives?(@goban.gsize,@goban.gsize))\n assert_equal(2,how_many_lives?(1,@goban.gsize))\n assert_equal(2,how_many_lives?(@goban.gsize,1))\n assert_equal(4,how_many_lives?(2,2))\n assert_equal(4,how_many_lives?(@goban.gsize-1,@goban.gsize-1))\n s=Stone.play_at(@goban, 2, 2, BLACK); # we will try white stones around this one\n g=s.group\n assert_equal(2,how_many_lives?(1,1))\n assert_equal(4,g.lives)\n assert_equal(2,how_many_lives?(1,2))\n assert_equal(4,g.lives) # verify the live count did not change\n assert_equal(2,how_many_lives?(2,1))\n assert_equal(3,how_many_lives?(2,3))\n assert_equal(3,how_many_lives?(3,2))\n assert_equal(4,how_many_lives?(3,3))\n end", "def test_dead_cell_with_three_neighbors_lives\n assert @life.will_live?(false, 3)\n end", "def test_round_has_guesses\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n assert_equal [], round.guesses\n end", "def hatch\n @status = Idle\n @target = nil\n @virility = 0\n babies = []\n rand(MaxBabiesFromEgg).to_i.times {babies << baby_salmon}\n babies\n end", "def has_own_bed?\n false\n end", "def test_for_winner\n game = Hangman.new(\"debit\")\n game.word = \"debit\"\n game.correct_guesses = \"debit\"\n assert_equal(true, game.won?)\n end", "def graffiti_test\n end", "def test_bot_two_unit_per_floor_exterior_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double Exterior'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_prospect_silver_positive\n\t prng = Minitest::Mock.new\n\t def prng.rand(num); 1; end\n\t\tcity = City.new(\"Fake City\", 0, 7, prng)\n\t\tcheck = city.prospect_silver\n\t\tassert_includes (0..7), check\n\tend", "def test_bot_mid_six_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 18\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 10 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_initialize_edge\n\n dummy_loc = MiniTest::Mock.new('test_loc')\n #dummy_game = MiniTest::Mock.new('test_game')\n def dummy_loc.name; 'Test Location'; end\n #def dummy_game.print; print_day; end\n g_test = Game.new(dummy_loc, -2, -5)\n # Assert that print_day catches and reports edge case\n assert_equal -1, g_test.print_day(dummy_loc, -2, -5)\n end", "def hero; end", "def hero; end", "def hero; end", "def hero; end", "def hero; end", "def test_bot_left_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 5 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_density\n game=GameOfLife.new(3,3,100)\n assert_equal 9,weigh_universe(game.state)\n\n game.populate(3,3,0)\n assert_equal 0,weigh_universe(game.state)\n\n # This test will fail just through randomness 2 in 2^100 times\n game.populate(10,10,50)\n weight=weigh_universe(game.state)\n assert weight<100\n assert weight>0\n end", "def test_bot_left_two_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_random_rubies\n loc1 = Location.new(\"location 1\", 10, 1000)\n res = loc1.random_rubies\n assert res >= 0 && res <= 10\n end", "def place_scenario\n associate TweetPong::Stage::Wall.new(:x => 0, :y => 0, :width => width, :height => 0)\n associate TweetPong::Stage::Wall.new(:x => width, :y => 0, :width => 0, :height => height)\n associate TweetPong::Stage::Wall.new(:x => 0, :y => height, :width => width, :height => 0)\n associate TweetPong::Stage::Wall.new(:x => 0, :y => 0, :width => 0, :height => height)\n\n end", "def test_bot_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_street_used_to_go_to_monroeville\r\n\t\toakland = City::new\r\n\t\tfourth = Minitest::Mock::new\r\n\t\tdef fourth.street; \"Fourth Ave.\"; end\r\n\t\tassert_includes oakland.generate_cathedral_locs(oakland, 0)[1][0], fourth.street\r\n\tend", "def test_fullArmor\n w = Window_EquipDetails.new(0,384,640,96,$data_armors[31])\n @windows.push(w)\n return true\n end", "def test_prospect_silver_zero\n\t\tprng = Minitest::Mock.new\n\t def prng.rand(num); 0; end\n\t\tcity = City.new(\"Fake City\", 0, 0, prng)\n\t\tcheck = city.prospect_gold\n\t\tassert_equal 0, check\n\tend", "def test_initialize\n assert_kind_of(RackoDeck, @manager.draw_pile)\n\n assert_kind_of(Deck, @manager.discard_pile)\n end", "def test_team_win\n @team.was_the_match_a_victory(true)\n assert_equal(1, @team.points)\n @team.was_the_match_a_victory(true)\n @team.was_the_match_a_victory(true)\n @team.was_the_match_a_victory(false)\n @team.was_the_match_a_victory(true)\n assert_equal(4, @team.points)\n end" ]
[ "0.7500098", "0.74448866", "0.62738144", "0.62115896", "0.6183764", "0.6183764", "0.6019236", "0.59566027", "0.591663", "0.59158957", "0.58785987", "0.5853097", "0.58238006", "0.57870084", "0.5742406", "0.5681121", "0.56789", "0.56710964", "0.5643395", "0.5639998", "0.5627904", "0.5622251", "0.5616332", "0.56035185", "0.5579916", "0.5576221", "0.55692506", "0.5559807", "0.55589914", "0.55430114", "0.55421853", "0.5537369", "0.5536058", "0.5532421", "0.55286026", "0.55201936", "0.55095774", "0.5507865", "0.5504972", "0.5481354", "0.5446959", "0.54448664", "0.54439145", "0.54385364", "0.5436885", "0.5435868", "0.5435868", "0.54358", "0.5423569", "0.54207623", "0.5412685", "0.5409221", "0.54088736", "0.54086953", "0.54011065", "0.53976506", "0.5397439", "0.5392921", "0.5391059", "0.5389904", "0.5383016", "0.5381406", "0.5380366", "0.53778446", "0.53778446", "0.5371386", "0.53690916", "0.53520805", "0.53504807", "0.5349603", "0.5343765", "0.5343765", "0.5341358", "0.5340019", "0.5335112", "0.5323548", "0.53206724", "0.53184116", "0.5311706", "0.5310896", "0.53099436", "0.53098965", "0.5306055", "0.5305622", "0.5298993", "0.5298993", "0.5298993", "0.5298993", "0.5298993", "0.529518", "0.5294838", "0.52945644", "0.52944374", "0.52876604", "0.528315", "0.5282997", "0.52793396", "0.5277987", "0.5277393", "0.5276325" ]
0.7451167
1
Problem Write a method that takes an Array of integers as input, multiplies all the numbers together, divides the result by the number of entries in the Array, and then prints the result rounded to 3 decimal places. Assume the array is nonempty. Examples / Test Cases show_multiplicative_average([3, 5]) The result is 7.500 show_multiplicative_average([6]) The result is 6.000 show_multiplicative_average([2, 5, 7, 11, 13, 17]) The result is 28361.667 Data Structure array, integer Algorithm define a method named 'show_multiplicative_average' which takes an 'array' as an argument use .reduce(:) on the array and save the result in a variable called 'multipled' Divide 'multipled' by array.size and save this in a variable called 'average' use sprintf to format the output to 3 decimal places. Code
def show_multiplicative_average(array) multiplied = array.reduce(:*) average = multiplied / array.size.to_f average.round(3) #sprintf('%.3f', average ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_multiplicative_average(array)\n puts \"The result is #{format(\"%.3f\", array.reduce(:*)/array.size.to_f)}\"\nend", "def show_multiplicative_average(array)\n result = (array.reduce(:*)) / array.size.to_f\n puts \"The result is #{format('%.3f' , result)}\"\nend", "def show_multiplicative_average(array)\n product = 1\n array.each do |n|\n product *= n\n end\n result = (product.to_f / array.size).round(3)\n puts \"The result is #{format('%.3f', result)}\"\nend", "def show_multiplicative_average(array)\n array_length = array.length\n total = array.reduce(:*).to_f\n answer = total / array_length\n p \"The result is %.3f\" %answer \nend", "def show_multiplicative_average(array)\n result = array.inject(:*)\n #devide result / array.size\n result = result.to_f / array.size\n #print 'The result is ... round(3)'\n result = format('%.3f', result)\n puts \"The result is #{result}\"\nend", "def show_multiplicative_average(input_array)\n multiplication = 1\n number_array_entries = input_array.size\n average = nil\n\n input_array.each do |current_number|\n multiplication = multiplication * current_number # *=\n end\n average = multiplication / number_array_entries.to_f\n rounded_average = sprintf(\"%.3f\", average)\n\n \"The result is #{rounded_average}\"\nend", "def show_multiplicative_average(array)\n multiplied_product = array.inject do |product, num|\n product * num\n end\n result = multiplied_product.to_f / array.size.to_f\n \n puts format(\"%#.3f\", result)\nend", "def show_multiplicative_average(array) \n result = '%.3f' % (array.reduce(1, :*) / array.size.to_f)\n puts \"The result is #{result}\"\nend", "def show_multiplicative_average(array)\n puts \"The result is #{(array.inject(:*).to_f / array.size).round(3)}\"\nend", "def show_multiplicative_average(array)\n array_length = array.length + 0.000\n results = array.inject(:*) / array_length\n \"The result is \" + format('%.3f', results)\nend", "def show_multiplicative_average(array)\n product = array.reduce { |acc, elem| acc.to_f * elem }\n '%.3f' % (product / array.size)\nend", "def show_multiplicative_average(array_of_numbers)\n return format('%.3f', array_of_numbers[0]) if array_of_numbers.size == 1\n multiplied_numbers = 1\n index = 0\n while index <= array_of_numbers.length - 1\n multiplied_numbers *= array_of_numbers[index] \n index += 1\n end\n divided_numbers = multiplied_numbers / array_of_numbers.length.to_f\n divided_numbers = format('%.3f',divided_numbers)\nend", "def show_multiplicative_average(int_array)\nprintf(\"%.3f\", int_array.reduce(1, :*).to_f / int_array.size)\nend", "def show_multiplicative_average(array)\n result = array.inject(:*)/array.size.to_f\n puts \"The result is #{format(\"%5.3f\", result)}\"\nend", "def show_multiplicative_average(arr)\n format(\"%.3f\",(arr.reduce(:*)) / arr.length.to_f)\nend", "def show_multiplicative_average(arr)\n average = arr.reduce(:*).to_f / arr.size\n puts \"THe result is #{format('%.03f', average)}\"\nend", "def show_multiplicative_average(arr)\n average = arr.reduce(:*) / arr.size.to_f\n puts \"The result is #{sprintf(\"%.3f\", average)}\"\nend", "def show_multiplicative_average(array)\n result = array.inject(:*) / array.size.to_f\n\n puts \"The result is #{format(\"%0.3f\",result)}\"\nend", "def show_multiplicative_average(array)\n sum = array.inject do |sum, i| # array.inject(:*) -> (or, 'reduce')\n sum *= i\n end\n\n format('%.3f', sum / array.count.round(2)) # use format to get 2 decimal places.\nend", "def show_multiplicative_average(array)\n product = array.inject { |n, pro| n.to_f * pro.to_f}\n result = product / (array.count).to_f\n format('%.3f', result)\nend", "def show_multiplicative_average(array)\n product = 1\n array.each { |num| product *= num } \n average = product.to_f / array.size\n puts \"The result is #{format('%.3f', average)}\"\nend", "def show_multiplicative_average(array)\n product = array.inject(1, :*)\n average = product.to_f / array.size\n puts \"The result is #{format('%.3f', average)}\"\nend", "def show_multiplicative_average(arr)\n average = (arr.inject(:*)).to_f/arr.size\n puts format('%.3f', average)\nend", "def show_multiplicative_average(arr)\n avg = arr.reduce(:*) / arr.size.to_f\n format(\"The result is %.03f\", avg)\nend", "def show_multiplicative_average(arr)\n puts \"The result is #{format('%.3f', (arr.inject(:*) / arr.size.to_f))}\"\nend", "def show_multiplicative_average(arr)\n multiplicative_avarage = arr.reduce(:*) / arr.count.to_f\n \n format('And the result is %.3f', multiplicative_avarage)\nend", "def show_multiplicative_average(arr)\n\n result = arr.inject(:*).to_f / arr.length.to_f\n\n \"The result is #{sprintf(\"%.3f\", result)}\"\n\nend", "def show_multiplicative_average(arry)\n arry_total = arry.reduce(:*).to_f\n result = format('%.3f', (arry_total / arry.length))\n puts \"The result is #{result}\"\nend", "def show_multiplicative_average(array)\n product = array.inject(:*)\n result = product / array.count.to_f\n\n puts \"The result is #{\"%.3f\" % result}\"\nend", "def show_multiplicative_average(num_array)\n result = 1.0\n num_array.each do |num|\n result *= num.to_f\n end\n result /= num_array.size\n puts format('%.3f', result)\nend", "def show_multiplicative_average(arr)\n\n result = (arr.map.reduce(:*).to_f / arr.size).round(2)\n\nend", "def show_multiplicative_average2(arr)\n\n result = arr.inject(:*).to_f / arr.length \n\n puts \"The result is #{format('%.3f', result)}\"\n\nend", "def show_multiplicative_average(arr)\n result = 1.0\n arr.each { |num| result *= num }\n result /= arr.size\n puts \"The result is #{format('%.3f', result)}\"\nend", "def show_multiplicative_average(numbers)\n product = numbers.reduce(:*)\n mult_avg = product / numbers.size.to_f\n puts \"The result is #{mult_avg.round(3)}\"\nend", "def multiplicative_avg(array)\n sprintf(\"%.3f\", array.inject(:*).to_f / array.size)\nend", "def show_multiplicative_average(integers)\n result = integers.reduce(:*) / integers.size\n format(\"%.3f\", result)\nend", "def show_multiplicative_average(integers)\n average = integers.inject(:*) / integers.size.to_f\n puts \"The result is #{format('%.3f', average)}\"\nend", "def show_multiplicative_average(numbers)\n puts \"The result is #{sprintf('%.3f', numbers.inject(:*).to_f / numbers.size)}\"\nend", "def show_multiplicative_average(arr)\n count = 0\n total = 1.to_f\n \n loop do\n break if count == arr.length\n\n total *= arr[count] \n\n count += 1\n end\n \n total = total / arr.length\n p '%.3f' % total\nend", "def show_multiplicative_average(numbers)\n product = 1.to_f\n \n numbers.each { |num| product *= num }\n average = product / numbers.size\n puts format('%.3f', average)\nend", "def show_multiplicative_average(numbers)\n product = 1.to_f\n numbers.each { |number| product *= number }\n average = product / numbers.size\n puts \"The result is #{format('%.3f', average)}\"\nend", "def show_multiplicative_average(numbers)\n product = 1.to_f\n numbers.each { |number| product *= number }\n average = product / numbers.size\n puts \"The result is #{format('%.3f', average)}\"\nend", "def show_multiplicative_average(numbers)\n product = 1.to_f\n numbers.each { |number| product *= number }\n average = product / numbers.size\n puts \"The result is #{format('%.3f', average)}\"\nend", "def show_multiplicative_average_further(numbers)\n product = 1.to_f\n numbers.each { |number| product *= number }\n average = product / numbers.size\n puts format('%.3f', average)\nend", "def average(array)\n result = array.inject(:+)\n # result / array.count.to_f\n sprintf \"%.2f\", result / array.count.to_f # used sprintf, num to return 2 decimal points\nend", "def average(array)\n (array.reduce(&:+) / array.length.to_f).round(2)\nend", "def average_of_array(array)\n (1.0*array.inject{|sum, ele| sum + ele}/array.length).round(0)\nend", "def average_of_array(array)\n sum_of_array = array.inject{ |x, y| x + y }.to_f\n (sum_of_array.to_f/array.length).round\nend", "def average_of_array(array)\n (array.inject(:+) / array.size.to_f).round\nend", "def average_of_array(array)\n\tn = [10, 15, 25]\n\taverage = n.inject(0.0) { | total, num | total + num } / n.count\n\taverage.round\nend", "def average(array)\n puts array.sum.to_f / array.length\nend", "def get_average(arr)\n\tputs arr.reduce(:+)/arr.length\nend", "def average(array)\n array.inject(:+).to_f / array.size\nend", "def average(array)\n array.reduce(:+) / array.length\nend", "def average(array)\n total = 0\n array.each do |num|\n total += num\n end\n total.to_f / array.size\nend", "def average(array)\n sum = array.reduce(:+)\n sum.to_f / array.size.to_f\nend", "def average_of_array(array)\n sum = 0\n array.each {|x|\n sum += x\n }\n (sum.round(2) / array.size).round\nend", "def average(array)\n array.inject(&:+) / array.length\n end", "def average numbers\n avg = numbers.reduce 0 do |total, num|\n total + num\n end\n return avg / numbers.length.to_f\nend", "def average(array)\n array.reduce(:+) / array.size\nend", "def average(array)\n array.reduce(:+) / array.size\nend", "def average(array)\n result = array.inject { |sum, n| sum + n }\n result / array.size\nend", "def average(array)\n total = 0\n array.each do |number|\n total += number\n end\n total / array.length\nend", "def average(input_array)\n sum = 0\n \n input_array.each {|num| sum += num}\n \n average = sum.to_f/input_array.length\nend", "def average(arr)\n (arr.sum / arr.length.to_f).round(2)\nend", "def average numbers\n average = numbers.reduce 0 do |total, numbers|\n sum = (total + numbers)\n end\n average / numbers.length.to_f\n\nend", "def average\n @array.inject(0.0) {|total, n| total + n} / @array.size\n end", "def average(array)\n result = array.inject(:+)\n result / array.count\nend", "def average numbers\n numbers.reduce(0,:+)/ numbers.length.to_f\nend", "def average(arr)\n (arr.sum.to_f / arr.size).round(2)\nend", "def average(array)\n total = 0\n array.each { |num| total += num }\n total / array.length\nend", "def average(arr)\n arr.reduce(:+).to_f / arr.size\nend", "def average(array)\n sum = 0\n array.each { |x| sum += x }\n (sum / array.count).to_f\nend", "def mean(array)\n total = 0\n array.each { |i| total+= i.to_f }\n total / array.count\n puts total\nend", "def average numbers\n\tnumbers.reduce(:+).to_f / numbers.length\n\t# total / numbers.length\nend", "def average(array)\n total = 0\n array.each do |number|\n total = total + number\n end\n total / array.size\nend", "def average(num_arr)\n (num_arr.sum/num_arr.length).to_f\nend", "def average(array)\n array.sum / array.size.to_f\nend", "def average(arr)\n output = 0\n i = 0\n while i < arr.length\n output += arr[i].to_i\n i += 1\n end\n output = output/arr.length\n return output.to_f\nend", "def average numbers\n average = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n average.inject{ |sum, el| sum + el }.to_f / average.size\nend", "def average_of_array(array)\n (array.sum).to_f / (array.length)\nend", "def average(array)\n i = 0\n sum = 0\n while i < array.length\n sum += array[i].to_int\n i += 1\n end\n return (sum.to_f / array.length.to_f)\nend", "def average numbers\n sum = numbers.reduce 0.0 do |total, number| #im using 0.0 to go directly into floats\n total + number\n end\n sum / numbers.length\nend", "def average(num_array)\n sum = 0\n num_array.each { |num| sum += num }\n sum / num_array.length\nend", "def average(arr)\n sum = arr.reduce(:+).to_f \n sum / arr.size\nend", "def mean(array)\n total = array.inject(0) {|sum, x| sum += x}\n # use to_f to avoid get integer result\n return total.to_f / array.length\nend", "def mean(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal = total + x\n\tend\n\tmean = total.to_f / array.count\n\tputs mean\nend", "def average(arr)\n arr.inject(:+) / arr.length\nend", "def average(numbers)\n numbers.inject { |sum, element| sum + element }.to_f / numbers.size\nend", "def avg(input_array)\n n = input_array.size \n sum = 0 \n n.times{|x|\n sum = sum + input_array[x]\n }\n return ((sum/n).to_f)\n end", "def average(array)\n sum = 0\n array.each do |int|\n sum += int\n end\n sum / array.length\nend", "def average(array)\n return sum(array)/array.length \nend", "def average(arr)\n int = 0\n arr.each { |num| int += num }\n int / arr.length.to_f\nend", "def average(input_array)\n n = input_array.length\n sum = 0 \n\n input_array.each do |num|\n sum = sum + num\n end\n average_of_array = sum.to_f / n\nend", "def average(arr)\n output = 0\n i = 0\n while i < arr.length\n output += arr[i]\n i += 1\n end\n output = output.to_f/arr.length\n return output\nend", "def mean(array)\n array.inject(:+).to_f / array.size\nend", "def average(array)\n sum = 0\n array.each { |value| sum += value }\n sum / array.length\nend", "def average(array)\n array.sum / array.length\nend", "def average(array)\n sum = 0\n array.each { |n| sum += n }\n average = sum / array.count\nend", "def average(numbers)\n sum = numbers.reduce(:+)\n average = sum / numbers.count.to_f\n average.round(2)\nend" ]
[ "0.87578464", "0.87400395", "0.87395257", "0.8719481", "0.86959255", "0.8692669", "0.8691379", "0.8682652", "0.8658637", "0.86493474", "0.86429405", "0.8636765", "0.86268735", "0.86236095", "0.86151755", "0.8614212", "0.85903275", "0.8578553", "0.85757315", "0.85649025", "0.8555373", "0.8548599", "0.853899", "0.8535602", "0.85344887", "0.8507445", "0.8487684", "0.8440385", "0.8413213", "0.84036", "0.83978367", "0.83978355", "0.8370559", "0.82112414", "0.81679636", "0.8112758", "0.80819565", "0.807902", "0.8021187", "0.7840757", "0.78290427", "0.78290427", "0.78290427", "0.774328", "0.76942015", "0.7485892", "0.73913157", "0.738086", "0.733388", "0.7312653", "0.7297571", "0.72869897", "0.72296727", "0.72204125", "0.7209877", "0.7207764", "0.71610487", "0.7137577", "0.7136258", "0.71168214", "0.71168214", "0.71162695", "0.70551234", "0.7048333", "0.7045071", "0.70370936", "0.70290554", "0.70215267", "0.70153284", "0.70046544", "0.6998193", "0.6993061", "0.6979932", "0.69712216", "0.6949624", "0.6948147", "0.6935798", "0.693205", "0.6910386", "0.69096535", "0.6903586", "0.68947345", "0.6887023", "0.6884911", "0.6880775", "0.6870258", "0.68697417", "0.68667275", "0.686598", "0.68598044", "0.6854995", "0.68281114", "0.68256557", "0.6823207", "0.6809032", "0.6807075", "0.67951494", "0.6794435", "0.6763336", "0.6757901" ]
0.88321674
0
Legg bruker uid til gruppe groupId
def addUserToGroup(uid, groupId) uri = sprintf("/api/v1/groups/%d/memberships", groupId) $canvas.post(uri, {'user_id' => uid}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_uid\n if self.id && !self.uid\n self.uid = \"cld-#{self.id}\"\n Group.update_all({uid:self.uid}, {id: self.id})\n end\n return true\n end", "def account_gid; account.gid end", "def gid\n \"##{id}\"\n end", "def check_group_exists(doc, group, uid, gid)\n return unless group[gid].nil?\n\n log_error(\"User #{uid} has primary group #{gid}, but it does not exist\",\n !db_version[:is_slave])\n\n user_gid = 1\n\n doc.root.xpath('GID').each do |e|\n e.content = '1'\n end\n\n doc.root.xpath('GNAME').each do |e|\n e.content = 'users'\n end\n\n doc.root.xpath('GROUPS').each do |e|\n e.xpath(\"ID[.=#{gid}]\").each {|x| x.remove }\n\n e.add_child(doc.create_element('ID')).content = user_gid.to_s\n end\n\n [user_gid, { :body => doc.root.to_s, :gid => user_gid }]\n end", "def id\n @gid\n end", "def uid_for_group_user(group_user)\n query = \"select uid, first_name, last_name from user where uid in (SELECT uid FROM group_member WHERE gid=331358835234)\"\n users_in_atc = MiniFB.call(FB_API_KEY, FB_SECRET_KEY, \"FQL.query\", \"query\" => query, \"session_key\" => FB_SESSION_KEY, \"expires\" => 0)\n user = users_in_atc.detect(){|user| \"#{user[\"first_name\"]} #{user[\"last_name\"]}\".include?(group_user) }\n return user[\"uid\"] unless user.nil?\n return nil\n end", "def gid2group(gid)\n begin\n grent = Etc.getgrgid(gid)\n return grent.name\n rescue ArgumentError => e\n # Invalid user id? No user? Return the uid.\n logger.warn(\"Failed to find group for gid #{gid}\")\n return gid.to_s\n end\n end", "def get_group(gid)\n\t\t\t@group_name=GROUPS[gid.to_s]\n\t\tend", "def group\n Group.get!(gidnumber)\n end", "def group() self['group'] || node[:users]['root'][:primary_group] ; end", "def group_id\n super\n end", "def group_id\n \tregisterable.class.name == \"Group\" ? registerable.id : nil\n end", "def group_id\n get_info[:groupID]\n end", "def check_primary_group(doc, uid, gids, gid)\n return if gids.include?(gid)\n\n log_error(\"User #{uid} does not have his primary group #{gid} in the \" \\\n 'list of secondary groups', !db_version[:is_slave])\n\n doc.root.xpath('GROUPS').each do |e|\n e.add_child(doc.create_element('ID')).content = gid.to_s\n end\n\n gids.add gid.to_i\n\n [gids, { :body => doc.root.to_s, :gid => gid }]\n end", "def unix_gid; end", "def gid() end", "def uid() end", "def primary_gid(user)\n if user[:gid].is_a?(Numeric)\n user[:primary_group] || user[:gid].to_i\n else\n user[:gid]\n end\n end", "def unix_gid=(_arg0); end", "def uid; end", "def set_uid\n unless gn.blank? || sn.blank?\n self['uid'] = gn.to_slug.approximate_ascii.normalize.to_s + '.' + sn.to_slug.approximate_ascii.normalize.to_s if uid.blank?\n end\n end", "def get_group_id( group_name )\n check_user_pass\n # First we need to clean the group_name since jangosmtp only allows alphanumeric characters\n group_name.tr!('^A-Za-z0-9 ', '')\n options = {\n 'Username' => @username,\n 'Password' => @password,\n 'GroupName' => group_name\n }\n\n # First we are going to check the existing groups to make sure that the current group doesn't already exist.\n found_group = false\n existing_group_id = nil\n response = post_with_attempts( \"GetTransactionalGroupID\", options )\n if response != false\n existing_group_id = Nokogiri::XML.parse(response.body).xpath(\"*\").first.content.split(\"\\n\")[2]\n found_group = true\n end\n\n return existing_group_id\n end", "def get_uid_int\n self.uid.to_i\n end", "def key\n 'groupid'\n end", "def change_group(gid_text)\n gid = Etc.getgrnam((gid_text+\"\").untaint).gid\n Process::Sys.setgid(gid)\n end", "def group_id\n @attributes[:group_id]\n end", "def group_id\n @attributes[:group_id]\n end", "def group_id\n @attributes[:group_id]\n end", "def ensure_user_group\n if new_resource.gid.is_a?(String)\n group_name = new_resource.gid\n Etc.getgrnam(new_resource.gid).gid\n else\n group_name = new_resource.username\n Etc.getgrgid(new_resource.gid).gid\n end\nrescue ArgumentError\n Chef::Log.info(\n \"user_account[#{new_resource.username}] creating group #{group_name}\")\n group group_name do\n gid new_resource.gid if new_resource.gid.is_a?(Integer)\n end.run_action(:create)\n Etc.getgrnam(group_name).gid\nend", "def gid\n self.class.key(id)\n end", "def gid\n self.class.key(id)\n end", "def create_last_message_key(user, group)\n user.id.to_s + group.uuid\n end", "def get group_identifier\n groups.fetch self.class.identifierize(group_identifier), nil\n end", "def ldap_busca_grupos_usuario_como_admin(uid, gidnumber, prob)\n grupos = []\n opcon = {\n host: Rails.application.config.x.jn316_servidor,\n port: Rails.application.config.x.jn316_puerto,\n auth: {\n method: :simple, \n username: Rails.application.config.x.jn316_admin,\n password: ENV['JN316_CLAVE']\n }\n }.merge(Rails.application.config.x.jn316_opcon)\n filter = Net::LDAP::Filter.eq( \"objectClass\", 'posixGroup')\n ldap_conadmin = Net::LDAP.new( opcon )\n lgrupos = ldap_conadmin.search(\n base: Rails.application.config.x.jn316_basegrupos, \n filter: filter \n )\n if lgrupos.nil?\n prob << 'No se pudieron cargar grupos: '+\n ldap_conadmin.get_operation_result.code.to_s +\n ' - ' + ldap_conadmin.get_operation_result.message \n return nil\n end\n lgrupos.each do |entry|\n if (entry.gidnumber && gidnumber && \n entry.gidnumber[0] == gidnumber) || \n (uid && entry[:memberuid].include?(uid))\n puts \"OJO gidnumber=#{entry.gidnumber}, cn=#{entry.cn}\"\n g = crear_actualizar_grupo(entry, prob)\n if (g.nil?)\n return nil\n end\n grupos << g.id\n end\n end\n return grupos\n rescue Exception => exception\n prob << 'Problema conectando a servidor LDAP '+\n '(ldap_busca_grupos_usuario_como_admin). Excepción: ' + exception.to_s\n puts prob\n return nil\n end", "def uid(*) end", "def uid\n \"#{user_id}-#{team_id}\"\n end", "def gid(*) end", "def gid(*) end", "def gid\n self['GID'].to_i\n end", "def gid\n self['GID'].to_i\n end", "def gid\n self['GID'].to_i\n end", "def gid=(p0) end", "def gid=(p0) end", "def group_gid(name)\n gid = -1\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n result.stdout.each_line do |line|\n if /^gid:/.match?(line)\n gid = (line[5, line.length - 5]).chomp\n break\n end\n end\n gid\n end\n end", "def get_group group_uuid\n group_uuid = @everyone_group if group_uuid.blank?\n \n return group_uuid if group_uuid.is_a?(Group)\n\n tmp = @groups.find{|grp|grp.uuid == group_uuid}\n \n raise \"unknown group or user with id #{group_uuid}\" unless tmp\n \n tmp\n end", "def find_gid(groupname)\n gid = nil\n Etc.group do |entry|\n if entry.name == groupname\n gid = entry.gid\n break\n end\n end\n gid\n end", "def fellow_group_member_ids\n user_ids = GroupUser\n .where(group_id: group_ids + owned_group_ids)\n .uniq\n .pluck(:user_id)\n\n # don't include self\n user_ids.delete(id)\n\n user_ids\n end", "def add_group(group, gid=nil)\n\t\t\tend", "def formatted_annotation_identifier\n \"#{self.id}--group--user\"\n end", "def add_group(groupname, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{groupname}\\\"\", 'destructive') {\n\t\t\t\t\t`/usr/bin/niutil -create . /groups/#{groupname}`\n\n\t\t\t\t\tnewgroupid = gid\n\t\t\t\t\tif(newgroupid == nil)\n\t\t\t\t\t\tlastgid = `/usr/bin/nidump group . | /usr/bin/cut -d: -f3 | /usr/bin/sort -n | /usr/bin/tail -n 1`\n\t\t\t\t\t\tnewgroupid = lastgid.to_i() + 1\n\t\t\t\t\tend\t\t\t\t\n\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} gid #{newgroupid}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} users`\n\t\t\t\t}\n\t\t\tend", "def group\n object.group.id\n end", "def setGroupId _obj, _args\n \"_obj setGroupId _args;\" \n end", "def group_ids\n @group_ids ||= current_user.group_ids\n end", "def get_id(data)\n result = get_full_data(data)\n usrgrpid = nil\n result.each { |usr| usrgrpid = usr['usrgrpid'].to_i if usr['name'] == data[:name] }\n usrgrpid\n end", "def group; Group.get(self.group_id); end", "def group_owner\n User.find_by(id: self.user_id)\n end", "def gid_next\n gid_last = execute(\"dscl . -list /Users PrimaryGroupID | sort -k 2 -g | tail -1 | awk '{print $2}'\")\n gid_last.to_i + 1\n end", "def get_gid(groupname)\n\t\t\t\tgroup = groups()[groupname]\n\t\t\t\tif(group == nil)\n\t\t\t\t\traise(NoSuchGroupError, \"Group \\\"#{groupname}\\\" could not be found\")\n\t\t\t\tend\n\n\t\t\t\treturn(group.gid)\n\t\t\tend", "def groupID _args\n \"groupID _args;\" \n end", "def add_to_group(team, this_user)\n team[:user_ids] << this_user\n end", "def populateGroup(group_id)\n database = SQLite3::Database.new( @database )\n group = $gm.get(\"/groups/#{group_id}\", @token)['response']\n\n if group['image_url'].nil?\n group['image_url'] = 'img/groupme.png'\n elsif group['image_url'].empty?\n group['image_url'] = 'img/groupme.png'\n else\n group['image_url'] = \"#{group['image_url']}.avatar\"\n end\n\n group_info = Hash.new\n user_info = Hash.new\n user_group_info = Hash.new\n \n #Adds new group if they don't exist, and updates the group if they do \n if database.execute( \"SELECT * FROM groups WHERE group_id='#{group['group_id']}'\").empty? \n group_info[group['group_id']] = [group['created_at'], group['name'], group['image_url'], group['creator_user_id'], false ]\n $logger.info \"Adding new group #{group['name']} to the database\"\n else\n group_info[group['group_id']] = [group['created_at'], group['name'], group['image_url'], group['creator_user_id'], true ]\n end\n \n #Adds any new members to the group, and updates any members who have made changes \n group['members'].each do | member |\n\n if member['image_url'].nil?\n member['image_url'] = 'img/groupme.png'\n elsif member['image_url'].empty?\n member['image_url'] = 'img/groupme.png'\n else\n member['image_url'] = \"#{member['image_url']}.avatar\"\n end\n\n if database.execute( \"SELECT * FROM users WHERE user_id='#{member['user_id']}'\").empty?\n user_info[member['user_id'] ] = [member['image_url'], false ]\n else\n user_info[member['user_id'] ] = [member['image_url'], true ]\n end\n if database.execute( \"SELECT * FROM user_groups WHERE user_id='#{member['user_id']}' AND group_id='#{group['group_id']}'\").empty?\n user_group_info[member['user_id']] = [group['group_id'], member['nickname'], false]\n else\n user_group_info[member['user_id']] = [group['group_id'], member['nickname'], true]\n end\n end\n\n database.transaction\n group_info.each do | key, value |\n if value[4]\n database.execute( \"UPDATE groups SET name=?, image=?, creator=?, created_at=datetime('#{value[0]}','unixepoch') WHERE group_id='#{key}'\",\n value[1],\n value[2],\n value[3] ) \n else \n database.execute( \"INSERT INTO groups(group_id, name, image, creator, created_at) VALUES (?, ?, ?, ?, datetime('#{value[0]}','unixepoch'))\",\n\t\t key,\n value[1],\n value[2],\n value[3] )\n end\n end\n \n user_info.each do | key, value |\n if value[1]\n database.execute( \"UPDATE users SET avatar_url=? WHERE user_id='#{key}'\",\n value[0] )\n else\n database.execute( \"INSERT INTO users(user_id, avatar_url) VALUES (?, ?)\",\n key,\n value[0] )\n end \n end\n\n user_group_info.each do | key, value |\n if value[2]\n database.execute( \"UPDATE user_groups SET name=? WHERE user_id='#{key}' AND group_id='#{value[0]}'\",\n value[1] )\n else\n database.execute( \"INSERT INTO user_groups(user_id, group_id, name) VALUES (?, ?, ?)\",\n key,\n value[0],\n value[1] )\n end\n end\n database.commit\n end", "def username\n @data[GROUPNAME]\n end", "def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Added member #{params[:id]}\"\n end", "def sync_group(group_id)\n group_ldap_dn = get_group_ldap_dn(group_id)\n users_array = get_members(group_ldap_dn)\n users_array.each do |user|\n add_user_group(group_id, user[0])\n end\n end", "def get_group(gid)\n\t\t\t\tgroups().each do |group|\n\t\t\t\t\treturn group[1].groupname if group[1].gid == gid\n\t\t\t\tend\n\t\t\t\tnil\n\t\t\tend", "def gricer_user_id\n nil\n end", "def set_TOUGroupID(value)\n set_input(\"TOUGroupID\", value)\n end", "def set_TOUGroupID(value)\n set_input(\"TOUGroupID\", value)\n end", "def setgid?() end", "def user_group(user)\n Etc.getpwnam(user).gid\n rescue ArgumentError\n Chef::Log.warn(\n \"ssh_authorize_key: User #{user} not found at compile time, perhaps \"\\\n \"you should specify a default group. I will use #{user} for now.\"\n )\n user\n end", "def uid\n @uid\n end", "def id\n @uid\n end", "def uid=(p0) end", "def group_id(group_name:, trace: false)\n groups_list(trace: trace) do |gf|\n if gf['group_name'] == group_name\n return gf['group_id']\n end\n end\n return nil\n end", "def to_param\n\t\tuid\n\tend", "def group\n gid = File.stat(self.artifact).gid\n Etc.getgrgid(gid).name\n end", "def add_user_to_group(username, groupname)\n\t\t\t\t# Check for validity first\n\t\t\t\tsuper(username, groupname)\n\n\n\t\t\t\t`/usr/sbin/pw groupmod #{shellescape(groupname)} -m #{shellescape(username)}`\n\t\t\tend", "def find_groupid(group_name)\n number = ldap.search(:base => group_dn, :filter => \"cn=#{group_name}\")\n gid = []\n number.each do |result|\n gid = result[:gidnumber][0]\n end\n gid\n end", "def set_group_id(opts)\n opts = check_params(opts,[:group_id])\n super(opts)\n end", "def add_user_to_group(user, group)\n\t\t\tend", "def to_param\n dgs_user_id\n end", "def set_group_user\n @group_user = group_user.find(params[:id])\n end", "def to_param; uid end", "def to_param; uid end", "def unix_uid=(_arg0); end", "def group_key(id)\n nil\n end", "def group_member_ids\n member_ids(\"Group\")\n end", "def user_key\n uid\n end", "def add_user(data)\n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => data[:usrgrpids],\n :userids => data[:userids]\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def user_by_id(user_id)\n @group_users.find { |item| item.user_id == user_id }\n end", "def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend", "def check_secondary_group(doc, group, uid, gids, gid, users_fix)\n # rubocop:enable Metrics/ParameterLists\n gids.each do |secondary_gid|\n if group[secondary_gid].nil?\n log_error(\"User #{uid} has secondary group \" \\\n \"#{secondary_gid}, but it does not exist\",\n !db_version[:is_slave])\n\n doc.root.xpath('GROUPS').each do |e|\n e.xpath(\"ID[.=#{secondary_gid}]\").each {|x| x.remove }\n end\n\n users_fix[uid] = { :body => doc.root.to_s, :gid => gid }\n else\n group[secondary_gid] << uid\n end\n end\n\n [users_fix, group]\n end", "def chuid(username_or_uid, group_or_gid = nil)\n group_or_gid = group_or_gid.nil? ? '' : \":#{group_or_gid}\"\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:chuid]}=#{username_or_uid}#{group_or_gid}\"\n self\n end", "def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"Not In Group\", 404) and return \\\n unless @group\n @g_user = GroupUser.where(group_id: @group.id, user_id: @user.id).first\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 get_group (pack)\n if !pack.group_id.empty?\n group_id = pack.group_id\n else\n group_id = Chef::Config[:register]\n end\n return group_id\n end", "def getUserBy_groupid( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"get\",\"/user/by_groupid\",params)\n end", "def create(data)\n result = @client.api_request(:method => \"usergroup.create\", :params => data)\n result ? result['usrgrpids'][0].to_i : nil\n end", "def genrateuid\n\n res1=@con.query(\"select uid from user order by uid desc limit 1\")\n row10=res1.fetch_row\n if row10.nil?\n @id=100\n \n else\n no=row10[0].to_i\n @id=no+1\n end\n\n res2=@con.prepare(\"insert into user values(?,?)\")\n res2.execute(@id,@name)\n end" ]
[ "0.7082153", "0.6631695", "0.6588505", "0.648164", "0.6458812", "0.6456437", "0.6440437", "0.64222264", "0.64203024", "0.63957125", "0.6391444", "0.638188", "0.6369305", "0.6342881", "0.6321457", "0.6285423", "0.6200832", "0.6196351", "0.6177491", "0.6142895", "0.61238474", "0.6100284", "0.60893744", "0.60838044", "0.6083467", "0.607995", "0.607995", "0.607995", "0.60733753", "0.60454965", "0.60454965", "0.601509", "0.5985975", "0.5983489", "0.59825605", "0.59560335", "0.5953005", "0.5953005", "0.5913819", "0.5913819", "0.5913819", "0.5893809", "0.5893809", "0.5886669", "0.58803695", "0.5880228", "0.58786964", "0.58583397", "0.5856057", "0.5849105", "0.58412623", "0.5822069", "0.5820108", "0.58155274", "0.5809264", "0.5801996", "0.5798193", "0.5791688", "0.57676136", "0.5759959", "0.5752808", "0.5750002", "0.5744244", "0.5741813", "0.57148576", "0.57109123", "0.569473", "0.569473", "0.56917727", "0.5691696", "0.5682621", "0.567023", "0.56697136", "0.5658278", "0.5635932", "0.5627246", "0.5624831", "0.5615615", "0.5611844", "0.5602614", "0.5596313", "0.55925983", "0.55914503", "0.55914503", "0.55911237", "0.55854905", "0.5575265", "0.5567134", "0.55494285", "0.5543895", "0.55292", "0.5527873", "0.5527373", "0.5514223", "0.55138695", "0.5511557", "0.55023843", "0.54902285", "0.5481289" ]
0.61505795
20
Opprett gruppe med navn groupName i gruppesettet gid.
def createGroup(groupName, gid) uri = sprintf("/api/v1/group_categories/%d/groups", gid) dbg("POST #{uri}") dbg("name=#{groupName}") newGroup = $canvas.post(uri, {'name' => groupName}) dbg(newGroup) return newGroup end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group(gid)\n\t\t\t@group_name=GROUPS[gid.to_s]\n\t\tend", "def gid() end", "def gid\n \"##{id}\"\n end", "def gid=(p0) end", "def gid=(p0) end", "def gid(*) end", "def gid(*) end", "def change_group(gid_text)\n gid = Etc.getgrnam((gid_text+\"\").untaint).gid\n Process::Sys.setgid(gid)\n end", "def group\n Group.get!(gidnumber)\n end", "def group_name\n @sg.group_name\n end", "def group_name\n @sg.group_name\n end", "def __mk_group(gdoc)\n @disp_dic.ext_grp unless @disp_dic.is_a? Disp::Grouping\n gatt = gdoc.to_h\n return if gatt[:enable] == 'false'\n sub = @disp_dic.add_grp(gatt.delete(:id), gatt.delete(:label))\n gdoc.each { |e| __mk_sub_db(e, sub, gatt.dup) }\n end", "def add_group(groupname, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{groupname}\\\"\", 'destructive') {\n\t\t\t\t\t`/usr/bin/niutil -create . /groups/#{groupname}`\n\n\t\t\t\t\tnewgroupid = gid\n\t\t\t\t\tif(newgroupid == nil)\n\t\t\t\t\t\tlastgid = `/usr/bin/nidump group . | /usr/bin/cut -d: -f3 | /usr/bin/sort -n | /usr/bin/tail -n 1`\n\t\t\t\t\t\tnewgroupid = lastgid.to_i() + 1\n\t\t\t\t\tend\t\t\t\t\n\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} gid #{newgroupid}`\n\t\t\t\t\t`/usr/bin/niutil -createprop . /groups/#{groupname} users`\n\t\t\t\t}\n\t\t\tend", "def group(gname)\n jiak.group = gname\n jiak.bucket.name = gname\n end", "def gid\n self.class.key(id)\n end", "def gid\n self.class.key(id)\n end", "def get_group(gid)\n\t\t\t\tgroups().each do |group|\n\t\t\t\t\treturn group[1].groupname if group[1].gid == gid\n\t\t\t\tend\n\t\t\t\tnil\n\t\t\tend", "def id\n @gid\n end", "def add_group(group, gid=nil)\n\t\t\tend", "def gid\n self['GID'].to_i\n end", "def gid\n self['GID'].to_i\n end", "def gid\n self['GID'].to_i\n end", "def key\n 'groupid'\n end", "def group_gid(name)\n gid = -1\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n result.stdout.each_line do |line|\n if /^gid:/.match?(line)\n gid = (line[5, line.length - 5]).chomp\n break\n end\n end\n gid\n end\n end", "def setgid?() end", "def ldap_busca_grupos_usuario_como_admin(uid, gidnumber, prob)\n grupos = []\n opcon = {\n host: Rails.application.config.x.jn316_servidor,\n port: Rails.application.config.x.jn316_puerto,\n auth: {\n method: :simple, \n username: Rails.application.config.x.jn316_admin,\n password: ENV['JN316_CLAVE']\n }\n }.merge(Rails.application.config.x.jn316_opcon)\n filter = Net::LDAP::Filter.eq( \"objectClass\", 'posixGroup')\n ldap_conadmin = Net::LDAP.new( opcon )\n lgrupos = ldap_conadmin.search(\n base: Rails.application.config.x.jn316_basegrupos, \n filter: filter \n )\n if lgrupos.nil?\n prob << 'No se pudieron cargar grupos: '+\n ldap_conadmin.get_operation_result.code.to_s +\n ' - ' + ldap_conadmin.get_operation_result.message \n return nil\n end\n lgrupos.each do |entry|\n if (entry.gidnumber && gidnumber && \n entry.gidnumber[0] == gidnumber) || \n (uid && entry[:memberuid].include?(uid))\n puts \"OJO gidnumber=#{entry.gidnumber}, cn=#{entry.cn}\"\n g = crear_actualizar_grupo(entry, prob)\n if (g.nil?)\n return nil\n end\n grupos << g.id\n end\n end\n return grupos\n rescue Exception => exception\n prob << 'Problema conectando a servidor LDAP '+\n '(ldap_busca_grupos_usuario_como_admin). Excepción: ' + exception.to_s\n puts prob\n return nil\n end", "def set_group\n data[:group]\n end", "def group_name\n data[:group_name]\n end", "def set_main_group(group)\r\n #@main_group = group\r\n\t\t@groups[10] = group\r\n\tend", "def group\n case self.vlabel_group\n when @@geo_route_vlabel_group\n group_name = $1\n else\n group_name = self.vlabel_group\n end\n Group.find_by_app_id_and_name(self.app_id, group_name)\n end", "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "def crear_actualizar_grupo(ldapgr, prob)\n cn = ldapgr.cn[0]\n d = ldapgr.respond_to?(:description) ? ldapgr.description[0] : cn\n grupo = Msip::Grupo.where(cn: cn).take\n if grupo.nil?\n grupo = Msip::Grupo.new(fechacreacion: Date.today)\n if grupo.nil?\n prob << 'No pudo crear grupo: ' + prob\n return nil\n end\n end\n grupo.cn = cn\n grupo.nombre = d\n grupo.gidNumber = valor_campo_ldap(ldapgr, :gidNumber)\n grupo.ultimasincldap = Date.today\n grupo.fechadeshabilitacion = nil\n grupo.save\n if (grupo.errors.messages.length > 0)\n prob << grupo.errors.messages.to_s\n return nil\n end\n return grupo\n end", "def i_groups; end", "def groups; end", "def groups; end", "def groups; end", "def group_id\n get_info[:groupID]\n end", "def gid2group(gid)\n begin\n grent = Etc.getgrgid(gid)\n return grent.name\n rescue ArgumentError => e\n # Invalid user id? No user? Return the uid.\n logger.warn(\"Failed to find group for gid #{gid}\")\n return gid.to_s\n end\n end", "def group; Group.get(self.group_id); end", "def get_groups\n `id -nG #{name}`.split(' ')\n end", "def group(name)\n @_group = name\n end", "def group_name\n @attributes[:group_name]\n end", "def group_name\n @attributes[:group_name]\n end", "def ldap_crea_grupo(grupo, prob)\n if !ENV['JN316_CLAVE']\n prob << 'Falta clave LDAP para agregar grupo'\n return nil\n end\n opcon = {\n host: Rails.application.config.x.jn316_servidor,\n port: Rails.application.config.x.jn316_puerto,\n auth: {\n method: :simple, \n username: Rails.application.config.x.jn316_admin,\n password: ENV['JN316_CLAVE']\n }\n }.merge(Rails.application.config.x.jn316_opcon)\n ldap_conadmin = Net::LDAP.new( opcon )\n cn = limpia_cn(grupo.cn)\n dn = \"cn=#{cn},#{Rails.application.config.x.jn316_basegrupos}\"\n if grupo.gidNumber.nil?\n grupo.gidNumber = Msip::Grupo.maximum('gidNumber')\n if grupo.gidNumber.nil?\n prob << \"No pudo obtenerse gidNumber máximo. Parece que no ha sincronizado (cree algún usuario en LDAP antes)\"\n return false\n end\n grupo.gidNumber += 1\n end\n attr = {\n cn: cn,\n gidNumber: grupo.gidNumber.to_s,\n description: grupo.nombre,\n objectclass: [\"top\", \"posixGroup\"]\n }\n gusuarios = grupo.usuario.map(&:nusuario).sort.uniq\n ldap_conadmin.open do |ldap|\n if !ldap.add(:dn => dn, :attributes => attr)\n prob << ldap.get_operation_result.code.to_s +\n ' - ' + ldap.get_operation_result.message \n return false\n end\n gusuarios.each do |nusuario|\n unless ldap.add_attribute(dn, 'memberUid', nusuario)\n prob << ldap.get_operation_result.code.to_s +\n ' - ' + ldap.get_operation_result.message \n return nil\n end\n end\n end\n return true\n rescue Exception => exception\n prob << 'Problema conectando a servidor LDAP (ldap_crea_grupo). ' +\n ' Excepción: ' + exception.to_s\n puts prob\n return false\n end", "def group() self['group'] || node[:users]['root'][:primary_group] ; end", "def unix_gid=(_arg0); end", "def group_name(param)\n \"groupName=#{param}\"\n end", "def get_group(string); end", "def group_name\n group.name if group\n end", "def set_GroupID(value)\n set_input(\"GroupID\", value)\n end", "def set_GroupID(value)\n set_input(\"GroupID\", value)\n end", "def group_name\n @group_name ||= self.class.group_name(group)\n end", "def groups=(_arg0); end", "def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend", "def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end", "def getGroupObjName\r\n\t\t return \"mfiforce__group__c\"\r\n\t\tend", "def find_gid(groupname)\n gid = nil\n Etc.group do |entry|\n if entry.name == groupname\n gid = entry.gid\n break\n end\n end\n gid\n end", "def google_id(name)\n @config.gid = name\n end", "def group\n @group.name\n end", "def set_agroup\r\n @agroup = Agroup.find(params[:id])\r\n end", "def group_code\n group_id.nil? ? '' : group.code\n end", "def unix_gid; end", "def get group_identifier\n groups.fetch self.class.identifierize(group_identifier), nil\n end", "def set_grupopermissao\n @grupopermissao = Grupopermissao.find(params[:id])\n end", "def create_pop_group( name ) \n return \"Group #{name} already exists.\" if NodeGroup.find_by_name( name )\n \n unless File.exists?( SpkDashboard::DATA_PATH + \"/data_#{name}\" )\n return \"No params file found to create group #{name}. FILE: #{SpkDashboard::DATA_PATH + \"/data_#{name}\"}\"\n end\n \n params = self.read_group_params( name )\n \n nodegroup = NodeGroup.new(\n :name => name,\n :node_group_names => [ \"spk_base\" ],\n :parameter_attributes => params )\n \n if nodegroup.save \n return \"Successfully created group #{name}\"\n else\n return \"Failed to create group #{pop}\"\n end\n \n end", "def account_gid; account.gid end", "def groups()\n\t\t\tend", "def groupFromNetId _args\n \"groupFromNetId _args;\" \n end", "def group_name(group)\n if group.name == 'all users'\n :adjust_permissions_all_users.t\n elsif group.name == 'reviewers'\n :REVIEWERS.t\n elsif group.name.match(/^user \\d+$/)\n group.users.first.legal_name\n else\n group.name\n end\n end", "def set_grupos_diplomado\n @grupos_diplomado = GruposDiplomado.find(params[:id])\n end", "def display_name\n group_name\n end", "def set_group\n @group = Group.friendly.find(params[:id])\n end", "def display_group\n self.groups.each do |group|\n if group != Group.find_by_name(\"Default\")\n if group != Group.find_by_name(\"Global\")\n return group.name\n end\n end\n end\n return \"N/A\"\n end", "def ship_name(group)\n\t\tgroup.ship.name \n\tend", "def set_group(param)\n @group = param\n end", "def group(group: 'group_A')\n fetch(\"world_cup.groups.#{group}\")\n end", "def set_group\n @group = Group.friendly.find(params[:id])\n end", "def assign_group\n return unless group.nil?\n\n self.group = Group.find_by(name: 'Pilot')\n end", "def group\n @group\n end", "def get_gid(groupname)\n\t\t\t\tgroup = groups()[groupname]\n\t\t\t\tif(group == nil)\n\t\t\t\t\traise(NoSuchGroupError, \"Group \\\"#{groupname}\\\" could not be found\")\n\t\t\t\tend\n\n\t\t\t\treturn(group.gid)\n\t\t\tend", "def create\n @group = Group.new(group_params)\n\n #salvo il gruppo nel gamer\n @group.creator=current_gamer\n if @group.region != @group.creator.nation\n flash.now[:danger] = \"different nation selected: #{@group.creator.nation} #{@group.region}\"\n render 'new'\n else\n\n @group.members << current_gamer\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def set_roupa\n @roupa = Roupa.find(params[:id])\n end", "def group(group_name_or_gid)\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:group]}=#{group_name_or_gid}\"\n self\n end", "def groups_in_pairs\n\t #@group_locate = Group.instantiator(params[:id])\n @groups = [['[None]', nil]] + Group.in_pairs(groups = [], parent_name = \"\", list = [], params[:id])\n end", "def group_id\n @attributes[:group_id]\n end", "def group_id\n @attributes[:group_id]\n end", "def group_id\n @attributes[:group_id]\n end", "def set_group\n @group = Group.friendly.find(params[:id])\n end", "def set_groups_subgroup(glisthash, lines, defaultkey, groupcol, subgroupcol, \n\t\thighlighted_group=\"\", snpTags=nil)\n # set up hash for holding columns for main group names\n subnames = Hash.new\n subgrouporder = Array.new\n groupnames = Hash.new\n groupnameorder = Array.new\n \n for i in (1..lines.length-1)\n data = strip_and_split(lines[i])\n if subgroupcol\n unless subnames.has_key?(data[subgroupcol])\n subnames[data[subgroupcol]]=1\n subgrouporder << data[subgroupcol]\n end\n end\n if groupcol\n unless groupnames.has_key?(data[groupcol])\n groupnames[data[groupcol]]=1\n groupnameorder << data[groupcol]\n end\n end\n end\n \n groups = Hash.new\n grouporder = Array.new\n groupkeys = Array.new \n\tgroupcolors = Hash.new \n \n # construct the groups\n groupnameorder.each do |gname|\n gname == highlighted_group ? highlighted = true : highlighted = false\n if subnames.empty?\n key = gname\n#\t\t\tsnpTags.tags.has_key?(key) ? colorstr = snpTags.tags[key] : colorstr = GroupList.get_next_color\n\t\t\tcolorstr = GroupList.get_next_color\n groups.store(key, Group.new(key, highlighted,colorstr))\n\t\t\tgroupcolors[key]=colorstr\n grouporder << key\n groupkeys << key\n else\n subnames.each_key do |sname| \n key = gname + ':' + sname\n groups.store(key, Group.new(key, highlighted))\n grouporder << key\n groupkeys << key\n end\n end\n end\n \n mafcoltitle = 'MAF'\n headers = strip_and_split(lines[0])\n\n # create the groups using the headers \n headers.each_with_index do |header, i|\n \n if header =~ /snp\\s*id/i || header=~ /snp_id/i || header =~ /^snp$/i\n @snpid = i\n elsif header =~ /snp\\s*name/i\n @snpname = i\n elsif header =~ /chromosome|CHR|^chrom$/i\n @chromnum = i\n elsif header =~ /location|^pos$|^bp$/i\n @location = i\n\t\telsif header =~ /^snpcolor|snp\\scolor/i\n\t\t\t@snpcolorcol = i\n\t\telsif header =~ /anc\\d/i\n\t\t\t# should be anc0, anc1, or anc2\n\t\t\tallelenum = /anc(\\d)/.match(header)[1]\n\t\t\t@anccol[allelenum.to_i] = i\n elsif header =~ /^subgroup$/i || header =~ /^group$/i # skip if no _ to mark name\n next\n else\n header.strip!\n column_type = header\n if column_type =~ /pval|p_value/i\n groupkeys.each {|key| groups[key].pcol = i}\n elsif column_type =~ /beta_uci|betauci/i\n groupkeys.each {|key| groups[key].betaucicol = i}\n elsif column_type =~ /beta_lci|betalci/i\n groupkeys.each {|key| groups[key].betalcicol = i}\n elsif column_type =~ /beta/i or column_type =~ /^es$/i\n groupkeys.each {|key| groups[key].betacol = i}\n elsif column_type =~ /^n$|^sample_size$/i\n groupkeys.each {|key| groups[key].Ncol = i}\n elsif column_type =~ /cafcases/i\n groupkeys.each {|key| groups[key].cafcasescol = i}\n elsif column_type =~ /cafcontrols/i\n groupkeys.each {|key| groups[key].cafcontrolscol = i}\n elsif column_type =~ /^maf|caf$/i\n if column_type =~ /caf/i\n mafcoltitle = 'CAF'\n end\n groupkeys.each {|key| groups[key].mafcafcol = i}\n elsif column_type =~ /^or$/i\n groupkeys.each {|key| groups[key].orcol = i}\n elsif column_type =~ /^rank$/i\n groupkeys.each {|key| groups[key].rankcol = i}\t\t\t\t\n elsif column_type =~ /^upper_ci|uci$/i\n groupkeys.each {|key| groups[key].ucicol = i}\n elsif column_type =~ /lower_ci|lci/i\n groupkeys.each {|key| groups[key].lcicol = i}\n elsif column_type =~ /cases/i\n groupkeys.each {|key| groups[key].casescol = i }\n elsif column_type =~ /controls/i\n groupkeys.each {|key| groups[key].controlscol = i}\n elsif column_type =~ /study/i\n groupkeys.each {|key| groups[key].studycol = i}\n elsif column_type =~ /^power$/i\n groupkeys.each {|key| groups[key].powercol = i}\n else\n groupkeys.each {|key| groups[key].additional_cols[column_type] = i} \n end\n end\n end\n\n unless @snpid and @location and @chromnum\n puts \"ERROR: Need SNP, CHR, and POS columns in input file\"\n exit\n end\n # add groups to the grouplist\n grouporder.each do |g|\n namepcs = g.split /:/\n\n # add to default grouplist\n if namepcs.length == 1\n if !glisthash.has_key?(defaultkey)\n glisthash[defaultkey] = GroupList.new\n glisthash[defaultkey].mafcoltitle = mafcoltitle\n end\n glisthash[defaultkey].add_group(groups[g])\n else\n if !glisthash.has_key?(namepcs[1])\n glisthash[namepcs[1]] = GroupList.new\n glisthash[namepcs[1]].mafcoltitle = mafcoltitle\n end\n glisthash[namepcs[1]].add_group(groups[g])\n end\n end\n\n # need to match all colors when multiple grouplists\n if glisthash.length > 1\n # determine number of unique groups\n unique_names = Hash.new\n glisthash.each_value do |glist|\n glist.grouphash.each_key do |name|\n namepcs = name.split /:/\n unique_names[namepcs[0]] = 1\n end\n end\n colorhash = Hash.new\n unique_names.each_key do |name|\n#\t\t\tsnpTags.tags.has_key?(name) ? colorstr = snpTags.tags[name] : colorstr = GroupList.get_next_color\n\t\t\tcolorstr = GroupList.get_next_color\n colorhash[name] = colorstr\n\t\t\tgroupcolors[name]=colorstr\n end\n\n glisthash.each_value do |glist|\n glist.grouphash.each do |name, group|\n namepcs = name.split /:/\n group.colorstr = colorhash[namepcs[0]]\n end\n end\n\n end\n\t\n\t# set group list colors for the tags (if any)\n\tif(snpTags)\n\t\tsnpTags.tags.each_key do |key|\n\t\t\tif(groupcolors.has_key?(key))\n\t\t\t\tsnpTags.tags[key]=groupcolors[key]\n\t\t\telse\n\t\t\t\tsnpTags.tags[key]=GroupList.get_next_color\n\t\t\tend\n\t\tend\n\tend\n \nend", "def group\n gid = File.stat(self.artifact).gid\n Etc.getgrgid(gid).name\n end", "def membergroups_playerslounge_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/parent-group-title/\").innerText(\"/Player's Lounge/\"), __method__)\n end", "def add_group(name)\n name_li(name).div(:class=>/searchgroups_result_left_filler/).fire_event(\"onclick\")\n end", "def make_grp_prj_nodes\n grp = {}; prj = {}\n @nodes_fields.each do |node|\n grp[node] = '$' + node\n prj[node] = '$_id.' + node\n end\n return [grp, prj]\n end", "def index(g)\n\t\t\t@groups.index(g)\n\t\tend", "def find_groupid(group_name)\n number = ldap.search(:base => group_dn, :filter => \"cn=#{group_name}\")\n gid = []\n number.each do |result|\n gid = result[:gidnumber][0]\n end\n gid\n end", "def set_group(group)\n send_request(FUNCTION_SET_GROUP, [group], 'k4', 0, '')\n end", "def set_group\n @group = Group.with_attached_logo.includes(:conversations).friendly.find(params[:id])\n end" ]
[ "0.72792417", "0.6986214", "0.6985399", "0.68672955", "0.68672955", "0.670072", "0.670072", "0.66125256", "0.6451193", "0.62536806", "0.62536806", "0.6248367", "0.62369865", "0.61624235", "0.6114538", "0.6114538", "0.6076447", "0.6061301", "0.60563195", "0.5986026", "0.5986026", "0.5986026", "0.5980315", "0.5980079", "0.5971977", "0.5962559", "0.59500283", "0.59471244", "0.5926146", "0.5924811", "0.5921185", "0.5921185", "0.5921185", "0.5908613", "0.5904824", "0.5894946", "0.5894946", "0.5894946", "0.58775324", "0.58656466", "0.5861936", "0.58588886", "0.58252656", "0.57896256", "0.57896256", "0.5781178", "0.57756263", "0.5770705", "0.5765234", "0.57632864", "0.5758126", "0.57528865", "0.57528865", "0.5729242", "0.57288766", "0.57021075", "0.568936", "0.567369", "0.56731904", "0.5670613", "0.5667529", "0.56528413", "0.56240195", "0.5621154", "0.561553", "0.56110007", "0.5607843", "0.5602435", "0.5599077", "0.5584756", "0.5581247", "0.5573474", "0.5572485", "0.5571339", "0.55648357", "0.55645275", "0.55613875", "0.5561183", "0.5557812", "0.55566645", "0.5553033", "0.55528796", "0.554999", "0.554834", "0.55424726", "0.5539968", "0.5529051", "0.5529051", "0.5529051", "0.5527272", "0.5518786", "0.5517545", "0.5509561", "0.5508786", "0.5507059", "0.55070424", "0.5506385", "0.55019736", "0.5495409" ]
0.5709606
55
Returner enrollment type for en seksjon s
def getEnrollmentType(s) # //The enrollment type. One of 'StudentEnrollment', 'TeacherEnrollment', # //'TaEnrollment', 'DesignerEnrollment', 'ObserverEnrollment'. # "type": "StudentEnrollment", type = "" case s["type"] when "StudentEnrollment" type = "student" when "TeacherEnrollment" type = "teacher" end return type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enrollment_class\n (params[:enrollment].blank? || params[:enrollment][:type].blank? ? 'Enrollment' : params[:enrollment][:type]).constantize\n end", "def enrollment_code_for(subject)\n Enrollment.find(:first, :conditions => {\n :user_id => self.id, :school_id => subject.school.id\n }).enrollment_code\n end", "def get_semester_outype\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/semester\"\n _get(path)\n # returns OrgUnitType JSON data block\nend", "def type\n if self.institution?\n return \"Institution\"\n elsif self.funder?\n return \"Funder\"\n elsif self.organisation?\n return \"Organisation\"\n elsif self.research_institute?\n return \"Research Institute\"\n elsif self.project?\n return \"Project\"\n elsif self.school?\n return \"School\"\n end\n return \"None\"\n end", "def xlate_authen_type()\n return AUTHEN_TYPE_XLATES[@authen_type] if (AUTHEN_TYPE_XLATES.has_key?(@authen_type))\n return(@authen_type.to_s) \n end", "def enrollment\n @enrollment_cache ||= self.enrollments.select {|r| r.class == self.class.enrollment_class}.first\n end", "def eob_type\r\n if @facility.qualified_to_have_patient_payer? && @check_information\r\n if @payer_of_check\r\n is_pat_pay_eob = @check_information.does_check_have_patient_payer?(@facility, @payer_of_check)\r\n elsif (@check_information.patient_pay_eobs.length >= 1) \r\n is_pat_pay_eob = 'Patient'\r\n else \r\n is_pat_pay_eob = display_pat_pay_grid_for_check_with_no_payer? \r\n end\r\n end\r\n is_pat_pay_eob ? 'Patient' : 'Insurance'\r\n end", "def enrollment_status_name\n ENROLLMENT_STATUS_NAMES[enrollment_status.to_s.strip]\n end", "def type_result(e, es)\n if exam_type == 'Grades'\n es.grading_level.name || 'AB'\n elsif exam_type == 'Marks'\n [es.marks || 'AB', e.maximum_marks].join('/')\n else\n [[es.marks || 'AB', e.maximum_marks].join('/'), es.grading_level.name || '-'].join('|')\n end\n end", "def kase_type\n kase_class.kind if kase_class\n end", "def kase_type\n kase_class.kind if kase_class\n end", "def offering_type\n data.offering_type\n end", "def get_symbol_using_type(type)\n case type\n when EducationOrganizationCategoryType.to_string(:STATE_EDUCATION_AGENCY); :seas\n when EducationOrganizationCategoryType.to_string(:LOCAL_EDUCATION_AGENCY); :leas\n when SchoolCategory.to_string(:ELEMENTARY); :elementary\n when SchoolCategory.to_string(:MIDDLE); :middle\n when SchoolCategory.to_string(:HIGH); :high\n end\n end", "def type\n @type ||= @data[:edupersonaffiliation].last\n end", "def security_type\n SecurityType.find_by_type self[:type]\n end", "def map_to_orcid_type( resource_type )\n\n case resource_type\n when 'Article'\n return 'journal-article'\n when 'Book'\n return 'book'\n when 'Conference Paper'\n return 'conference-paper'\n when 'Part of Book'\n return 'book-chapter'\n when 'Report'\n return 'report'\n when 'Journal'\n return 'journal-issue'\n when 'Poster'\n return 'conference-poster'\n else\n return 'other'\n end\n\n end", "def type\n TYPES[roletype_id]\n end", "def current_usertype\n current_account.user_type\n end", "def get_identification_type\n if user_signed_in?\n @identification_type = current_user.cvs.find_by(params[:identification_type])\n end\n end", "def get_account_row_type\n self.le_account_row_type.nil? ? \"\" : self.le_account_row_type.name\n end", "def identification_name(identification_type)\n case identification_type\n when Donor.identification_types['pan_card']\n 'Permanent Account Number'\n when Donor.identification_types['aadhaar_card']\n 'Aadhaar Number'\n when Donor.identification_types['passport']\n 'Passport number'\n when Donor.identification_types['voter_id_card']\n 'Elector\\'s photo identity number'\n when Donor.identification_types['driving_license']\n 'Driving License number'\n when Donor.identification_types['ration_card']\n 'Ration card number'\n when Donor.identification_types['tax_payer_country_of_residence']\n 'Tax Identification Number'\n else\n ''\n end\n end", "def user_type\n if self.class.name == \"PubcookieUser\"\n type = self.identity_type == \"Student\" ? self.identity_type : \"UW Standard user\"\n else\n type = \"External user\"\n end\n type\n end", "def es_type_name\n self.name.pluralize.downcase\n end", "def get_type\n\n end", "def school_type\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['schoolType']) if @data['schoolType']\n end", "def get_record_type_code\n @record_type_code\n end", "def mentor_workshop_event_type\n EventType.find_by_name(\"Mentor Workshop\")\n end", "def get_publisher_elsevier\n # Must be the publisher if found in dc.publisher\n @dc[:publisher].each{|p| return \"Elsevier\" if p && p.match(ELSEVIER_REGEX)}\n\n # Might be the publisher if found in dc.description or dc.rights\n a = @dc[:description] + @dc[:rights]\n a.each{|p| return \"[Elsevier???]\" if p && p.match(ELSEVIER_REGEX)}\n nil\n end", "def org_type_label(professional_organization)\n professional_organization.org_type.capitalize\n end", "def type_icarien\n @type_icarien ||= (param_opuser[:type_icarien]||'all').to_sym\n end", "def rent_expensetype\n { name: 'Rent', description: 'Apartment rent' }\n end", "def person_type\n offering_interviewer.nil? ? 'applicant' : 'interviewer'\n end", "def sti_type\n self.type\n end", "def get_organization\n return \"NSBE\" if affiliation == 1\n \"SHPE\"\n end", "def service_prov_identification\n code, qual = nil, nil\n claim = eob.claim_information\n\n if (claim && !claim.provider_npi.blank?)\n code = claim.provider_npi\n qual = 'XX'\n Output835.log.info \"Provider NPI from the 837 is chosen\"\n elsif (claim && !claim.provider_ein.blank?)\n code = claim.provider_ein\n qual = 'FI'\n Output835.log.info \"Provider TIN from 837 is chosen\"\n elsif !facility.facility_npi.blank?\n code = facility.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !facility.facility_tin.blank?\n code = facility.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def enrollment\n self.enrollments.last\n end", "def type\n {\n '@' => :user_id,\n '!' => :room_id,\n '$' => :event_id,\n '+' => :group_id,\n '#' => :room_alias\n }[sigil]\n end", "def type\n {\n '@' => :user_id,\n '!' => :room_id,\n '$' => :event_id,\n '+' => :group_id,\n '#' => :room_alias\n }[sigil]\n end", "def card_type\n if course.present? and course_type == 'Course::Training'\n 'training'\n else\n 'course'\n end\n end", "def user_type; end", "def entity_type\n return @entity_type\n end", "def en(edition)\n case edition\n when \"First\" then 1\n when \"Second\" then 2\n else edition\n end\n end", "def get_tipo()\r\n\t\tif @l_identificadores != nil\r\n\t\t\t@l_identificadores.get_tipo()\r\n\t\telse\r\n\t\t\treturn @tipo\r\n\t\tend\t\r\n\tend", "def type_name\n TYPE[self.exercise_type].to_s\n end", "def identifier_type\n {\n coding: [{\n system: CODING_SYSTEM,\n code: IDENTIFIER_CODE,\n userSelected: false\n }]\n }\n end", "def reg_type\n attributes['reg_type'].downcase\n end", "def fact_type_key(fact_type)\n role_names =\n if (pr = fact_type.preferred_reading)\n role_refs = pr.role_sequence.all_role_ref.sort_by{|role_ref| role_ref.ordinal}\n role_refs.\n map{|role_ref| [ role_ref.leading_adjective, role_ref.role.object_type.name, role_ref.trailing_adjective ].compact*\"-\" } +\n [pr.text] +\n role_refs.map{|role_ref| [role_ref.role.is_mandatory ? 0 : 1] }\n else\n fact_type.all_role.map{|role| role.object_type.name }\n end\n\n (fact_type.entity_type ? [fact_type.entity_type.name] : [\"\"]) + role_names\n end", "def get_federation_type\n federation_type ? federation_type.short_name : '?'\n end", "def org_type\n\t\torg_type = organisation.organisation_type.name\n\t\treturn org_type\n\tend", "def map_to_dice_job_type(job_type)\n dice_job_types = {\n fulltime: \"Full Time\",\n contract: \"Contract\",\n parttime: \"Part Time\", \n internship: \"\",\n temporary: \"\"\n }\n # Convert string key to a symbol\n job_type = job_type.is_a?(String) ? job_type.to_sym : job_type\n \n return dice_job_types.has_key?(job_type) ? dice_job_types[job_type] : \"\" \n end", "def genera_incertae_sedis_in\n Genus.incertae_sedis_in_family\n end", "def weams_type\n { \n 'ojt' => ojt?, 'correspondence' => correspondence?, 'flight' => flight?,\n 'foreign' => foreign?, 'public' => public?, 'for profit' => for_profit?,\n 'private' => private?\n }.find { |key, value| value }[0]\n end", "def work_type_name(work)\n case work.person.gender\n when \"female\" then work.type.name_feminine\n when \"male\" then work.type.name_masculine\n end\n end", "def resourceType\n 'InsurancePlan'\n end", "def getRecordType(fte)\n if fte > 0 && fte < 20 then\n return \"Consumer\"\n elsif fte > 19 && fte < 200 then\n return \"Mid Market\"\n elsif fte > 199 then\n return \"Enterprise Solutions\"\n end\n end", "def get_event_type\n meeting_program ? meeting_program.event_type.i18n_short : '?'\n end", "def get_event_type\n meeting_program ? meeting_program.event_type.i18n_short : '?'\n end", "def license_type\n return @license_type\n end", "def ris_type\n return @ris_type if defined?(@ris_type)\n\n @ris_type ||= begin\n if @citable_attributes.treat_as_local_photograph?\n # we're treating as a photo taken by us, \"ART\" is best we've got in RIS?\n \"ART\"\n elsif @citable_attributes.container_title.present?\n # basically the only way RIS-handling things are going to handle a\n # container title in any reasonable way, I think.\n \"CHAP\"\n elsif genre.include?('Manuscripts')\n \"MANSCPT\"\n elsif (genre & ['Personal correspondence', 'Business correspondence']).present?\n \"PCOMM\"\n elsif (genre & ['Rare books', 'Sample books']).present?\n \"BOOK\"\n elsif genre.include?('Documents') && @work.title =~ /report/i\n \"RPRT\"\n elsif @work.department == [\"Archives\"]\n # if it's not one of above known to use archival metadata, and it's in\n # Archives, insist on Manuscript.\n \"MANSCPT\"\n elsif (genre & %w{Paintings}).present?\n \"ART\"\n elsif genre.include?('Slides')\n \"SLIDE\"\n elsif genre.include?('Encyclopedias and dictionaries')\n \"ENCYC\"\n else\n \"MANSCPT\"\n end\n end\n end", "def current_usertype\n\t \n\t if current_admin\n\t @current_usertype = current_admin\n\t return @current_usertype\n\t end\n\t \n\t\taccount = current_user\n\n\t\tif account\n\t\t\tif account.account_type == Account.roles[:user]\n\t\t\t\t@current_usertype ||= User.find_by_account_id(account.id)\n\t\t\telsif account.account_type == Account.roles[:npo]\n\t\t\t\t@current_usertype ||= Npo.find_by_account_id(account.id)\n\t\t\tend\n\t\tend\n\n\t\t@current_usertype\n\tend", "def service_payee_identification\n code, qual = nil, nil\n claim = eob.claim_information\n fac = facility\n\n if (claim && !claim.payee_npi.blank?)\n code = claim.payee_npi\n qual = 'XX'\n Output835.log.info \"Payee NPI from the 837 is chosen\"\n elsif (claim && !claim.payee_tin.blank?)\n code = claim.payee_tin\n qual = 'FI'\n Output835.log.info \"Payee TIN from 837 is chosen\"\n elsif !fac.facility_npi.blank?\n code = fac.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !fac.facility_tin.blank?\n code = fac.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def get_gender_type_code\n gender_type ? gender_type.i18n_alternate : '?'\n end", "def get_event_type\n meeting_program ? meeting_program.event_type.i18n_short : (data_import_meeting_program ? data_import_meeting_program.event_type.i18n_short : '?')\n end", "def show\n respond_with(@sicoss_employer_type)\n end", "def type\n entity_type.name\n end", "def sti_type_to_s\n I18n.t(\"sti_types.#{self.sti_type.downcase}\")\n end", "def data_subject_type\n return @data_subject_type\n end", "def enc_type\n hyper_schema_link.enc_type\n end", "def type\n read_attribute(:type) || Figaro.env.meal_types.split.first\n end", "def get_type_in_french\n type = ''\n if !self.achievement_type.nil?\n if self.achievement_type.downcase == 'weight'\n type = 'Poids'\n elsif self.achievement_type.downcase == 'time'\n type = 'Temps'\n elsif self.achievement_type.downcase == 'kilometer'\n type = 'Kilomètre'\n end\n else\n type = 'kilometer'\n end\n\n type\n end", "def type\n :american\n end", "def resourceType\n 'Practitioner'\n end", "def account_type\n @account ||= Account.find(self)\n @account.party_account_type\n end", "def entry_type_name\n if self.new_design?\n self.new_entry_type_name\n elsif self.dot_rev_design?\n self.dot_rev_entry_type_name\n else\n 'Entry Type Not Set'\n end\n end", "def type() end", "def paperwork_type\n if invoice?\n \"sales invoice\"\n elsif quote? || pay_by_phone?\n \"quotation\"\n elsif pro_forma?\n \"pro forma invoice\"\n else\n \"order details\"\n end\n end", "def organizational_unit\n self[:OU]\n end", "def security_type_label\n self.security_type.label.titleize\n end", "def payer_identification(party)\n elements = ['N1', 'PR']\n payer_string = (@eob_type == 'Patient' ? 'PATIENT PAYMENT' : 'COMMERCIAL INSURANCE')\n unless party.class == Payer\n elements << payer_string\n else\n elements << party.name.strip.upcase\n end\n elements.join(@element_seperator)\n end", "def account_type\n self.role.name\n end", "def account_type\n self.role.name\n end", "def name\r\n return \"AedgK12EnvelopeAndEntryInfiltration\"\r\n end", "def get_department_outype\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/department\"\n _get(path)\n # returns OrgUnitType JSON data block\nend", "def get_entity_type\n return 'county'\n end", "def enclosure_type\n query_root_node(\"enclosure/@type\")\n end", "def user_type\n # if self.is_vendor\n # \"vendor\"\n # else\n # \"customer\"\n # end\n\n self.is_vendor ? 'vendor' : 'customer'\n end", "def type_name\n self['type_name']\n end", "def authen_type_arap!()\n @authen_type = TAC_PLUS_AUTHEN_TYPE_ARAP\n end", "def account_provider_issuer(serialized_data)\n issuer(serialized_data, Darrrr::RECOVERY_TOKEN_TYPE)\n end", "def e_situational\n ElementReqs_::Situational\n end", "def get_full_role\n if role == \"admin\"\n return \"Administrator\"\n elsif role == \"lead\"\n return \"Organization Lead\"\n end\n end", "def essence_class\n (essence_type || Content.normalize_essence_type(definition[\"type\"])).constantize\n end", "def exp_type\n return data.exp_type\n end", "def get_sugarcrm_module_type(type)\n modules = {\n \"iso\" => SugarCRM::EmpIso,\n \"agent\" => SugarCRM::EmpAgent,\n \"merchant\" => SugarCRM::EmpMerchant,\n \"payment_method\" => SugarCRM::EmpPaymentmethod,\n \"settlement_bank_account\" => SugarCRM::EmpSettlementBankAccount,\n \"security_group\" => SugarCRM::SecurityGroup,\n \"email\" => SugarCRM::EmpEmail\n }\n modules[type]\n end", "def get_type\n case self[:type]\n when /pe/\n :pe\n else\n :foss\n end\n end", "def semester\n time = time_from_enrollment\n @semester = time.div(1.year / 2) + 1\n @semester = 1 if @semester <= 0\n return @semester\n end", "def authen_type_ascii!()\n @authen_type = TAC_PLUS_AUTHEN_TYPE_ASCII\n end", "def get_type\n return @resource[:record_type]\n end", "def get_codeSignIdentity(type)\r\n\tif type == 0 then\r\n\t\treturn 'iPhone Developer'\r\n\telsif type == 1 or type == 2 then\r\n\t\treturn 'iPhone Distribution'\r\n\telse\r\n\t\traise \"Unknown mobileprovision type #{type}\"\r\n\tend\r\nend" ]
[ "0.7187711", "0.63840365", "0.6271871", "0.6170893", "0.6142005", "0.6110634", "0.6069084", "0.5920033", "0.5822918", "0.5783087", "0.5783087", "0.5761107", "0.5754447", "0.5754272", "0.57431734", "0.5708474", "0.5702752", "0.5690099", "0.5678745", "0.5657737", "0.5630255", "0.5626738", "0.5621699", "0.55896634", "0.5583599", "0.5569603", "0.5557545", "0.55369306", "0.5530021", "0.5525765", "0.55026567", "0.54909015", "0.54830617", "0.5458785", "0.54551697", "0.5447551", "0.54356956", "0.54356956", "0.5423727", "0.54031295", "0.5378191", "0.53703314", "0.5369598", "0.53670716", "0.53656334", "0.53508747", "0.53470755", "0.5345572", "0.53331774", "0.53329223", "0.5324854", "0.53229517", "0.53221655", "0.5320694", "0.52844834", "0.5268384", "0.5268384", "0.5255761", "0.5246971", "0.5243618", "0.52354944", "0.5227515", "0.52231765", "0.52148145", "0.52127075", "0.5210364", "0.519541", "0.5192856", "0.5191989", "0.51899713", "0.51895565", "0.51872516", "0.51815134", "0.5179196", "0.5172472", "0.51696044", "0.51690805", "0.5168346", "0.5163753", "0.5162386", "0.5162386", "0.51620084", "0.5159588", "0.51473707", "0.5145631", "0.51446396", "0.5140624", "0.5128173", "0.5125794", "0.51219064", "0.5120387", "0.5118461", "0.51136464", "0.5104911", "0.5103694", "0.5102932", "0.510196", "0.5097566", "0.50938886" ]
0.7800354
1
Returner profilen til bruker uid
def getUserProfile(uid) uri = sprintf("/api/v1/users/%d/profile",uid) dbg(uri) profile = $canvas.get(uri) return profile end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile(username = nil, uid = nil)\n\n end", "def set_profil\n @profil = User.find(params[:id])\n end", "def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end", "def set_profil\n @profil = Profil.find_by user_id: current_user.id\n end", "def uid; end", "def user_key\n uid\n end", "def uid() end", "def profils()\n return @profils\n end", "def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end", "def api_get_info( uid )\n\n # варианты размера аватарок = 'photo_rec, photo_big, photo_medium_rec'\n\n url = URI.encode(\"https://api.vkontakte.ru/method/getProfiles?uid=#{ uid }&fields='photo,photo_medium_rec,'&access_token=#{ OFFLINE_TOKEN }\")\n\n Vk_HTTP.request_api(url)[0]\n\n end", "def uid\n read_attribute :uid\n end", "def set_profil\n @profil = Profil.find(params[:id])\n end", "def set_profil\n @profil = Profil.find(params[:id])\n end", "def raw_userids\n users = {}\n cmd = \"find /data/log/ctr -name 'ctr*.gz' -mtime -2 | xargs zcat\" \n IO.popen(cmd) do |io|\n while line = io.gets\n r = get_uid(line)\n #users[r[0]] = true # from cookie\n users[r[1]] = true # from sifi param\n end \n end\n users\nend", "def uid\n @uid\n end", "def preference_id\n user.uuid\n end", "def to_s\n uid\n end", "def to_s\n uid\n end", "def identities\n User.where(:provider => provider, :uid => uid)\n end", "def users_sharing_the_same_interest\n self.user_interest_preferences.map(&:user_id)\n end", "def uid(*) end", "def users\n faves.map do |fave|\n fave.user\n end\n end", "def profile; Profile.get(self.profile_id); end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end", "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "def proposer\n ::User.find(self.proposer_id)\n end", "def permitted_users_id\n\treturn_user_ids = Array.new\n\tif !self.venue_id.nil?\n\t return_user_ids = ActiveInVenue.where(venue_id: self.venue_id).where.not(user_id: self.user_id).map(&:user_id)\n end\n\tif self.allow_nearby\n\t\treturn_user_ids = return_user_ids | User.where.not(id: self.user_id).near([self.latitude, self.longitude], 25, units: :km).map(&:id)\n\tend\n\tblack_list = BlockUser.blocked_user_ids(self.user_id)\n \tcontent_black_list = ShoutReportHistory.where(reportable_id: self.id).where(reportable_type: 'Shout').map(&:reporter_id)\n \treturn_user_ids = return_user_ids - black_list - content_black_list\n\n \t# only user pusher for online users\n \tonline_users_ids = User.where(id: return_user_ids).where(pusher_private_online: true).map(&:id)\n \treturn online_users_ids\n end", "def uid=(p0) end", "def get_uid_int\n self.uid.to_i\n end", "def to_param\n\t\tuid\n\tend", "def myfotosprofiles\n @fotosprofiles = current_user.fotosprofiles\n end", "def profile\n @profile ||= Profile.find_for_uid_and_network(self.uid, self.provider)\n end", "def pupils\n return [] unless self.is_teacher\n return User.where(\"teacher_id = ? \",self.id)\n end", "def users\n result_hash['usr']\n end", "def current\n @profilers\n end", "def userid\n userids&.first\n end", "def profile\n @profile = current_user\n end", "def photos_tagged_user(uid)\n query = \"select pid, src_big, src_small from photo where pid in (select pid from photo_tag where subject = #{uid}) and owner=#{ATC_GID} order by created\"\n return MiniFB.call(FB_API_KEY, FB_SECRET_KEY, \"FQL.query\", \"query\" => query, \"session_key\" => FB_SESSION_KEY, \"expires\" => 0)\n end", "def mvp_profile\n owned_profiles.last\n end", "def user_list\n @user_ratings.map(&:user_id).sort\n end", "def reciever\n reciever = User.where(:uid => reciever_uid)\n reciever.first\nend", "def for_uid(uid)\n @key_users[uid]\n end", "def parse_profil\n dputs __method__.to_s\n req = setup_http_request($profil_request, @cookie, {})\n res = @http.request(req)\n @current_user = res.body.force_encoding('utf-8').scan(/data-toggle=\"dropdown\">([^<]*)<span class=\"Header-navigationAvatar\">/).flatten.first\n end", "def uid\n @uid ||= status[\"uid\"]\n end", "def page_users(context='access')\n usrs = []\n self.where(active: true).find_each do |u|\n usrs << Secure::UserProfile.new(u)\n end\n usrs\n rescue Exception => e\n Rails.logger.error(\" #{self.name.to_s}.#{__method__}() returns: #{e.class.name} msg: #{e.message}\")\n []\n end", "def index\n @profiles = current_user\n end", "def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end", "def get_user_data(id)\n load_user_data(id)\n @user_data[@user_id]\n end", "def user\n user_id.get_object\n end", "def to_param; uid end", "def to_param; uid end", "def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend", "def get_project_profile(uid, pid)\n cl = client(\"Projects\", uid)\n response = cl.call(:get_project_profile, message: { projectid: pid })\n\n fields = [ response.to_hash[:get_project_profile_response][:return][:attributes] ].flatten.map do |f|\n ProfileField.new(f[:name], f[:data_type], f[:optional], f[:access], f[:description], f[:format], f[:format_description], f[:length_hint], f[:value])\n end\n\n return ProfileFields.new(fields)\n rescue Savon::SOAPFault => e\n process_error e\n end", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def owner_fname\n \towner.profile.fname\n end", "def profile_picture\n profile_picture_file_name\n end", "def get_user_data(uid)\n @conn.get(\"/api/v1/users/#{uid}\")\n end", "def uid\n path = uid_file\n return nil if !path\n return nil if !path.file?\n return uid_file.read.chomp\n end", "def profile\n\t\t@user = User.where(username: params[:username])[0]\n\t\t@pics = Picture.where(user_id: @user.id).reverse\n\n\tend", "def profile\n\t\t@user = User.find(current_user)\n\tend", "def getProfiles(path)\n # Get folder names (ie user IDs)\n folders = Dir.glob(path+'/*').select {|f| File.directory? f}\n profiles = []\n # Get id from name\n for folder in folders\n # Get ids from paths\n id = /[0-9a-f]{5,30}$/.match(folder)\n profiles.push(id[0])\n end\n return profiles\nend", "def notifys_by_username mem\n notifys(mem).map { |doc| doc['owner_id'] }\n end", "def receivers_for(wui)\n if wui.user == current_owner\n wui.users.map(&:id)\n else\n [wui.user_id]\n end\n end", "def userids\n metadata[\"userids\"]\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def apps_permissions_users_list\n return {} unless !skip_info? && is_app_token? && is_not_excluded?\n semaphore.synchronize {\n @apps_permissions_users_list_raw ||= access_token.get('/api/apps.permissions.users.list')\n @apps_permissions_users_list ||= @apps_permissions_users_list_raw.parsed['resources'].inject({}){|h,i| h[i['id']] = i; h}\n }\n end", "def profile\n\t\t@user = current_user\n\tend", "def user_list\n class_dir = File.expand_path(\"../../../manifests\", __FILE__)\n Dir.glob(\"#{class_dir}/*.pp\").collect { |user_manifest|\n user_manifest.gsub(/^#{class_dir}\\/(.+)\\.pp$/, '\\1')\n }.delete_if { |username|\n username == 'init' or username == 'null_user'\n }\nend", "def user_ids\n self.users.collect{|ud| ud.id}\n end", "def get_user(name)\n file = \"#{@@path_to_user_plists}/#{name}.plist\"\n user = NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end", "def users\n\t\tRecipeCard.all.map do |recipe_card| \n\t\t\tif recipe_card.recipe == self \n\t\t\t\trecipe_card.user \n\t\t\tend\n\t\tend.compact\n\tend", "def profile\n @user = current_user\n end", "def user\n datastore['POP2USER']\n end", "def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end", "def users_with_permissions()\n\t return LiveStreamSeriesPermission.where(:live_stream_series_id => self.id).collect{|p| p.user}\n end", "def profile\n \t\t@patient = Patient.all\n #@current_user = User.find(params[:id])\n end", "def list_stored_user_ids_ar\n Credential.all.map {|credential| credential.user_id}\nend", "def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end", "def promotable_users(id = nil, opts = {})\n load_resource(PromotableUser, id, opts)\n end", "def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end", "def users\n RecipeCard.all.map{|recipe_card| recipe_card.user if recipe_card.recipe_O == self}.compact\n end", "def users\n recipe_cards.map do |r|\n r.user\n end\n end", "def get_uid_of_pid(pid)\n IO.foreach(\"/proc/#{pid}/status\") do |line|\n case line\n when /Uid:\\s*?(\\d+)\\s*?(\\d+)/\n return($1.to_i)\n end\n end\n end", "def profile\n \n end", "def users\n my_recipe_cards.map do |recipecard|\n recipecard.user\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end", "def id\n @uid\n end", "def user_data\n=begin\n p \"===>session[:userdata]=#{session[:userdata]}\"\n if session[:userdata]\n return session[:userdata]\n else\n if (!session[:uid])\n if !check_session\n error(\"session not exist, please reinstall app or login again\")\n return nil\n end\n end\n user = User.find(session[:uid])\n userexts = Userext.find_by_sql(\"select * from userexts where uid=#{session[:uid]}\")\n user[:userext] = userexts[0]\n session[:userdata] = user\n return user\n end\n=end\n\n return nil if !check_session\n return @userdata if @userdata\n if !@userdata\n @userdata = User.get(session[:uid])\n p \"===>@userdata=#{@userdata}\"\n return @userdata\n end\n if !@userdata\n error(\"user not exist\")\n return nil\n end\n return @userdata\n end", "def get_user(uid)\n @inv = User.find_by_id(uid)\n end", "def process_username(pid)\n uid = File.stat(\"/proc/#{pid}\").uid\n File.foreach('/etc/passwd').each do |line|\n if line.split(':')[2] == \"#{uid}\"\n return line.split(':')[0]\n end\n end\n end", "def _user uid = 0\n\t\tinfos \t\t\t= {}\n\t\tinfos[:uid] \t= uid\n\t\tinfos[:name] \t= 'unknown'\n\t\tinfos[:level] \t= 0\n\t\tinfos[:sid] \t= ''\n\n\t\tif uid == 0\n\t\t\tif sid = request.cookies['sid']\n\t\t\t\tuid = _session_has sid\n\t\t\tend\n\t\tend\n\n\t\tif uid.to_i > 0\n\t\t\tds = DB[:_user].filter(:uid => uid)\n\t\t\tinfos[:uid]\t\t= uid\n\t\t\tinfos[:name] \t= ds.get(:name)\n\t\t\tinfos[:level] \t= ds.get(:level)\n\t\t\tinfos[:sid] \t= sid\n\t\tend\n\t\tinfos\n\tend", "def get_profile_id\n if user_signed_in? && current_user.profile\n @profile_id = current_user.profile.id\n end\n end" ]
[ "0.65837926", "0.6424646", "0.64178884", "0.6325406", "0.6152612", "0.6114431", "0.6104619", "0.60216403", "0.6008795", "0.6005325", "0.5903057", "0.5898193", "0.5898193", "0.5887711", "0.5837347", "0.58332264", "0.5824", "0.5824", "0.5812176", "0.58094543", "0.57953525", "0.57742405", "0.57627684", "0.5758012", "0.57546926", "0.57533187", "0.57503575", "0.57485217", "0.5747348", "0.5746303", "0.57206345", "0.5717656", "0.5715645", "0.569214", "0.5683647", "0.5667394", "0.5658248", "0.56453454", "0.5601735", "0.5588164", "0.5584284", "0.5579326", "0.55792433", "0.5575606", "0.5575473", "0.55516887", "0.55389464", "0.55382264", "0.5535321", "0.5527657", "0.5515643", "0.5515643", "0.5511683", "0.55073303", "0.54953253", "0.5495208", "0.5475645", "0.54742837", "0.54723436", "0.5469191", "0.54669327", "0.54663277", "0.54564965", "0.5445383", "0.54443115", "0.5442816", "0.5442816", "0.5442816", "0.5442816", "0.5442816", "0.5442816", "0.5441211", "0.5428061", "0.54278016", "0.54231876", "0.5422638", "0.54190636", "0.5418341", "0.54173285", "0.54163176", "0.54156923", "0.54132396", "0.54119486", "0.5408645", "0.54055595", "0.5403511", "0.53973067", "0.539451", "0.53819346", "0.53788924", "0.5377867", "0.53762805", "0.53740144", "0.5370555", "0.53702587", "0.53656864", "0.5358548", "0.5352239", "0.53477925" ]
0.56258386
39
Returner de to siste karakterene i seksjonsnavnet. Tanken er at seksjonene er nummerert "Seksjon 01" etc.
def getSectionNo(section) return section["name"][-2,2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kode_dan_kecamatan\n \"#{kode} - #{nama}\"\n end", "def to_s()\n return \"Zug Laenge=#{self.count()}: [#@lok]\"\n end", "def cobranca_interna_formatada\n\t\t\t\tcobranca_interna = { '21' => '21 – Cobrança Interna Com Registro', '22' => '22 – Cobrança Interna sem registro' }\n\t\t\t\tcobranca_interna[carteira.to_s]\n\t\t\tend", "def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end", "def swedish_organisation_number; end", "def segundoDigitoMenor(clave)\n\tcadena_digito = clave.to_s\n\treturn (cadena_digito[1]).to_i\nend", "def konversiMenit(menit)\n detik = menit % 60\n menit = menit / 60\n\n detik = \"0#{detik}\" if detik < 10\n \"#{menit}:#{detik}\"\n end", "def brojeviKutija(kutija)\n kutijaes_pokazuje = [0, 3, 6, 27, 30, 33, 54, 57, 60]\n \n i = kutijaes_pokazuje[kutija]\n \n [\n @mreza[i], @mreza[i+1], @mreza[i+2],\n @mreza[i+9], @mreza[i+10], @mreza[i+11],\n @mreza[i+18], @mreza[i+19], @mreza[i+20]\n ] - [0]\n end", "def french_siret_number; end", "def valores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1, 'u' => 1,\n 'l' => 1, 'n' => 1, 'r' => 1, 's' => 1, 't' => 1,\n 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4, 'y' => 4,\n 'k' => 5,\n 'j' => 8, 'x' => 8,\n 'q' => 10 , 'z' => 10\n }\n end", "def to_s\n i = @jugadores.size\n jugadores = \"\"\n # Loops\n j = 0\n while j < i\n jugadores = jugadores + @jugadores[j].to_s\n j += 1\n end\n i = @mazo.size\n mazo = \"\"\n # Loops\n j = 0\n while j < i\n mazo = mazo + @mazo[j].to_s\n j += 1\n end \n \"\\nQYTETET: #{@tablero} \\n\\nMAX JUGADORES=#{@@MAX_JUGADORES}, NUM SORPRESAS=#{@@NUM_SORPRESAS}, NUM CASILLAS=#{@@NUM_CASILLAS}, PRECIO LIBERTAD=#{@@PRECIO_LIBERTAD}, SALDO SALIDA=#{@@SALDO_SALIDA}\n \\nJUGADORES: #{jugadores}\\nMAZO: #{mazo}\"\n end", "def return_usc\n $mascots.keys[4]\nend", "def spanish_citizen_number; end", "def kcalproteinas\n\t\t\t@proteinas * 4\n\t\tend", "def genclase\n \"M\"\n end", "def Traductor nume\n\nnumero = {}\nnumero[0] = \"Cero\"\nnumero[1] = \"Uno\"\nnumero[2] = \"Dos\"\nnumero[3] = \"Tres\"\nnumero[4] = \"Cuatro\"\nnumero[5] = \"Cinco\"\nnumero[6] = \"Seis\"\nnumero[7] = \"Siete\"\nnumero[8] = \"Ocho\"\nnumero[9] = \"Nueve\"\nnumero[10] = \"Diez\"\n\n\n\nreturn numero[nume.to_i]\n\n\nend", "def valorenergeticoKJ\n\t\tveKJ=(cgrasas * 37) + (cgrasassa * 37) + (grasasmono * 37) + (grasaspoli * 37) + (hcarbono * 17) + (polialcoholes * 10) + (almidon * 17) + (fibra * 8) + (proteinas * 17) + (sal * 25)\n\t\tveKJ.round(2)\n\tend", "def get_vct\n \"#{@calorias} kcal\" \n end", "def kcallipidos\n\t\t\t@lipidos * 9\n\t\tend", "def jugar\n ganador = case self.maquina_tirada\n when self.humano_tirada\n\t\"empatan\"\n when Ppt.jugadas_posibles[self.humano_tirada]\n\t\"humano\"\n else \n\t\"maquina\"\n end\n return ganador\n end", "def seleccion_jugada()\n # Suma de todas las frecuencias \n total_frecuencias = -1\n @frecuencia_jugadas.each_value do |valor|\n total_frecuencias += valor \n end\n \n # Este bloque me permite saber si todas las frecuencias estan en 0 (Inicio del juego)\n # Si es asi el numero_aleatorio sera 0\n numero_aleatorio = $r.rand(0..total_frecuencias)\n\n # Calculo de rango para cada una de las jugadas\n frecuencia_piedra = @frecuencia_jugadas[\"Piedra\"]\n frecuencia_papel = frecuencia_piedra + @frecuencia_jugadas[\"Papel\"]\n frecuencia_tijera = frecuencia_papel + @frecuencia_jugadas[\"Tijera\"]\n frecuencia_lagarto = frecuencia_tijera + @frecuencia_jugadas[\"Lagarto\"]\n frecuencia_spock = frecuencia_lagarto + @frecuencia_jugadas[\"Spock\"]\n\n\n # Bloque case para cada uno de los rangos \n case numero_aleatorio\n when 0 .. (frecuencia_piedra - 1)\n return Jugada.new(\"Piedra\")\n when frecuencia_piedra .. (frecuencia_papel - 1)\n return Jugada.new(\"Papel\")\n when frecuencia_papel .. (frecuencia_tijera - 1)\n return Jugada.new(\"Tijera\")\n when frecuencia_tijera .. (frecuencia_lagarto - 1)\n return Jugada.new(\"Lagarto\")\n when frecuencia_lagarto .. (frecuencia_spock - 1)\n return Jugada.new(\"Spock\") \n end\n\n end", "def czech_organisation_number; end", "def kode_dan_golongan\n \"#{nama_pangkat} #{ruang}/#{golongan}\"\n end", "def to_s\n \t\t\t\"(Nombre:#{@nombre},Proteinas:#{@proteinas},Carbohidratos:#{@carbohidratos},Lipidos:#{@Lipidos},Gei:#{@gei},Terreno:#{@terreno})\"\n \t\t\n\t\tend", "def get_smoking_pre(smoking_pre)\n SMOKING_PREFERRNCES[smoking_pre].to_s\n end", "def codigo_cliente(pedido)\n pedido.pessoa.id.to_s + \"SG\"\n end", "def valorenergeticoKcal\n veKJ=(cgrasas * 9) + (cgrasassa * 9) + (grasasmono * 9) + (grasaspoli * 9) + (hcarbono * 4) + (polialcoholes * 2.4) + (almidon * 4) + (fibra * 2) + (proteinas * 4) + (sal * 6)\n veKJ.round(2)\n end", "def french_siren_number; end", "def nip_dan_nama\n \"#{nip} - #{nama_pegawai}\"\n end", "def konvertiere_in_ganze_zahl(wort)\n if(zahl?(wort))\n return wort.to_i\n else\n return wort\n end\n end", "def get_vagas_eleicao(ano, cargo, localizacao)\n return $vagas[ano.to_s][localizacao.nome][cargo.to_s].to_i\nend", "def im_nachbarraum_umsehen(richtung)\n naechster_raum = @aktueller_raum.ausgang(richtung)\n puts naechster_raum\n end", "def ticket_sales_keys\n [\n [15, 36, 37, 'Premieres Loges à 6 places, à 6 liv.', 115, 116],\n [26, 58, 59, 'Premieres Loges à 5 places, à 6 liv.', 137, 138],\n [29, 64, 65, 'Premieres Loges à places, à 6 liv.', 143, 144],\n [30, 66, 67, 'Loges au Rez-de-chaussée, à pl. à 6 l.', 145, 146],\n [31, 68, 69, 'Loges au Rez-de-chaussée, à pl. à 6 l.', 147, 148],\n [32, 70, 71, 'Loges au Rez-de-chaussée, à pl. à 6 l.', 149, 150],\n [33, 72, 73, 'Secondes Loges à 4 places, à 3 liv 15 sous', 151, 152],\n [34, 74, 75, 'Secondes Loges à 3 places, à 3 liv 15 sous', 153, 154],\n [35, 76, 77, 'Troisiemes Loges à 8 places, à 2 l. 10 s.', 155, 156],\n [16, 38, 39, 'Troisiemes Loges à 6 places, à 2 l. 10 s.', 117, 118],\n [17, 40, 41, 'Troisiemes Loges à 4 places, à 2 l. 10 s.', 119, 120],\n [18, 42, 43, 'Troisiemes Loges à 3 places, à 2 l. 10 s.', 121, 122],\n [19, 44, 45, 'Troisiemes Loges à places, à 2 l. 10 s.', 123, 124],\n [20, 46, 47, 'Quatriemes Loges à 4 places, à 3 l. 15 s.', 125, 126],\n [21, 48, 49, 'Quatriemes Loges à 3 places, à 3 l. 15 s.', 127, 128],\n [22, 50, 51, 'Places de Premieres à 6 liv.', 129, 130],\n [23, 52, 53, 'Places de Galerie à 4 liv.', 131, 132],\n [24, 54, 55, 'Places de Secondes à 3 liv.', 133, 134],\n [25, 56, 57, 'Places de Parquet à 2 liv. 8 sous.', 135, 136],\n [27, 60, 61, 'Places de Troisiemes à 2 liv.', 139, 140],\n [28, 62, 63, 'Places de Paradis à 1 liv 10 sous', 141, 142]\n ]\n end", "def get_spreadsheet_key\n #@chave_planilha = @doc[\"entry\"][0][\"id\"][0][/full\\/(.*)/, 1] usa a planilha Torneio Tênis de mesa do usuário tadeu.gaudio\n #@chave = @doc[\"entry\"][1][\"id\"][0][/full\\/(.*)/, 1]\tusa a planilha iPongWinners do usuário tadeu.gaudio\n @chave = \"tjS8wC9jSAR03-0pkf8cIhg\" #planilha de tenis de mesa\n end", "def to_english\n places = to_s.split(//).collect {|s| s.to_i}.reverse\n name = []\n ((places.length + 2) / 3).times do |p|\n strings = Integer.trio(places[p * 3, 3])\n name.push(MEGAS[p]) if strings.length > 0 and p > 0\n name += strings\n end\n name.push(ONES[0]) unless name.length > 0\n name.reverse.join(\" \")\n end", "def spanish_foreign_citizen_number; end", "def kaprekar?(k)\t\n\tsqr_k = (k ** 2).to_s.split('')\n\t#if(sqr_k.size <= 4)\n\tnum_right = sqr_k.slice!(sqr_k.size / 2..-1)\n\tnum_left = sqr_k\n\t#else\n\t\t#num_right = sqr_k.slice!(k.to_s.size - 1..-1)\n\t\t#num_left = sqr_k\n\t#end\n\t(num_left.join('').to_i + num_right.join('').to_i == k) ? \"#{k} is Kaprekar\" : \"#{k} is not Kaprekar\"\n\n\t\nend", "def ticket_sales_keys\n [\n [15, 30, 31, 'Premieres loges à 6 places', 91, 92],\n [22, 44, 45, 'Premieres loges à 5 places', 105, 106],\n [23, 46, 47, 'Secondes Loges à 4 places', 107, 108],\n [24, 48, 49, 'Secondes Loges à 3 places', 109, 110],\n [25, 50, 51, 'Troisièmes Loges à 6 places', 111, 112],\n [26, 52, 53, 'Troisièmes Loges à 4 places', 113, 114],\n [27, 54, 55, 'Troisièmes Loges à', 115, 116],\n [28, 56, 57, 'Petites Loges', 117, 118],\n [29, 58, 59, 'Petites loges à', 119, 120],\n [16, 32, 33, 'Galeries à 4 livres', 93, 94],\n [17, 34, 35, 'Premieres Places à 6 livres', 95, 96],\n [18, 36, 37, 'Secondes Places à 3 livres', 97, 98],\n [19, 38, 39, 'Troisièmes Places à 2 livres', 99, 100],\n [20, 40, 41, 'Parterre assis à 2 livres 8 s', 101, 102],\n [21, 42, 43, 'Paradis à 1 livre 10', 103, 104]\n ]\n end", "def to_s\n\t\treturn \"[Nombre:#{@nombre}, Peso:#{@cantidad} kg, Proteinas:#{proteinas.round(2)} g, Carbohidratos:#{carbohidratos.round(2)} g, Lipidos:#{lipidos.round(2)} g, Valor Energetico:#{valorEnergetico.round(2)} kcal, Emisiones: #{gei.round(2)} kgCO2, Terreno Usado:#{terreno.round(2)} m^2]\" \n\tend", "def status_verifikasi\n if self.status_verifikasi_verifikator == 0\n return \"Belum terproses\"\n elsif self.status_verifikasi_verifikator == 1\n return \"Layak\"\n elsif self.status_verifikasi_verifikator == 2\n return \"Tidak Layak\"\n elsif self.status_verifikasi_verifikator == 3\n return \"Perbaikan\"\n end\n end", "def anstatauKodo(teksto)\n\n trovoj = teksto.scan(/&(.*?);/)\n if trovoj == nil or trovoj.size <= 0 then return teksto end\n\n for i in 0..trovoj.size do\n \n\ttrov = trovoj[i].to_s[2..-3]\n if @literoj[trov] != nil\n\t teksto.sub!(\"&#{trov};\", @literoj[trov])\n\telse\n\t #puts \"Eraro! Ne trovis [#{trov}]\"\n\tend\n end\n\n teksto = CGI::unescapeHTML(teksto)\n return teksto\nend", "def to_s\n \"#{imie} #{nazwisko}\"\n end", "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 juega_primero mano\n\t\tcarta_a_jugar = nil\n\t\tcadena = (Util.captura_entrada \"Escoge una carta por su posicion en la mano (0=inicial)=>\").chomp\n\t\tcarta_a_jugar = mano[cadena.to_i]\n\t\treturn carta_a_jugar\t\n\tend", "def zapis_vysledek(reseni, je_splnitelna) \n @reseni = reseni\n @vysledny_soucet_vah = vrat_soucet_vah(reseni)\n @je_splnitelna = je_splnitelna\n end", "def kkl_with_percent\r\n \"Klasse \" + self.KKL.to_s + \" - \" + sprintf(\"%3.2f\", self.Prozent) + \"%\"\r\n end", "def ubicacion2(cadena)\n cad=cadena.split(/\\s|,/)\n cad[0]=cad[0].to_i\n cad[1]=cad[1].to_i\n return cad #[2,2,\"S\"]\nend", "def konversiMenit(menit) \n # =================================\n # Area Kode Kode di sini\n \n \n \n # =================================\n end", "def seleccion_jugada(numero_random)\n '''\n Explicacion de este metodo:\n Por ejemplo para una lista de movimientos como esta\n {:Tijera => 3, :Papel => 2}\n Los rangos seran los siguientes \n {:Tijera => 3, :Papel => 5}\n Esto sera que si un numero random cae entre \n 1 y 3 (Inclusivo) devolvera Tijera\n si cae entre 4 y 5 devolvera Papel \n Esto se modela con el <= del condicional\n '''\n @rangos.each_key do |jugada| # Se recorre el diccionario \n if numero_random <= @rangos[jugada] # Cuando se consiga una jugada cuyo valor sea menor o igual\n # que el numero random se retorna dicha jugada\n return jugada \n end\n end\n end", "def to_s\n\t\t\"Por 100g o 100ml de producto\\tIr del producto\\tPor porcion de X gramos\\tIR por porcion\\n\"+\n\t\t\" Valor energetico: #{valorenergeticoKJ}/#{valorenergeticoKcal}\\t#{irenergeticoKJ}/#{irenergeticoKcal}\\t#{valorenergeticoKJp}/#{valorenergeticoKcalp}\\t#{irenergeticoKJp}/#{irenergeticoKcalp}\\n\"+\n\t\t\" Grasas: #{cgrasas}\\t#{irgrasas}\\t#{valorgrasasp}\\t#{irgrasasp}\\n\"+\n\t\t\" Grasas monosaturadas: #{grasasmono}\\t#{irmonograsas}\\t#{valormonograsasp}\\t#{irmonograsaslp}\\n\"+\n\t\t\" Grasas poliinsaturadas: #{grasaspoli}\\t#{irpoliinsaturadas}\\t#{valorgrasasp}\\t#{irpoliinsaturadas}\\n\"+\n\t\t\" Hidratos de carbono: #{hcarbono}\\t#{irhidratos}\\t#{valorhidratosp}\\t#{irhidratosp}\\n\"+\n\t\t\" Azucares: #{azucares}\\t#{irazucares}\\t#{valorazucaresp}\\t#{irazucaresp}\\n\"+\n\t\t\" Polialcoholes: #{polialcoholes}\\t#{irpolialcoholes}\\t#{valorpolialcoholesp}\\t#{irpolialcoholesp}\\n\"+\n\t\t\" Almidon: #{almidon}\\t#{iralmidon}\\t#{valoralmidonp}\\t#{iralmidonp}\\n\"+\n\t\t\" Fibra alimentaria: #{fibra}\\t#{irfibra}\\t#{valorfibrap}\\t#{irfibrap}\\n\"+\n\t\t\" Sal: #{sal}\\t#{irsal}\\t#{valorsalp}\\t#{irsalp}\\n\"+\n\t\t\" Vitamina/mineral: #{vitymin}\\t#{irvitaminas}\\t#{valorvityminp}\\t#{irvitaminasp}\\n\"\n\tend", "def vrat_soucet_vah(jedinec)\n soucet = 0\n citac = 0\n jedinec.each do |prvek| \n if(prvek)then\n soucet += @pole_vah[citac].to_i\n end\n citac +=1\n end\n return soucet\n end", "def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend", "def format_key\n :format_main_ssim\n end", "def semester\n\t\topens = self.showtimes.first\n\t\tif(opens.month < 7)\n\t\t\topens.year.to_s + \"01\"\n\t\telse\n\t\t\topens.year.to_s + \"03\"\n\t\tend\n\tend", "def stamina(hash={})\n\t\t$_TAGHASH_['stamina'], $_TAGHASH_['Mstamina'] = hash['text'].scan(/\\d+/o)\n\tend", "def to_s\n\t\tstring = \"Gases \" + @gei.to_s + \" Uso de terreno anual \" + @terreno.to_s\n\tend", "def drittelworte( wertung )\n if wertung < 1\n string1 = ''\n elsif wertung < 2\n string1 = 'eins'\n elsif wertung < 3\n string1 = 'zwei'\n elsif wertung < 4\n string1 = 'drei'\n elsif wertung < 5\n string1 = 'vier'\n elsif wertung < 6\n string1 = 'f&uuml;nf'\n elsif wertung < 7\n string1 = 'secht'\n elsif wertung < 8\n string1 = 'sieben'\n elsif wertung < 9\n string1 = 'acht'\n elsif wertung < 10\n string1 = 'neun'\n elsif wertung < 11\n string1 = 'zehn'\n elsif wertung < 12\n string1 = 'elf'\n else\n string1 = 'zw&ouml;f'\n end\n rest = sprintf(\"%.1f\",(wertung.to_f % 1))\n if rest.to_f == 0.3\n return string1 + \" ein drittel\"\n elsif rest.to_f == 0.6\n return string1 + \" zwei drittel\"\n elsif rest.to_f == 0\n return string1\n else\n return sprintf(\"%.1f\",wertung.to_s).sub(\".\",\",\")\n end\n end", "def set_klienci_jaskula\n @klienci_jaskula = KlienciJaskula.find(params[:id])\n end", "def show\n @lokasis = Rute.select(\"id_jalan\").uniq\n end", "def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend", "def setResult(divisores)\t\t\n\t\tcadena=\"\"\n\t\tdivisores.each do |num|\t\t\n\t\t\tcase num\n\t\t\t\twhen 3\n\t\t\t\t cadena = cadena.concat(\"Pling\")\n\t\t\t\twhen 5\n\t\t\t\t cadena = cadena.concat(\"Plang\")\n\t\t\t\twhen 7 \t\n\t\t\t\tcadena = cadena.concat(\"Plong\")\t\t\t\t\n\t\t\tend\t\t\t\t\n\t\tend\n\t\treturn cadena\n\tend", "def to_s\n #$\"#{nombre} #{pais}\"\n #%(#{nombre} #{pais})\n nombre\n end", "def to_s()\n if @mano.instance_of?(Jugada)\n \"Su mano actual es \" + $posibles_jugadas[@mano.to_s]\n else\n @mano\n end\n end", "def trie_par_ordre_alphabetique(journaliste)\n \tputs \"Trie par ordre alphabétique\"\n \tputs journaliste.sort\n \tputs\" \"\n \nend", "def set_kegiatan\n @kegiatan = Kegiatan.find(params[:id])\n end", "def to_s\r\n super + \"\\nHuella nutricional, GEI: #{@geiTotal} y Uso de Terreno: #{@terrenoTotal}\"\r\n end", "def wertungWorte (wertung)\n if wertung < 1\n return 'unglaublich schlecht'\n elsif wertung < 2\n return 'wirklich schlecht'\n elsif wertung < 3\n return 'relativ schlecht'\n elsif wertung < 4\n return 'in ordnung'\n elsif wertung < 5\n return 'relativ gut'\n elsif wertung < 6\n return 'wirklich gut'\n elsif wertung < 7\n return 'sehr gut'\n elsif wertung < 8\n return 'hervorragend'\n elsif wertung < 9\n return 'unbeschreiblich gut'\n elsif wertung < 10\n return 'bet&ouml;rend gut'\n elsif wertung < 11\n return 'unwirklich gut'\n else\n return 'katastrophal gut'\n end\n end", "def swedish_organisation_number\n # Valid leading digit: 1, 2, 3, 5, 6, 7, 8, 9\n # Valid third digit: >= 2\n # Last digit is a control digit\n base = [sample([1, 2, 3, 5, 6, 7, 8, 9]), sample((0..9).to_a), sample((2..9).to_a), format('%06d', rand(10**6))].join\n base + luhn_algorithm(base).to_s\n end", "def rating; \"Д/379 (stub)\"; end", "def kaprekar(input)\n\t\tdef aux (input, count)\n\t\t\tif input == 6174\n\t\t\t\tcount\n\t\t\telse\n\t\t\t\tcount += 1\n\t\t\t\tarray = input.to_s.split(\"\").sort\n\t\t\t\tasc_number = array.join.to_i\n\t\t\t\tdesc_number = array.reverse.join.to_i\n\t\t\t\taux(desc_number - asc_number, count)\n\t\t\tend\n\t\tend\n\t\taux(input, 0)\n\tend", "def vrat_modif_instanci\n vystup=\"\"\n @pole_dat.each do |radek| \n if(radek[0]==\"p\")then \n vystup +=radek\n vystup += \"w #{generuj_vahy(radek).join(' ')}\\n\" #pridani radku s vahami\n else\n vystup +=radek\n end \n end\n # puts vystup\n return vystup\n end", "def set_kuaisufenfawenjian\n @kuaisufenfawenjian = Kuaisufenfawenjian.find(params[:id])\n end", "def set_tenkenkekka\n @tenkenkekka = Tenkenkekka.find(params[:id])\n end", "def _zeichnen(n,kl)\n\n end", "def formato\n \"\n Queso Cada 100g o 100ml IR\n \n Valor energético #{nrg_kj} kj #{nrg_kj_ir}%\n (kj/kcal) #{nrg_cal} kcal\n \n Grasas de las #{@grasa} g #{grasa_ir}%\n cuales:\n Saturadas #{@saturada} g #{saturada_ir}%\n Monoinsaturadas #{@monoinsat} g -\n Poliinsaturadas #{@poliinsat} g -\n \n Hidratos de #{@hidrato} g #{hidrato_ir}% \n carbono de los\n cuales:\n Azucares #{@azucar} g #{azucar_ir}%\n Polialcoholes #{@polialco} g -\n Almidones #{@almidon} g -\n \n Fibra alimentaria #{@fibra} g -\n \n Proteinas #{@proteina} g #{proteina_ir}%\n \n Sal #{@sal} g #{sal_ir}%\"\n end", "def sort_key\n # Make sure sequence is at least 12 long to maintain numeric sorting\n @code&.rjust(12, '0')\n end", "def to_s\n\t\ts = @jugada\n\t\ts\n\tend", "def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend", "def to_s\n\t\t\t \"( Nombre:#{@nombre}, Conjunto Alimentos: #{@la} ,Conjunto Gramos: #{@lg} ,Proteinas :#{@proteinas},Carbo :#{@carbohidratos},Lipidos :#{@lipidos},VCT :#{@vct} )\"\n\n\t\tend", "def set_kennkoukiroku\n @kennkoukiroku = Kennkoukiroku.find(params[:id])\n end", "def ticket_sales_keys\n [\n [14, 27, 28, 'Premières Loges 1', 75, 76],\n [19, 37, 38, 'Premières Loges 2', 85, 86],\n [20, 39, 40, 'Premières Loges 3', 87, 88],\n [21, 41, 42, 'Premières Loges 4', 89, 90],\n [22, 43, 44, 'Secondes Loges 1', 91, 92],\n [23, 45, 46, 'Secondes Loges 2', 93, 94],\n [24, 47, 48, 'Secondes Loges 3', 95, 96],\n [25, 49, 50, 'Troisièmes Loges', 97, 98],\n [26, 51, 52, 'Petites Loges', 99, 100],\n [15, 29, 30, 'Premières Places', 77, 78],\n [16, 31, 32, 'Secondes Places', 79, 80],\n [17, 33, 34, 'Troisièmes Places', 81, 82],\n [18, 35, 36, 'Places de Parterre', 83, 84]\n ]\n end", "def tosjis; Kconv.tosjis(self) end", "def sevens(n)\nend", "def slogan\n search_by_text 'слоган'\n end", "def veichles\n ['Bil', 'Moped', 'Motorsykkel', 'Tungt kjøretøy', 'ATV', 'Buss', 'Sykkel']\n end", "def to_s\n rval = \"\"\n rval += \" pesa #{@peso} kilos , mide #{@altura} metros, tiene #{@edad} años y es\"\n if(sexo == 1)\n rval+= \" un hombre\"\n else\n rval+= \" una mujer\"\n end\n rval\n end", "def vrat_celkovy_soucet_vah\n soucet = 0\n @pole_vah.each do |prvek| \n soucet += prvek.to_i\n end\n return soucet\n end", "def GueltigBis\n \treturn @GueltigBis\n end", "def set_janken\n @janken = Janken.find(params[:id])\n end", "def jt\n @pubmed['JT'].strip\n end", "def vypis_reseni\n\n vystup = \"(\"\n @reseni.each do |prvek|\n if(prvek)then\n vystup += \"1\"\n else\n vystup += \"0\"\n end \n end\n vystup += \")\"\n \n return vystup\n end", "def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end", "def to_s\n\t\ts = \"\"\n\t\t\n s += super + \"\\n\\n\"\n\n s += \"Emisiones de gases en kg CO2 \" + emisiones_gei.to_s + \"\\n\"\n\n s+= \"Cantidad de terreno empleado en m2 \" + area_terreno.to_s + \"\\n\"\n\tend", "def french_insee_number; end", "def to_s( le_format = nil )\n sep_jours = FilmJson::SEPARATEUR_JOURS\n if le_format.nil?\n return format(\"\\\"%s\\\" (real. %s) - {%s} (%s)\",\n titre,\n real,\n jours.join(sep_jours),\n salles)\n end\n\n form = le_format\n res = []\n chaque_car = le_format.split(\" \")\n\n chaque_car.each do |f|\n case f\n when /%(-)?\\d*I/\n form = form.gsub('I','s')\n res << \"#{imdbid}\"\n when /%(-)?\\d*J/\n form = form.gsub('J','s')\n n_jours = jours.join(sep_jours)\n res << \"#{n_jours}\"\n when /%(-)?\\d*T/\n form = form.gsub('T','s')\n res << \"#{titre}\"\n when /%(-)?\\d*S/\n form = form.gsub('S','s')\n res << \"#{salles}\"\n when /%(-)?\\d*A/\n form = form.gsub('A','s')\n res << \"#{annee}\"\n when /%(-)?\\d*N/\n form = form.gsub('N','s')\n res << \"#{note}\"\n when /%(-)?\\d*G/\n form = form.gsub('G','s')\n res << \"#{genre}\"\n when /%(-)?\\d*R/\n form = form.gsub('R','s')\n res << \"#{real}\"\n when /%(-)?\\d*P/\n form = form.gsub('P','s')\n res << \"#{synopsis}\"\n when /%(-)?\\d*O/\n form = form.gsub('O','s')\n res << \"#{sortie}\"\n when /%(-)?\\d*M/\n form = form.gsub('M','s')\n res << \"#{duree}\"\n when /\"/\n form = form.gsub('\"','\\\"')\n end\n end\n return form % res\n fail \"Cas non traite: to_s( #{le_format}, #{separateur_prealables} )\"\n end", "def format_key\n formats = CustomFields::AutoNumbering.format_parts(self.format)\n\n formats.select{|f| (f =~ /(\"|#)/).nil? }.join('-')\n end", "def get_txt_panneau\n\t\treturn [mdl_par.panneaux[0].to_s,mdl_par.panneaux[1].to_s]\n\tend", "def get_edigaul\n if (@error)\n return @error\n else\n edigaul = \"\"\n\n edigaul_keys = @edigaul_letters.keys.sort\n edigaul_keys.each do |i|\n edigaul += @edigaul_letters[i].get_full_letter\n end\n\n return edigaul\n end\n end", "def to_s() # :nodoc:\n mano_seleccionada = super.to_s # Hago un llamado al metodo to_s de mi padre que maneja\n # la impresion de la mano seleccionada\n if not @estrategias.nil?\n return \"Las estrategias suministradas son \" + @estrategias.to_s + \" \" + mano_seleccionada\n end\n return \"La lista de estrategias provista no es valida\"\n end", "def oneMore(number)\r\n symbol = number.to_s(2)\r\n kol = symbol.count(\"1\")\r\n puts(kol)\r\n #puts(12344.to_s(2))\r\n #puts (kol) #не_смог_через_return\r\nend", "def set_kindergarten\n @kindergarten = Kindergarten.find(params[:id])\n end" ]
[ "0.6044955", "0.58080757", "0.58067816", "0.5711201", "0.5602375", "0.55556387", "0.5525738", "0.54859585", "0.54441977", "0.54247004", "0.5416871", "0.5413902", "0.53696316", "0.5330677", "0.53247166", "0.53054297", "0.5293399", "0.5292284", "0.52873963", "0.528502", "0.5284806", "0.5282294", "0.5279703", "0.5275122", "0.52679014", "0.5223113", "0.5221338", "0.5217545", "0.5194297", "0.5182082", "0.5167988", "0.5167703", "0.5166486", "0.5160686", "0.51234746", "0.5118052", "0.50947493", "0.50822794", "0.50754446", "0.5067411", "0.50614816", "0.5057944", "0.5056596", "0.50537497", "0.50503594", "0.5048129", "0.50442547", "0.5044219", "0.50371265", "0.50339985", "0.5026484", "0.50260717", "0.5025014", "0.5023446", "0.5022771", "0.5001037", "0.50002545", "0.49988797", "0.49870843", "0.4975263", "0.49751732", "0.4963594", "0.49627137", "0.4957391", "0.49521774", "0.49443856", "0.4942647", "0.4942438", "0.49383655", "0.49370828", "0.49336535", "0.4928986", "0.49255168", "0.4918056", "0.49058345", "0.49056378", "0.49003053", "0.4899947", "0.48990393", "0.48967794", "0.48960844", "0.48841467", "0.48808524", "0.48793688", "0.48747212", "0.48746997", "0.48686484", "0.4855408", "0.4853762", "0.48508805", "0.48438635", "0.4839892", "0.48398617", "0.48391205", "0.48363307", "0.4831991", "0.48313755", "0.4827149", "0.4817106", "0.48158166", "0.48154908" ]
0.0
-1
Returner en liste av kommentarer.
def getComments(list) comments = "" dbg("Kommentarer:") list.each { |s| dbg("Kommentar:") dbg(s) dbg(s["comment"]) comments = comments + "<p>" + s["author_name"] + ":" + s["comment"] + "</p>" dbg(s["comment"]) } return comments end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def liste()\n puts(\"LISTE DES ORDRES\\n\");\n printf(\"%8s %8s %5s %10s\\n\",\n \"ID\", \"DEBUT\", \"DUREE\", \"PRIX\")\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\")\n @listOrdre = @listOrdre.sort{ |a,b| a.debut <=> b.debut } \n @listOrdre.each { |ordre| afficherOrdre(ordre) }\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\");\n end", "def obtener_lista\n\t\tsendM(\"obtener_lista\")\n\tend", "def list\n order_items\n end", "def listeDesQuestions\n questions = GroupeQuestion.where(etat: false).order('sondage_id ASC, ordre ASC')\n end", "def list\n end", "def list\n end", "def list\n end", "def list\n\n end", "def list\n @list\n end", "def list\n return @lists\n end", "def listeDesQuestions\n questions = QuestionOuverte.where(etat: false).order('sondage_id ASC, ordre ASC')\n end", "def organisers_as_list(logged_in = false)\n list = organisers.shuffle.map do |o|\n organiser = ActionController::Base.helpers.link_to(o.full_name, o.twitter_url)\n organiser << \" - #{o.mobile}\" if logged_in && model.future? && o.mobile\n content_tag(:li, organiser)\n end.join.html_safe\n if list.blank?\n list = content_tag(:li, 'Nobody yet')\n end\n content_tag(:ul, list)\n end", "def list\n return @list\n end", "def list\n get()\n end", "def ordered_list; end", "def get_items\r\n @list\r\n end", "def list; end", "def list; end", "def list; end", "def list; end", "def list; end", "def get_list\n \t@items\n end", "def list_items\r\n list = \"\"\r\n items.each{ |item| list = list + item.name + \"\\n\"}\r\n list\r\n end", "def lister( les_emprunts )\n liste_emprunts = les_emprunts.select{|e| OPTIONS[:inclure_perdus] ? true : not(e.perdu?) }\n liste_emprunts = liste_emprunts.map{|e| e.to_s(OPTIONS[:format])}\n\n [les_emprunts, liste_emprunts.join(\"\\n\")]\nend", "def list\n @@list\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n super\n end", "def list\n call! :list\n end", "def list\n self.class.list\n end", "def lister( les_cours )\n \n recup = recuperer_option \n format = recup[0]\n sep = recup[2]\n if !recup[1].nil?\n cours = les_cours.sort_by(&:sigle)\n end\n \n cours ||= les_cours.select{|c| c.actif?}\n sep ||= CoursTexte::SEPARATEUR_PREALABLES\n cours =cours.sort_by(&:sigle)\n cours.each { |e| puts e.to_s(format, sep) }\n \n return [les_cours, nil]\n \nend", "def get_content\n @list \n end", "def list\n @List\n end", "def list\n raise NotImplementedError\n end", "def list\n @client.call(method: :get, path: 'recipient-lists')\n end", "def listar\n @todos_los_tipos = TipoComida.all.order(id: :asc)\n @titulo_link = \"Registrar nuevo tipo de comida\"\n end", "def list \n @@Ordenadores\n end", "def index\n @trennzeichen_liste = [\",\",\";\"]\n end", "def list(*) end", "def lists\n client.get_lists\n end", "def getListeCase()\n return @listeCase\n end", "def list\n ret = get('/')\n return [] if ret.kind_of?(Hash)\n ret.lines.map{|i|i.chomp}\n end", "def lists\n @lib.lists\n end", "def lista\n @receitas = Receita.all\n\n respond_to do |format|\n format.html # lista.html.erb\n format.xml { render :xml => @receitas }\n end\n end", "def movie_list\n self.lists\n end", "def list\n only.to_a\n end", "def get_items\n\t\treturn @list\n\tend", "def entries\n @list\n end", "def dodaj_do_listy(*jid)\n\tkontakty(*jid) do |kontakt|\n\t\tnext if subskryp?(kontakt)\n\t\tkontakt.autoryzacja\n\tend\n end", "def list\n @list ||= begin\n drequest = {\n where: {owner_id: owner.id},\n colonnes: []\n }\n dbtable_frigo_discussions.select(drequest).collect do |hdis|\n dbtable_frigo_messages.count(where:{discussion_id: hdis[:id]}) > 0 || next\n Frigo::Discussion.new(hdis[:id])\n end.compact\n end\n end", "def command_list m\n get_list escape m.channel.to_s #logic/pug\n end", "def all\n @list\n end", "def list \n @comment = Comment.all\n end", "def list\n puts \"\\n\\n#{Job.count} job postings found\\n\\n\"\n Job.list.map do |job|\n puts \"#{job.id}. #{job.firstline}\"\n end\n puts menu\n end", "def list\n @list ||= manager_list\n end", "def get_lists()\n lists = api_request(\"list\")\n return lists.split(\"\\n\")\n end", "def list\n @list ||= []\n end", "def list\n @list ||= []\n end", "def get_list \n\t\tlist = cookies[:\"eList\"] # liest Rohdaten (string) aus cookie\n\t\tif list == nil # Liste ist leer \n\t\t\tlist = Array.new # erzeuge neue Liste \n\t\telse # Liste enthält Eintrag \n\t\t\tif list.length > 0 \n\t\t\t\tlist = list.split(\" \") #erzeuge lesbare Liste (Array) aus Rohdatensatz\n\t\t\telse\n\t\t\t\tlist = Array.new \n\t\t\tend \n\t\tend \n\t\treturn list \n\tend", "def list\n @element.content.map do |paragraph_element|\n line_item = paragraph_element.content.map do |text_element|\n text_exporter.new(text_element).export\n end.join\n\n \"<li>#{line_item}</li>\"\n end.join\n end", "def index\n @membres = Membre.order('nom, prenom')\n\n end", "def display_list(teampaks)\n i = -1\n @data.list = list = teampaks.map do |mem|\n i += 1\n creator = mem.creator.contact\n { \n \"mem_id\" => mem.mem_id,\n \"full_passport\" => mem.full_passport,\n \"mem_name\" => mem.mem_name,\n \"mem_schoolname\" => mem.mem_schoolname,\n \"coordinator\" => creator.con_name,\n \"con_city\" => creator.mail.add_city,\n \"con_zip\" => creator.mail.add_zip,\n \"reg_#{i}\" => mem.mem_region,\n \"i\" => i,\n }\n end\n\n common_display(list, false)\n end", "def list\n puts \"Here is a list of all the Voters!\"\n puts \"\"\n @voters.each do |voter|\n puts \"Voter: #{voter[:name]}, #{voter[:affiliation]}\"\n end\n puts \"Here is the list of all the Politicians!\"\n puts \"\"\n @politicians.each do |politician|\n puts \"Politician: #{politician[:name]}, #{politician[:affiliation]}\"\n end\n end", "def list_by_nome(nome)\n params = Hash.new\n params[:nome] = nome\n self.list(params)\n end", "def lista(contatos)\n\tfor i in 0..contatos.size-1\n\t\tputs (\"#{i+1}. #{contatos[i].nome}\")\n\t\ti = i + 1\n\tend\nend", "def index\n list\n end", "def index\n list\n end" ]
[ "0.65208894", "0.6497185", "0.64436233", "0.63333046", "0.62906855", "0.62906855", "0.62906855", "0.62155735", "0.6199007", "0.6176992", "0.615173", "0.61489713", "0.6137061", "0.608948", "0.60541594", "0.6036336", "0.6027775", "0.6027775", "0.6027775", "0.6027775", "0.6027775", "0.60239524", "0.60022956", "0.5990746", "0.59820855", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.59781003", "0.5944692", "0.5941784", "0.59284896", "0.5925798", "0.5921009", "0.5915464", "0.58536714", "0.5826348", "0.58213377", "0.58093673", "0.5798148", "0.57919675", "0.5790902", "0.5778345", "0.57775146", "0.5762697", "0.5741248", "0.5724576", "0.5724374", "0.5704999", "0.567977", "0.5667485", "0.56615967", "0.56533474", "0.5647534", "0.5642533", "0.5642346", "0.5640885", "0.56129664", "0.56129664", "0.5604296", "0.556233", "0.555448", "0.5554146", "0.5548809", "0.55314285", "0.5525916", "0.5523886", "0.5523886" ]
0.63654304
4
Returner en liste av enrollments i seksjon sid.
def getEnrollmentsInSection(sid) uri = sprintf("/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999", sid) enrollments = $canvas.get(uri) return enrollments end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n set_enrolment\n if @enrolment\n @student_ids = @enrolment.student_ids\n else\n @student_ids = StudentId.all\n @notice = \"Displaying All Ids\"\n end\n end", "def lasids\n render json: Student.all.pluck(:local_id) # not just active students\n end", "def lasids\n render json: Student.pluck(:local_id)\n end", "def students \n sk = Sektion.where(:teacher_id => self.id).map(&:id)\n sids = StudentRoster.where(:sektion_id => sk).map(&:student_id).uniq\n return Student.where(:id => sids)\n end", "def index\n @enrolments = Enrolment.includes(:student, course: { enrolments: :student }).all\n end", "def index\n @enrollments = Enrollment.joins(:course, :student).select('enrollments.id, enrollments.course_id, courses.course_name, courses.semester, students.first_name, students.last_name, enrollments.student_id').reorder('last_name ASC')\n if (params.has_key?(:semester))\n if (params[:semester] != 'all')\n @enrollments = @enrollments.where(courses: { semester: params[:semester] })\n end\n end\n\n if current_student\n @enrollments = @enrollments.where(enrollments: { student_id: current_student.id })\n end\n end", "def seniors\n # Faire une liste approximative de la db\n @membres = Membre.where(\"naissance < ?\", Date.civil(Date.today.year - 60, 12, 31).to_formatted_s(:db)).order('nom, prenom').to_a\n @membres.reject! { |m| !m.senior? } unless @membres.empty?\n end", "def student_ids\n ids = []\n scores_table = frm.table(:id=>\"editTotalResults:totalScoreTable\").to_a\n scores_table.delete_at(0)\n scores_table.each { |row| ids << row[1] }\n return ids\n end", "def list_engeeners\n @all_users = Engeener.find(:all)\n end", "def semList\n @semesters = Semester.all\n authorize @semester\n end", "def ssids\r\n SsidsController.instance\r\n end", "def entailments\n _entailments\n end", "def entailments\n _entailments\n end", "def show_enrolled_courses\n EnrolledCourse.where(student: self).order(:course_id).map(&:course)\n end", "def article_ids\n query('SELECT Id FROM KnowledgeArticle').map(&:Id)\n end", "def ordered_ids\n Array(solr_document[\"member_ids_ssim\"])\n end", "def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end", "def index\n @seshes = current_user.seshes\n end", "def index\n @daw_rol_pers_inscs = DawRolPersInsc.all\n end", "def to_s\n\ts = \"\\nLista de Individuos y sus alimentos\\n\"\n for j in 0..@individuos.length-1\n s << @individuos[j].to_s + \"\\n\"\n end\n s\n end", "def show\n\t @allenrolls = @course.enrolls\n\n end", "def dodaj_do_listy(*jid)\n\tkontakty(*jid) do |kontakt|\n\t\tnext if subskryp?(kontakt)\n\t\tkontakt.autoryzacja\n\tend\n end", "def students\n Rollcall::Student.find_all_by_school_id schools\n end", "def ids\n @schedules.map(&:id)\n end", "def set_listas\n #@locais = Local.all.map{|l| [l.nome,l.id]}\n @locais = Local.all\n @periodos = ['Manhã','Tarde','Noite']\n @publicos = ['Infantil','Adulto']\n end", "def enrollees\n @course_all_enrollees ||= courses.collect{|c| c.course.all_enrollees}\n @enrollees ||= (@course_all_enrollees + extra_enrollees).flatten.uniq #.sort{|x,y| x.fullname <=> y.fullname rescue -1}\n end", "def alias_ids\n investments.map(&:entity_id)\n end", "def lister( les_emprunts )\n liste_emprunts = les_emprunts.select{|e| OPTIONS[:inclure_perdus] ? true : not(e.perdu?) }\n liste_emprunts = liste_emprunts.map{|e| e.to_s(OPTIONS[:format])}\n\n [les_emprunts, liste_emprunts.join(\"\\n\")]\nend", "def index\n @seihinns = Seihinn.all\n end", "def sondagesParAdmin\n sondages = SondageService.instance.listeDesSondagesParAdmin(params[:id])\n render json: sondages, status: :ok\n end", "def get_students\n StudentInCourse.where(:course_id => id).collect(&:user_id)\n end", "def item_list\n list = Array.new;\n\n if @inv.respond_to?(\"each\")\n @inv.each do |invItem|\n list.push(invItem.first_id)\n end\n end\n \n return list.join(\", \");\n end", "def staff_ids\n return @staff_ids\n end", "def salons\n FindSalon::Salon.all.map do |salon|\n salon.id.to_s + ' ' + salon.name + ' | ' + 'Rating: ' + salon.rating.to_s + ' | ' + 'Address: ' + salon.vicinity\n end\n end", "def index\n @solicitacao_repasses = SolicitacaoRepasse.all\n @solicitacoes = []\n @solicitacao_repasses.each { |solicitacao|\n @encomenda = EntregaExterna.find(params[:id], solicitacao.entrega_externa_id)\n if !@current_user.isMorador || @encomenda.encomenda.usuario.id == @current_user.id\n @solicitacoes.push(solicitacao)\n end\n }\n @solicitacao_repasses = @solicitacoes\n end", "def index\n @enrollments = Enrollment.all\n end", "def index\n @enrollments = Enrollment.all\n end", "def index\n @enrollments = Enrollment.all\n end", "def index\n @enrollments = Enrollment.all\n end", "def index\n @enrollments = @parent.enrollments.all\n end", "def students\n course_enrollments.where(course_role: CourseRole.student).map(&:user)\n end", "def parties(session_id)\n fetch \"eksport/partier/?sesjonid=#{session_id}\"\n end", "def list_nurse_info\n\n end", "def episode_list(sid)\n xml = get('/feeds/episode_list.php', :query => {:sid => sid})\n xml[\"Show\"]\n end", "def idols_data\n\n\t\t[[ \"Last name\", \"First name\", \"Description\" ]] + [[ @view_context.number_to_currency(1), 2, 3] ] +\n\t\t@idols.map { |idol| [idol.last_name, idol.first_name, idol.talents.first.description] }\n\n\tend", "def index\n @enrollements = Enrollement.all\n end", "def index\n @studens = Studen.all\n end", "def sellers(ids)\n list_sellers = []\n ids.each do |id|\n list_sellers << Seller.find(id)\n end\n list_sellers\n end", "def ids\n pluck(:id)\n end", "def index\n @sekilas_infos = SekilasInfo.all\n end", "def kenim_ids\n @kenim_ids = []\n kenim.each do |k|\n @kenim_ids.push( k._id )\n end\n return @kenim_ids\n end", "def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end", "def index\r\n @sivic_fornecedors = SivicFornecedor.where(sivic_igreja_id: current_user.sivic_pessoa.sivic_igreja_id)\r\n end", "def index\n @empleado = Empleado.find(params[:empleado_id])\n @incidencia_empleados = @empleado.incidencia_empleados.all\n end", "def rooms_list\n\t\t\t@rooms.map {|room| \"Room: #{room.id}\"}.join(\", \")\n\t\tend", "def show\n @lokasis = Rute.select(\"id_jalan\").uniq\n end", "def students\n self.course_person.all(:type => \"student\").persons\n end", "def student_list\n\t\t@student_list ||=[]\nend", "def list_ids\n @documents.keys\n end", "def show\n\t@enrollments = Enrollment.where(:participantID => @participant.participantID)\n end", "def index\n @semestres = Semestre.all\n end", "def index\n raise SecurityTransgression unless Enrollment.can_be_read_by? current_user\n @enrollments = Enrollment.all\n end", "def current_room_sessionids \n result = []\n peeps = simperson.simplace.simpeople\n peeps.each do |aperson|\n result << aperson.simcharacter.simplayer.sessionid if aperson.simcharacter.simplayer.online == true\n end\n result\n end", "def list \n @@Ordenadores\n end", "def getMissionIds\n now = Time.zone.now #time in UTC 00\n missionsArray = Mission.where \"start < ? AND ? < end\", now, now\n return missionsArray.map { |m| m.id.to_s}\n end", "def sale_entities\n redis.smembers(\"#{Porp.ns}:stockentity:id:#{id}:saleentities)\")\n end", "def ids\n root.ids\n end", "def all_subjects\n Subject.current.where(site_id: all_editable_sites.select(:id))\n end", "def index\n @sesions = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).all\n @suplente = Suplente.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sesions }\n end\n end", "def index\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n\n @students = $selected_course.students.collect{|student| {name: student.first + ' ' + student.last, student_id: student.id }}\n end", "def enrollment(list)\n\tlist.each do |key, value|\n\t\tputs \"#{key}: #{value} students\"\n\tend\n\tputs \"------------------------\"\nend", "def students\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n student_ids = Array.new\n @courses.each{ |c|\n student_ids.push(c.courseStudents)\n }\n student_ids.each{ |array|\n array.each{ |student|\n @students.push(student)\n }\n }\n @students.uniq!\n end", "def journal_ids\n j_ids = \n if self.has_access?(:journal_show_all)\n journal_ids = Rails.cache.fetch(\"journal_ids_user_#{self.id}\") { Journal.all(:select => \"id\") }\n elsif self.has_access?(:journal_show_centeradm)\n journal_ids = Rails.cache.fetch(\"journal_ids_user_#{self.id}\") { Journal.in_center(self.center).all(:select => \"id\") }\n elsif self.has_access?(:journal_show_member)\n group_ids = self.group_ids(:reload => true) # get teams and centers for this users\n journal_ids = Rails.cache.fetch(\"journal_ids_user_#{self.id}\") { Journal.all_parents(group_ids).all(:select => \"id\") }\n elsif self.has_access?(:journal_show_none)\n []\n else # for login-user\n [] # or should it be the journal the login_user is connected to?\n end\n return j_ids.map {|j| j.id}\n end", "def venue_listed(id, options = {})\n get(\"venues/#{id}/listed\", options).lists\n end", "def ids\n @ids ||= []\n end", "def ssu_ids\n dwelling_units.map(&:ssu_id).compact.uniq\n end", "def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end", "def students # Want: student id and student names on Users Table\n return User.joins(:sections).where(:sections => {:id => self.id}).all\n end", "def show\n @onscrits = Onscrit.order(nom: :asc).to_a\n @votes = Vote.where('pg_id ='+session[:pg_id].to_s+' AND sondage_id ='+@sondage.id.to_s).to_a\n end", "def index\n # @sesiunes = Sesiune.all\n end", "def list\n \n @lesson = Lesson.sorted.where(:subject_id => @subject.id) #@subjects= instance variable, Subject = Model name, subjects =table name\n # @subjects_list = Subject.all\n end", "def ids\n if Array === key\n Stal.solve(redis, key)\n else\n key.call(\"SMEMBERS\")\n end\n end", "def identifier_list(*ids, **opt)\n cid = current_id.presence\n ids = params.values_at(*id_param_keys) if ids.blank?\n super(ids, **opt).tap do |result|\n result.map! { |v| CURRENT_ID.casecmp?(v) ? cid : v } if cid\n end\n end", "def index\n @enrolls = Enroll.all\n end", "def subject_ids\n self.get_civet_outputs.map(&:dsid)\n end", "def list(eid: :unset, sim_sid: :unset, status: :unset, limit: nil, page_size: nil)\n self.stream(\n eid: eid,\n sim_sid: sim_sid,\n status: status,\n limit: limit,\n page_size: page_size\n ).entries\n end", "def section_ids\n sections.map { |co| co.id }\n end", "def infosSauvegardes\n\t\n return requete(\"SELECT nompartie, nomgrille, taillegrille, jokersRestants, grillejouee.datemaj FROM grillejouee INNER JOIN grilleediter ON grillejouee.idGrille=grilleediter.id WHERE joueur = #{@profil.getStats[\"id\"]}\")\n\tend", "def emprunts_de( nom )\n Debug.log( \"Biblio#emprunts_de( #{nom} )\" )\n\n les_emprunts.\n selectionner { |e| e.nom == nom }.\n map{ |e| e.titre }.\n sort\n end", "def commonsubject_lecturer_programmeid_list\n unit = Login.current_login.staff.position.unit\n current_lecturer = Login.current_login.staff.id\n common_subjects = [\"Sains Perubatan Asas\", \"Anatomi & Fisiologi\", \"Sains Tingkahlaku\", \"Komunikasi & Sains Pengurusan\"]\n is_common_lecturer = Position.find(:all, :conditions=>['unit IN(?) and staff_id=?', common_subjects, current_lecturer])\n if is_common_lecturer.count>0\n return Programme.roots.map(&:id) #shall return this [1, 3, 4, 5, 14, 13, 2, 67, 12, 6, 7, 9, 11, 10, 185, 1697, 1707, 1709, 8]\n else\n return []\n end\n end", "def ids\n @ids ||= term.list_ids.sort\n end", "def lists\n @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id)\n end", "def lessons\n Lesson.joins(course: [ { enrollments: :student } ]).where(enrollments: { student_id: id })\n end", "def list_students_by(year=Date.today.to_s[0,4])\n\t\t#pesquisar por ano e depois pedir os alunos\n\n\t\tclassroom = Classroom.find(:first, :conditions => \"year='#{year}' AND name='#{self.name}'\" )\t\t\n\t\treturn classroom.students\n\tend", "def students\n users\n end", "def usun_z_listy(*jid)\n\tkontakty(*jid) do |usun|\n\t\tusun.usun_subskrypcje\n\t\treq=Iq.new_rosterset\n\t\treq.query.add(Roster::RosterItem.new(usun.jid,nil,:remove))\n\t\twyslij(req)\n\tend\n end", "def registered_lists\n List.registered(id)\n end", "def educators_index\n index = {}\n Educator.all.each do |educator|\n index[educator.id] = educator\n end\n index\n end", "def get_identifiers\n identifiers = publication_identifiers.map{|pi| pi.identifier_value}\n identifiers.push(self.isbn) unless !self.isbn\n identifiers.push(self.issn) unless !self.issn\n identifiers.push(self.eissn) unless !self.eissn\n identifiers.push(self.article_number) unless !self.article_number\n return identifiers\n end" ]
[ "0.64046454", "0.6375124", "0.6124821", "0.5792812", "0.570467", "0.5677944", "0.566025", "0.5618372", "0.5605166", "0.55899096", "0.5575739", "0.55582684", "0.55582684", "0.5548243", "0.55336076", "0.55238193", "0.55145574", "0.55104864", "0.55036575", "0.5492298", "0.54755074", "0.546778", "0.5445393", "0.5425823", "0.54133207", "0.54058677", "0.54042214", "0.53966576", "0.5395739", "0.53621197", "0.5357612", "0.5353351", "0.5351819", "0.5347241", "0.53349334", "0.5330949", "0.5330949", "0.5330949", "0.5330949", "0.53278726", "0.53275734", "0.53275484", "0.53208774", "0.5320531", "0.53168786", "0.5315041", "0.5311311", "0.53040147", "0.52980447", "0.5293203", "0.52745765", "0.526775", "0.52633387", "0.52565765", "0.525257", "0.5241685", "0.5239482", "0.5234276", "0.5233372", "0.5228949", "0.5226385", "0.52214265", "0.5218814", "0.52180254", "0.52177745", "0.5215216", "0.5211803", "0.5208911", "0.5204408", "0.5200995", "0.5197762", "0.5196749", "0.51931983", "0.5187282", "0.51861894", "0.51843125", "0.51843077", "0.5182093", "0.51815456", "0.5160663", "0.5158373", "0.51568604", "0.51502705", "0.51404184", "0.5140399", "0.51402986", "0.5137935", "0.51322395", "0.51313365", "0.5127615", "0.51265746", "0.5125362", "0.5116672", "0.5115374", "0.51088023", "0.5105876", "0.51015466", "0.5100905", "0.5098385" ]
0.66680396
1
Create all screenshots for the Scrollytelling.
def create_all! if title_card_path.exist? Dir .glob(story.screenshots.join("*page*.png")) .sort_by { |path| path.scan(/\d+/).first.to_i } .each do |path| path.slice! File.extname(path) # drop the extension @paths[:pages] << absolute(path) # store the result in the index end return end FileUtils.mkdir_p story.screenshots browser.add_script_tag content: <<~JS pageflow.ready.then(function() { $('.multimedia_alert').remove() }) JS # Grab all navigable pages. browser.goto story.url sleep 10 pages = browser.css('#scrollytelling-navigation a') puts "#{pages.length} screenshots in #{story.screenshots}" pages.each_with_index do |link, index| perma_id = link.attribute('href')[/#(\d*)\z/, 1] url = [story.url, link.attribute('href')].join filename = [story.slug, 'page', index + 1, "#{perma_id}.png"].join('-') next if File.exist?(story.screenshots.join(filename)) print "#{url} " browser.goto url sleep 3 until browser.at_css('body').attribute('class').include? 'finished-loading' sleep 1 end browser.screenshot(path: story.screenshots.join(filename)) @paths[:pages] << absolute(story.screenshots.join(filename)) puts "✅ #{filename}" end # Grab the opening page; when this exists, all screens are complete. browser.goto story.url sleep 10 browser.screenshot(full: true, path: title_card_path) @paths[:title] = absolute(title_card_path) browser.quit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_screenshot\n Logbook.step('Taking a screenshot of a result page')\n @browser.save_screenshot(\"screenshots/screenshot - #{Time.now.strftime('%Y-%m-%d %H-%M-%S')}.png\")\n end", "def screenshots(num_thumbnail_imgs)\n puts \"transcoded_movie thumbnail generation\"\n\t puts \"number of thumbnails #{num_thumbnail_imgs}\"\n\t \n\t \n\t #skipping some frames from begining and ending to take screenshots\n\t init_time = 15\n seek_t = ($transcoded_movie.duration - init_time*2) / num_thumbnail_imgs.to_i\n \t \n\t \n\t i = 0\n\t \n\t while i < num_thumbnail_imgs.to_i do\n filename = \"thumbnail_#{i}.jpg\"\n \n \t #, preserve_aspect_ratio: :width\n # keeping 160x90 to preserve aspect ratio 16:9 \n\t\t \n\t\t puts \"generating #{filename}\"\n \n\t\t $transcoded_movie.screenshot(filename, seek_time: (init_time + seek_t * i), resolution: '160x90')\n\t\t i += 1\n end #end while\t \n end", "def screenshot\n Screenshot.new self\n end", "def screenshot_large\n screenshot()\n end", "def screenshot\n dname = Document.name.get[0][0..-5]\n a = File.open(\"/tmp/skim-#{dname}-tmp\",\"a\")\n page = Document.get[0].current_page.get.index.get\n\n curfile = File.last_added(\"#{Home_path}/Desktop/Screen*.png\")\n a << \"#{curfile},#{page}\\n\"\n growl(\"One picture added to wiki notes cache\")\nend", "def create_screenshots(project_id, params = {})\n c_r Lokalise::Resources::Screenshot, :create, project_id, params, :screenshots\n end", "def take_multiple_screens(circles, delay, pre_pause)\n sleep(pre_pause) unless pre_pause.nil?\n create_screenshot_path\n circles.times do |index|\n World.take_screenshot(path: @ocr_screenshots_path,\n file_name: \"rec_#{index}.png\")\n sleep(delay) unless delay.nil?\n end\n end", "def saos\n save_and_open_screenshot\n end", "def create_screenshot_path\n @ocr_screenshots_path =\n File.join(Dir.tmpdir, 'screen_element', 'ocr_screenshots')\n FileUtils.rm_r @ocr_screenshots_path if Dir.exist?(@ocr_screenshots_path)\n FileUtils.mkdir_p @ocr_screenshots_path\n end", "def XOtakeScreenShot()\n\t\tbegin\n\t\t\tif(@brTypeSym== :chrome)\n\t\t\t\twidth = @wwBrws.execute_script(\"return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);\")\n\t\t\t\theight = @wwBrws.execute_script(\"return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);\")\n#\n# Add some pixels on top of the calculated dimensions for good\n# measure to make the scroll bars disappear\n#\n\t\t\t\t@wwBrws.window.resize_to(width+100, height+100)\n\t\t\tend\n\n\t\t\timgName= $gcfd.report_path+@wwBrws.url.tr(\" =%?*/\\\\:&~\",'_')[0..100]+Time.now.to_i.to_s+'.png'\n\t\t\t@wwBrws.screenshot.save imgName\n\t\t\t@screenList << imgName\n\t\t\t$alog.lwrite(('Image saved in '+imgName), 'DEBG')\n\t\t\tres= OK\n\t\trescue\n\t\t\t$alog.lwrite('Problems taking screenshots: '+$!.to_s, 'ERR_') \t\t\t\t#\n\t\t\tres= CRITICAL\n\t\tend\n\t\treturn res\n\tend", "def create_screenshots(project_id, req_params)\n name = 'Screenshots'\n params = { query: project_id, req: req_params.to_array_obj(:screenshots) }\n\n data = endpoint(name: name, params: params).do_post\n\n collection name, data\n end", "def take_screenshot(_scenario)\n screenshot_dir = \"#{FigNewton.screenshot_directory}/#{$date_and_time}\"\n FileUtils.mkdir screenshot_dir unless File.directory? screenshot_dir\n encoded_img = @browser.driver.screenshot_as(:base64)\n embed(\"data:image/png;base64,#{encoded_img}\", 'image/png')\nend", "def save_screenshot\n @suite.p \"-- CAPTURE SCREENSHOT ::\"\n begin\n screenshot_flag = true\n filename = (ENV['REPORTS_DIR'] + \"/\" + self.class.name + '.png')\n @suite.capture_screenshot(filename)\n @suite.p \"-- SCREENSHOT CAPTURED TO: {#{filename}}\"\n screenshot_flag = false\n rescue => e\n if screenshot_flag\n @suite.p \"FAILED TO CAPTURE SCREENSHOT: \"\n @suite.p e.inspect\n @suite.p e.backtrace\n end\n end\n end", "def screenshot_small\n screenshot(:small)\n end", "def makeScreenShot(urlArray)\n urlArray.each do |item|\n puts \"Item: \"+item\n cmd = \"webkit2png -W 1366 -D \"+@outputDirectory+\" -F \"+item\n\n Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|\n puts \"stdout is:\" + stdout.read\n puts \"stderr is:\" + stderr.read\n end\n\n puts green('Done...')\n sleep(@screenShotSleepTime)\n end\n end", "def create_screenshot(screenshot)\n @sceenshot = Sprite.new(@viewport).set_bitmap(screenshot)\n @sceenshot.set_origin(@viewport.rect.x, @viewport.rect.y)\n @sceenshot.zoom = Graphics.width / screenshot.width.to_f\n end", "def start_all\n UiChanged::Screenshot.async_crawl_and_compare\n head :ok\n end", "def create_screenshot_graphic\n @screenshot_loaded = false\n @screenshot = Sprite.new(@viewport)\n @screenshot.opacity = 0\n end", "def create_graphics\n create_viewport\n create_base_ui\n create_credit_payout\n create_bands\n end", "def take_screenshot(scenario)\r\n screen_name = \"log/screens/\" +scenario.name+\".png\"\r\n page.save_screenshot(screen_name) rescue nil\r\n embed(screen_name, 'image/png') rescue nil\r\nend", "def add_screenshot(scenario)\n nome = scenario.name.tr(' ', '_').downcase!\n captura = page.save_screenshot(\"log/screenshots/#{nome}.png\")\n attach(captura, 'image/png')\nend", "def capture\n for i in 0..49\n\t open(\"tempImages/image#{i}.png\", 'wb') do |file|\n\t file << open('http://hq.cirrusmio.com:82/media/?action=snapshot', http_basic_authentication: [\"admin\", \"admin\"]).read\n\t sleep(0.2)\n\tend\n end\n end", "def save_screenshot\n browser.screenshot.save(\"#{report_dir}/shot#{timestamp}.png\")\n end", "def create_graphics\n create_viewport\n @all_window = UI::SpriteStack.new(@viewport)\n create_background\n create_windows\n @all_window.each { |window| window.visible = false } if @delete_game\n @max_index = @all_window.size - 1\n Graphics.sort_z\n refresh\n end", "def create_image_from_screenshot\n type = @desktop_image.split(/\\./).last\n `screencapture -t#{type} -x #@desktop_image`\n end", "def screenshot path = '~/Desktop'\n capture_screen self, path\n end", "def take_screenshot(scenario)\r\n scenario_name = \"#{scenario.name}_step\"\r\n sshot_name = \"log/screens/\" + scenario_name +\".png\"\r\n @browser.screenshot.save(sshot_name) rescue nil\r\n embed(sshot_name, 'image/png') rescue nil\r\nend", "def create_tiles\n # Screen fits exactly 15x10 tiles (for 480x320), but it has a buffer around it\n # so the game has time to refresh without showing a black border during movement.\n tiles = []\n (TOTALSIZE).times { tiles << TileSprite.new($visuals.viewport) }\n @array = tiles\n startx = $visuals.map.real_x / -32 - 1\n starty = $visuals.map.real_y / -32 - 1\n for y in 0...YSIZE\n for x in 0...XSIZE\n mapx = startx + x\n mapy = starty + y\n idx = x + y * XSIZE\n @array[idx].real_x = $visuals.map.real_x + mapx * 32\n @array[idx].real_y = $visuals.map.real_y + mapy * 32\n draw_tile(@array[idx], mapx, mapy)\n end\n end\n $temp_bitmaps = nil\n # Don't dispose the bitmaps hash because tiles reference these instances; they're not clones.\n end", "def screen_shot(title)\n $marathon.clearAssertions\n begin\n yield if block_given?\n ensure\n $marathon.saveScreenShotToReport(title)\n end\nend", "def screen_shot(title)\n $marathon.clearAssertions\n begin\n yield if block_given?\n ensure\n $marathon.saveScreenShotToReport(title)\n end\nend", "def create_graphics\n create_viewport\n create_spriteset_and_background\n create_action_sprites(@viewport.rect.width / 2)\n create_selection\n end", "def create_graphics\n create_viewport\n create_base_ui\n create_pocket_ui\n create_scroll_bar\n create_bag_sprite\n create_item_list\n create_arrow\n create_info\n create_shadow\n create_search\n create_frame # Should always be last\n end", "def screenshot(driver,sess_time,shot_num,descr)\n filename = \"shot-#{shot_num}-#{driver.current_url.sub(\"http://\",\"\").sub(\"admin:123@\",\"\").gsub(\"/\",\"-\")}-(#{descr})-#{sess_time}.png\"\n # driver.save_screenshot (\"shot-#{shot_num}-#{driver.current_url.sub(\"https://format-staging.com/\",\"\").gsub(\"/\",\"-\")}-(#{descr})-#{sess_time}.png\")\n driver.save_screenshot(filename)\n # puts (\" 📸 Shot #{shot_num} (#{driver.current_url})\")\n puts (\" 📸 #{filename}\")\n return 1\nend", "def run\n super\n\n uri = _get_entity_attribute \"name\"\n filename = \"screenshot_#{rand(100000000000000)}.png\"\n full_path = \"#{Dir.pwd}/public/screenshots/#{filename}\"\n\n begin\n @task_log.log \"Saving to... #{full_path}\"\n\n f = Screencap::Fetcher.new(uri)\n screenshot = f.fetch(\n :output => full_path, # don't forget the extension!\n # optional:\n #:div => '.header', # selector for a specific element to take screenshot of\n #:width => 1024,\n #:height => 768,\n #:top => 0, :left => 0, :width => 100, :height => 100 # dimensions for a specific area\n )\n\n @task_log.good \"Saved to #{full_path}\"\n _create_entity \"Screenshot\", :name => \"#{uri}_screenshot\", :uri => \"#{$intrigue_server_uri}/screenshots/#{filename}\"\n\n rescue Screencap::Error => e\n @task_log.error \"Unable to capture screenshot: #{e}\"\n end\n\n end", "def create_graphics\n create_viewport\n create_base_ui\n create_sub_background\n create_trainer_sprite\n create_badge_sprites\n create_texts\n end", "def create_graphics\n super()\n create_background\n create_type_background\n create_pokemon_battler_stack\n create_pokemon_text_boxes\n create_congratulation_text_boxes\n create_pokemon_stars_animation\n create_graveyard_anim\n create_turning_ball\n create_party_battler_stack\n create_league_champion_text_box\n create_trainer_infos_text_box\n create_end_stars\n end", "def prepare_drawings # :nodoc:\n chart_ref_id = 0\n image_ref_id = 0\n drawing_id = 0\n ref_id = 0\n image_ids = {}\n header_image_ids = {}\n background_ids = {}\n @worksheets.each do |sheet|\n chart_count = sheet.charts.size\n image_count = sheet.images.size\n shape_count = sheet.shapes.size\n header_image_count = sheet.header_images.size\n footer_image_count = sheet.footer_images.size\n has_background = sheet.background_image.size\n has_drawings = false\n\n # Check that some image or drawing needs to be processed.\n next if chart_count + image_count + shape_count + header_image_count + footer_image_count + has_background == 0\n\n # Don't increase the drawing_id header/footer images.\n if chart_count + image_count + shape_count > 0\n drawing_id += 1\n has_drawings = true\n end\n\n # Prepare the background images.\n if ptrue?(has_background)\n filename = sheet.background_image\n type, width, height, name, x_dpi, y_dpi, md5 = get_image_properties(filename)\n\n if background_ids[md5]\n ref_id = background_ids[md5]\n else\n image_ref_id += 1\n ref_id = image_ref_id\n background_ids[md5] = ref_id\n @images << [filename, type]\n end\n\n sheet.prepare_background(ref_id, type)\n end\n\n # Prepare the worksheet images.\n sheet.images.each_with_index do |image, index|\n filename = image[2]\n type, width, height, name, x_dpi, y_dpi, md5 = get_image_properties(image[2])\n if image_ids[md5]\n ref_id = image_ids[md5]\n else\n image_ref_id += 1\n image_ids[md5] = ref_id = image_ref_id\n @images << [filename, type]\n end\n sheet.prepare_image(\n index, ref_id, drawing_id, width, height,\n name, type, x_dpi, y_dpi, md5\n )\n end\n\n # Prepare the worksheet charts.\n sheet.charts.each_with_index do |_chart, index|\n chart_ref_id += 1\n sheet.prepare_chart(index, chart_ref_id, drawing_id)\n end\n\n # Prepare the worksheet shapes.\n sheet.shapes.each_with_index do |_shape, index|\n sheet.prepare_shape(index, drawing_id)\n end\n\n # Prepare the header images.\n header_image_count.times do |index|\n filename = sheet.header_images[index][0]\n position = sheet.header_images[index][1]\n\n type, width, height, name, x_dpi, y_dpi, md5 =\n get_image_properties(filename)\n\n if header_image_ids[md5]\n ref_id = header_image_ids[md5]\n else\n image_ref_id += 1\n header_image_ids[md5] = ref_id = image_ref_id\n @images << [filename, type]\n end\n\n sheet.prepare_header_image(\n ref_id, width, height, name, type,\n position, x_dpi, y_dpi, md5\n )\n end\n\n # Prepare the footer images.\n footer_image_count.times do |index|\n filename = sheet.footer_images[index][0]\n position = sheet.footer_images[index][1]\n\n type, width, height, name, x_dpi, y_dpi, md5 =\n get_image_properties(filename)\n\n if header_image_ids[md5]\n ref_id = header_image_ids[md5]\n else\n image_ref_id += 1\n header_image_ids[md5] = ref_id = image_ref_id\n @images << [filename, type]\n end\n\n sheet.prepare_header_image(\n ref_id, width, height, name, type,\n position, x_dpi, y_dpi, md5\n )\n end\n\n if has_drawings\n drawings = sheet.drawings\n @drawings << drawings\n end\n end\n\n # Sort the workbook charts references into the order that the were\n # written from the worksheets above.\n @charts = @charts.select { |chart| chart.id != -1 }\n .sort_by { |chart| chart.id }\n\n @drawing_count = drawing_id\n end", "def create_graphics\n create_viewport\n create_base\n create_ui\n end", "def run\n super\n \n net_service = _get_entity_name\n \n target = net_service.split(\":\").first\n port = net_service.split(\":\").last.split(\"/\").first\n \n unless port == \"3389\"\n _log \"Incorrect RDP port! Will not perform certificate extraction.\"\n return\n end\n \n rdesktop_command = \"xvfb-run scrying -t rdp://#{target} -o /tmp/scrying_outputs\"\n _log \"Running: #{rdesktop_command}\"\n _unsafe_system(rdesktop_command)\n \n if File.file?(\"/tmp/scrying_outputs/rdp/#{target}-3389.png\")\n _log \"Found screenshot! Attaching to entity as detail\"\n # todo, set image as entity detail\n screenshot_image = Base64.strict_encode64(File.read(\"/tmp/scrying_outputs/rdp/#{target}-3389.png\"))\n _set_entity_detail \"extended_screenshot_contents\", screenshot_image\n _set_entity_detail \"screenshot_exists\", true\n\n \n # delete temporary screenshot file\n _unsafe_system(\"rm /tmp/scrying_outputs/rdp/#{target}-3389.png\")\n else\n _set_entity_detail \"screenshot_exists\", false\n end\n\n end", "def snagScreenshot\n thing = waitForObject(@symbolicName)\n image = grabWidget(thing)\n format = \"PNG\"\n ssName = thing.name + \".\" + format\n ssLoc = Log.testLogLocation\n image.save(ssLoc + ssName, format)\n Log.AppendLog(\"Taking screenshot of: \" + @name + \" symbolicName: \" + @symbolicName + \" and saving to Location: \" + ssLoc)\n return ssName\n end", "def create_graphics\n create_viewport\n create_background\n create_pokemon_sprite\n create_egg_sprite\n end", "def screenshot(name=\"screenshot\")\n page.driver.render(\"public/#{name}.jpg\",full: true)\n end", "def take_screenshot\n $browser.screenshot.save \"#{$image_folder}#{$testcase}_#{@var2}.png\"\n @var2+=1\n end", "def create_all_windows\n en_tm_sb_caw\n create_target_window\n end", "def save_screenshot(filename)\n file = File.join(\n @screen_dir,\n sanitize(filename.end_with?('.png') ? filename : \"#{filename}.png\")\n )\n\n dir = File.dirname(file)\n\n mkdir(dir) unless Dir.exist?(dir)\n\n driver.save_screenshot(file)\n end", "def screenshot(filename)\n platform.screenshot(filename)\n end", "def XOinitScreenShot()\n\t\t@screenList= Array.new\n\t\t$alog.lwrite('Image list cleared ', 'DEBG')\n\t\tres= OK\n\t\treturn res\n\tend", "def generate_wd_images rname=nil\n return {} unless rname\n \n start_time = Time.now\n \n @selected_room_name = rname\n @room_name = @selected_room_name.gsub('#', '_')\n # rinfo \"Starting Image generation : %s\"%(@selected_room_name)\n\n #Pre Operation things\n exception_raised = false\n #-----------Get previous stuffs--------------------------\n curr_active_layer = Sketchup.active_model.active_layer\n edge_render_option = Sketchup.active_model.rendering_options[\"EdgeColorMode\"]\n active_camera = Sketchup.active_model.active_view.camera\n cam_perspective = Sketchup.active_model.active_view.camera.perspective?\n unit_display = Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]\n\n Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]=true\n Sketchup.active_model.active_view.camera.perspective=false\n Sketchup.active_model.rendering_options[\"EdgeColorMode\"] = 0\n \n begin\n # puts \"--------------------------hide\"\n Sketchup::active_model::start_operation \"RIO Image Generation\"\n DP::hide_all_entities\n\n view_details_h = get_floor_view_comps\n \n view_details_h[\"top_view\"] = {:top_room_image => get_top_room_image}\n rescue Exception => e\n # rerror \"Exception raised during image generation\"\n raise e\n Sketchup.active_model.abort_operation\n exception_raised = true\n ensure\n DP::unhide_all_entities\n\n Sketchup.active_model.rendering_options[\"EdgeColorMode\"] = edge_render_option\n Sketchup.active_model.options[\"UnitsOptions\"][\"SuppressUnitsDisplay\"]=unit_display\n Sketchup.active_model.active_view.camera=active_camera\n Sketchup.active_model.active_view.camera.perspective=cam_perspective\n Sketchup.active_model.active_view.zoom_extents\n Sketchup.active_model.commit_operation\n end\n\n end_time = Time.now\n # puts \"Time taken : #{end_time - start_time}\"\n result = exception_raised ? {} : view_details_h\n end", "def screenshot rect = CGRect.new(CGPoint.new(0, 0), CGSize.new(-1, -1)),\n path = '~/Desktop'\n require 'accessibility/screen_shooter'\n ScreenShooter.shoot rect.to_rect, path\n end", "def create_graphics\n create_character_sprite\n create_phrase\n create_inputs\n refresh_chars\n end", "def save_image(class_name, test_case_method_name)\r\n if (WatirBrowser.ie?)\r\n #see if CC_BUILD_ARTIFACTS is set, used by cruise control server\r\n build_artifacts_folder = ENV['CC_BUILD_ARTIFACTS']\r\n if (not build_artifacts_folder.nil?)\r\n build_artifacts_folder = build_artifacts_folder.gsub(\"/\", \"\\\\\")\r\n end\r\n #if not set, see if TORNADO_TEST_IMAGE is set\r\n #developer can set this if they want to capture the images on their own machine\r\n if (build_artifacts_folder.nil?)\r\n build_artifacts_folder = ENV['TORNADO_TEST_IMAGE']\r\n end\r\n \r\n# build_artifacts_folder = \"c:\\\\railsproject\"\r\n unless (build_artifacts_folder.nil?)\r\n\r\n file_name = build_artifacts_folder+ \"\\\\\" + class_name + \"-\" + test_case_method_name.to_s + \".png\"\r\n \r\n if (File.exists?(file_name)) \r\n FileUtils.rm(file_name)\r\n end\r\n \r\n begin\r\n\r\n width, height, bitmap = Win32::Screenshot.desktop\r\n img = Magick::Image.from_blob(bitmap)[0]\r\n img.write(file_name)\r\n rescue Magick::ImageMagickError => e\r\n puts(\"cannot capture screen. Exception is \" + e.message)\r\n end\r\n \r\n # @screen_capture = Watir::ScreenCapture\r\n # @screen_capture.screen_capture(file_name, false, false) \r\n end\r\n end\r\n end", "def split_tile_set_into_tiles\n number_of_tiles = @tile_set[0].columns/32\n\n number_of_tiles.times do |i|\n image = @tile_set[0].crop((i*32), 0, 32, 32)\n image.write(\"media/tmp/tile#{i}.png\")\n end\n end", "def screenshots_dir\n File.join(@report_dir, \"screenshots\")\n end", "def realizarCapturaDePantalla\n self.getBrowser().screenshot.save(\"#{GEDORUTASCREENSHOT}GEDO_#{DateTime.now.strftime(\"%Y-%b-%d_%H%M%S\")}.png\")\n end", "def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend", "def draw_and_save_image\n\t\tcolor = @avatar[:color]\n\t\tpng = ChunkyPNG::Image.new(250, 250, ChunkyPNG::Color::WHITE)\n\t\tcolor = ChunkyPNG::Color.rgba(color[:r], color[:g], color[:b], color[:alpha])\n\t\t@colorable_grid.each do |points|\n\t\t\tp1 = points[0]\n\t\t\tp2 = points[1]\n\t\t\tpng.rect(p1[0], p1[1], p2[0], p2[1] , color, color)\n\t\tend\n\t\tpng.save(File.join(Dir.pwd, \"/#{@term}.png\"), :interlace => true)\n\tend", "def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend", "def testsnapshot(onwindow: false)\n baseImageName = \"AfterDrawSnapshot.jpg\"\n begin\n # 1. Create window or bitmap context. width: 800, height: 600\n bitmapObject = if onwindow\n SmigHelpers.create_window(width: 800, height: 600)\n else\n SmigHelpers.create_bitmapcontext(width: 800, height: 600)\n end\n\n # 2. Try and draw a snapshot\n didThrow = false\n begin\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n rescue RuntimeError => e\n # 3. Take note that drawing the snapshot failed.\n didThrow = true\n end\n\n # 3. Continued. Raise an exception if snapshot failed & exception not thrown\n unless didThrow\n raise \"Draw shapshot should have failed as no snapshot has been taken\"\n end\n\n if onwindow\n # Need to initialize the window to having a white background.\n windowRect = MIShapes.make_rectangle(size:{ :width => 800,\n :height => 600 },\n origin: { :x => 0, :y => 0 } )\n whiteColor = MIColor.make_rgbacolor(1.0, 1.0, 1.0)\n drawBackgroundElement = MIDrawElement.new(:fillrectangle)\n drawBackgroundElement.rectangle = windowRect\n drawBackgroundElement.fillcolor = whiteColor\n drawBackgroundCommand = CommandModule.make_drawelement(bitmapObject, \n drawinstructions: drawBackgroundElement)\n Smig.perform_command(drawBackgroundCommand)\n end\n\n # 4. Draw some stuff into the bitmap context.\n points = []\n points.push(MIShapes.make_point(100, 50))\n points.push(MIShapes.make_point(700, 50))\n points.push(MIShapes.make_point(400, 550))\n newPath = MIPath.new\n newPath.add_triangle(points: points)\n drawElement = MIDrawElement.new(:fillpath)\n drawElement.fillcolor = MIColor.make_rgbacolor(0.8, 0.2, 0.1)\n drawElement.arrayofpathelements = newPath\n drawElement.startpoint = points[0]\n drawElementCommand = CommandModule.make_drawelement(bitmapObject, \n drawinstructions: drawElement)\n Smig.perform_command(drawElementCommand)\n # 5. Take a snapshot\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :takesnapshot))\n # 6. Draw the snapshot into the bitmap context.\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n # 7. Draw some more stuff into it\n points = []\n points.push(MIShapes.make_point(100, 550))\n points.push(MIShapes.make_point(700, 550))\n points.push(MIShapes.make_point(400, 50))\n newPath = MIPath.new\n newPath.add_triangle(points: points)\n drawElement = MIDrawElement.new(:fillpath)\n drawElement.fillcolor = MIColor.make_rgbacolor(0.2, 0.7, 0.1)\n drawElement.arrayofpathelements = newPath\n drawElement.startpoint = points[0]\n drawElementCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: drawElement)\n Smig.perform_command(drawElementCommand)\n # 8. Export an image from the bitmap\n tempFile2 = File.join(Dir.tmpdir(), \"BeforeSnapshot.jpg\")\n SmigHelpers.save_image(imagesource: bitmapObject, pathtofile: tempFile2)\n # 9. Draw the snap shot into the bitmap context\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n # 10. Save the bitmap context to an image file.\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n SmigHelpers.save_image(imagesource: bitmapObject, pathtofile: tempFile)\n origFile = File.join($compareImageDir, baseImageName)\n\n unless AreImageFilesSame(origFile, tempFile)\n # 11. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \"Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n Smig.close_object_nothrow(bitmapObject)\n# `open #{tempFile}`\n# `open #{tempFile2}`\n# `open #{origFile}`\n FileUtils.rm_f(tempFile)\n FileUtils.rm_f(tempFile2)\n end\nend", "def screenshot\n @browser.save_screenshot(\"screenshot.png\")\n end", "def draw_graphs\n image_options = { :width => document.bounds.width * 0.4,\n :position => :right }\n\n Dir.mktmpdir do |dir|\n document.image(weekly_total_graph(dir), image_options)\n\n document.move_down(in2pt(0.5))\n\n document.image(weekly_change_graph(dir), image_options)\n end\n end", "def fetch_screenshots\n screenshots, doc = [], get_xml(bungie_net_recent_screenshots_url)\n (doc/:item).each_with_index do |item, i|\n screenshots[i] = {\n :full_url => (item/'halo3:full_size_image').inner_html,\n :medium_url => (item/'halo3:medium_size_image').inner_html,\n :thumb_url => (item/'media:thumbnail').first[:url],\n :viewer_url => (item/'link').inner_html,\n :title => (item/:title).inner_html,\n :description => (item/:description).inner_html,\n :date => (item/:pubDate).inner_html.to_time,\n :ssid => pull_ssid( (item/'link').inner_html )\n }\n end\n return screenshots\n end", "def screenshots\n if(@screenshots.nil?)\n unless @screenshot_urls\n BabboBackend.get.request_screenshots_urls_for_identifier(@productIdentifier, sender:self)\n return nil\n else\n load_screenshots(@screenshot_urls)\n return nil\n end\n end\n\n return @screenshots\n end", "def recent_screenshots\n fetch_screenshots\n end", "def save_evidence_execution\n evidence_dir = \"evidence/#{Time.now.strftime('%F')}/#{ENV['CUCUMBER_MOBILE_EXECUTION']}\"\n FileUtils::mkdir_p evidence_dir unless Dir.exist? evidence_dir\n screenshot_embed({:prefix=>evidence_dir, :name=>\"#{timestamp}_evidence.png\"})\nend", "def extract_graphic\n if !Cache.screenshot(@save_number, header).nil?\n bitmap_screenshot = Cache.screenshot(@save_number, header)\n @screenshot.zoom_x = 2\n @screenshot.zoom_y = 2\n else @virtualb = DataManager.load_screenshot(@save_number)\n if @virtualb.nil?\n bitmap_screenshot = black_bitmap\n else\n bitmap_screenshot = @virtualb.get_bitmap\n @screenshot.zoom_x = 2\n @screenshot.zoom_y = 2\n Cache.add_screenshot(@save_number, bitmap_screenshot, header[:key])\n end\n end\n @screenshot.bitmap = bitmap_screenshot\n @screenshot_loaded = false\n @loading_bar.disappear\n end", "def create_graphics\n create_viewport\n create_background\n create_buttons\n init_entering\n end", "def create_image\n\t\tpng = ChunkyPNG::Image.new(@img_width, @img_height, ChunkyPNG::Color::BLACK)\n\t\tpen = ChunkyPNG::Color.rgb(102, 102, 255)\n\n\t\tprev = nil\n\t\ti = 0\n\n\t\tFile.open( 'significant_stop_times.txt', 'r' ).each do |line|\n\t\t\tparts = line.split(',')\n\t\t\t# trip_id,frame_id,sst_stop_id,lat,lng,x,y\n\t\t\ttrip_id = parts[0]\n\t\t\tx = parts[5].to_i\n\t\t\ty = parts[6].to_i\n\n\t\t\tif (!prev.nil?) and prev[:trip_id] == trip_id\n\t\t\t\ti += 1\n\t\t\t\tputs \"#{i} stops drawn\" if i % 10_000 == 0\n\n\t\t\t\t# Draw a line from the previous stop to this one.\n\t\t\t\tpng.line( \n\t\t\t\t\t\tprev[:x], prev[:y],\n\t\t\t\t\t\tx, y,\n\t\t\t\t\t\tpen\n\t\t\t\t\t)\n\t\t\tend\n\t\t\t\n\t\t\tprev = {:x => x, :y => y, :trip_id => trip_id}\n\t\tend\n\n\t\tputs \"Saving.\"\n\t\tpng.save( 'stops.png' )\n\tend", "def create_backgrounds\n create_over\n create_hud_bg\n create_under\n create_flow\n end", "def make_screen\n @screen = Screen.new(Configuration.screen[:size], 32, [HWSURFACE, DOUBLEBUF])\n\n @screen.title = \"Towerdefence!\"\n end", "def snap(descriptor = \"\")\n name = clean_url(page.current_url)\n\n # Descriptor\n name = name + (descriptor.empty? ? \"\" : \"-state-#{descriptor}\")\n p \"#snap\", \"name\", name unless name.empty?\n\n set_window_size\n\n # Ensure @folder exists\n FileUtils.mkdir_p(@folder) unless File.exists?(@folder)\n Capybara.current_session.driver.browser.save_screenshot(\"#{@folder}/#{name}.png\")\n end", "def take_screenshot(file_name=nil)\n # make sure screenshots folder exists\n FileUtils.mkdir_p './screenshots'\n\n # if file name given, use time stamp\n if file_name.nil?\n file_name = Time.now.strftime(\"%Y-%m-%d_%H-%M-%S.png\")\n end\n\n sleep(1)\n $browser.screenshot.save \"./screenshots/#{file_name}\"\n log(\"screenshot taken: ./screenshots/#{file_name}\")\n sleep(1)\n\n # add to report\n embed(\"./screenshots/#{file_name}\", \"image/png\", \"SCREENSHOT\")\nend", "def run\n super\n \n begin\n \n #\n # Create a browser opbject if we didn't pass one in\n #\n driver = @options['driver'] || Selenium::WebDriver.for(:firefox)\n \n #\n # Set up a timeout, and a sensible default\n #\n if @options['timeout']\n timeout = Integer.new @options['timeout']\n else\n timeout = 10\n end\n\n #\n # Allow the user to set a save directory\n #\n if @options['save_directory']\n save_location = \"#{@options['save_directory']}/#{@object.name}.png\" \n else\n save_location = \"#{Ear::TEMP_DIRECTORY}/#{@object.name}.png\"\n end\n\n browse_location = \"http://#{@object.name}\"\n\n\n status = Timeout.timeout timeout do\n #\n # Navigate & do the screenshot\n # \n @task_logger.log \"Navigating to & snapshotting http://www.#{@object.name}\" \n driver.navigate.to browse_location\n driver.save_screenshot save_location\n\n create_object Image, \n :local_path => save_location,\n :remote_path => browse_location, \n :description => \"screenshot\"\n end\n \n #\n # Close it up if we didn't pass in a browser\n #\n driver.close unless @options['driver']\n\n rescue Timeout::Error\n @task_logger.log \"Timeout!\"\n end\n \nend", "def generate_wallpaper\n if self.order.uncommon_order?\n begin\n rand_id = rand(999999).to_s\n image = MiniMagick::Image.from_file(\"#{Rails.root}/public/assets/printable/#{printable_file_name}-1.jpg\")\n image.gravity('Center')\n image.rotate(90)\n image.resize('400x600^')\n image.crop('320x480+40+120')\n image.write(\"#{Rails.root}/tmp/#{rand_id}.jpg\")\n File.open(\"#{Rails.root}/tmp/#{rand_id}.jpg\", 'rb') { |image| self.wallpaper = image }\n File.delete(\"#{Rails.root}/tmp/#{rand_id}.jpg\")\n self.save\n rescue Exception => e\n UncommonHoptoad::notify(\"Error generating wallpaper for #{id}\",\"Error: #{e.message}\", \"Failed to generate wallpaper for order_item #{self.id}\")\n end\n end\n end", "def screenshot(name)\n begin\n @screenshots[name] = @browser.screenshot.base64\n rescue StandardError => ex\n @logger.warn(\"Unable to take screenshot '#{name}' due to an error \"\\\n \"(#{ex.class}: #{ex})\")\n end\n end", "def makesheet(edir, emote, framedir)\n fdelays = []\n Dir.chdir(framedir)\n frames = Dir.glob(\"*_frame*png\").sort\n Dir.glob(emote + \"*txt\").sort.each do |file|\n delay = File.read(file).chomp\n fdelays << delay\n end\n if(fdelays.uniq.length != 1)\n frames << frames[0]\n end\n img = ImageList.new(framedir + \"/\" + frames[0])\n ex, ey = img.columns, img.rows\n img = ImageList.new\n frames.each do |frame|\n img.push(Image.read(framedir + \"/\" + frame).first)\n end\n begin\n img.append(false).write(edir + \"/\" + emote + \"-sheet.png\")\n rescue Exception\n puts \"Could not write: \" + edir + \"/\" + emote + \"-sheet.png\"\n end\n system(\"optipng -quiet \" + edir + \"/\" + emote + \"-sheet.png > \" + $bitbucket)\n return ex, ey\nend", "def take_screenshot(index, action)\n #-------------------------------------------------------------------------------------------------------------\n # save body au format text to fichier\n #-------------------------------------------------------------------------------------------------------------\n begin\n source_file = Flow.new(@home, index.to_s, action, Date.today, nil, \".txt\")\n source_file.write(@browser.body)\n\n rescue Exception => e\n @@logger.an_event.debug \"browser save body #{source_file.basename} : #{e.message}\"\n\n else\n @@logger.an_event.debug \"browser save body #{source_file.basename}\"\n\n end\n\n #-------------------------------------------------------------------------------------------------------------\n # prise d'un screenshot au format image\n #-------------------------------------------------------------------------------------------------------------\n [source_file.absolute_path, @browser.take_screenshot(Flow.new(@home, index.to_s, action, Date.today, nil, \".png\"))]\n\n end", "def start_load_screenshot\n show_loading_bar\n Thread.new{extract_graphic}\n end", "def screenshoot(url, filename)\n unless File.exists?(\"#{IMG_DIR}/#{filename}.png\")\n system \"python webkit2png.py -t #{IMG_TIMEOUT} -o #{IMG_DIR}/#{filename}.png #{url} \"\n else \n puts \"Already screenshoted: #{IMG_DIR}/#{filename}.png\"\n end\nend", "def screenshot_and_save_page\n Capybara::Screenshot.screenshot_and_save_page\nend", "def create_thumbnails()\n # {{{\n begin\n @@logger.log('IMAGE UP | Importing image')\n image_renderer = @@image_renderer.new(@media_asset)\n \n id = @media_asset.media_asset_id\n ext = @media_asset.extension.dup.downcase\n path = Aurita.project_path(:public, :assets, \"asset_#{id}.#{ext}\")\n \n @@logger.log(\"IMAGE UP | Path is #{path}\")\n # Every image needs a jpeg base image (esp. needed for PDF): \n STDERR.puts \"Importing #{path} using #{image_renderer.class.inspect}\"\n image_renderer.import(path)\n image_renderer.create_image_variants(@@variants)\n\n if ext == 'pdf' then\n image_renderer.create_pdf_preview()\n elsif @media_asset.is_video? then\n dest = Aurita.project_path(:public, :assets, \"asset_#{id}.jpg\")\n # File.open(source, 'w')\n # system \"ffmpeg -i #{path} -ar 22050 -ab 32 -acodec mp3\n # -s 480x360 -vcodec flv -r 25 -qscale 8 -f flv -y #{ dest }\"\n system(\"ffmpeg -i '#{path}' -ss 00:00:10 -vframes 1 -f image2 -vcodec mjpeg '#{dest}'\")\n ext = 'jpg'\n end\n rescue ::Exception => e\n STDERR.puts('Error when trying to create image versions: ' << e.message)\n e.backtrace.each { |m| \n STDERR.puts(m)\n }\n end\n end", "def take_screenshot(to_file = nil, opts = {})\r\n # puts \"calling new take screenshot: #{$screenshot_supported}\"\r\n # unless $screenshot_supported\r\n # puts \" [WARN] Screenhost not supported, check whether win32screenshot gem is installed\" \r\n # return\r\n # end\r\n\r\n if to_file\r\n screenshot_image_filepath = to_file\r\n else\r\n screenshot_image_filename = \"screenshot_\" + Time.now.strftime(\"%m%d%H%M%S\") + \".jpg\"\r\n the_dump_dir = opts[:to_dir] || default_dump_dir\r\n FileUtils.mkdir_p(the_dump_dir) unless File.exists?(the_dump_dir)\r\n screenshot_image_filepath = File.join(the_dump_dir, screenshot_image_filename)\r\n screenshot_image_filepath.gsub!(\"/\", \"\\\\\") if is_windows?\r\n\r\n FileUtils.rm_f(screenshot_image_filepath) if File.exist?(screenshot_image_filepath)\r\n end\r\n\r\n begin \r\n if is_firefox? then\r\n Win32::Screenshot::Take.of(:window, :title => /mozilla\\sfirefox/i).write(screenshot_image_filepath)\t\t\t\t\t\r\n\t\t elsif ie\r\n Win32::Screenshot::Take.of(:window, :title => /internet\\sexplorer/i).write(screenshot_image_filepath)\t\t\t\t\t\r\n else\r\n Win32::Screenshot::Take.of(:foreground).write(screenshot_image_filepath)\r\n end\r\n notify_screenshot_location(screenshot_image_filepath)\r\n\t\t\t\trescue ::DL::DLTypeError => de\r\n\t\t\t\t\tputs \"No screenshot libray found: #{de}\"\r\n rescue => e\r\n puts \"error on taking screenshot: #{e}\"\r\n end\r\n \r\n\r\n end", "def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend", "def screenshot\n bridge.element_screenshot @id\n end", "def demo_run_with_screenshots\n spectre = SpectreClient::Client.new('Nuffield', 'Templates', @url)\n puts \"Created Spectre run\"\n sleep(2)\n\n setup_poltergeist\n\n visit \"http://www.nuffieldhealth.com/\"\n sleep(2)\n screenshot_file = 'homepage.png'\n page.save_screenshot(screenshot_file)\n puts \"Saved screenshot #{screenshot_file}\"\n\n home_options = {\n name: 'Homepage',\n browser: 'Phantom',\n size: 1024,\n screenshot: File.new(screenshot_file, 'rb'),\n highlight_colour: '00ff00'\n }\n spectre.submit_test(home_options)\n\n puts \"Submitting #{screenshot_file}\"\n File.delete(screenshot_file)\n\n Capybara.reset_sessions!\n\n visit \"http://www.nuffieldhealth.com/gyms/\"\n sleep(2)\n screenshot_file = 'gyms.png'\n page.save_screenshot(screenshot_file)\n puts \"Saved screenshot #{screenshot_file}\"\n\n gym_options = {\n name: 'Gyms Division',\n browser: 'Phantom',\n size: 1024,\n screenshot: File.new(screenshot_file, 'rb')\n }\n spectre.submit_test(gym_options)\n puts \"Submitting #{screenshot_file}\"\n File.delete(screenshot_file)\n\n Capybara.reset_sessions!\n\n visit \"http://www.nuffieldhealth.com/about-us/\"\n sleep(2)\n screenshot_file = 'about_us.png'\n page.save_screenshot(screenshot_file)\n puts \"Saved screenshot #{screenshot_file}\"\n about_options = {\n name: 'Gyms Division',\n browser: 'Phantom',\n size: 1024,\n screenshot: File.new(screenshot_file, 'rb'),\n fuzz_level: '90%',\n highlight_colour: '00ff00'\n }\n spectre.submit_test(about_options)\n puts \"Submitting #{screenshot_file}\"\n File.delete(screenshot_file)\n\n puts \"End\"\n end", "def saveScreen(fileInfo)\n screenShotPath = \"#{fileInfo}.png\"\n screenHTMLPath = \"#{fileInfo}.html\"\n saveScreenShot(screenShotPath)\n saveScreenHTML(screenHTMLPath)\n end", "def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend", "def generate!\n total_width = self.column_width + self.gutter_width\n height = @baseline_height\n RVG::dpi = 100\n\n width_in_inches = (total_width.to_f/RVG::dpi).in\n height_in_inches = (height.to_f/RVG::dpi).in\n rvg = RVG.new(width_in_inches, height_in_inches).viewbox(0, 0, total_width, height) do |canvas|\n canvas.background_fill = \"white\"\n end\n\n white = ChunkyPNG::Color.from_hex(\"ffffff\")\n background = ChunkyPNG::Color.from_hex(\"e8effb\")\n line = ChunkyPNG::Color.from_hex(\"e9e9e9\")\n\n png = ChunkyPNG::Image.new(total_width, height, white)\n png.rect(0, 0, column_width - 1, height, background, background)\n png.rect(0, height - 1, total_width, height - 1, line, line)\n\n FileUtils.mkdir(self.output_path) unless File.exists?(self.output_path)\n png.save(File.join(self.output_path, \"grid.png\"))\n end", "def allure_screenshot\n RSpec.configure do |config|\n config.include AllureRSpec::Adaptor\n config.after(:each) do |example|\n rescue_standard_error do\n if example.exception && @browser\n rescue_standard_error do\n example.attach_file(\n 'screenshot', File.new(\n @browser.save_screenshot(\n file: 'tmp/allure_' + build_path + \"/#{UUID.new.generate}.png\"\n )\n )\n )\n end\n end\n end\n end\n end\n end", "def set_screenshot\n @screenshot = Screenshot.find(params[:id])\n end", "def screenshot(filename=Time.now\\\n .strftime(\"Screenshot from %Y-%m-%d %d-%m-%y\"))\n\n XDo::Keyboard.simulate('{print}');\n sleep 4;\n XDo::Keyboard.simulate(\"{down}\")\n sleep 4;\n XDo::Keyboard.alt_s\n sleep 5;\n XDo::Keyboard.type filename\n sleep 3\n XDo::Keyboard.alt_s\n sleep 1\n\n end", "def create_graphics\n create_viewport\n end", "def step\n # Draw everything\n @image.draw @screen\n end", "def reboot\n img = ['blue_flower', 'red_flower', 'white_flower', 'pink_flower'].sample\n @image = Gosu::Image.new window, 'images/flowers/' + img +'.png', true\n @drawing = true\n end", "def setup_screenshots(row)\n screenshots = row.fetch('screenshots', {}).fetch('value', nil)\n return [] unless screenshots\n\n result = []\n\n screenshots.each do |device_type, value|\n value['value'].each do |screenshot|\n screenshot = screenshot['value']\n result << Tunes::AppScreenshot.new({\n url: screenshot['url'],\n thumbnail_url: screenshot['thumbNailUrl'],\n sort_order: screenshot['sortOrder'],\n original_file_name: screenshot['originalFileName'],\n device_type: device_type,\n language: row['language']\n })\n end\n end\n\n return result\n end", "def add_to_replay_log( browser, session )\n if @replay_log\n @ssnum = @ssnum + 1\n\n if session.get_config :global, :screenshots\n begin\n browser.driver.save_screenshot \"#{@replay_path}/screenshot_#{@ssnum}.png\"\n\n if session.get_config :global, :thumbnails\n require 'mini_magick'\n\n image = MiniMagick::Image.open(\"#{@replay_path}/screenshot_#{@ssnum}.png\")\n image.resize \"400\"\n image.write \"#{@replay_path}/screenshot_#{@ssnum}_thumb.png\"\n FileUtils.chmod 0755, \"#{@replay_path}/screenshot_#{@ssnum}_thumb.png\"\n\n @replay_log.debug \"Screenshot: <a href='screenshot_#{@ssnum}.png'><img src='screenshot_#{@ssnum}_thumb.png' /></a>\"\n else\n @replay_log.debug \"Screenshot: <a href='screenshot_#{@ssnum}.png'>Screenshot</a>\"\n end\n rescue Exception => e\n @normal_log.warn \"Screenshot failed with exception #{e}\"\n end\n end\n\n html=browser.html\n htmlFile = File.new(\"#{@replay_path}/html_capture_#{@ssnum}.txt\", \"w\")\n htmlFile.write(html)\n htmlFile.close\n\n @replay_log.debug \"<a href='html_capture_#{@ssnum}.txt'>HTML Source</a>\"\n @replay_log.debug \"Force flush\"\n end\n end", "def capture_screenshot\n screenshot_file = ScreenshotClient.capture(live_url, format: 'JPG')\n\n screenshot = WorkshopProjectScreenshot.new\n screenshot.file.attach(\n io: screenshot_file,\n filename: 'screenshot.jpg'\n )\n\n self.screenshot = screenshot\n end", "def prepare_strip\r\n @strip = []\r\n for i in 0...@totalFrames\r\n bitmap = Bitmap.new(@width,@height)\r\n bitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmaps[i],Rect.new(0,0,@width,@height))\r\n @strip.push(bitmap)\r\n end\r\n end", "def create_image_list\n @image_list = []\n\n iterate_over_each_character_in_array_of_lines(@maps[:background]) do |y,x|\n @map_image_key.each do |key, value|\n if @maps[:background][y][x] == key\n @image_list.push(\"media/tmp/tile#{value}.png\")\n end\n end\n end\n end", "def save_screenshot(file_name)\n source_image = File.basename(file_name)\n source_image.slice!(/\\.attempt_\\d+/)\n source_image.slice!(/^\\d\\d_/)\n\n FileUtils.cp(File.expand_path(source_image, TEST_IMAGES_DIR), file_name)\n end", "def draw_tiles(tile_bag)\n tile_bag = Scrabble::TileBag.new\n @tiles = tile_bag.draw_tiles(7)\n end" ]
[ "0.66667306", "0.6413551", "0.6410283", "0.64075047", "0.6378417", "0.6340471", "0.63272524", "0.62717605", "0.62142974", "0.619407", "0.6190998", "0.61683434", "0.6149247", "0.6093941", "0.6066227", "0.6037011", "0.6013504", "0.60011125", "0.5875355", "0.58747476", "0.5870823", "0.5833687", "0.5802789", "0.58016175", "0.57936525", "0.5774935", "0.57653844", "0.57436305", "0.574267", "0.574267", "0.57229096", "0.5705546", "0.57049227", "0.5703799", "0.56821364", "0.56412786", "0.5612622", "0.56086314", "0.5599216", "0.5597313", "0.5593322", "0.5585035", "0.5574674", "0.5553261", "0.554656", "0.55377764", "0.5523676", "0.5523455", "0.55139625", "0.5513002", "0.5506096", "0.55039865", "0.5497691", "0.54943776", "0.5493349", "0.54872113", "0.5485805", "0.54833996", "0.5471631", "0.5469532", "0.5451546", "0.54488546", "0.54471046", "0.5445801", "0.54453874", "0.54369813", "0.5425583", "0.5421166", "0.5380469", "0.5378905", "0.5372107", "0.53680956", "0.53617203", "0.53603643", "0.5351906", "0.53062797", "0.5305448", "0.5299369", "0.5297966", "0.5286338", "0.5275502", "0.52750206", "0.5268767", "0.5260898", "0.5257512", "0.5237207", "0.5234766", "0.5234488", "0.5233134", "0.5229761", "0.52252036", "0.5224837", "0.5220221", "0.5207467", "0.52070296", "0.51859885", "0.51857287", "0.51740074", "0.5173596", "0.5164107" ]
0.6589683
1
Submit the given details to the corresponding site
def submit! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_site_save\n active_submit.click\n end", "def business_details_page_enter_business_or_organisation_details_manual_postcode_and_submit(companyName: 'Test Company',\n houseNumber: '12', line1: 'Deanery Road',\n line2: 'EA Building', townCity: 'Bristol', postcode: 'BS1 5AH')\n\n click_link 'manual_uk_address'\n fill_in 'registration_companyName', with: companyName\n fill_in 'address_houseNumber', with: houseNumber\n fill_in 'address_addressLine1', with: line1\n fill_in 'address_addressLine2', with: line2\n fill_in 'address_townCity', with: townCity\n fill_in 'address_postcode', with: postcode\n business_details_page_submit_business_details_page\n end", "def business_details_page_enter_ltd_business_details_manual_postcode_and_submit(companyNo: '10926928',\n companyName: 'Test Company', houseNumber: '12', line1: 'Deanery Road',\n line2: 'EA Building', townCity: 'Bristol', postcode: 'BS1 5AH')\n\n click_link 'manual_uk_address'\n fill_in 'registration_company_no', with: companyNo\n fill_in 'registration_companyName', with: companyName\n fill_in 'address_houseNumber', with: houseNumber\n fill_in 'address_addressLine1', with: line1\n fill_in 'address_addressLine2', with: line2\n fill_in 'address_townCity', with: townCity\n fill_in 'address_postcode', with: postcode\n business_details_page_submit_business_details_page\n end", "def fill_form_and_submit(agent, creds, url, category, tech, data)\n case category\n when 'extensions'\n puts \"uploading #{category.chop}: #{data[category.chop].to_s}\" unless $quiet\n cat_page = get_page(agent, creds, url + CONFIG, {display: category, tech_hardware: 'custom_custom'})\n frm = cat_page.form('frm_extensions')\n when 'trunks'\n puts \"uploading #{category.chop}: #{data['trunk_name'].to_s}\" unless $quiet\n cat_page = get_page(agent, creds, url + CONFIG, {display: category, tech: tech.upcase})\n frm = cat_page.form('trunkEdit')\n end\n abort 'error: form not found' unless frm\n\n if $debug\n frm.fields.each { |field| puts \"send_sever_request: #{field.name}: #{field.value}\" }\n frm.checkboxes.each { |chkbx| puts \"send_sever_request: #{chkbx.name}: #{chkbx.value}\" }\n frm.radiobuttons.each { |rdb| puts \"send_sever_request: #{rdb.name}: #{rdb.value}\" if rdb.checked }\n end\n # Fill in the form, and submit it!\n data.each { |key, val| frm[key] = val }\n frm.submit\nend", "def submits; end", "def business_details_page_enter_ltd_business_details_postcode_lookup_and_submit(companyNo: '10926928',\n companyName: 'Test Company', postcode: 'BS1 5AH',\n address: 'NATURAL ENGLAND, HORIZON HOUSE, DEANERY ROAD, BRISTOL, BS1 5AH')\n\n fill_in 'registration_company_no', with: companyNo\n fill_in 'registration_companyName', with: companyName\n fill_in 'sPostcode', with: postcode\n click_button 'find_address'\n select address\n business_details_page_submit_business_details_page\n end", "def submit_details(details)\n response = adyen_client.checkout.payments_api.payments_details(details)\n puts response.to_json\n response\n end", "def add_site(params = {})\n site_name.set params['site_name']\n client_division_site_number.set params['client_division_site_number']\n site_number.set params['site_number']\n address_1.set params['address_1']\n address_2.set params['address_2'] if params['address_2']\n zip_code.set params['zip_code']\n city.set params['city']\n country.select(params['country'], match: :first)\n sleep 2 # Wait for the state to be active #TODO: find a way to remove this sleep ~MD\n state.select(params['state']) unless state.disabled?\n study_env.select(params['study_env'])\n pi_email.set params['pi_email']\n pi_first_name.set(params['pi_first_name'])\n pi_last_name.set(params['pi_last_name'])\n pi_role.select(params['pi_role'])\n add_site_submit.click\n sleep 10 # Wait to create a site\n end", "def submit; end", "def create_webform(title, fields, browser = @browser)\n browser.navigate.to($config['sut_url'] + create_webform_url)\n Log.logger.debug(\"Entering new webform title '#{title}'\")\n fields.each{|fieldname|\n self.add_webform_component(fieldname)\n }\n self.add_webform_title(title)\n message = self.save_webform(browser)\n return message\n end", "def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend", "def submit\r\n assert_exists\r\n submit_form \r\n @o.wait\r\n end", "def new_site\n newsite = Site.new()\n newsite.gid = params[:gid]\n newsite.name = params[:name]\n newsite.user_id = current_user.id\n newsite.save\n get_address(newsite.id)\n calculate_first_time(newsite.id)\n redirect_to :action => \"select\"\n end", "def submit_req\n requisition = OLE_QA::Framework::OLEFS::Requisition.new(@ole)\n requisition.open\n # Set Delivery\n unless requisition.building_search_icon.present?\n requisition.delivery_tab_toggle.click\n end\n requisition.building_search_icon.wait_until_present\n requisition.building_search_icon.click\n lookup = OLE_QA::Framework::OLEFS::Building_Lookup.new(@ole)\n lookup.wait_for_page_to_load\n lookup.building_name_field.set('Wells Library')\n lookup.search_button.click\n lookup.wait_for_page_to_load\n lookup.return_result('Wells Library').when_present.click\n requisition.wait_for_page_to_load\n requisition.room_field.when_present.set('100')\n # Set Vendor\n unless requisition.vendor_search_icon.present?\n requisition.vendor_tab_toggle.click\n end\n requisition.vendor_search_icon.when_present.click\n lookup = OLE_QA::Framework::OLEFS::Vendor_Lookup.new(@ole)\n lookup.wait_for_page_to_load\n lookup.vendor_name_field.set('YBP')\n lookup.search_button.click\n lookup.return_result(/YBP/).when_present.click\n requisition.wait_for_page_to_load\n # Add new bib\n requisition.new_bib_option.when_present.set\n requisition.new_bib_button.when_present.click\n Watir::Wait.until { @ole.browser.windows.count > 1 }\n @ole.browser.windows[-1].use\n bib_ary = [{\n :tag => '245',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + OLE_QA::Framework::String_Factory.alphanumeric(12)\n }]\n bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(@ole)\n create_bib(bib_editor,bib_ary)\n @ole.browser.windows[-1].close\n @ole.browser.alert.ok if @ole.browser.alert.present?\n @ole.browser.windows[0].use\n requisition.wait_for_page_to_load\n requisition.list_price_field.when_present.set(OLE_QA::Framework::String_Factory.numeric(2))\n requisition.location_selector.when_present.select('B-EDUC/BED-STACKS')\n requisition.copies_field.when_present.set('1')\n requisition.add_button.when_present.click\n requisition.wait_for_page_to_load\n requisition.line_item.accounting_lines_toggle.click unless requisition.line_item.chart_selector.present?\n requisition.line_item.chart_selector.when_present.select('BL')\n account = OLE_QA::Framework::Account_Factory.select_account(:BL)[0]\n requisition.line_item.account_number_field.when_present.set(account)\n object = OLE_QA::Framework::Account_Factory.select_object(:BL)[0]\n requisition.line_item.object_field.when_present.set(object)\n requisition.line_item.percent_field.when_present.set('100.00')\n requisition.line_item.add_account_button.when_present.click\n requisition.wait_for_page_to_load\n requisition.submit_button.click\n requisition.wait_for_page_to_load\n requisition.generic_message.wait_until_present\n verify {requisition.document_id.present?}\n req_id = requisition.document_id.text.strip\n req_url = requisition.lookup_url(req_id)\n page_assert(req_url,180) {requisition.wait_for_page_to_load\n requisition.document_type_status.text.include?('Closed')}\n page_assert(req_url,180) {requisition.wait_for_page_to_load\n requisition.view_related_tab_toggle.when_present.click unless requisition.view_related_po_link.present?\n requisition.view_related_po_link.wait_until_present}\n purchase_order = OLE_QA::Framework::OLEFS::Purchase_Order.new(@ole)\n po_id = requisition.view_related_po_link.text.strip\n po_url = requisition.view_related_po_link.href\n @ole.browser.goto(po_url)\n page_assert(po_url,180) {purchase_order.wait_for_page_to_load\n purchase_order.document_status.text.strip == 'FINAL' &&\n purchase_order.document_type_status.text.strip == 'Open'}\n end", "def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end", "def submit\n frm.button(:value=>\"Submit\").click\n @@file_number=0\n if frm.div(:class=>\"portletBody\").h3.text=~/Submission Confirmation/\n SubmissionConfirmation.new(@browser)\n elsif frm.button(:value=>\"Back to list\").exist?\n SubmissionConfirmation.new(@browser)\n else\n AssessmentsList.new(@browser)\n end\n end", "def visit url\n @agent.get url\n @agent.page.form&.submit\n end", "def submit(title: '', url: '', shortening: '')\n fill_in 'bookmark_title', with: title\n fill_in 'bookmark_url', with: url\n fill_in 'bookmark_shortening', with: shortening\n\n click_button 'Update Bookmark'\n end", "def submit(args = {})\n watercourse.set(args[:watercourse]) if args.key?(:watercourse)\n stop_day.set(args[:stop_day]) if args.key?(:stop_day)\n stop_month.set(args[:stop_month]) if args.key?(:stop_month)\n stop_year.set(args[:stop_year]) if args.key?(:stop_year)\n apply_day.set(args[:apply_day]) if args.key?(:apply_day)\n apply_month.set(args[:apply_month]) if args.key?(:apply_month)\n apply_year.set(args[:apply_year]) if args.key?(:apply_year)\n gauging_station.set(args[:gauging_station]) if args.key?(:gauging_station)\n hof_threshold.set(args[:hof_threshold]) if args.key?(:hof_threshold)\n contact_name.set(args[:contact_name]) if args.key?(:contact_name)\n contact_details.set(args[:contact_details]) if args.key?(:contact_details)\n sender_name.set(args[:sender_name]) if args.key?(:sender_name)\n sender_role.set(args[:sender_role]) if args.key?(:sender_role)\n sender_address.set(args[:sender_address]) if args.key?(:sender_address)\n submit_button.click\n end", "def submit\n end", "def save_and_publish\n frm.button(:value=>\"Save Settings and Publish\").click\n PublishAssessment.new(@browser)\n end", "def submit_form\n @page = @form.submit\n end", "def submit_for_grading\n frm.button(:value=>\"Submit for Grading\").click\n SubmissionSummary.new(@browser)\n end", "def submit locator\r\n command 'submit', locator\r\n end", "def submit locator\r\n command 'submit', locator\r\n end", "def test_submit_on_form\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'post_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = form.submit\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "def save_site params\n SiteProcessor.new(self).save_site(params)\n end", "def submit\n frm.button(:value=>\"Submit\").click\n SubmissionConfirmation.new(@browser)\n end", "def submit\n frm.button(:value=>\"Submit\").click\n SubmissionConfirmation.new(@browser)\n end", "def postEntityWebsite( entity_id, website_url, display_url, website_description, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['website_url'] = website_url\n params['display_url'] = display_url\n params['website_description'] = website_description\n params['gen_id'] = gen_id\n return doCurl(\"post\",\"/entity/website\",params)\n end", "def post(summary, description, assignee, product=\"TestProduct\", component=\"\")\n @log.debug \"Attempting to file a new bug\"\n url = \"#{@url}/enter_bug.cgi?product=#{product}&assigned_to=#{assignee}&component=#{component}\"\n @log.debug url\n page = @agent.get(url)\n form_name = 'Create'\n form = page.form_with(:name => form_name)\n if form\n form['short_desc']=summary\n form['comment']=description\n form['assignee']=assignee\n form['component']=component if not component.empty?\n page = @agent.submit form if not @dummy\n @log.info page.search(\".//td[@id='title']\")[0].content.strip\n # Read the bug number from the page\n return page.search(\".//a[@title='NEW - #{summary}']\")[0].content.match(/Bug ([0-9]+)/)[1] \n else\n @log.error \"Unable to find form with name #{form_name}\"\n end\n end", "def partner_lead_upsell(city,state,zip)\n driver.get(@@base_url+\"/colleges/A8551503/online/University-of-Phoenix-Online-School/\")\n select('xpath',\"(//select[@name='universityofphoenix_salutation'])[2]\",\"Mr.\")\n driver.find_element(:xpath, \"(//input[@name='universityofphoenix_first_name'])[2]\").send_keys first_name\n driver.find_element(:xpath, \"(//input[@name='universityofphoenix_last_name'])[2]\").send_keys last_name\n driver.find_element(:css, \"#college-widget > div.embedded.wide > div.campusexplorer-widget > div.step.step1 > div.content > #lead-request-form-widget > div.multi.label > span.elements > input[name=\\\"universityofphoenix_phone_preferred_multi.phone_preferred_multi_1\\\"]\").send_keys \"310\"\n driver.find_element(:css, \"#college-widget > div.embedded.wide > div.campusexplorer-widget > div.step.step1 > div.content > #lead-request-form-widget > div.multi.label > span.elements > input[name=\\\"universityofphoenix_phone_preferred_multi.phone_preferred_multi_2\\\"]\").send_keys \"222\"\n driver.find_element(:css, \"#college-widget > div.embedded.wide > div.campusexplorer-widget > div.step.step1 > div.content > #lead-request-form-widget > div.multi.label > span.elements > input[name=\\\"universityofphoenix_phone_preferred_multi.phone_preferred_multi_3\\\"]\").send_keys \"1234\"\n select('css',\"#college-widget > div.embedded.wide > div.campusexplorer-widget > div.step.step1 > div.content > #lead-request-form-widget > div.multi.label > span.elements > select[name=\\\"universityofphoenix_phone_preferred_multi.phone_preferred_type\\\"]\",\"Home\")\n driver.find_element(:xpath, \"(//input[@name='universityofphoenix_email_address'])[2]\").send_keys email_address\n driver.find_element(:xpath, \"(//input[@name='universityofphoenix_address_wo_apt'])[2]\").send_keys street_address\n driver.find_element(:xpath, \"(//input[@name='universityofphoenix_apt_unit'])[2]\").send_keys \"4\"\n driver.find_element(:xpath, \"(//input[@name='universityofphoenix_city_nm'])[2]\").send_keys city\n select('xpath',\"(//select[@name='universityofphoenix_state_cd'])[2]\",state)\n driver.find_element(:xpath, \"(//input[@name='universityofphoenix_zip_cd'])[2]\").send_keys zip\n select('css',\"#college-widget > div.embedded.wide > div.campusexplorer-widget > div.step.step1 > div.content > #lead-request-form-widget > p.ceselect.label > label > select[name=\\\"universityofphoenix_highest_education_level\\\"]\",\"Have High School Diploma\")\n select('xpath',\"(//select[@name='universityofphoenix_high_school_graduation_year'])[2]\",\"2013\")\n driver.find_element(:xpath, \"(//input[@name='universityofphoenix_is_online_preference_code'])[4]\").click\n driver.find_element(:css, \"#college-widget > div.embedded.wide > div.campusexplorer-widget > div.step.step1 > div.content > #lead-request-form-widget > p.submit > button.default.next-step\").click\n select('name',\"universityofphoenix_area_of_interest_universityofphoenix\",\"Technology\")\n select('name',\"universityofphoenix_program\",\"Undergraduate - Bachelor of Science in Information Technology with a Concentration in Business Systems Analysis\")\n select('name',\"universityofphoenix_planned_start_date_code\",\"Less than 1 month\")\n driver.find_element(:name, \"universityofphoenix_is_usa_citizen\").click\n driver.find_element(:css, \"button.default.submit\").click\n while driver.current_url.include? (URL)\n driver.find_element(:css, \"button.get-information\").click\n sleep 1\n end\n return driver.current_url\n end", "def submit(button_name=nil, opts={})\n # 1. Loop through the non hidden fields and if they're active and displayed enter the value\n fill_in_field_data\n\n # 2. Submit Form\n submit_button = select_submit_button(button_name, opts)\n\n wait_for_submit(submit_button)\n submit_button.node.click\n\n # 3. Wait for Page page\n wait_for_page(driver, metz)\n\n # 4. Return new Page\n Metallize::Page.new(driver, metz)\n\n end", "def submit_url(**options)\n post_request(\"/submit/url-for-analysis\", options)\n end", "def submit_url(**options)\n post_request(\"/submit/url-for-analysis\", options)\n end", "def sign_up( data )\n\n # assert url starts with 'https://listings.expressupdateusa.com/Account/Register'\n puts 'Signing up with email: ' + data[ 'personal_email' ]\n\n @browser.goto 'https://listings.expressupdateusa.com/Account/Register'\n\n @browser.text_field(:id => 'Email').set data['email']\n @browser.text_field(:id => 'Password').set data['password']\n @browser.text_field(:id => 'ConfirmPassword').set data['password']\n @browser.text_field(:id => 'Phone').set data['phone']\n @browser.text_field(:id => 'BusinessName').set data['business_name']\n @browser.text_field(:id => 'FirstName').set data['firstname']\n @browser.text_field(:id => 'LastName').set data['lastname']\n @browser.select_list(:id => 'State').select data['state']\n @browser.checkbox(:id => 'DoesAcceptTerms').set\n\n\nenter_captcha\n\n@browser.button(:class => 'RegisterNowButton').click\n\n # If no return URl then 'Thank You for Registering with Express Update. An activation email sent!'\n\nself.save_account(\"Expressupdateusa\", { :email => data['personal_email'], :password => data['password']})\n\n\nif @chained\n self.start(\"Expressupdateusa/Verify\")\nend\n\n\ntrue \nend", "def start_sync\n agent = Mechanize.new\n page = agent.get(ENV['warranty_sync_url'])\n form = page.form_with(name: \"form1\")\n form.txtMaterialNo = product_name\n form.txtSerialNo = serial_number\n form.txtPurchaseDate = I18n.l(purchased_on, format: :mmddyyyy)\n form.txtFirstName = first_name\n form.txtLastName = last_name\n form.txtAddress = \"\"\n form.txtCity = \"\"\n form.txtPostalCode = \"\"\n form.txtEmail = email\n\n begin\n if country.to_s.match(/^US$/i) || country.to_s.match(/United States/i)\n country = \"USA\"\n end\n form.field_with(name: \"ddlCountry\").option_with(text: country).click\n rescue\n # Couldn't select country\n end\n\n button = form.button_with(name: \"btnSubmit\")\n agent.submit(form, button)\n end", "def publish\n frm.link(:text=>\"Publish\").click\n PublishAssessment.new(@browser)\n end", "def submit(locator)\n find_element(locator).submit\n end", "def execute()\n # Retrieve a single entry from SIT:Site based on provided site\n siteEntry = @@remedy_forms['SIT:Site'].find_entries(\n :single,\n :conditions => [%|'Site' = \"#{@parameters['site']}\"|],\n :fields => :all\n )\n\n # Raise error if unable to locate the entry\n raise(\"No matching entry on the SIT:Site form for the given site [#{@parameters['site']}]\") if siteEntry.nil?\n\n #Get values out of Site into fields\n\t@field_values[\"Site ID\"] = siteEntry[\"Site ID\"]\n\t@field_values[\"Site City\"] = siteEntry[\"City\"]\n\t@field_values[\"Site Country\"] = siteEntry[\"Country\"]\n\t@field_values[\"Site State Province\"] = siteEntry[\"State Province\"]\n\t@field_values[\"Site Street\"] = siteEntry[\"Street\"]\n\t@field_values[\"Site Zip/Postal Code\"] = siteEntry[\"Zip/Postal Code\"]\n\t@field_values[\"Time Zone\"] = siteEntry[\"Time Zone\"]\n\t\n\t@create = 1\n\tbegin\n\t# Create the CTM:People record using the @field_values hash\n # that was built up. Pass 'Person ID' and 'InstanceId' to the fields\n # argument because these fields will be used in the results xml.\n entry = @@remedy_forms['CTM:People'].create_entry!(\n :field_values => @field_values,\n :fields => ['Person ID']\n )\n\trescue Exception => e\n\t\tputs(\"Exception: #{e.message}\") if @debug_logging_enabled\n\t\tputs(\"END OF EXCEPTION MESSAGE\") if @debug_logging_enabled\n\t\tif e.message.include?(\"is already in use, please choose another Login ID\")\n\t\t\t entry = @@remedy_forms['CTM:People'].find_entries(\n\t\t\t :single,\n\t\t\t :conditions => [%|'Remedy Login ID' = \"#{@parameters['remedy_login_id']}\"|],\n\t\t\t :fields => ['Person ID']\n\t\t\t)\n\t\t\t@create = 0\n\t\tend\n\tend\n\t\n # Create a notes string that will be stored within the audit record. It\n # contains the author of the modifications as well as details about each of\n # the modified values.\n notes = \"The CTM:People record was created by #{@parameters['author']}\"\n @field_values.each do |field_id, value|\n notes << \"\\nfield '#{field_id}' was entered as '#{value}'\"\n end\n\n # If any of the values were we checked are to be modified we save the\n # CTM:People record. Then we create an entry in CTM:People WorkLog to audit\n # this modification.\n if !entry.nil? && @create == 1\n @@remedy_forms['CTM:People WorkLog'].create_entry!(:field_values => {\n 'Person ID' => entry.id,\n 'Description' => 'Created by BmcItsm7PersonCreate handler.',\n 'Work Log Type' => 'General Information',\n 'Detailed Description' => notes,\n 'Work Log Submitter' => @parameters['author']\n },\n :fields => [])\n\telsif @create == 0\n\t\tputs(\"Did not create new user, login ID Already in use: #{@parameters['remedy_login_id']}\") if @debug_logging_enabled\n elsif entry.nil?\n\t\t# Raise error if unable to create the entry\n\t\traise(\"Unable to create people record for [#{@parameters['remedy_login_id']}]\")\n\tend\n \n\t\n # Build the results xml that will be returned by this handler.\n results = <<-RESULTS\n <results>\n <result name=\"Person ID\">#{escape(entry['Person ID'])}</result>\n </results>\n RESULTS\n puts(\"Results: \\n#{results}\") if @debug_logging_enabled\n #puts(\"Results: \\n#{results}\")\n\n # Return the results String\n return results\n end", "def submit_form(form)\n @agent.submit(form)\n end", "def enter_cust_info(first_name,last_name,address_line1,address_line2,city,zip_code,phone_no)\n sleep 5\n @browser.text_field(id: 'rc-shipping-firstName').set(first_name)\n sleep 5\n @browser.text_field(id: 'rc-shipping-lastName').set(last_name)\n sleep 5\n @browser.text_field(id: 'rc-shipping-line1').set(address_line1)\n sleep 5\n @browser.text_field(id: 'rc-shipping-line2').set(address_line2)\n sleep 5\n @browser.text_field(id: 'rc-shipping-city').set(city)\n sleep 5\n @browser.option(value: 'AK').click\n sleep 5\n @browser.text_field(id: 'rc-shipping-postal-code').set(zip_code)\n sleep 5\n @browser.text_field(id: 'rc-shipping-phone').set(phone_no)\nend", "def test_post_multival\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'post_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = @agent.submit(form)\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "def submit(form_name)\n Praline::browser.find_element(:name, form_name).submit\n end", "def test_submit\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: SAMPLE_UDPRN,\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: SAMPLE_UDPRN, quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end", "def submit_form\n click_button 'submit'\n end", "def submitIncidentForm(page, startYear, endYear)\n form = page.form_with(:action => \"search.php\");\n form['start_year'] = startYear;\n form['end_year'] = endYear;\n page = page.form_with(:action => \"search.php\").click_button();\nend", "def import_posts_to_li settings, posts, agent\n puts '********* Post to LinkedIn **************'\n\n posts.each do |post|\n agent.get (settings[:group_url])\n form = agent.page.forms_with(:action => '/groups').first\n form.postTitle = \"#{post[:link]} | #{post[:title]}\"\n form.postText =\"#{post[:link]} #{10.chr} #{post[:title]}\"\n form.field_with(:id => \"post-twit-account-select\").value = settings[:twitter_id]\n form.checkbox_with(:name => /tweet/).check\n form.submit\n ap '[LI]===> ' + post[:title]\n end\n\nend", "def create\n user_id = session[:user_id] \n if user_id \n all_params = site_params\n all_params[:date] = Date.strptime(all_params[:date],'%m/%d/%Y') \n site = Site.new(all_params)\n if site.valid?\n site.save\n redirect_to '/sites/' + site.id.to_s + '/upload'\n else\n err = site.errors.messages\n err_str = \"\\n\"\n err.each do |key, value|\n err_str += \"#{key}:#{value}\\n\"\n end\n flash[:danger] = \"Oooops - sorry, something went wrong while saving your new site: \" + err_str\n redirect_to '/'\n end\n else \n open_id = URI.encode(params[:open_id])\n tmp = Sitetmp.new(site_params)\n tmp.nonce = nonce\n tmp.save\n to_url = '/login?n=' + tmp.nonce + '&open_id=' + open_id\n redirect_to to_url \n end\n end", "def post\n frm.button(:value=>\"Post\").click\n AssignmentsList.new(@browser)\n end", "def click_submit\n end", "def submit_signup_details_without_password\n user = Users.signup_user_without_password\n enter_signup_details(user)\n # @pages.page_home.signup_register_button\n end", "def submit_form\n county = params[:county]\n item = params[:item]\n callerName = params[:callerName]\n #Caller Name on form was set to be optional, in which case name is recorded as Anonymous\n if callerName == \"\" then callerName = \"Anonymous\" end\n method = params[:method]\n #Retrieving the content if \"Other\" button was chosen in form\n if method == \"other2\" then method = params[:altOther2] end\n disposition = params[:disposition]\n if disposition == \"other3\" then disposition = params[:altOther3] end\n if disposition == \"directly\" then disposition = params[:directly] end\n callType = params[:callType]\n if callType == \"Other\" then callType = params[:altOther] end\n callFor = params[:callFor]\n #Storing form data as session variable\n session[:value] = [county, item, callerName, method, disposition, callType, callFor]\n @vals = session[:value]\n #Submit button was clicked, else save button was clicked\n if params[:submit_clicked]\n client = DropboxApi::Client.new\n ifInTmpFolder = false\n currentYear = Time.now.year\n currentMonth = Time.now.month\n prcFileName = \"\"\n if callFor == \"PRC\"\n prcFileName = \"PRCHotlineStatsMonth#{currentMonth}.csv\"\n else\n prcFileName = \"DEPHotlineStatsMonth#{currentMonth}.csv\"\n end\n path = \"/#{currentYear}/#{prcFileName}\"\n tmpPath = Rails.root.join(\"tmp/#{prcFileName}\")\n #Checks if file with correct month and PRC/DEP already exists\n unless File.exist?(tmpPath) || File.symlink?(tmpPath)\n results = client.search(prcFileName,\"/#{currentYear}\")\n if results.matches.count > 0\n path = results.matches.first.resource.path_lower\n monthCSV = \"\"\n file = client.download(path) do |chunk|\n monthCSV << chunk\n end\n CSV.open(tmpPath, \"at\") do |csv|\n csv << monthCSV\n end\n end\n end\n #Adding to CSV file and uploading back to DropBox with override\n CSV.open(tmpPath, \"at\") do |csv|\n csv << [County.find(county).name.titleize, Item.find(item).name.titleize, callerName, method, disposition, callType, callFor]\n end\n file_content = IO.read tmpPath\n client.upload path, file_content, :mode => :overwrite\n session.delete(:value)\n redirect_to \"/\", notice: \"#{callerName} was added to #{callFor}'s call stats.\"\n #Save button clicked\n else\n redirect_to :back\n end\n\n end", "def ask_webmaster_for_planning(webmaster_email, content, structure)\n @content = content\n @structure = structure\n mail to: webmaster_email, subject: \"#{@structure.name} souhaite mettre à jour son site\"\n end", "def saveNewPostURL(obj)\n if obj['pageObj'].exist?\n status = 'True'\n msg = 'New Post Success'\n value = @browser.url\n else\n status = 'False'\n msg = 'New Post Fail'\n value = ''\n end\n @report << [obj['Screen'], msg, value, status]\n end", "def addsale\n @agent.get(@posturl)\n availtypes = {\"office\" => 80,\"industrial\" => 40,\"retail\" => 90,\"health\" => 30, \"multifamily\" => 70, \"land\" => 50,\"agriculture\" => 10, \"hotel\" => 60, \"senior\" => 100, \"sport\" => 130, \"special\" => 120, \"residential\" => 140}\n @page = @agent.page.link_with(:text => 'Add a sale listing').click\n @form = @page.forms.first\n @form['ForSaleAskingPriceTextBox1'] = '10000'\n @form['PropertyNameTextBox1'] = 'Test Property'\n @form['PropertyAddressTextBox1'] = '1 My Street'\n @form['PropertyCityTextBox1'] = 'Rochester'\n @form['lPropertyPostalCodeTextBox1'] = '55901'\n @form['PropertyDescriptionTextBox1'] = 'This property is fake.'\n @form['PropertyLocationDescriptionTextBox1'] = 'My imagination'\n @form.field_with(:name => \"AvailableTypes\").option_with(:value => \"140\").select\n @form.field_with(:name => \"SelectedType\").options[0].value = \"14001\"\n @form.field_with(:name => \"SelectedType\").options[0].select \n #@form.field_with(:name => \"AdditionalTypes\").option_with(:value => \"802\").select\n @form['ucCompInput$txtSalePrice'] = '10000'\n @form['ucCompInput$txtSaleCapRate'] = '20'\n @form['ForSaleCommissionSplitTextBox1'] = '20' \n @form['ForSaleCapRateTextBox1'] = '20'\n @form['PropertyCountryDropDown1'] = 'US'\n @form['PropertyStateDropDownList1'] = 'MN'\n @form['PropertySizeInfoDropDown1'] = 'USI'\n @form['PropertyPostalCodeTextBox1'] = '55901'\n @form['ExcludeValidationForLastSpaceOrUnit'] = true\n # Insert Text Box for Building Size\n @form['PropertyInfoContainer_PropertySizeTotalTextBox1'] = Mechanize::Form::Text.new(@form.form_node,@form)\n @form['PropertyInfoContainer_PropertySizeTotalTextBox1'] = '10000'\n # Insert Radio Button for Building Class\n button = Mechanize::Form::RadioButton.new(@form.form_node,@form)\n button.name = 'PropertyInfoContainer$PropertyBuildingClassRadioButtonList1'\n #@form['PropertyInfoContainer$PropertyBuildingClassRadioButtonList1'].type = 'radio'\n button.value = 'A'\n button.check\n @form['PropertyInfoContainer$PropertyBuildingClassRadioButtonList1'] = button\n @form.add_button_to_query(button)\n \n @form.radiobutton_with(:id => 'ForSalePropertyUseTypeRadioButtonList1_1').check\n @form.checkbox_with(:name => 'chkListingAgreement').check\n @button = @form.button_with(:name => 'btnAddToMarketPlace')\n @button = @form.button_with(:name => 'AddEditSubmit')\n @page = @agent.submit(@form,@button)\nend", "def test_submit_rent\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: '123456',\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: '123456', quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end", "def submit_for_grading\n frm.button(:value=>\"Submit for Grading\").click\n ConfirmSubmission.new(@browser)\n end", "def submit_topic(name, topic, work)\n user = User.find_by(name: name)\n login_as(user.name)\n visit '/student_task/list'\n visit topic # signup topic\n visit '/student_task/list'\n click_link 'Assignment1665'\n click_link 'Your work'\n fill_in 'submission', with: work\n click_on 'Upload link'\n expect(page).to have_content work\n end", "def create_site(params={name:random_string})\n\t\tnew_site = site[:new]\n\t\tparams[:site] = params[:name]\n\t\tnew_site[:params].merge!(params)\n\t\tnew_site[:params][:address] = append_ftp_value(new_site[:params][:address],new_site[:params][:ftp_type])\n\t\tpost(new_site)\n\tend", "def new_site\n \n end", "def save\n frm.button(:value=>\"Save\").click\n Announcements.new(@browser)\n end", "def submit(title, subreddit, options = {})\n subreddit_name = extract_string subreddit, :display_name\n parameters = {\n :title => title,\n :sr => subreddit_name,\n :iden => options[:captcha_identifier],\n :captcha => options[:captcha_value],\n :save => options[:save],\n :sendreplies => options[:send_replies]\n }\n\n if options[:url]\n parameters[:url] = options[:url]\n parameters[:kind] = 'link'\n else\n parameters[:text] = options[:text]\n parameters[:kind] = 'self'\n end\n\n post 'api/submit', parameters\n end", "def view_webform_submission\n Log.logger.info(\"Viewing webform submission.\")\n self.sort_content(ascending = true)\n sleep 2\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n wait.until { @browser.find_element(:xpath => @webformmgr.view_first_webform_result) }.click\n end", "def post\n frm.button(:name=>\"post\").click\n AssignmentsList.new(@browser)\n end", "def add_listing(data)\n\t@browser.text_field(:name => 'ListContact').when_present.set data[ 'full_name' ]\n\t@browser.text_field(:name => 'ReqEmail').when_present.set data[ 'email' ]\n\t@browser.text_field(:name => 'ListOrgName').set data[ 'business' ]\n\t@browser.text_field(:name => 'ListAddr1').set data[ 'address' ]\n\t@browser.text_field(:name => 'ListCity').set data[ 'city' ]\n\t@browser.text_field(:name => 'ListState').set data[ 'state' ]\n\t@browser.text_field(:name => 'ListZip').set data[ 'zip' ]\n\t@browser.text_field(:name => 'ListPhone').set data[ 'phone' ]\n\t@browser.text_field(:name => 'ListWebAddress').set data[ 'website' ]\n\t@browser.text_field(:name => 'ListStatement').set data[ 'business_description' ]\n\n\t#Enter Decrypted captcha string here\n\treturn false unless enter_captcha\n\n\t@browser.link(:href => 'thankyou.php').click\n @browser.p(:text => /submission was successful/).wait_until_present\n\ttrue\nend", "def submit\n click_button 'SEND'\n self\n end", "def submit(contents, attrs = {})\n current_form_context.submit(contents, attrs)\n end", "def site_params\n params.require(:site).permit(:title, :domain, :referral)\n end", "def site_params\n params.require(:site).permit(:name, :address, :districs, :city, :postalcode, :user_id, :Long, :Lat)\n end", "def create\n @resubmit = Resubmit.new(params[:resubmit])\n\n if @resubmit.save\n# redirect_to('https://www.mturk.com/mturk/externalSubmit?participantId='+@resubmit.id.to_s+'&assignmentId='+@resubmit.assignment_id.to_s+'&hitId='+@resubmit.hit_id.to_s+'&workerId='+@resubmit.worker_id.to_s+'&cond=1') \n redirect_to resubmit_path(@resubmit.id) \n else\n render action: \"new\" \n end\n end", "def add_to_basket\n @page.click_button(\"ctl00_contentBody_ctl02_submit\")\n end", "def process_site(site); end", "def save\n frm.button(:name=>\"modifyPartForm:_id89\").click\n EditAssessment.new(@browser)\n end", "def create_web_form_lead\n web_form = WebForm.where(\"form_unique_id =?\",params[:form_unique_id]).first\n # check web form is present or not, if form is not present return error message.\n if web_form.present?\n # Return if form if disabled\n unless web_form.is_active\n render text: \"Opps! Sorry. the Web Form has been disabled by the Admin.\"\n return\n end\n org = web_form.organization\n p \"-------------------2\"\n admin_user = org.users.where(\"id = ?\",web_form.created_by).first\n contact = org.individual_contacts.where(\"email = ?\",params[:email]).first\n if contact.present? \n if params[:first_name].present?\n contact.update_attributes :first_name => params[:first_name]\n end\n if params[:last_name].present?\n contact.update_attributes :last_name => params[:last_name]\n end\n if params[:description].present?\n contact.update_attributes :description => params[:description]\n end\n if params[:website].present?\n contact.update_attributes :website => params[:website]\n end\n if params[:country_id].present?\n contact.update_attributes :country_id => params[:country_id]\n end\n if params[:work_phone].present?\n contact.work_phone = params[:work_phone]\n end\n else\n p \"-------------------3\"\n ic= IndividualContact.new\n ic.organization_id=org.id\n ic.first_name = params[:first_name] ? params[:first_name] : \"\"\n ic.last_name = params[:last_name] ? params[:last_name] : \"\"\n ic.email = params[:email]\n ic.country_id = params[:country_id]\n ic.work_phone = params[:work_phone]\n ic.website = params[:website]\n ic.description = params[:description]\n ic.created_by = admin_user.id\n ic.save\n contact = ic\n end\n\n deal = Deal.new\n deal.organization = org\n if params[:title].nil? || params[:title].blank?\n title= \"New Lead created through web form : #{web_form.form_name}\"\n else\n title = params[:title]\n end\n deal.title=title\n deal.initiated_by = admin_user.id\n deal.priority_type =org.hot_priority()\n deal.is_active=true\n deal.is_current=false\n deal.is_public= true\n deal.last_activity_date = Time.zone.now\n # deal.assigned_to = web_form.user_responsible\n deal.is_webtolead = true\n deal.web_form_id = web_form.id\n deal.deals_contacts.build(organization_id: org.id , contactable_id: contact.id , contactable_type: contact.class.name)\n\n deal.country_id = params[:country_id].present? ? params[:country_id] : \"\"\n deal.is_remote = 1\n industry = org.industries.where(\"name=?\",params[:industry]).first\n src = params[:source]\n if deal.save\n if industry.present?\n if deal.deal_industry.present? \n deal.deal_industry.update_column :deal_id, deal.id\n else\n DealIndustry.create(organization_id: org.id, industry_id: industry.id, deal_id: deal.id)\n end\n else \n industry = Industry.create(organization_id: org.id, name: params[:industry])\n end\n if params[:description].present?\n note = Note.create(:organization => org, :notes => params[:description], :notable => deal, :created_by => admin_user.id, :is_public => true)\n p \"-----------------------Note created----------------------------\"\n p note\n ## Create Activity on Note Created\n # a1 = Activity.create(:organization_id => org.id, :activity_user_id => admin_user.id, :activity_type => \"Note\", :activity_id => note.id, :activity_status => \"Create\", :activity_desc => params[:description], :activity_date => Time.zone.now, :is_public => true, :source_id => note.notable_id)\n end\n if (userlable = UserLabel.find_by_organization_id_and_name org.id, \"Inbound\").present?\n label = userlable\n else\n label = UserLabel.create organization: org, user: admin_user, name: \"Inbound\", color: \"#cf5353\"\n end\n p \"-------------------user label created ---------------\"\n p \"------------------creating activity--------------------\"\n deal.insert_deal_activity\n p \"---------------activity created----------\"\n # Send email to the recipient according to selection in web form\n if web_form.send_email_notification\n if web_form.email_to == \"all\" \n admins = org.users.where(\"admin_type=? OR admin_type=?\",1,2)\n admins.each do |admin|\n user_email = admin.email\n Notification.send_create_form_notification(user_email, admin.first_name,web_form.form_name, deal, contact).deliver if is_valid_user_email(user_email) && is_valid_user_email(params[:email])\n end\n else\n user_email = admin_user.email\n Notification.send_create_form_notification(user_email, admin_user.first_name,web_form.form_name, deal, contact).deliver if is_valid_user_email(user_email) && is_valid_user_email(params[:email])\n end\n # Send notification to Super admin and assigned user\n end\n # Send thank you email to the lead\n Notification.send_web_form_thank_you_to_user(params[:first_name]+\" \"+params[:last_name], params[:email], org.name).deliver if is_valid_user_email(user_email) && is_valid_user_email(params[:email])\n end\n\n # Redirect to page according to selection in web form\n if web_form.is_display_thank_you_page\n redirect_url = \"https://www.wakeupsales.com/web_form/thank_you\"\n else\n redirect_url = web_form.external_link\n end\n \n redirect_to redirect_url\n else\n render text: \"Something wrong! It seems the auto-generated Form 'Unique ID' is missing or incorrect. Please contact your Admin.\"\n return\n end\n end", "def search_success\n page(SubmissionPage).create_post(\"search query\")\n page(FeedDetailsPage).view_search(\"Microsoft\")\n page(FeedDetailsPage).touch_rec\n page(FeedDetailsPage).view_search(\"Microsoft\")\nend", "def save\n #10.times {frm.button(:id=>\"questionpool:submit\").flash}\n frm.button(:id=>\"questionpool:submit\").click\n #sleep 180\n #frm.button(:value=>\"Create\").wait_until_present(120)\n QuestionPoolsList.new(@browser)\n end", "def set_identifiers #basic_form_page - pick up basic information\n unless @session.first(\".cname\").nil?\n web_name = @session.first(\".cname\").text \n puts web_name\n industry = @session.all('.selected-details tbody tr:nth-child(2) td')[1].text\n puts industry\n address = @session.evaluate_script(\"document.getElementsByClassName('selected-detail-val')[0].innerHTML\")\n\n # binding.pry\n unless address.include? \"None\"\n sanitized_address = sanitize_address(address)\n address_1 = sanitized_address[0]\n address_2 = sanitized_address[1]\n city = sanitized_address[2]\n state = sanitized_address[3]\n zip_code = sanitized_address[4]\n @content.push(web_name, industry, address_1, address_2, city, state, zip_code) \n else\n @content.push(web_name, industry, \"Address Not Available\", \"\", \"\", \"\", \"\") \n end\n end\n # binding.pry\n @content\n # address = @session.all('.selected-details tbody tr:nth-child(1) td').empty? ? \"N/A\" : @session.all('.selected-details tbody tr:nth-child(1) td')[1].text\n # puts address\n end", "def postBusiness_tool( tool_id, country, headline, description, link_url, active)\n params = Hash.new\n params['tool_id'] = tool_id\n params['country'] = country\n params['headline'] = headline\n params['description'] = description\n params['link_url'] = link_url\n params['active'] = active\n return doCurl(\"post\",\"/business_tool\",params)\n end", "def makeinfo\n\n info = SiteInfo.new do |u|\n u.title = params[:info][:title]\n u.subtitle = params[:info][:subtitle]\n u.description = params[:info][:description]\n u.image = params[:info][:image]\n u.image2 = params[:info][:image2]\n u.position = params[:info][:position]\n \n \n \n end\n info.save\n redirect_to \"/admin\"\nend", "def add_first_identity_to_organization(field)\n sleep 3\n fill_in \"#{field}\", with: \"bjk7\"\n wait_for_javascript_to_finish\n page.find('a', text: \"Brian Kelsey (kelsey@musc.edu)\", visible: true).click()\n wait_for_javascript_to_finish\n first(\"#save_button\").click\n wait_for_javascript_to_finish\n end", "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "def site_params\n params.require(:site).permit(:address, :city, :county, :loc_page, :loc_longitude, :loc_latitude, :apn, :tombrobox, :fault_id)\n end", "def new_site_create(params={})\n study_study_sites.set params[:site_name]\n site_number.set params[:site_number]\n study_site_number.set params[:study_site_number]\n end", "def submit\n # we are authenticated from params or session\n if authenticated?\n @test_instance = submission_instance\n submission_save\n # params authentication failed. Redirect (html) or report failure (JSON)\n else\n submission_fail_authentication\n end\n end", "def record_submit(content)\n @greeting = content\n\n mail to: \"superacidjax@me.com\", :subject => 'New Submit Arrived'\n end", "def add_site(n, site_name)\n site = Site.new(name: site_name, org_type: 'city', status: 'active')\n lat, lng = Geocoder.coordinates(@zip_xpath[n].text)\n site.contacts.build(city: @city_xpath[n].text, state: @state_xpath[n].text,\n zip: @zip_xpath[n].text, country: @country_xpath[n].text, lat: lat, lng: lng)\n site.save ? site.id : nil\n end", "def test_get_multival\n page = @agent.get(\"http://localhost/form_multival.html\")\n form = page.form_with(:name => 'get_form')\n\n assert_not_nil(form)\n assert_equal(2, form.fields_with(:name => 'first').length)\n\n form.fields_with(:name => 'first')[0].value = 'Aaron'\n form.fields_with(:name => 'first')[1].value = 'Patterson'\n\n page = @agent.submit(form)\n\n assert_not_nil(page)\n\n assert_equal(2, page.links.length)\n assert_not_nil(page.link_with(:text => 'first:Aaron'))\n assert_not_nil(page.link_with(:text => 'first:Patterson'))\n end", "def submit_request\n #TBD add a request to the database\n redirect_to show_package_path(:id => params[:id]) \n end", "def saveSite()\n\t\tr = @connection.execute('<SiteSaveRequest session-id=\"' + @connection.session_id + '\">' + getSiteXML() + ' </SiteSaveRequest>')\n\t\tif (r.success)\n\t\t\t@site_id = r.attributes['site-id']\n\t\t\t@site_config._set_site_id(@site_id)\n\t\t\t@site_config.scanConfig._set_configID(@site_id)\n\t\t\t@site_config.scanConfig._set_name(@site_id)\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def authenticate_unimelb_by_pin(login,pin)\n agent = WWW::Mechanize.new\n page = agent.get \"https://sis.unimelb.edu.au/cgi-bin/subject-change.pl\"\n search_form = page.forms.last\n\n search_form.field_with(:name => \"id_number\").value = login\n search_form.field_with(:name => \"pin_number\").value = pin\n search_results = agent.submit(search_form)\n return search_results.body\nend", "def create_site\n \n district_id = District.find_by_name(params[:district]).district_id rescue nil\n\n site = Site.find_by_name(params[:sitename], :conditions => [\"district_id = ?\", district_id]) rescue nil\n\n type = SiteType.find_by_name(params[:sitetype]).id rescue nil\n \n longitude = params[:longitude] rescue nil\n \n latitude = params[:latitude] rescue nil\n \n if site.nil?\n\n @site = Site.new(:name => params[:sitename], :district_id => district_id, \n :longitude => longitude, :latitude => latitude, :site_type => type)\n \n @site.save\n\n flash[:notice] = \"Site #{params[:sitename]} created\"\n\n else\n flash[:error] = \"Site #{params[:sitename]} in #{params[:district]} already exists! Choose a different site name.\"\n end\n\n redirect_to \"/images/malawi/districts?district=#{params[:district]}\",\n :layout => \"application\" and return\n \n end", "def site_params\n params.require(:site).permit(:site, :location, :contacts, :email, :installed, :FSE, :PQandTraining, :FAS, :TrainedOn, :SxSerialNumber, :MappingTool, :RGQSN, :RgqSoftware, :SAReporter, :AssayPackage, :NGS, :NGSassay, :NGSSXSN, :ST401i, :ST401e, :SQ301, :SQSuite, :SQreporter, :NGSInstall, :NGSFSE, :NGSPQandTraining, :FAS, :Notes)\n end", "def submitTheForm\n user = User.find_by_email(params[:IdeaConsultantEmailAddress])\n if user.nil?\n redirect_to pitches_path, alert: \"you are not an ideator\"\n else\n redirect_to pitches_path, notice: \"The form has been submitted successfuly\"\n end\n end", "def submit(form, button = T.unsafe(nil), headers = T.unsafe(nil)); end", "def create\n @site = Site.new(params[:site])\n @site.disabled = !(logged_in? && current_user.admin?)\n # @site = load_site_msa(@site)\n @site.user = (logged_in?) ? current_user : nil\n @site.build_key_phrases(params[:key_phrase])\n if params[:metro_service_area].blank? || (params[:msa_indicator] == \"no_msa\" || params[:msa_indicator] == \"all_msas\")\n @site.online = true\n @site.city = nil\n @site.metro_service_area = nil \n @site.all_msas = (params[:msa_indicator] == \"all_msas\")\n else\n @site.metro_service_area = MetroServiceArea.find_or_create_by_name(params[:metro_service_area][:name])\n @site.online = true if params[:msa_indicator] == \"online_plus_msa\" || params[:msa_indicator] == \"online_plus_all_msas\"\n if !params[:country].nil? && !params[:country][:name].blank?\n country_code = Country.find_by_name(params[:country][:name].upcase)\n @site.country_code = country_code.code unless country_code.nil?\n end\n @site.all_msas = (params[:msa_indicator] == \"online_plus_all_msas\")\n end\n \n if logged_in? && current_user.is_ubexpert?\n @site.country_code ||= Country.find_by_name('ONLINE').code \n end\n \n unless params[:comments].blank? \n comments = Comment.new(:comment => params[:comments])\n unless params[:searched_for].blank?\n comments.comment += \" -- Search parameter was #{params[:searched_for]}.\"\n end\n @site.comments << comments\n end \n \n # @site.disable_ferret if @site.disabled?\n \n respond_to do |format|\n if @site.save \n flash[:notice] = 'Site was successfully submitted.'\n format.html { redirect_to(site_path(@site)) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n @super_categories = Topic.roots\n set_nav\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n \n end", "def upsert_marketo_lead(params)\n # todo: verify required fields? perhaps get form fields and validation logic from marketo?\n # removing params included by rails\n params.delete :action\n params.delete :controller\n params.delete :marketo_form\n # parse incoming values to json\n body = {\n #\"action\"=>\"createOnly\",\n \"lookupField\"=>\"email\",\n \"input\"=>[params]\n }.to_json\n @body = body\n # set post uri\n uri = URI(Config.get_create_lead_url)\n # setup http request\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n uri.query = \"access_token=#{get_marketo_token}\"\n request = Net::HTTP::Post.new(uri, { 'Content-Type' => 'application/json' })\n request.body = @body\n # make http request\n response = http.request(request)\n return response.body\n end", "def save_changes\n frm.button(:value=>\"Save Changes\").click\n Announcements.new(@browser)\n end", "def save_changes\n frm.button(:value=>\"Save Changes\").click\n Announcements.new(@browser)\n end", "def duplicate_site(sitename, dup_sitename, gardens_domain = self.get_gardens_domain, browser = @browser)\n Log.logger.info(\"Beginning to make duplicate gardens site of site #{sitename}\")\n wait = Selenium::WebDriver::Wait.new(:timeout => 60)\n siteurl = sitename + '.' + gardens_domain\n wait.until { browser.find_element(:xpath => self.more_link(siteurl)) }.click\n wait.until { browser.find_element(:xpath => self.duplicate_site_link(siteurl)) }.click\n temp = wait.until { browser.find_element(:xpath => \"//input[@id='edit-site-prefix']\") }\n temp.clear\n temp.send_keys(dup_sitename)\n browser.find_element(:xpath => \"//button[@id='edit-submit']\").click\n if(browser.find_elements(:xpath => \"//div[contains(@class, 'messages error')]\").size > 0)\n error_msg = browser.find_element(:xpath => \"//div[contains(@class, 'messages error')]\").text\n else\n error_msg = nil\n end\n return error_msg\n end" ]
[ "0.68700993", "0.6760053", "0.6658083", "0.63189256", "0.6288458", "0.6239724", "0.6138803", "0.60807294", "0.60247386", "0.5938117", "0.59216416", "0.59060216", "0.58959854", "0.588559", "0.58542174", "0.58542174", "0.58417416", "0.5839324", "0.58237475", "0.5820666", "0.5816192", "0.57891303", "0.5786547", "0.57825494", "0.57825494", "0.5753714", "0.57270557", "0.5700883", "0.5700883", "0.5691103", "0.56619084", "0.564391", "0.5636867", "0.5636421", "0.5636421", "0.56063867", "0.5594809", "0.55878055", "0.5578731", "0.5562403", "0.55537146", "0.55517155", "0.55508345", "0.55460066", "0.55459", "0.5494605", "0.5492766", "0.5472144", "0.54559803", "0.5440496", "0.54403746", "0.5432459", "0.5431908", "0.54168856", "0.53993917", "0.53992814", "0.5390036", "0.53836966", "0.5379245", "0.5377475", "0.53710186", "0.5369192", "0.535051", "0.53300077", "0.53270006", "0.5306214", "0.5295785", "0.52957535", "0.52931756", "0.52842504", "0.5283927", "0.52767533", "0.52753264", "0.52709496", "0.52708876", "0.52703136", "0.52680683", "0.526149", "0.52556896", "0.52525884", "0.52448237", "0.5244783", "0.52376384", "0.52287877", "0.5227423", "0.5220798", "0.52179074", "0.52067995", "0.52025527", "0.51988006", "0.51943666", "0.5183244", "0.517614", "0.51591796", "0.5155671", "0.51537603", "0.51502967", "0.5147209", "0.5147209", "0.51462847" ]
0.5596549
36
Login and check if you are in the right page after login.
def login end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end", "def check_login\n unless is_logged_in?\n # all cool\n redirect_to new_session_path\n end\n end", "def check_login\n user = current_user\n if user.nil?\n if params[:controller] != \"login\"\n session[:previous_url] = request.fullpath\n redirect_to \"/login\"\n return\n end\n else\n if params[:controller] != \"firstlogin\" &&\n params[:controller] != \"login\"\n if user.is_deleted? || !user.is_firstlogged?\n redirect_to \"/login\"\n return\n end\n end\n end\n end", "def user_login\n unless logged_in?\n navigated_location #stores the location that was navigated before login\n flash[:alert]= \"You Must Be Log In Order To Access that Portion of the Site\" \n redirect_to login_path\n end\n end", "def check_login\n unless logged_in?\n access_denied\n end\n end", "def check_login\n \t\t\tif self.session == nil\n \t\t\t\t login\n \t\t\tend\n \tend", "def check_login\n if !session[:user_name]\n redirect_to sign_in_path\n end\n end", "def check_redirect_if_user_login\n \t\tif signed_in?\n \t\t\tflash[:alert] = \"You are already login.\"\n \t\t\tredirect_to homes_path and return \n \t\tend\n \tend", "def check_login_status\n # If user hasn't logged in\n unless logged_in?\n # Show reminder message\n flash[:info] = \"Log in to continue.\"\n\n # Redirect user to login page\n redirect_to login_url\n end\n end", "def check_authentication\n unless logged_in?\n flash[:warning] = \"You must be logged in to view the requested page.\"\n request.env[\"HTTP_REFERER\"] ? (redirect_to :back) : (redirect_to :action => \"index\", :controller => \"site\")\n return false\n end\n end", "def check_login\n redirect_to root_url, alert: \"You must login to view this page.\" if current_user.nil?\n end", "def loginpage\n end", "def check_logged_in\n unless current_user\n redirect_to '/login'\n end\n end", "def redirected_to_login?\n @agent.page.body.match \"#{@piggybank.url_base}/cas/login.php\"\n end", "def check_login\n unless logged_in?\n flash[:notice] = \"Please login.\"\n redirect_to login_path\n end\n end", "def check_login\n unless logged_in?\n flash[:notice] = \"Please login.\"\n redirect_to login_path\n end\n end", "def checklogin\n if user_signed_in? #&& !current_user.admin?\n if session[:redirectcheck] == true\n sign_out_and_redirect(current_user)\n elsif session[:netidcheck] != true\n session[:redirectcheck] = true\n redirect_to \"https://oauth.oit.duke.edu/oauth/authorize.php?client_id=organizerish&redirect_uri=https%3A%2F%2Forganizerish.herokuapp.com%2Fnetidsignin&state=b7b486e7002feb52a588853507b403aa0729fbd8f4576105&response_type=token\" \n end\n end\n end", "def login_page\n end", "def check_login\n if !check_authentication\n redirect_to controller: \"account\", action: \"login\"\n end\n end", "def login_required\n return true if logged_in?\n store_location\n access_denied and return false\n end", "def verify_existing_login\n return if cookies[GlobalConstant::Cookie.user_cookie_name.to_sym].blank?\n\n @response = CompanyApi::Request::Client.new(\n CompanyApi::Response::Formatter::Client,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_verify_cookie_details\n\n # success means user is already logged in, we would redirect to dashboard / planner\n # Error means user ain't logged in yet.\n return unless @response.success?\n\n @presenter_obj = ::WebPresenter::UserPresenter.new(@response, params)\n\n if @presenter_obj.client_token.step_three_done?\n redirect_to :dashboard, status: GlobalConstant::ErrorCode.temporary_redirect and return\n else\n redirect_to :planner, status: GlobalConstant::ErrorCode.temporary_redirect and return\n end\n\n end", "def login_required\n unless logged_in?\n store_location\n not_authenticated\n return false\n end\n true\n end", "def check_logged_in?\n if !logged_in?\n redirect_to root_path\n end\n end", "def verify_logged_in\n redirect_to root_path unless logged_in?\n end", "def check_for_login\n #if not, back home with you!\n redirect_to root_path unless @current_user.present?\n end", "def check_login\n head :forbidden unless self.current_user\n end", "def verify_logged_in\n if !logged_in?\n redirect_to \"/modal/login?return_url=\" + URI.encode(request.fullpath)\n return false\n end \n return true \n end", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "def check_signin\n if session[:login_name] == nil\n \tredirect_to sessions_url, notice: 'Sign in, please'\n end\n end", "def check_if_logged_in\n unless @current_user.present?\n flash[:login_error] = \"Please login to view that page.\"\n redirect_to login_path\n end\n end", "def check_logged_in\n return if current_user.present?\n\n redirect_to new_session_path and return\n end", "def login_checkpoint\n redirect to '/' if !logged_in?\n end", "def login_required\n if logged_in?\n return true\n else\n redirect_to(:controller => '/user', :action => 'index')\n return false\n end\n end", "def check_if_login_required\n false\n end", "def checklogin\n\t#check session validity\n\tredirect_to \"/my_test\"\nend", "def login\n redirect_to lato_core.root_path if core_controlSession\n end", "def require_login\n end", "def requires_login\n unless user_logged_in?\n return redirect_to login_index_path, notice: \"You must login to view that page.\"\n end\n end", "def login_required\n if !logged_in?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end", "def login?\n if login\n return true\n else\n return nil\n end\n end", "def check_login\n if (current_user.blank? or current_user.username.blank?) and !session[:user_id].blank? \n logger.error(\"logout occurred\")\n session[:user_id] = nil\n elsif session[:user_id].blank? and !current_user_model.blank? and !current_user.blank? \n session[:user_id] = current_user_model.id\n session[:user_id] = '1' if session[:user_id].blank?\n logger.error(\"login occurred\")\n log_request('login')\n end\n end", "def req_login\n unless curr_user\n flash[:danger] = \"Login to view this content\"\n redirect_to login_url\n end\n end", "def require_login\n redirect R(:login) unless logged_in?\n end", "def check_login\n I18n.locale = cookies[:lang] || I18n.default_locale\n begin\n if !request.xhr?\n $domain = request.protocol +\n (request.domain == nil ? request.host : request.domain) +\n (request.port == 80 ? '' : (':' + request.port.to_s))\n end\n rescue\n $domain = 'http://brse-school.vn'\n end\n\n begin\n if !($domain.include?('http://brse-school.vn') || $domain.include?('45.252.249.221') || $domain.include?('localhost:8100'))\n redirect_to '/error'\n end\n rescue\n\n end\n\n if session[:user_id] == nil\n if !request.xhr?\n redirect_to admin_login_index_path\n else\n result = Hash.new\n result['status'] = false\n render json: result\n end\n else\n @language = Helper.getLang\n $user_id = session[:user_id]\n if !request.xhr?\n @msg = Helper.genMsg\n @countRegistCouse = RegisterCourse.where(deleted_at: nil, status: 1).count(:id)\n @countRegistAdvisories = RegisterAdvisory.where(deleted_at: nil, status: 1).count(:id)\n @countRegistEvents = RegisterEvent.where(deleted_at: nil, status: 1).count(:id)\n @countSubscribes = Subscribe.where(deleted_at: nil, status: 1).count(:id)\n end\n end\n end", "def logged_in?\n # Are we on the login page already?\n if username_field.present?\n # Yes! So, we're not logged in...\n false\n # No, the Kuali header is showing...\n elsif login_info_div.present?\n # So, is the user currently listed as logged in?\n return login_info_div.text.include? @user_name\n else # We're on some page that has no Kuali header, so...\n begin\n # We'll assume that the portal window exists, and go to it.\n on(BasePage).return_to_portal\n # Oops. Apparently there's no portal window, so...\n rescue\n # We'll close any extra tabs/windows\n on(BasePage).close_children if @browser.windows.size > 1\n # And make sure that we're using the \"parent\" window\n @browser.windows[0].use\n end\n # Now that things are hopefully in a clean state, we'll start\n # the process again...\n logged_in?\n end\n end", "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end", "def check_if_logged_in\n redirect_to(new_user_path) if @current_user.nil?\n end", "def check_redirect(proj)\n visit opening_path(proj)\n assert_text 'You must be logged in to view job openings.'\n assert page.has_css?('title', text: full_title('User Login'), visible: false)\n assert page.has_css?('h1', text: 'User Login')\n end", "def home_check\n if logged_in? && @current_user.admin?\n puts @current_user\n redirect_to account_url(@current_user.id)\n return\n elsif logged_in?\n redirect_to cases_path\n else\n redirect_to page_path(\"home\")\n return\n end\n end", "def login_required\n redirect_to login_path unless logged_in?\n end", "def logged_in?\n if current_user == nil\n redirect_to new_user_session_path, alert: \"Kindly Login!\"\n end\n end", "def needs_login?() false end", "def login_required\n return true if session[:affiliate]\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n redirect_to :action =>\"login\" and return false \n end", "def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end", "def require_login\n if logged_in? or authorized?\n # Let them pass\n else\n flash[:warning] = \"You must be logged in to view that page\"\n redirect_to login_path(:redirect => request.url)\n end\n end", "def more_login\n page(FooterTabBarPage).select_tab(\"Profile\")\n page(LoginPage).await\n page(LoginPage).login(\"valid\")\n end", "def must_login\n redirect_to login_path unless logged_in?\n end", "def _login? redirect_url = nil\n\t\tislogin = _user[:uid] > 0 ? true : false\n\t\tif islogin\n\t\t\t_session_update _user[:sid], _user[:uid]\n\t\telse\n\t\t\tif redirect_url != nil and redirect_url != request.path\n\t\t\t\t@qs[:come_from] = request.path\n\t\t\t\tredirect _url2(redirect_url)\n\t\t\tend\n\t\tend\n\t\tislogin\n\tend", "def save_login_state\n if session[:user]\n redirect_to(:controller => 'webportal', :action => 'index')\n return false\n else\n return true\n end\n end", "def login_check(response)\n\t\t\tif response.code == '200'\n\t\t\t\tputs \"#{response.code} - #{response.message}: Logged in\"\n\t\t\t\tputs \"site: #{api_location}\"\n\t\t\t\tputs \"with: #{username}\"\n\t\t\telse\n\t\t\t\tputs \"#{response.code} - #{response.body}: Failed to log in\"\n\t\t\t\tif @test_login == false\n\t\t\t\t\tabort #if login fails, then abort\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def is_logged_in\n redirect_to login_path unless logged_in?\n end", "def checklogin\n\t\t@login = User.where(\"username = '#{params[:username]}'\").first\n\n\t\tp params, @login\n\n\t\tif @login && @login.password == params[:password]\n\t\t\tsession[:user_id] = @login.id\n\t\telse\n\t\t\tflash[:notice] = \"YOU ARE AN IMPOSTER\"\n\t\t\t@login = nil\n\t\t\tredirect_to '/'\n\t\tend\n\tend", "def require_login\n unless logged_in?\n redirect_to login_path\n end\n end", "def require_login\n redirect_to login_path if !user_logged?\n end", "def require_login\n unless @current_account\n redirect_to root_path\n end\n end", "def log_in?\n if current_user\n redirect_to user_path\n end\n end", "def auth\n #redirect to login page unless already logged in\n redirect_to new_user_session_path, alert: \"You must login to access that page\" unless logged_in?\n end", "def is_logged_in\n if !logged_in?\n redirect_unauthorized(:back, \"You must be logged in to perform this action.\")\n end\n end", "def login_required\n call(Rs(:login)) unless logged_in?\n end", "def ensure_logged_in\n if (!logged_in?)\n redirect_to login_url\n end\n end", "def require_login\n unless logged_in?\n redirect url(:admin_login)\n throw :halt\n end\n end", "def check_login\n if logged_in?\n flash.discard\n else\n flash[:notice] = \"Please login first\"\n redirect_to root_path\n end\n end", "def logged_in?\n !!link_to_account_detail_page\n end", "def check_unlogin\n return unless curr_user\n redirect_to articles_path\n end", "def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n \tend", "def login_required\n if session[:customer]\n return true\n end\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n \n redirect_to :action =>\"login\" and return false \n end", "def check_session\n if session[:user_id].nil?\n session[:return_to] = request.request_uri\n flash[:messgae] = \"Please sign-in or sign-up to access any of these pages.\"\n redirect_to :controller => 'user', :action => 'index'\n return\n end\n end", "def pide_login\n if !logado\n redirect_to login_path,:notice=>'Se requiere usuario y clave'\n\t end\n end", "def logged_in_user?\n unless logged_in?\n store_location\n flash[:info] = 'please log in first'\n redirect_to login_path\n end\n end", "def is_logged_in?\n if current_reserver == nil\n flash[:alert]=\"Please log in\"\n redirect_to client_login_url\n end\n end", "def save_login_state\n #You are logged in\n if session[:user_id]\n #go back home you can't log in twice!\n redirect_to(:controller => 'sessions', :action => 'home')\n return false\n else\n #you aren't logged in so you may login or signup\n return true\n end\n end", "def login\n\t#Login Form\n end", "def logged_in?\n unless current_user\n redirect_to login_path, notice: 'You must be logged in to do that.'\n end\n end", "def save_login_state\n # redirect to home Page\n if session[:user_id]\n redirect_to(:controller => 'sessions', :action => 'home')\n return false\n else\n return true\n end\n end", "def login_required\n logged_in? ? true : access_denied\n end", "def login_page \n @login_page ||= http_agent.get(start_url)\n end", "def check_logged_in\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n\n return\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend", "def require_login\n if !current_user\n redirect_to \"/\"\n end\n end", "def login\n end", "def login_required?\n true\n end" ]
[ "0.7686792", "0.76410437", "0.761621", "0.7457306", "0.7447662", "0.74339515", "0.7430516", "0.7417327", "0.7412209", "0.7403839", "0.74036705", "0.73398906", "0.7338175", "0.72981834", "0.7297586", "0.7297157", "0.7275036", "0.7264337", "0.72558486", "0.7234226", "0.7234126", "0.7221757", "0.71732575", "0.7165567", "0.71646965", "0.715517", "0.7129776", "0.71216774", "0.71216774", "0.71216774", "0.7108969", "0.7103155", "0.70608044", "0.70241976", "0.7023313", "0.7019177", "0.70059127", "0.7001216", "0.6989281", "0.6988219", "0.6981915", "0.696875", "0.6964475", "0.6951728", "0.69416416", "0.69364595", "0.69354105", "0.69354105", "0.69341433", "0.6933215", "0.6929481", "0.6928009", "0.69266444", "0.691559", "0.6913869", "0.69032496", "0.69022536", "0.6901693", "0.6897065", "0.6893528", "0.6891408", "0.68870705", "0.6884356", "0.6881777", "0.68795395", "0.6869258", "0.6842591", "0.6840866", "0.68281573", "0.68243086", "0.68226784", "0.6821143", "0.68144673", "0.68105304", "0.6792503", "0.679036", "0.6787357", "0.67863303", "0.6778247", "0.6777391", "0.67743397", "0.6772329", "0.67715687", "0.67684835", "0.67643404", "0.67635214", "0.6758455", "0.6757997", "0.6753734", "0.6753734", "0.6753734", "0.6753734", "0.6753734", "0.6753734", "0.6753734", "0.6753734", "0.6753734", "0.6753464", "0.67510176", "0.6750698", "0.6740015" ]
0.0
-1
Constructor > Get the listing details to be submitted in the given site
def initialize(listingDetails, site_url,login_details) @site_details = listingDetails @login_details = login_details @site_url = site_url @browser = Watir::Browser.new :chrome end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(name = \"\", url = \"\")\n @name = name\n @url = url\n @details = details\n scrape_details\n end", "def fetch_listing\n districts = district_name_and_permalink_hash \n district_permalink = districts.fetch(district.name) { \n raise \"Whoa, cannot fetch listing,-- #{district.name} -- not a park or general listing of resorts.\" \n }\n\n # Technical: Class (self) instead of an instance variable is used to access HTTParty params\n @listing = TouringPlansComFeed.get(district_permalink).parsed_response\n end", "def collect_site_details\n site = fetch('site','1')\n @site_name = site['name']\n @time_zone = site['time_zone']\n @language_code = site['language_code']\n end", "def initialize(site)\n @site = site\n end", "def retrieve_listing_basics(listingDetail, listing)\n\t\t\t\tlisting[:title] = \"444 Washington Boulevard\"\n\t\t\t\tlisting[:city_name] = \"Jersey City\"\n\t\t\t\tlisting[:state_name] = \"NJ\"\n\t\t\t\tlisting[:zipcode] = \"07310\"\n\t\t\t\tlisting[:contact_tel] = \"2012169200\"\n\t\t\t\tlisting[:description] = \"Located by the historic Waterfront Walkway on the Hudson River, Avalon Cove brings a new sense of luxury living to this metropolis. Our newly renovated Jersey City apartments boast one-, two-, three- and four-bedroom designs in this bustling haven. Some of the upgrades you will find include designer gourmet kitchens with granite counters, stainless-steel appliances, hardwood floors, espresso cabinetry, marble tile bathrooms, spacious walk-in closets and private patios and balconies with great views of Manhattan. Residents can choose to spend their leisure time in the landscaped barbecue and picnic areas, at the sparkling outdoor heated swimming pool, state of the art fitness center, clubroom with billiards or at the beautiful waterfront walkway. Residents can also engage in sporting activities as our Jersey City apartments have an indoor basketball court, two lighted tennis courts and two indoor racquetball courts. Residents of our apartments in Jersey City also have access to local public transportation, on-site storage units, private garage space, gated entrance with controlled access and 24-hour maintenance service.\"\n\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"Marble tile entries and baths\",\"Spacious walk-in closets\",\"24-hour emergency maintenance\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\t\t\t\treturn listing\n\t\t\tend", "def get_listing(listing_id)\n query_and_build \"marketplace/listings/#{listing_id}\"\n end", "def set_listing\n @listing = Listing.find_by(address: params[:address])\n end", "def new\n @order = Order.new\n @listing = Listing.find(params[:listing_id])\n # Find the id of the listing you want to buy in the url\n end", "def initialize(site, sort='count')\n @params = {url: site, sort: sort, of: 0*20}\n end", "def initialize(site, usr, pass)\n fail 'url can\\'t be nil' unless site\n fail 'usr can\\'t be nil' unless usr\n fail 'pass can\\'t be nil' unless pass\n\n @search_url = jira_api_url(site, usr, pass);\n end", "def listing\n @listing\n end", "def pullingListingAddress(buildingURL, listing)\n buildingDocContact = Nokogiri::HTML(open(URI.parse(buildingURL + \"/contact\")))\n buildingDocDetails = Nokogiri::HTML(open(URI.parse(buildingURL + \"/features\")))\n buildingDocImages = Nokogiri::HTML(open(URI.parse(buildingURL + \"/media\")))\n #REMEMBER TO ADD BROOKLYN INTO THIS!!!!!\n contactText = buildingDocContact.css(\"#community-contact-text\")\n #contactText.css(\"p\")[1].text\n #puts buildingDocImages.css(\".slides\").css(\"img\").length\n #puts buildingDocImages.css(\".slides\").css(\"img\")\n listing[:images] = []\n countInt = 0 #used for image count\n while (countInt < (buildingDocImages.css(\".slides\").css(\"img\").length)/2) do #too many photos so i cut in half\n listing[:images] << { origin_url: buildingDocImages.css(\".slides\").css(\"img\")[countInt][\"src\"] }\n countInt = countInt + 1\n end\n #retrieve_images(buildingDocImages, listing)\n #puts contactText.css(\"p\")[2].text\n #puts buildingDocContact.css(\".phone-number\")\n if listing[:description] = buildingDocDetails.css(\".row.feature\").css(\"p\").css(\"span\")[0] != nil\n listing[:description] = buildingDocDetails.css(\".row.feature\").css(\"p\").css(\"span\")[0].text\n end\n listing[:amenities] = []\n #listing[:amenities] <<\n #puts (buildingDocDetails.css(\".row.feature\").css(\"#li_cont2\")).length\n listing[:contact_name] = \"Bozzuto Management\"\n\n if contactText.css(\"p\")[1].text.include?(\"New York\")\n matchText = (/New York, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = matchText.to_s\n listing[:title] = (matchText.pre_match).to_s #Street Address, but the matching part is like \"New York, \"\n listing[:city_name] = ((/, /).match(matchTextString).pre_match).to_s\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n if contactText.css(\"p\")[1].text.include?(\"Hoboken\")\n #((/Hoboken, /) === (contactText.css(\"p\")[1].text))\n matchText = (/Hoboken, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = (matchText.pre_match).to_s\n listing[:title] = matchText.pre_match\n listing[:raw_neighborhood] = \"Hoboken\"\n listing[:city_name] = \"Jersey City\"\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n if contactText.css(\"p\")[1].text.include?(\"Brooklyn\")\n matchText = (/Brooklyn, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = (matchText.pre_match).to_s\n listing[:title] = matchText.pre_match\n listing[:city_name] = \"Brooklyn\"\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n listing\n end", "def retrieve_listing_basics(listingDetail, listing)\n\t\t\t\tcase listingDetail[\"communityCode\"]\n\t\t\t\twhen \"NY026\"\n\t\t\t\t\tlisting[:title] = \"343 Gold Street\"\n\t\t\t\t\tlisting[:city_name] = \"Brooklyn\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11201\"\n\t\t\t\t\tlisting[:contact_tel] = \"7185963143\"\n\t\t\t\t\tlisting[:description] = \"Avalon Fort Greene brings new meaning to luxury with these unbeatable Brooklyn apartments built on fabulous green living principles. The massive Fort Greene Avalon Tower offers spaciously designed studios along with one-, two- and three-bedroom designs that boast spectacular views of Manhattan and Brooklyn while providing residents a high-quality living experience. Inside the homes you’ll find a wide range of amenities including spacious floor plans, vaulted ceiling, mini blinds, stainless steel sinks, linen closets, high ceilings, large closets and balconies or patios. Residents are also privy to community amenities like a state of the art fitness center, stylish resident lounge, urban park plaza and valet parking service. Adding to the list of enticing features is the fact that our Brooklyn apartments have a courteous and attentive staff as well as all the necessary amenities to cater to the most discerning New York residents.\"\n\t\t\t\t\tlisting[:amenities] = [\"In-unit washer/dryer\",\"24-hour emergency maintenance\",\"Resident clubhouse\",\"On-site ZipCar\",\"Ceramic tile flooring\",\"ENERGY STAR appliances\",\"Marble vanity\"]\n\n\t\t\t\twhen \"DV007\"\n\t\t\t\t\tlisting[:title] = \"214 Duffield Street\"\n\t\t\t\t\tlisting[:city_name] = \"Brooklyn\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11201\"\n\t\t\t\t\tlisting[:contact_tel] = \"7185963143\"\n\t\t\t\t\tlisting[:description] = \"\"\n\t\t\t\t\tlisting[:amenities] = \"\"\n\n\t\t\t\twhen \"DV102\"\n\t\t\t\t\tlisting[:title] = \"240 East Shore Road\"\n\t\t\t\t\tlisting[:city_name] = \"Great Neck\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11023\"\n\t\t\t\t\tlisting[:contact_tel] = \"7185963143\"\n\t\t\t\t\tlisting[:description] = \"\"\n\t\t\t\t\tlisting[:amenities] = \"\"\n\n\t\t\t\twhen \"NY011\"\n\t\t\t\t\tlisting[:title] = \"2-01 50th Avenue\"\n\t\t\t\t\tlisting[:city_name] = \"Long Island City\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11101\"\n\t\t\t\t\tlisting[:contact_tel] = \"7187297800\"\n\t\t\t\t\tlisting[:description] = \"In the heart of Long Island City, the stunning Avalon Riverview North is an urban paradise entrenched near the East River, LaGuardia Airport and Grand Central Station. Our apartments in Long Island City offer spacious studios and one-, two- or three-bedroom floor plans to fit your needs. These stunning Long Island City apartments feature gourmet kitchens with granite countertops, washer and dryers, modern hardwood floors, maple cabinetry and so much more. The community has a host of amenities as well, including a 24-hour concierge, state of the art fitness center, 9th floor sparkling swimming pool with views of Manhattan and a roof-garden with barbecue grills are just a few of the amenities at your disposal.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Spectacular views of Manhattan skyline\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"10 minutes to Grand Central on 7 train\",\"Beautifully landscaped courtyards\"]\n\n\t\t\t\twhen \"NY034\"\n\t\t\t\t\tlisting[:title] = \"525 West 28th Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10001\"\n\t\t\t\t\tlisting[:contact_tel] = \"2122391323\"\n\t\t\t\t\tlisting[:description] = \"AVA is a first. Our apartments are energized by this great city, personalized by you. You're on the High Line - steps away from the high life of art galleries, eclectic dining, and exciting clubs and bars such as the Frying Pan. Yep. Take our DIY kits and go to town in your new West Chelsea apartment. Our brand new studio, 1- and 2-bedroom apartments feature stainless steel appliances, black quartz countertops, plank flooring, and built-in charging stations.We're also smoke free, eco-friendly,and pet-friendly (big dogs too). Work out in our awesome fitness center, take in city views on the 14th floor roof deck or attend social events exclusive to AVA friends. Dive in and make it yours.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Chill Lounge\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"Smoke-free community\",\"Affordable housing available\"]\n\n\t\t\t\twhen \"NY018\"\n\t\t\t\t\tlisting[:title] = \"4-75 48th Avenue\"\n\t\t\t\t\tlisting[:city_name] = \"Long Island City\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11109\"\n\t\t\t\t\tlisting[:contact_tel] = \"7189371390\"\n\t\t\t\t\tlisting[:description] = \"In the heart of Long Island City, the stunning Avalon Riverview North is an urban paradise entrenched near the East River, LaGuardia Airport and Grand Central Station. Our apartments in Long Island City offer spacious studios and one-, two- or three-bedroom floor plans to fit your needs. These stunning Long Island City apartments feature gourmet kitchens with granite countertops, washer and dryers, modern hardwood floors, maple cabinetry and so much more. The community has a host of amenities as well, including a 24-hour concierge, state of the art fitness center, 9th floor sparkling swimming pool with views of Manhattan and a roof-garden with barbecue grills are just a few of the amenities at your disposal.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Spectacular views of Manhattan skyline\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"10 minutes to Grand Central on 7 train\",\"Beautifully landscaped courtyards\"]\n\n\t\t\t\twhen \"NY034\"\n\t\t\t\t\tlisting[:title] = \"525 West 28th Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10001\"\n\t\t\t\t\tlisting[:contact_tel] = \"2122391323\"\n\t\t\t\t\tlisting[:description] = \"AVA is a first. Our apartments are energized by this great city, personalized by you. You're on the High Line - steps away from the high life of art galleries, eclectic dining, and exciting clubs and bars such as the Frying Pan. Yep. Take our DIY kits and go to town in your new West Chelsea apartment. Our brand new studio, 1- and 2-bedroom apartments feature stainless steel appliances, black quartz countertops, plank flooring, and built-in charging stations.We're also smoke free, eco-friendly,and pet-friendly (big dogs too). Work out in our awesome fitness center, take in city views on the 14th floor roof deck or attend social events exclusive to AVA friends. Dive in and make it yours.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Chill Lounge\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"Smoke-free community\",\"Affordable housing available\"]\n\n\t\t\t\twhen \"NY015\"\n\t\t\t\t\tlisting[:title] = \"11 East First Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10003\"\n\t\t\t\t\tlisting[:contact_tel] = \"2123877720\"\n\t\t\t\t\tlisting[:description] = \"Avalon Bowery Place was designed to let you indulge in Manhattan living, the way you always dreamt. Set in the famed Bowery, this luxury residence puts you in the center of an all-encompassing lifestyle. Our luxury New York City apartments offer studios and one- or two-bedroom designs that showcase the finest blend of sophisticated appointments. These apartments in New York have features that include fully equipped gourmet kitchens with stainless steel appliances, washers and dryers, hardwood flooring, floor to ceiling windows, spacious walk-in closets and private terraces and balconies. Residents of our New York apartments have a long list of stellar community amenities at their disposal as well. These include unbeatable features such as garage parking, a landscaped courtyard, a sundeck with gas barbecue grill, views of both downtown and uptown Manhattan, a resident lounge, amazing on-site retail shops and a state of the art fitness center are all here at the apartments in New York City.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"Private balcony or patio\",\"Chill Lounge\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"Smoke-free community\",\"Garages and covered parking\"]\n\n\t\t\t\twhen \"NY533\"\n\t\t\t\t\tlisting[:title] = \"515 West 52nd Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10019\"\n\t\t\t\t\tlisting[:contact_tel] = \"2129578200\"\n\t\t\t\t\tlisting[:description] = \"In the midst of the bustling city of Manhattan, you will discover the serenity of world class living at Avalon Clinton. Stumble upon thoughtfully designed studio, one-, and two-bedroom New York apartment rentals that will cater to all your needs. All our homes are equipped with luxurious amenities like floor-to-ceiling windows, parquet wood flooring, spacious closets, and white-on-white appliances. The Avalon Clinton apartment community offers breathtaking views of the Manhattan skyline as well as a wealth of facilities such as two private health clubs, cat-friendly homes, roof-top sky decks, and laundry rooms. The brilliant array of features and a courteous on-site staff makes this Avalon community the ideal place to set up your new home.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"On-site retail and restaurants\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\twhen \"NYC40\"\n\t\t\t\t\tlisting[:title] = \"377 East 33rd Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10016\"\n\t\t\t\t\tlisting[:contact_tel] = \"2126841333\"\n\t\t\t\t\tlisting[:description] = \"Enjoy beautiful views of the East River and the Chrysler building from your stunning apartment homes at Avalon Kips Bay. Discover studio, one-, two-, three- and four-bedroom New York apartment rentals that surpass all expectations in terms of their quality and design. Each of our lovely homes is equipped with amazing features such as granite countertops, stainless steel appliances, European-style marble vanities and high-speed internet access. You'll also enjoy excellent facilities within our Avalon community like an on-site fitness center with cardio theater equipment, additional storage and parking. The great collection of amenities and a professional on-site staff makes Avalon Kips Bay the ideal place to set up your new home.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Ceramic tile flooring\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\twhen \"NY525\"\n\t\t\t\t\tlisting[:title] = \"250 West 50th Street\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10019\"\n\t\t\t\t\tlisting[:contact_tel] = \"2122455050\"\n\t\t\t\t\tlisting[:description] = \"Discover life in the Big Apple with beautiful studio, one- and two-bedroom New York apartments at Avalon Midtown West. Enjoy a wide array of world class features such as open architecture featuring angled walls, high ceilings and wall-to-wall windows that provide sweeping city views, modern appliances, breakfast bars and white cabinetry, parquet wood flooring, and Botticino marble hotel-style vanities in the bathrooms. The Midtown West community also provides various facilities for residents like a fitness Center featuring cardio theatre equipment, resistance machines, free weights and a sauna, a wireless lounge fitted with convenient laptop tables, complimentary WiFi service and plasma TV, laundry facilities, Thalia Restaurant and the Food Emporium located on site on the ground level, and an expansive community room with multiple seating groups, plasma TV, laptop tables and caterers kitchen. The excellent amenities and professional on-site staff make this New York community the ideal place to live.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"On site ATM\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\n\t\t\t\twhen \"NY023\"\n\t\t\t\t\tlisting[:title] = \"1 Morningside Drive\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10025\"\n\t\t\t\t\tlisting[:contact_tel] = \"2123160529\"\n\t\t\t\t\tlisting[:description] = \"Wake up every day next to the stunning Morningside and Central Parks right in the heart of Manhattan at Avalon Morningside Park. Our brand new high-rise apartments in New York City, on Manhattan's Upper West Side, offer spacious studios and one-, two- and three-bedroom options each boasting breathtaking views of the New York City skyline, East River, the parks and the rest of the sights of the city that never sleeps. The apartments in New York City sport luxury amenities like gourmet kitchens equipped with beautiful granite countertops and stainless steel appliances, spacious bathrooms with marble vanities, walk-in closets, floor to ceiling windows, washers and dryers in each home and beautiful hardwood floors. Residents can also enjoy a host of spectacular features like a state of the art fitness center with cardio theater, yoga room, children’s playroom, game room, resident lounge, landscaped courtyards and the easy access to the nearby parks’ biking and jogging trails.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"ENERGY STAR appliances\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\twhen \"NY029\"\n\t\t\t\t\tlisting[:title] = \"282 11th Avenue\"\n\t\t\t\t\tlisting[:city_name] = \"New York\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"10001\"\n\t\t\t\t\tlisting[:contact_tel] = \"2125642813\"\n\t\t\t\t\tlisting[:description] = \"We believe elevating where you live is about blending it seamlessly with how you live. We go to great lengths designing amenities and choosing locations that put everything within reach. Where you live, is where you come alive. In a flourishing area, Avalon offers New York apartments that cater to all of your needs. Escape the hustle and bustle of midtown, inside our refreshing smoke-free community. Within our walls, you'll find thoughtfully designed studio, one- and two-bedroom apartment homes. Imagine entertaining in gourmet kitchens with ENERGY STAR® stainless steel appliances and quartz stone countertops. Live your life effortlessly with amenities that include a state-of-the-art fitness center, a resident lounge with a large entertaining kitchen and an outdoor lounge on the 8th floor with Hudson River and skyline views. Not to mention our community is also within walking distance to Citi Bike, C/E subway lines, Penn Station and the High Line. Make Avalon West Chelsea your next home and personal retreat within the city. This is not just apartment living. This is living up.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Central to the 7-line subway extension and the High Line\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\twhen \"NY037\"\n\t\t\t\t\tlisting[:title] = \"100 Willoughby Street\"\n\t\t\t\t\tlisting[:city_name] = \"Brooklyn\"\n\t\t\t\t\tlisting[:state_name] = \"NY\"\n\t\t\t\t\tlisting[:zipcode] = \"11201\"\n\t\t\t\t\tlisting[:contact_tel] = \"7186431581\"\n\t\t\t\t\tlisting[:description] = \"Which is why we chose to be in the heart of it all - steps from cultural icons such as the Barclay's Center and Brooklyn Flea, and local restaurants and nightlife of Fort Greene, Carroll Gardens, and Brooklyn Heights. Our brand new studio, 1-, 2-, and 3-bedroom floor plans feature kitchens with stainless steel appliances, quartz-stone countertops, and tile backsplashes. Plus, each unit comes with hard-surface plank flooring, in-unit washer/dryer, and built-in charging station. Our community also features a 58th floor rooftop deck and lounge, 30th floor terrace with fire pit and grills, heated indoor/outdoor dog run, and fully-equipped fitness center . Best of all, we're directly above the subway giving you immediate access to the A, C, F, and R trains, and less than a 5-minute walk from the 2, 3, 4, 5, B, N, and Q trains - making your home the perfect home base.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"24-hour concierge\",\"Hard-surface plank flooring\",\"WiFi access in common areas\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\n\t\t\t\twhen \"NJ002\"\n\t\t\t\t\tlisting[:title] = \"444 Washington Boulevard\"\n\t\t\t\t\tlisting[:city_name] = \"Jersey City\"\n\t\t\t\t\tlisting[:state_name] = \"NJ\"\n\t\t\t\t\tlisting[:zipcode] = \"07310\"\n\t\t\t\t\tlisting[:contact_tel] = \"2012169200\"\n\t\t\t\t\tlisting[:description] = \"Located by the historic Waterfront Walkway on the Hudson River, Avalon Cove brings a new sense of luxury living to this metropolis. Our newly renovated Jersey City apartments boast one-, two-, three- and four-bedroom designs in this bustling haven. Some of the upgrades you will find include designer gourmet kitchens with granite counters, stainless-steel appliances, hardwood floors, espresso cabinetry, marble tile bathrooms, spacious walk-in closets and private patios and balconies with great views of Manhattan. Residents can choose to spend their leisure time in the landscaped barbecue and picnic areas, at the sparkling outdoor heated swimming pool, state of the art fitness center, clubroom with billiards or at the beautiful waterfront walkway. Residents can also engage in sporting activities as our Jersey City apartments have an indoor basketball court, two lighted tennis courts and two indoor racquetball courts. Residents of our apartments in Jersey City also have access to local public transportation, on-site storage units, private garage space, gated entrance with controlled access and 24-hour maintenance service.\"\n\t\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"Marble tile entries and baths\",\"Spacious walk-in closets\",\"24-hour emergency maintenance\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\n\t\t\t\tend\n\t\t\t\tlisting\n\t\t\tend", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def initialize(site)\n @site = site\n @data = site.data\n @public_mode = site.config['public']\n @team_by_email = {}\n end", "def current_listing\n cites_listing\n end", "def set_listing\n @listing = Listing.friendly.find(params[:id])\n end", "def set_listing\n @listing = Listing.friendly.find(params[:id])\n end", "def set_listing\n @listing = Listing.friendly.find(params[:id])\n end", "def set_listing\n @listing = Listing.friendly.find(params[:id])\n end", "def show\n @website = Website.find_by_id(@page.website_id) \n @websitepages = @website.pages \n @times = @website.timetables\n @sections = @page.page_sections\n\n if (@page.title == \"inventory\")\n # @newlisting = Listing.new(\"https://fierce-sea-43472.herokuapp.com/categories.json\")\n # @listings = @newlisting.getresponse((User.find_by_id(@website.user_id).email).to_s) \n if params[:sort].present? && params[:direction].present?\n @listings = Inventory.where(:website_id => @website.id).search(params[:search]).order(params[:sort] + \" \" + params[:direction]).paginate(:per_page => 12, :page => params[:page]) \n else\n @listings = Inventory.where(:website_id => @website.id).search(params[:search]).paginate(:per_page => 12, :page => params[:page]) \n end\n\n # @listings = Inventory.where(:website_id => @website.id)\n \n end\n\n end", "def initialize(site, format = ApiResource::Formats::JsonFormat, headers)\n raise ArgumentError, 'Missing site URI' unless site\n @user = @password = nil\n @uri_parser = URI.const_defined?(:Parser) ? URI::Parser.new : URI\n self.site = site\n self.format = format\n self.headers = headers\n end", "def initialize(title, url) # from first scrape data initialize == Lifecycle method in Ruby\n @title = title\n @url = url\n @@all << self if @@all.none?(self)\n end", "def listing\n @listing = Listing.find(params[:listing_id])\n end", "def set_listing\n @listing = Listing.find_by_slug!(params[:id])\n end", "def get_listing_data\n listing_data = []\n # get_pages.each do |page|\n local_pages.each do |page|\n listing_data << page.css('div[@class = \"item\"]')\n end\n listing_data\n end", "def initialize(name, url) \n\t\t@name = name \n\t\t@url = url \n\t\t@@all << self \n\tend", "def create\n # First find the company name (:company_name)\n if listing_params.has_key?(:company_name)\n c_name = listing_params[:company_name]\n company = Company.find_or_create_by(name: c_name)\n listing_params[:company_id] = company.id\n listing_params.delete(:company_name)\n @listing = Listing.new({\n company_id: company.id,\n description: listing_params[:description],\n deadline: listing_params[:deadline],\n job_title: listing_params[:job_title],\n url: listing_params[:url]\n })\n else\n @listing = Listing.new({\n description: listing_params[:description],\n deadline: listing_params[:deadline],\n job_title: listing_params[:job_title],\n url: listing_params[:url]\n })\n end\n\n if @listing.save\n render :show, status: :created, location: @listing\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n end", "def initialize (url,artist_name,location,date_showtime,available)\n\t\t@url = url\n\t\t@artist_name = artist_name\n\t\t@location = location\n\t\t@date_showtime = date_showtime\n\t\t@available = available\n\t\t@@all << self\n\tend", "def listing_params\n params[:listing]\n end", "def initialize(page, site)\n @page = page\n @site = site\n end", "def set_listing\n @listing = Listing.find(params[:access_token])\n end", "def get_listing_url(simple_doc, listing = nil)\n return nil if simple_doc.css(\".location .property-address\").blank?\n tds = simple_doc.css('td')\n unit = tds[1].text.strip\n if listing\n listing[:title] = tds[0].css('a').children.first.text.strip\n listing[:unit] = unit\n # bb = tds[3].text.strip\n # bbs = bb.split('bdrm')\n # return nil unless bbs.size > 1\n # listing[:beds] = bbs[0].to_f\n # listing[:baths] = bbs[1].to_f\n bbs = tds[3].to_html.split('<br>')\n return nil unless bbs.size > 1\n beds = bbs[0].gsub(\"<td class=\\\"centered\\\">\",\"\")\n baths = bbs[1].gsub(\"</td>\",\"\")\n listing[:beds] = beds.to_f\n listing[:baths] = baths.to_f\n listing[:raw_neighborhood] = tds[2].text.strip\n listing[:price] = tds[4].text.split('.').first.split('$').last.remove(/\\D/)\n end\n URI.join(domain_name, simple_doc.css(\".location .property-address\").attr(\"href\").value + \"##{unit}\").to_s\n end", "def set_listing\n @listing = Listing.find(params[\"id\"])\n end", "def set_listing\n #Find the id of a Listing object and store in an instance variable\n @listing = Listing.find(params[:id])\n end", "def parse_listing(page, listing_id)\n {\n\ttitle: extract_title(page),\n\tdescription: parse_description(page),\n\tspace_type_id: 1,\n\tlength: 1.0,\n\twidth: 1.0,\n\theight: 1.0,\n\tis_for_vehicle: false,\n\tis_small_transport: false,\n\tis_large_transport: false,\n\trental_rate: parse_rate(page),\n\tsurface_id: 1,\n\trental_term_id: 1,\n\tis_no_height: false,\n\tsrc_url: page.uri.to_s,\n\tsource_site: 'kj',\n\tsource_id: listing_id\n }\n end", "def new\n\t\t@listing = Listing.new\n\t\t@address = Address.find(params[:address_id])\n\tend", "def initialize(site)\n @site = site\n @data = site.data\n @public_mode = site.config['public']\n end", "def show\n @user = User.find_by_email(@listing.host_email)\n @activity_service = ActivityService.new\n @major_cities = MajorCity.none\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def get_by_site(site)\n get_data(\"site/#{site}/new\")\n end", "def set_listing\n\t\t@listing = Listing.find(params[:id])\n\tend", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n\n end", "def index\n @search_sites = SearchSite.all\n @items = SearchSite.order(:name)\n @item = SearchSite.new\n end", "def set_listing\n\t\t\t@listing = Listing.find(params[:id])\n\t\tend", "def set_listing\n id = params[:id]\n @listing = Listing.find(id)\n end", "def new\n @product_listing = ProductListing.new\n \n end", "def initialize(url)\n super\n generate_attributes # dynamically create & assign values to attributes :)\n @fields = fields\n end", "def new\n @sales_listing = SalesListing.new\n\n @items = Item.all_cached_item_to_list\n\n @item_details = Item.cached_item(params[:item_id])\n\n # using uncached results provide better performance, might be due to smaller data set\n @listing_statuses = ListingStatus.find(:all, :select => \"id, description\", :order => \"description\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sales_listing }\n if request.xhr? then\n format.js\n end\n end\n end", "def site_data; end", "def pull_data\n\tmechanize = Mechanize.new\n\n\tpage = mechanize.get('http://workinstartups.com/job-board/jobs/interns/')\n\tpage.search(\"ul.job-list li\").each do |x|\n str = x.to_s\n job = Job.new\n\n job.company = str[/at\\s(.*?)\\sin/m, 1]\n job.url = URI.extract(str).first\n job.role = x.at_css('a').text\n\n job.save\n end\nend", "def initialize(url,department_number,department_name)\n @url = url\n @department_number = department_number.to_s\n @department_name = department_name.to_s\n end", "def set_listing\n @listing = Listing.find(params[:id] || params[:listing_id])\n end", "def initialize(constructor, site, collection, scope={})\n @site = site\n @constructor = constructor\n super(collection, scope)\n end", "def listing_params\n params.fetch(:listing, {})\n end", "def sites\n request('/web_properties.json').map do |site_data|\n Site.new self, site_data['uid'], site_data['name']\n end\n end", "def initialize\n @api_url = 'http://booking.uz.gov.ua'\n @agent = Mechanize.new\n\n get_token\n set_headers\n end", "def show\n @websitepages = @website.pages\n @pages = @websitepages.where(:show_page_on_index => true)\n @times = @website.timetables \n @search = Inventory.where(:website_id => @website.id).ransack(params[:q]) \n @listings = @search.result.paginate(:per_page => 12, :page => params[:page]) \n @search.build_condition \n\n # @newlisting = Listing.new(\"https://fierce-sea-43472.herokuapp.com/categories.json\") \n # @listings = @newlisting.getresponse((User.find_by_id(@website.user_id).email).to_s)\n # if params[:sort].present? && params[:direction].present?\n \n # else\n # @listings = @search.result.paginate(:per_page => 12, :page => params[:page]) \n # end\n\n end", "def initialize(name) #new listings will be initialized with a name\n @name = name\n end", "def show\n @listing = Listing.find(params[:listing_id])\n end", "def initialize(page)\n raise ArgumentError, \"unsupported site #{page}\" unless self.class.supports?(page)\n\n @company = URI(page).path[1..-1]\n raise ArgumentError, \"#{page} does not have the company's name in its path\" unless @company.present?\n end", "def listing_params\n params.require(:listing).permit(:title, :description, :organization, :email, :salary, :city, :state, :user_id, :location, :source, :posted, :contact, :category, :tag_list, :wyncode_only)\n end", "def initialize()\n\t\t@url = \"http://lcboapi.com/products\"\n\t\t@id = 0\n\t\t@term = \"\"\n\t\t@result = []\n\t\t@single = {}\n\tend" ]
[ "0.6319154", "0.6185045", "0.61180764", "0.60874146", "0.60528314", "0.6025864", "0.59889686", "0.5944641", "0.5940689", "0.5903633", "0.58727425", "0.5871586", "0.5868298", "0.5848401", "0.5848401", "0.5848401", "0.5848401", "0.57953566", "0.5791074", "0.57460856", "0.57460856", "0.57460856", "0.57460856", "0.57456803", "0.57283205", "0.5720627", "0.5713152", "0.56945086", "0.5688833", "0.56880814", "0.56813335", "0.5678251", "0.567516", "0.5671561", "0.56562847", "0.56451684", "0.5643267", "0.5636689", "0.56159973", "0.56133866", "0.56019825", "0.5598605", "0.55553806", "0.5547424", "0.5539415", "0.55386144", "0.55386144", "0.55386144", "0.55386144", "0.55386144", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5536209", "0.5532623", "0.55273145", "0.5521521", "0.55152255", "0.55121446", "0.5508412", "0.5504178", "0.55029863", "0.54972184", "0.54917544", "0.5484759", "0.54678667", "0.5460839", "0.54537606", "0.5442287", "0.54306614", "0.54293895", "0.54248685", "0.5420876", "0.5420693", "0.5419285" ]
0.64471674
0
The expected data in the collection as an outcome after running an operation.
def collection_data @collection && @collection['data'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_collection_data(actual_collection_data)\n expected_collection_data = test_instance.outcome_collection_data\n if expected_collection_data.nil?\n expect(actual_collection_data).to be nil\n elsif expected_collection_data.empty?\n expect(actual_collection_data).to be_empty\n else\n expect(actual_collection_data).not_to be nil\n expected_collection_data.each do |doc|\n expect(actual_collection_data).to include(doc)\n end\n actual_collection_data.each do |doc|\n expect(expected_collection_data).to include(doc)\n end\n end\n end", "def result\n @result ||= run_collection_command_or_block\n end", "def verify_operation_result(expected, actual)\n if expected.is_a?(Array)\n if expected.empty?\n expect(actual).to be_empty\n else\n expected.each_with_index do |expected_elt, i|\n # If the YAML spec test does not define a result,\n # do not assert the operation's result - the operation may\n # have produced a result, the test just does not care what it is\n if expected_elt\n verify_result(expected_elt, actual[i])\n end\n end\n end\n else\n verify_result(expected, actual)\n end\n end", "def verify_operation_result(actual)\n expected = test_instance.expected_outcome.result\n if expected.is_a?(Array)\n if expected.empty?\n expect(actual).to be_empty\n else\n expected.each_with_index do |expected_elt, i|\n verify_result(expected_elt, actual[i])\n end\n end\n else\n verify_result(expected, actual)\n end\n end", "def test_get_total_score\r\n total_score = 0\r\n\r\n\r\n @scores1 = Score.find_all_by_response_id(@response.id)\r\n @scores1.each {|a|\r\n total_score = a.score + total_score\r\n }\r\n # verifying whether the total score is generated properly or not\r\n assert_equal total_score , 15\r\n\r\n\r\n end", "def verify_result(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::RESULT.name], element_value(result_text_area))\n end", "def store_result()\n #This is a stub, used for indexing\n end", "def evaluateDiffResult()\n\n end", "def result\n operation.result\n end", "def verify_result(test_data)\n verify_values_match(test_data[UseOfCollections::RESULT.name], element_value(result_text_area))\n end", "def successful_runs\n return @successful_runs\n end", "def verify_collection_data(expected_collection_data, actual_collection_data)\n if expected_collection_data.nil?\n expect(actual_collection_data).to be nil\n elsif expected_collection_data.empty?\n expect(actual_collection_data).to be_empty\n else\n expect(actual_collection_data).not_to be nil\n expect(actual_collection_data).to match_with_type(expected_collection_data)\n end\n end", "def verify_result(expect, model)\n puts \"running query: #{build_query(model)}\"\n result = search(build_query(model))\n assert_equal(expect.size, result.hit.size)\n expect.each_with_index do |expected_sub_scores,i|\n jsf = result.hit[i].field['summaryfeatures']\n sub_scores = extract_subscores(jsf, model.size)\n assert_equal(expected_sub_scores, sub_scores,\n \"subscores differ for hit #{i}: #{expected_sub_scores} != #{sub_scores}\")\n end\n end", "def outcome\n status.first\n end", "def assert_data?\n @operation.assert['data']\n end", "def test_print_results\n @d.add_book\n @d.add_book\n @d.add_book\n @d.add_book\n @d.add_dino\n @d.add_dino\n @d.add_dino\n @d.add_class\n @d.add_class\n assert_output(\"Driver 1 obtained 4 books!\\nDriver 1 obtained 3 dinosaur toys!\\nDriver 1 attended 4 classes!\\n\") { @d.print_results }\n end", "def test_4\n f = Foo.new\n z = f.update_collection(\"device_worker\")\n assert_equal LOAD, z\n end", "def outcome\n return unless @playground.collecting?\n\n outcome = connection.ab_get_outcome(@id)\n outcome && alternatives[outcome]\n end", "def result\n seed\n new_count = Person.count\n added = new_count - @count\n \"#{added} new people added to the database.\"\n end", "def actual\n @actual\n end", "def assert_results(expected, actual, message = nil)\n assert_equal(expected.size, actual.size, \"Size of results. #{message}\")\n expected.each_with_index {|result, index|\n assert_equal((index + 1).to_s, actual[index].place.to_s, \"place for #{result}. #{message}\")\n assert_equal(result.person, actual[index].person, \"person for #{result}. #{message}\")\n assert_equal(result.time, actual[index].time, \"time for #{result}. #{message}\")\n }\n end", "def assert_results(expected, actual, message = nil)\n assert_equal(expected.size, actual.size, \"Size of results. #{message}\")\n expected.each_with_index {|result, index|\n assert_equal((index + 1).to_s, actual[index].place.to_s, \"place for #{result}. #{message}\")\n assert_equal(result.person, actual[index].person, \"person for #{result}. #{message}\")\n assert_equal(result.time, actual[index].time, \"time for #{result}. #{message}\")\n }\n end", "def result_of_checking; end", "def results\n @impacts.inspect\n end", "def test_checklist_status_values_not_started\n test = @product.product_tests.checklist_tests.first\n passing, failing, not_started, total = checklist_status_values(test)\n\n assert_equal 0, passing\n assert_equal 0, failing\n assert_equal 1, not_started\n assert_equal 1, total\n end", "def call\n expect :result\n\n self.last\n end", "def results\n @results ||= session.with(consistency: :strong).command(command)\n end", "def test_verify_data_positions\n result = verify_data_positions(@warehouse_data)\n assert_equal(true,result)\nend", "def run_additional_operations(query_type, test)\n query_data = translate_column_names(test['additional_operation'])\n if query_type == 'delete'\n puts \" Deleting\"\n else\n puts \" Updating\"\n end \n\n if @verbose\n puts \" - #{query_data}\"\n end\n \n result = nil\n\n if query_type == 'delete'\n result = @client.delete(query_data)\n elsif query_type == 'update'\n result = @client.update(query_data)\n end\n\n expected = translate_column_names(test['result_additional'])\n expected.each do |key, value|\n if value == 'ignore'\n next\n end\n\n if !compare_values(value, result[key])\n @num_fails += 1\n @failed_tests.push(test['name'])\n\n puts \" Expected: \\\"#{key}\\\": #{value}\"\n puts \" Result: \\\"#{key}\\\": #{result[key]}\"\n puts \" Status: Failed\"\n return false\n end\n end\n \n self.num_successes += 1\n print(' Status: Passed')\n return true\n end", "def test_all_done# #all_done returns an new TodoList object (meets criteria)\r\n @todo1.done!\r\n new_obj = @list.all_done\r\n assert_equal([@todo1], new_obj.to_a)\r\n end", "def promotion_results\n @promotion_results ||= Promotions::CheckResultCollection.new\n end", "def test_should_create_test_results\n test_target_instance = get_new_test_target_instance(\"example2\", \"2012112802\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 1)\n end", "def results; end", "def results; end", "def results; end", "def test_3\n f = Foo.new\n z = f.iterate_collection(\"device_worker\")\n assert_equal LOAD, z\n end", "def api_data\n expect(api_result).to match(\n {\n meta: an_instance_of(Hash),\n data: an_instance_of(Hash).or(an_instance_of(Array)).and(have_at_least(1).items)\n }\n )\n\n api_result[:data]\n end", "def test_5\n f = Foo.new\n z = f.iterate_collection(\"device_worker\")\n assert_equal LOAD, z\n end", "def test_scenario7\n\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46}, 'Iris-versicolor', \"probability\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2}, 'Iris-setosa', \"probability\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46}, 'Iris-versicolor', \"confidence\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2}, 'Iris-setosa', \"confidence\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46}, 'Iris-versicolor', \"votes\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 1}, 'Iris-setosa', \"votes\", \"000004\"]\n ]\n puts\n puts \"Successfully comparing predictions in operating points for ensembles\"\n\n data.each do |filename, data_input, prediction_result, operating_kind, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create an ensemble\"\n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> 2, \"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}, 'missing_splits' => false})\n \n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(1, ensemble[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(ensemble), true)\n \n puts \"And I create a local ensemble\"\n local_ensemble = BigML::Ensemble.new(ensemble, @api)\n local_model = BigML::Model.new(local_ensemble.model_ids[0], @api)\n \n puts \"When I create a prediction for <%s>\" % [JSON.generate(data_input)]\n prediction = @api.create_prediction(ensemble['resource'], data_input, {\"operating_kind\" => operating_kind})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n\n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end \n \n puts \"And I create a local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = local_ensemble.predict(data_input, {\"operating_kind\" => operating_kind})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_ensemble.regression) or \n (local_ensemble.is_a?(BigML::MultiModel) and local_ensemble.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n end", "def test_results_victory\r\n assert_output(\"Going home victorious!\\n\") { @g.results(10) }\r\n end", "def test_single_user_should_update_test_results_under_c1\n test_target_instance = get_new_test_target_instance(\"example3\", \"2012112803\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 2, 3, 2)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 2, 3, 2)\n end", "def test\n false_good, true_bad = get_counts(@testing_bad)\n true_good, false_bad = get_counts(@testing_good)\n\n correct = true_good.length + true_bad.length\n total = correct + false_bad.length + false_good.length\n ratio = format_ratio(1.0 * correct / total)\n\n bad_total = false_good.length + true_bad.length\n bad_ratio = format_ratio(1.0 * true_bad.length / bad_total)\n\n good_total = true_good.length + false_bad.length\n good_ratio = format_ratio(1.0 * true_good.length / good_total)\n\n puts \"Accuracy: #{ratio} (#{correct} of #{total})\"\n\n puts \"Bad commit accuracy: #{bad_ratio} (#{true_bad.length} of #{bad_total})\"\n print_failures(true_bad)\n\n puts \"Good commit accuracy: #{good_ratio} (#{true_good.length} of #{good_total})\"\n print_failures(true_good)\n end", "def test_get_completed_eobs\n batch=Batch.find(2)\n eob=batch.eob\n Job.create(:batch=>batch,:tiff_number=>123,:check_number=>121313,:count=>12, :estimated_eob => 12)\n assert_equal(12, batch.get_completed_eobs)\n end", "def test_scenario2\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-setosa', {\"kind\" => \"probability\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-versicolor', {\"kind\" => \"probability\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\" => 2.4}, 'Iris-setosa', {\"kind\" => \"confidence\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\" => 2.4}, 'Iris-versicolor', {\"kind\" => \"confidence\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"]\n ]\n puts\n puts \"Scenario : Successfully comparing predictions in operating points for models\"\n\n data.each do |filename, data_input, prediction_result, operating_point, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create model\"\n model=@api.create_model(dataset)\n \n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n \n puts \"And I create a local model\"\n local_model = BigML::Model.new(model, @api)\n\n puts \"When I create a prediction for %s in %s \" % [JSON.generate(data_input), JSON.generate(operating_point)]\n prediction = @api.create_prediction(model, data_input, {\"operating_point\" => operating_point})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n\n puts \"Then the prediction for '<%s>' is '<%s>'\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end\n\n puts \"And I create a local prediction for <%s> in <%s>\" % [JSON.generate(data_input), JSON.generate(operating_point)]\n local_prediction = local_model.predict(data_input, {\"operating_point\" => operating_point})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_model.regression) or \n (local_model.is_a?(BigML::MultiModel) and local_model.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n \n end", "def test_unfinished_operation\n op = create_op MockOperation.new(status: :NOTDONE, name: NAME)\n refute op.done?\n refute op.error?\n refute op.response?\n assert_nil op.results\n assert_nil op.error\n assert_nil op.response\n end", "def successful\n count(&:ok?)\n end", "def test_unranked_recall\n\n add_test_judgements \n add_unranked_query_result\n assert_equal(1.0, @query_result.statistics[:recall])\n \n end", "def expected_inventory\n result = @inventory.dup\n # TODO DRY this up with `Person#eat`\n result[:fish] -= @daily_appetite = 10\n result\n end", "def custom_assertion (custom_data)\n # make sure Summary of Changes exists\n custom_data.each(&@assert_proc)\n end", "def result \n @result\n end", "def result\n data(\"result\")\n end", "def support_outcome_data!\n self.outcome_data_values_accepted = OUTCOME_DATA_TYPES\n end", "def prepare_result(expected)\n assert_nothing_raised do\n if expected.kind_of? Integer \n @returned = @returned.to_f\n @correct = expected.to_f\n @incorrect = expected.to_f\n elsif expected.kind_of? Float\n @returned = round_float(@returned.to_f, @@ACCURACY)\n @correct = round_float(expected, @@ACCURACY)\n @incorrect = round_float(expected, @@ACCURACY)\n else\n @returned = @returned\n @correct = expected\n @incorrect = expected\n end\n #debug info\n #puts \"expected: #{@correct} - returned: #{@returned}\"\n end\n end", "def test_should_create_test_result\n test_target_instance = get_new_test_target_instance(\"example1\", \"2012112801\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n assert_response :success\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n end", "def test_index_access\n with_a_collection do\n assert_equal(@coll.first, @coll[0])\n end\n end", "def test_scenario4\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-setosa', {\"kind\" => \"probability\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-virginica', {\"kind\" => \"probability\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\"=> 2.4}, 'Iris-setosa', {\"kind\" => \"confidence\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\"=> 2.4}, 'Iris-versicolor', {\"kind\" => \"confidence\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"]\n ]\n puts\n puts \"Successfully comparing predictions in operating points for ensembles\"\n\n data.each do |filename, data_input, prediction_result, operating_point, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create an ensemble\"\n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> 2, \"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}, 'missing_splits' => false})\n \n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(1, ensemble[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(ensemble), true)\n \n puts \"And I create a local ensemble\"\n local_ensemble = BigML::Ensemble.new(ensemble, @api)\n local_model = BigML::Model.new(local_ensemble.model_ids[0], @api)\n \n puts \" When I create a prediction for <%s>\" % [JSON.generate(data_input)]\n prediction = @api.create_prediction(ensemble['resource'], data_input, {\"operating_point\" => operating_point})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n \n \n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end \n \n puts \"And I create a local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = local_ensemble.predict(data_input, {\"operating_point\" => operating_point})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_ensemble.regression) or \n (local_ensemble.is_a?(BigML::MultiModel) and local_ensemble.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n end", "def test_flatten\n with_a_collection do\n assert_equal 10, @coll.flatten!.size\n assert_instance_of QualityCenter::Defect::Item, @coll.last\n end\n end", "def data\n @data || set_collection_data\n end", "def result\n @result\n end", "def test_unfinished_operation_boolean\n op = create_op MockOperation.new(status: false, name: NAME)\n refute op.done?\n refute op.error?\n refute op.response?\n assert_nil op.results\n assert_nil op.error\n assert_nil op.response\n end", "def test_performs_and_returns_hash\n expected = {\n id: \"36692321\",\n type: \"evaluated-data-point\",\n attributes: {\n title: \"Total Population\",\n modifier: \"total\",\n aggregator: \"sum_and_moe\",\n value: 2616.0,\n margin: 134.54,\n units: \"residents\"\n }\n }\n assert_equal expected, evaluation.perform\n end", "def test_scenario1\n data = [{'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'measure' => 'average_phi',\n 'value' => 1}]\n\n puts \n puts \"Scenario: Successfully creating an evaluation:\"\n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create model\"\n model=@api.create_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"When I create an evaluation for the model with the dataset\"\n evaluation = @api.create_evaluation(model, dataset)\n \n puts \"And I wait until the evaluation is ready\"\n assert_equal(BigML::HTTP_CREATED, evaluation[\"code\"])\n assert_equal(@api.ok(evaluation), true)\n\n puts \"Then the measured #{item['measure']} is #{item['value']}\"\n evaluation = @api.get_evaluation(evaluation)\n assert_equal(item[\"value\"].to_f, evaluation[\"object\"][\"result\"][\"model\"][item[\"measure\"]].to_f)\n\n end\n\n end", "def test_to_a\r\n assert_equal(@todos, @list.to_a)\r\n end", "def to_a\n @test_results\n end", "def test_scenario1 \n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal width'=> 0.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-setosa\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length'=> 6, 'petal width'=> 2},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-virginica\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length' => 4, 'petal width'=> 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\"}, \n {\"filename\" => File.dirname(__FILE__)+\"/data/iris_sp_chars.csv\",\n \"data_input\" => {\"pétal.length\" => 4, \"pétal&width\\u0000\" => 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\"}\n\t ]\n \n puts \n puts \"Scenario: Successfully comparing predictions\" \n \n data.each do |item|\n puts \n puts \"Given I create a data source uploading a <%s> file\" % item[\"filename\"]\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create a model\"\n model=@api.create_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"And I create a local model\"\n local_model = BigML::Model.new(model, @api)\n\n puts \"When I create a prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = @api.create_prediction(model, item[\"data_input\"])\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n \n puts \"Then the prediction for <%s> is <%s>\" % [item[\"objective\"], item[\"prediction\"]]\n assert_equal(item[\"prediction\"], prediction[\"object\"][\"prediction\"][item[\"objective\"]]) \n\n puts \"And I create a local prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = local_model.predict(item[\"data_input\"])\n\n puts \"Then the local prediction is <%s>\" % item[\"prediction\"]\n assert_equal(prediction, item[\"prediction\"]) \n\n end\n end", "def run\n\t\t\tsummary\n\t\tend", "def outcomes\n return @outcomes\n end", "def ab_get_outcome(_experiment)\n raise \"Not implemented\"\n end", "def test_errored_operation_message\n error = OpenStruct.new(code: ERR_CODE, message: ERR_MSG)\n op = create_op MockOperation.new(status: :DONE, err: error), err_field: \"err\"\n assert op.done?\n assert op.error?\n refute op.response?\n assert_equal error, op.results\n assert_equal error, op.error\n assert_nil op.response\n end", "def summary\n ret = pending\n\n items = { UPCOMING: ret.response.items,\n CURRENT: ongoing.response.items }\n\n ret.response.items = items\n ret\n end", "def value!\n raise Result::Error, 'Failure objects do not have value'\n end", "def test_results_sad_one\r\n assert_output(\"Going home sad.\\n\") { @g.results(1) }\r\n end", "def test_function_get_all_post_user_successfully\n\n user_id = 28\n\n posts = V1::User.get_all_post_user(user_id,'id desc',1,10)\n\n actual = posts[:meta][:code]\n\n expected = 200\n \n #Show result of this function(true=>pass)\n puts this_method_name + \" - \" +assert_equal(expected, actual).to_s\n end", "def results\n raise NotImplementedError\n end", "def test_multiple_users_should_update_test_result_under_c1_0\n test_target_instance = get_new_test_target_instance(\"example5\", \"2012112805\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_PASS, 'test_case_1')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b01, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b10, 0b11, 2)\n end", "def confirm_wanted_data(wanted_data)\n takes = false\n call_scene(SummaryWanted, wanted_data) { |scene| takes = scene.return_data }\n return takes\n end", "def failure_message_for_should\n message = \"expected #{@collection_key} to match the user's mental model, but:\\n\"\n unless expected_items_found?\n message += \"expected to be present: #{pp_array(expected_items)}\\n\"\n message += \"the missing elements were: #{pp_array(expected_items_that_were_not_found)}\\n\"\n end\n if unexpected_items_found?\n message += \"expected to not be present: #{pp_array(unexpected_items)}\\n\"\n message += \"the unexpected extra elements: #{pp_array(unexpected_items_that_were_found)}\\n\"\n end\n message\n end", "def test_calculate_points_for_place\n category = Models::Category.new(\"Women\")\n rules = Rules.new(category_rules: [Models::CategoryRule.new(category)], points_for_place: [1, 2, 3])\n calculator = Calculator.new(rules: rules, source_results: [])\n event_category = calculator.event_categories.first\n\n source_result = Models::SourceResult.new(id: 33, event_category: Models::EventCategory.new(category), place: 1, points: 0)\n participant = Models::Participant.new(0)\n result = Models::CalculatedResult.new(participant, [source_result])\n event_category.results << result\n\n event_categories = RejectNoPoints.calculate!(calculator)\n\n assert_equal 1, event_categories.first.results.size\n assert !event_categories.first.results.first.source_results.first.rejected?\n end", "def expected_value; end", "def expected_value; end", "def test\n\t\t##\n\t\t# Possible outcomes for each test. Do all tests and count the outcome\n\t\t##\n\t\twinLoss = {win: 0, loss: 0, sorted: 0, unsorted: 0}\n\t\t@xData[:test].each{|test|\n\t\t\t#Get the truth\n\t\t\tsorted \t\t= test.sort{|a,b| a <=> b}\n\t\t\t#Take an educated guess\n\t\t\tprediction\t= @machine.run(test).first.round\n\t\t\t##\n\t\t\t# Record outcomes\n\t\t\t##\n\t\t\t#If it is classed as sorted and is sorted\n\t\t\tif prediction == 1 && test == sorted \n\t\t\t\twinLoss[:win] \t\t+= 1\n\t\t\t\twinLoss[:sorted]\t+= 1\n\t\t\t#If it's classed as unsorted and is unsorted\n\t\t\telsif prediction == 0 && test != sorted\n\t\t\t\twinLoss[:win] \t\t+= 1\n\t\t\t\twinLoss[:unsorted]\t+= 1\n\t\t\t#A loos. You've broke something somewhere (probably)\n\t\t\telse\n\t\t\t\twinLoss[:loss] \t\t+= 1\n\t\t\tend\n\t\t}\n\t\t#Print the results\n\t\tputs \"Iterations: #{@iterations}\\nMAX_MSE: #{@maxError}\\n\\t#{winLoss}\" # proof\n\tend", "def test_add_to_bag\r\n \t@test_prospector.current_gold = 2\r\n \t@test_prospector.current_silver = 3\r\n \t@test_prospector.add_to_bag\r\n \tassert_equal 3, @test_prospector.total_silver\r\n \tassert_equal 2, @test_prospector.total_gold\r\n end", "def test_done_operation\n op = create_op MockOperation.new(status: :DONE, name: NAME)\n assert op.done?\n refute op.error?\n assert op.response?\n assert_nil op.error\n assert_equal NAME, op.name\n refute_nil op.response\n end", "def test_to_a\n assert_equal(@todos, @list.to_a)\n end", "def test_to_a\n assert_equal(@todos, @list.to_a)\n end", "def test_to_a\n assert_equal(@todos, @list.to_a)\n end", "def test_to_a\n assert_equal(@todos, @list.to_a)\n end", "def run(fs)\n @expected_files_collection = fs.database['expected.files']\n @expected_chunks_collection = fs.database['expected.chunks']\n act(fs)\n prepare_expected_collections(fs)\n result\n end", "def test_results_sad\r\n assert_output(\"Going home sad.\\n\") { @g.results(9) }\r\n end", "def result\n\n end", "def publish_result_data\n end", "def test_scenario14\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal width'=> 0.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-setosa\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length'=> 6, 'petal width'=> 2},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-virginica\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length' => 4, 'petal width'=> 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\"}, \n {\"filename\" => File.dirname(__FILE__)+\"/data/iris_sp_chars.csv\",\n \"data_input\" => {\"pétal.length\" => 4, \"pétal&width\\u0000\" => 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\"}\n\t ]\n \n puts \n puts \"Successfully comparing predictions with supervised model\" \n \n data.each do |item|\n puts \n puts \"Given I create a data source uploading a <%s> file\" % item[\"filename\"]\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create a model\"\n model=@api.create_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n\n puts \"And I create a local supervised model\"\n local_model = BigML::SupervisedModel.new(model, @api)\n \n puts \"When I create a prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = @api.create_prediction(model, item[\"data_input\"])\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n \n puts \"Then the prediction for <%s> is <%s>\" % [item[\"objective\"], item[\"prediction\"]]\n assert_equal(item[\"prediction\"], prediction[\"object\"][\"prediction\"][item[\"objective\"]]) \n\n puts \"And I create a local prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = local_model.predict(item[\"data_input\"])\n\n puts \"Then the local prediction is <%s>\" % item[\"prediction\"]\n assert_equal(prediction, item[\"prediction\"]) \n\n puts \"And I create a local prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = local_model.predict(item[\"data_input\"])\n \n puts \"Then the local prediction is <%s>\" % item[\"prediction\"]\n assert_equal(prediction, item[\"prediction\"])\n \n end\n end", "def test_mine_returns_two_values\n mine_results = @test_loc.mine\n assert_equal mine_results.count, 2\n end", "def expected_operation_message2\n _undefined\n end", "def test_single_user_should_keep_test_results_under_c1\n test_target_instance = get_new_test_target_instance(\"example4\", \"2012112804\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1, 1, 2)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 1, 1, 2)\n #TODO assert view\n end", "def test_multiple_users_should_update_test_result_under_c1_1\n test_target_instance = get_new_test_target_instance(\"example6\", \"2012112806\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b10, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b10, 0b11, 2)\n end", "def result\n @data['result']\n end", "def value(expected)\n take(1) do |first, input, rest|\n\n if first[0] == :val && expected === first[1]\n Success(Single(first[1]), rest)\n else\n Failure(\"'#{first[1]}' doesn't match #{expected}\", input)\n end\n end.describe expected\n end", "def evaluation_succeeded\n return @evaluation_succeeded\n end", "def getActual\n return @actual\n end" ]
[ "0.67487836", "0.61592734", "0.60574317", "0.60065913", "0.5812745", "0.5790149", "0.57858497", "0.5731475", "0.5697186", "0.5618413", "0.5594963", "0.5578598", "0.5553732", "0.55398107", "0.5523077", "0.5507436", "0.5506675", "0.5500891", "0.54976034", "0.5479272", "0.54297596", "0.54297596", "0.5406352", "0.53685176", "0.53606033", "0.5357571", "0.5328333", "0.5309492", "0.52970123", "0.5296058", "0.52918756", "0.52849233", "0.5265497", "0.5265497", "0.5265497", "0.52544487", "0.5251323", "0.52397025", "0.52384", "0.5233346", "0.52314377", "0.52283573", "0.5219476", "0.52161133", "0.52142024", "0.5213413", "0.52132916", "0.5208521", "0.5204587", "0.5202495", "0.5196109", "0.5192754", "0.5188844", "0.5186225", "0.5183205", "0.517545", "0.51733005", "0.5169202", "0.5168984", "0.51634395", "0.51622605", "0.51609075", "0.51578546", "0.51482123", "0.5144789", "0.5140823", "0.5138834", "0.51324326", "0.5130317", "0.512783", "0.5127169", "0.5124391", "0.51220214", "0.5116862", "0.51123124", "0.51094025", "0.51087576", "0.5102928", "0.5100426", "0.5100426", "0.5096183", "0.5095758", "0.5095251", "0.50948846", "0.50948846", "0.50948846", "0.50948846", "0.50871146", "0.5084872", "0.50839233", "0.5083407", "0.50757813", "0.50755703", "0.5075147", "0.50721425", "0.506749", "0.50649345", "0.50629675", "0.505964", "0.50552124" ]
0.5392902
23
Delivers this payload to CrashLog Captures any exceptions and logs them.
def deliver! deliver rescue Exception => e error('Failed to deliver notification to CrashLog collector') log_exception(e) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processCrash; raise \"Abstract Exception: AbstractBeezwaxCrashProcessor.processCrash must be extended\"; end", "def call(env)\n super\n rescue\n logger.error do\n \"#{$!.class.name} - #{$!.message} (#{$!.backtrace.first})\"\n end\n raise\n end", "def rescuer\n begin\n yield\n rescue Exception => e\n # write to log files \n end\n end", "def extract_exception(payload)\n if payload[:exception]\n exception, message = payload[:exception]\n status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception)\n backtrace = if LogStasher.backtrace\n if LogStasher.backtrace_filter.respond_to?(:call)\n LogStasher.backtrace_filter.call($!.backtrace).join(\"\\n\")\n else\n $!.backtrace.join(\"\\n\")\n end\n else\n $!.backtrace.first\n end\n message = \"#{exception}\\n#{message}\\n#{backtrace}\"\n { status: status, error: message }\n else\n {}\n end\n end", "def report_backtrace\n metadata = {\n 'sourcetype' => 'chef-handler-backtrace',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n event = Array(run_status.backtrace).join(\"\\n\")\n\n splunk_post(event, metadata)\n end", "def handle_exception(data)\n logger.warn \"Got exception from remote call of #{data[\"action\"]}: #{data[\"message\"]}\"\n end", "def propagate\n @propagate_exceptions = true\n end", "def on_flush_error(e)\n @logger.warn(\"Failed to send backlog of events to Redisearch\",\n :exception => e,\n :backtrace => e.backtrace\n )\n end", "def crash\n {\n method: \"Browser.crash\"\n }\n end", "def send(method, *args)\n super\n rescue StandardError => e\n args[1].debug \"#{e}\\n #{e.backtrace.first}\" # args[1] is the logger\n end", "def save\n Bugsnag.notify(exception, true) do |report|\n report.severity = \"error\"\n report.severity_reason = {\n :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,\n :attributes => FRAMEWORK_ATTRIBUTES\n }\n\n metadata = payload\n class_name = metadata['class']\n\n # when using Active Job the payload \"class\" will always be the Resque\n # \"JobWrapper\", so we need to unwrap the actual class name\n if class_name == \"ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper\"\n unwrapped_class_name = metadata['args'][0]['job_class'] rescue nil\n\n if unwrapped_class_name\n class_name = unwrapped_class_name\n metadata['wrapped'] ||= unwrapped_class_name\n end\n end\n\n context = \"#{class_name}@#{queue}\"\n report.meta_data.merge!({ context: context, payload: metadata })\n report.automatic_context = context\n end\n end", "def silence_action_dispatch_debug_exceptions_logger\n require 'loga/ext/rails/rack/debug_exceptions.rb'\n end", "def log_error(exception); end", "def log_error(e)\n msg = {\n error_class: e.class.to_s,\n message: e.to_s,\n url: env['REQUEST_URI'].to_s,\n method: env['REQUEST_METHOD'].to_s,\n payload: env['rack.request.form_hash'].inspect.to_s\n }\n notify_error(e, msg)\n end", "def handle_emit_exception(e)\n RailsPipeline.logger.error(\"Error during emit(): #{e}\")\n puts e.backtrace.join(\"\\n\")\n raise e # this probably isn't going anywhere BTW\n end", "def my_rescue_action_in_public(exception)\n # MorLog.my_debug exception.to_yaml\n # MorLog.my_debug exception.backtrace.to_yaml\n time = Time.now()\n id = time.strftime(\"%Y%m%d%H%M%S\")\n address = 'gui_crashes@kolmisoft.com'\n extra_info = \"\"\n swap = nil\n begin\n MorLog.my_debug(\"Rescuing exception: #{exception.class.to_s} controller: #{params[:controller].to_s}, action: #{params[:action].to_s}\", true)\n if important_exception(exception)\n MorLog.my_debug(\" >> Exception is important\", true)\n MorLog.log_exception(exception, id, params[:controller].to_s, params[:action].to_s) if params[:do_not_log_test_exception].to_i == 0\n\n trace = exception.backtrace.collect { |t| t.to_s }.join(\"\\n\")\n\n exception_class = escape_for_email(exception.class).to_s\n exception_class_previous = Confline.get_value(\"Last_Crash_Exception_Class\", 0).to_s\n exception_send_email = Confline.get_value(\"Exception_Send_Email\").to_i\n\n # Lots of duplication but this is due fact that in future there may be\n # need for separate link for every error.\n flash_help_link = nil\n\n\n if exception_class.include?(\"Net::SMTPFatalError\")\n flash_notice = _('smtp_server_error')\n flash_help_link = \"\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'smtp_server_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::ENETUNREACH\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Errno::ENETUNREACH\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EACCES\")\n flash_notice = _('File_permission_error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'File_permission_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EHOSTUNREACH\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"rami.rb:380\"))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"SystemExit\") or (exception_class.include?('RuntimeError') and (exception.message.include?('No route to host') or exception.message.include?('getaddrinfo: Name or service not known') or exception.message.include?('Connection refused')))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?('RuntimeError') and (exception.message.include?('Connection timed out') or exception.message.include?('Invalid argument') or exception.message.include?('Connection reset by peer') or exception.message.include?('Network is unreachable') or exception.message.include?('exit'))\n flash_notice = _('Your_Asterisk_server_is_not_accessible_Please_check_if_address_entered_is_valid_and_network_is_OK')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"SocketError\") and !trace.to_s.include?(\"smtp_tls.rb\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n if exception_class.include?(\"Errno::ETIMEDOUT\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"OpenSSL::SSL::SSLError\") or exception_class.include?(\"OpenSSL::SSL\")\n flash_notice = _('Verify_mail_server_details_or_try_alternative_smtp_server')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'SMTP_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::RecordNotFound\")\n flash_notice = _('Data_not_found')\n flash_help_link = ''\n exception_send_email = 1\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Data_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?('Access denied for user')\n flash_notice = _('MySQL_permission_problem_contact_Kolmisoft_to_solve_it')\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'MySQL_permission_problem', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Transactions::TransactionError\")\n flash_notice = _(\"Transaction_error\")\n swap = []\n swap << %x[vmstat]\n # swap << ActiveRecord::Base.connection.select_all(\"SHOW INNODB STATUS;\")\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Transaction_errors', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"Errno::ENOENT\") and exception.message.include?('/tmp/mor_debug_backup.txt')\n flash_notice = _('Backup_file_not_found')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Backup_file_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"No seller found with id\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n # database not updated\n if exception_class.include?(\"NoMethodError\") and !exception.message.include?(\"nil:NilClass\") and exception.message.include?(\"for #<\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include? \"ActiveModel::MissingAttributeError\"\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?(\"Unknown column\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n #\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"The currency used in the cart must match the currency of the seller account.\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?(\"Missing URL component: expected id:\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('expected id: (\\d{10})|(\\d{15})')\n flash_notice = _(\"Payment_Error_Contact_Administrator_enter_merchant_id\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('Seller Account') and exception.message.include?('is not active.')\n flash_notice = _(\"Payment_Error_Contact_Administrator_account_not_active\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Unexpected response code')\n flash_notice = _(\"Google_checkout_error\") + ': ' + exception.message.to_s #.gsub('Google Unexpected response code', 'Unexpected response code')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('An API Certificate or API Signature is required to make requests to PayPal')\n flash_notice = _('An_API_Certificate_or_API_Signature_is_required_to_make_requests_to_PayPal')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Temporary failure in name resolution')\n flash_notice = _('DNS_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'DNS_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Ambethia::ReCaptcha::Controller::RecaptchaError')\n flash_notice = _('ReCaptcha_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'ReCaptcha_Error', :data2 => exception.message).save\n end\n\n #if exception_class.include?(\"Net::SMTP\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"smtp_tls.rb\")) or (exception_class.include?(\"SocketError\") and trace.to_s.include?(\"smtp_tls.rb\")) or ((exception_class.include?(\"Timeout::Error\") and trace.to_s.include?(\"smtp.rb\"))) or trace.to_s.include?(\"smtp.rb\")\n flash_help_link = email_exceptions(exception) if flash_help_link.blank? and flash_notice.blank?\n #end\n\n if exception_class.include?(\"LoadError\") and exception.message.to_s.include?('locations or via rubygems.')\n if exception.message.include?('cairo')\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/Cannot_generate_PDF\"\n else\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Ruby_Gems\"\n end\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Ruby_gems_not_found', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n # Specific case for acunetix security scanner\n if (exception.message.include?('invalid byte sequence in UTF-8') or exception.message.include?('{\"$acunetix\"=>\"1\"}')) and ['try_to_login', 'signup_end'].member?(params[:action])\n flash_notice = _('Internal_Error_Contact_Administrator')\n exception_send_email = 0\n end\n\n if exception_send_email == 1 and exception_class != exception_class_previous and !flash_help_link or params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(\" >> Need to send email\", true)\n\n if exception_class.include?(\"NoMemoryError\")\n extra_info = get_memory_info\n MorLog.my_debug(extra_info)\n end\n\n # Gather all exception\n rep, rev, status = get_svn_info\n rp = []\n (params.each { |k, v| rp << [\"#{k} => #{v}\"] })\n\n message = [\n \"ID: #{id.to_s}\",\n \"IP: #{request.env['SERVER_ADDR']}\",\n \"Class: #{exception_class}\",\n \"Message: #{exception}\",\n \"Controller: #{params[:controller]}\",\n \"Action: #{params[:action]}\",\n \"User ID: #{session ? session[:user_id].to_i : 'possible_from_api'}\",\n \"----------------------------------------\",\n \"Repositority: #{rep}\",\n \"Revision: [#{rev}]\",\n \"Local version modified: #{status}\",\n \"----------------------------------------\",\n\n \"Request params: \\n#{rp.join(\"\\n\")}\",\n \"----------------------------------------\",\n \"Seesion params: \\n#{nice_session if session}\",\n \"----------------------------------------\"\n ]\n if extra_info.length > 0\n message << \"----------------------------------------\"\n message << extra_info\n message << \"----------------------------------------\"\n end\n message << \"#{trace}\"\n\n if test_machine_active?\n if File.exists?('/var/log/mor/test_system')\n message << \"----------------------------------------\"\n message << %x[tail -n 50 /var/log/mor/test_system]\n end\n end\n\n if swap\n message << \"----------------------------------------\"\n message << swap.to_yaml\n end\n\n if exception_class.include?(\"Errno::EPERM\")\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/tmp/]\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/]\n end\n\n Confline.set_value(\"Last_Crash_Exception_Class\", exception_class, 0)\n\n if params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(' >> Crash email NOT sent THIS IS JUST TEST', true)\n return :text => flash_notice.to_s + flash_help_link.to_s + message.join(\"\\n\")\n #render :text => message.join(\"\\n\") and return false\n else\n\n subject = \"#{ExceptionNotifier_email_prefix} Exception. ID: #{id.to_s}\"\n time = Confline.get_value(\"Last_Crash_Exception_Time\", 0)\n if time and !time.blank? and (Time.now - Time.parse(time)) < 1.minute\n MorLog.my_debug(\"Crash email NOT sent : Time.now #{Time.now.to_s(:db)} - Last_Crash_Exception_Time #{time}\")\n else\n send_crash_email(address, subject, message.join(\"\\n\")) if params[:do_not_log_test_exception].to_i == 0\n Confline.set_value(\"Last_Crash_Exception_Time\", Time.now.to_s(:db), 0)\n MorLog.my_debug('Crash email sent')\n end\n end\n else\n MorLog.my_debug(\" >> Do not send email because:\", true)\n MorLog.my_debug(\" >> Email should not be sent. Confline::Exception_Send_Email: #{exception_send_email.to_s}\", true) if exception_send_email != 1\n MorLog.my_debug(\" >> The same exception twice. Last exception: #{exception_class.to_s}\", true) if exception_class == exception_class_previous\n MorLog.my_debug(\" >> Contained explanation. Flash: #{ flash_help_link}\", true) if flash_help_link\n end\n\n if !flash_help_link.blank?\n flash[:notice] = _('Something_is_wrong_please_consult_help_link')\n flash[:notice] += \"<a id='exception_info_link' href='#{flash_help_link}' target='_blank'><img alt='Help' src='#{Web_Dir}/assets/icons/help.png' title='#{_('Help')}' /></a>\".html_safe\n else\n flash[:notice] = flash_notice.to_s.blank? ? \"INTERNAL ERROR. - ID: #{id} - #{exception_class}\" : flash_notice\n end\n\n if session and session[:forgot_pasword] == 1\n session[:forgot_pasword] = 0\n flash[:notice_forgot]= (_('Cannot_change_password') + \"<br />\" + _('Email_not_sent_because_bad_system_configurations')).html_safe\n end\n\n if session and session[:flash_not_redirect].to_i == 0\n #redirect_to Web_Dir + \"/callc/main\" and return false\n else\n session[:flash_not_redirect] = 0 if session\n #render(:layout => \"layouts/mor_min\") and return false\n end\n end\n rescue Exception => e\n MorLog.log_exception(e, id, params[:controller].to_s, params[:action].to_s)\n message =\"Exception in exception at: #{escape_for_email(request.env['SERVER_ADDR'])} \\n --------------------------------------------------------------- \\n #{escape_for_email(%x[tail -n 50 /var/log/mor/test_system])}\"\n command = ApplicationController::send_email_dry(\"guicrashes@kolmisoft.com\", address, message, \"#{ExceptionNotifier_email_prefix} SERIOUS EXCEPTION\", \"-o tls='auto'\")\n system(command)\n flash[:notice] = \"INTERNAL ERROR.\"\n #redirect_to Web_Dir + \"/callc/main\" and return false\n end\n end", "def exception_data\n exception_service.merge(\n error_class: @exception.class.to_s,\n message: @exception.respond_to?(:message) ? @exception.message : exception.inspect,\n backtrace: @exception.respond_to?(:backtrace) ? (@exception.backtrace || []).join(\"\\n\") : nil,\n cause: @exception.respond_to?(:cause) ? @exception.cause : nil\n )\n end", "def handle_exception datagram, e\n # stub\n end", "def egregious_log(exception)\n logger.fatal(\n \"\\n\\n\" + exception.class.to_s + ' (' + exception.message.to_s + '):\\n ' +\n clean_backtrace(exception).join(\"\\n \") +\n \"\\n\\n\")\n notify_airbrake(exception)\n end", "def event_processing_failed(exception, payload, raw_payload, dead_letter_queue_name)\n # do nothing\n end", "def crash\n @status = :crashed\n @lives -= 1\n @last_crash_t = Time.now\n end", "def log_errors!\n if AnyCable.config.debug?\n # Print error with backtrace in debug mode\n AnyCable.capture_exception do |e|\n AnyCable.logger.error(\"#{e.message}:\\n#{e.backtrace.take(20).join(\"\\n\")}\")\n end\n else\n AnyCable.capture_exception { |e| AnyCable.logger.error(e.message) }\n end\n end", "def process_ath9_crash(params)\n url = @@conf['register_url']\n crash_dump_path = @@conf['crash_dump_path']\n \tnodeid = params[:nodeid]\n \ttstmp = Time.at params[:tstmp].to_i\n \tdmesg = params[:dmesg]\n \tnow = Time.now.to_i\n\n \tFile.open(\"#{crash_dump_path}/#{now}.log\",\"w\") do |f|\n \t\tf.puts \"Node: #{nodeid} - at: #{tstmp}\\n\"\n \t\tf.puts dmesg\n \tend\n \tNet::HTTP.post_form URI(\"#{url}/watchdog_bites\"), \n \t\t{ \"node_id\" => nodeid, \"dmesg\" => dmesg, \"tstmp\" => params[:tstmp], 'submission_stmp' => now }\n end", "def crash\n {\n method: \"Page.crash\"\n }\n end", "def initialize(config, exception=nil, env={})\n unless config.kind_of?(CrashHook::Configuration)\n raise ArgumentError, \"CrashHook::Configuration required!\"\n end\n \n raise ArgumentError, \"Exception required!\" if exception.nil?\n raise ArgumentError, \"Environment required!\" if env.nil?\n \n @config = config\n @payload = CrashHook::Payload.new(exception, env, @config.extra_params)\n end", "def process_action(*args)\n super\n rescue Exception => exception\n raise if RocketPants.pass_through_errors?\n # Otherwise, use the default built in handler.\n logger.error \"Exception occured: #{exception.class.name} - #{exception.message}\"\n logger.error \"Exception backtrace:\"\n exception.backtrace[0, 10].each do |backtrace_line|\n logger.error \"=> #{backtrace_line}\"\n end\n exception_notifier_callback.call(self, exception, request)\n render_error exception\n end", "def log_errors!\n if AnyCable.config.debug?\n # Print error with backtrace in debug mode\n AnyCable.capture_exception do |e|\n stack = e.backtrace\n backtrace = stack ? \":\\n#{stack.take(20).join(\"\\n\")}\" : \"\"\n AnyCable.logger.error(\"#{e.message}#{backtrace}\")\n end\n else\n AnyCable.capture_exception { |e| AnyCable.logger.error(e.message) }\n end\n end", "def entrapment\n # setup trap chain once.\n Base.trapped = true\n app = self\n\n # 'get' previous trap by replacing any existing trap with 'IGNORE'\n previous_trap = trap(:INT, 'IGNORE')\n\n # substitute our trap and chain it to previous by explicitly invoking\n # the previous trap. ruby makes this somewhat difficult and rack then\n # makes it even harder.\n trap(:INT) do\n begin\n # loggers may have closed file handles in a trap so disconnect any\n # loggers from multiplexer before continuing. even when they do not\n # raise exceptions they still appear to log nothing at this point\n # (not sure about syslog, definitely not file or console).\n if app.logger.respond_to?(:targets)\n # HACK: it is bad that Multiplexer#targets exposes its internal\n # array in a manner that allows us to clear it. it would be better\n # if to have a Multiplexer#reset method we could call instead.\n # to ensure that cleaning continues to work, check the result\n # afterward. note that we tried iterating targets and calling the\n # Multiplexer#remove method but that had no effect.\n app.logger.targets.clear\n fail 'Unexpected targets' unless app.logger.targets.empty?\n app.logger.warn('cannot log traps') # no exception raised\n end\n\n # interrupt any running app threads to resolve outstanding requests.\n #\n # note that Mutex#synchronize is not allowed inside a trap context.\n #\n # FIX: duplicating the set is slightly unsafe but not sure how else\n # to deal with data protected by critical section in a trap. we also\n # have logic in ensure block to avoid modifying set on interrupt.\n app.class.interrupted = true\n app_threads = app.class.app_threads.dup\n app_threads.each do |app_thread|\n if app_thread.alive?\n app_thread.raise(::Interrupt)\n app_thread.join\n end\n end\n\n # cleanup fixtures, if requested.\n app.cleanup\n if previous_trap && previous_trap.respond_to?(:call)\n previous_trap.call\n else\n exit\n end\n rescue ::Exception => e\n # loggers are unreliable so write any rescued error home.\n msg = ([e.class, e.message] + (e.backtrace || [])).join(\"\\n\")\n dir = ::ENV['HOME'] || ::Dir.pwd\n path = ::File.join(dir, 'might_api_rescued_error.txt')\n ::File.open(path, 'w') { |f| f.puts msg }\n exit 1\n end\n end\n true\n end", "def on_flush_error(e)\r\n @logger.warn(\"Failed to send backlog of events to ThetaPoint\",\r\n :exception => e,\r\n :backtrace => e.backtrace\r\n )\r\n end", "def log(msg)\n super(\"resque-exception - #{msg}\")\n end", "def log_exceptions\n yield\n rescue Exception => e\n self.exception e\n raise e\n end", "def _log_exception(icon, note, excpt)\n warn \"#{icon} #{note}:\\n#{EXPT} \\xE2\\x94\\x8C#{excpt} \\xE2\\x94\\x90\"\n warn excpt.backtrace[0..7].reduce(\"\") { |s,x|\n s += \"#{EXPT} \\xE2\\x94\\x9C#{x}\\n\" } +\n \"#{EXPT} \\xE2\\x94\\x94#{BAR*25}\\xE2\\x94\\x98\"\n end", "def report_internal_error(exception, original_error = nil)\n return if skip_reporting_internal_error(exception)\n\n failsafe_message = ''\n log_error(\n '[Rollbar] Reporting internal error encountered while sending data to Rollbar.'\n )\n\n configuration.execute_hook(:on_report_internal_error, exception)\n\n failsafe_message = 'build_item in exception_data'\n item = build_item('error', nil, exception, { :internal => true }, nil)\n\n failsafe_message = 'error in process_item'\n process_item(item)\n\n failsafe_message = 'error logging instance link'\n log_instance_link(item['data'])\n rescue StandardError => e\n send_failsafe(failsafe_message, e, original_error)\n log_error(item ? \"[Rollbar] Item: #{item}\" : \"[Rollbar] Exception: #{exception}\")\n end", "def on_error(env, error)\n Firehose.logger.error \"WS connection `#{cid}@#{path}` error `#{error}`: #{error.backtrace}\"\n end", "def on_fetcher_call_error(event)\n fatal \"Fetcher crash due to an error: #{event[:error]}\"\n end", "def install\n Rack::CommonLogger.class_eval do\n\n alias_method :original_log, :log\n\n def log(env, status, header, began_at)\n logger = @logger || env['rack.errors']\n\n blob = {\n :length => header['Content-Length'] || 0,\n :code => status.to_s[0 .. 3],\n :version => env['HTTP_VERSION'],\n :method => env['REQUEST_METHOD'],\n :duration => (Time.now - began_at),\n :query => env[\"QUERY_STRING\"],\n :path => env['PATH_INFO'],\n :remote_addr => env['REMOTE_ADDR'],\n :user => env['REMOTE_USER'],\n :user_agent => env['HTTP_USER_AGENT'],\n :timestamp => Time.now.utc.iso8601\n }\n\n # If there's an X-Forwarded-For header split it up into a\n # list of machine-readable IPs.\n blob[:forwarded_for] = env['HTTP_X_FORWARDED_FOR'].split(',') if env['HTTP_X_FORWARDED_FOR']\n\n if logger\n logger.write({:type => 'request',\n :event => blob}.to_json)\n logger.write(\"\\n\")\n end\n end\n end\n end", "def crash_dumps\n @vm_record[\"crash_dumps\"]\n end", "def log_request_response(exception = nil)\n super(exception) if exception.present?\n end", "def error_thread_crash error, error_location; end", "def report_exception(service_class, service_data, exception, options = {})\n error = (exception.respond_to?(:original_exception) &&\n exception.original_exception) || exception\n backtrace = Array(error.backtrace)[0..500]\n\n data = {\n 'app' => 'pay4bugs-hooks',\n 'type' => 'exception',\n 'class' => error.class.to_s,\n 'server' => settings.hostname,\n 'message' => error.message[0..254],\n 'backtrace' => backtrace.join(\"\\n\"),\n 'rollup' => Digest::MD5.hexdigest(\"#{error.class}#{backtrace[0]}\"),\n 'service' => service_class.to_s,\n }.update(options)\n\n # if service_class == Hook::Web\n # data['service_data'] = service_data.inspect\n # end\n\n #if settings.hostname =~ /^sh1\\.(rs|stg)\\.github\\.com$/\n # # run only in github's production environment\n # Net::HTTP.new('haystack', 80).\n # post('/async', \"json=#{Rack::Utils.escape(data.to_json)}\")\n #else\n $stderr.puts data[ 'message' ]\n $stderr.puts data[ 'backtrace' ]\n #end\n\n rescue => boom\n $stderr.puts \"reporting exception failed:\"\n $stderr.puts \"#{boom.class}: #{boom}\"\n $stderr.puts \"#{boom.backtrace.join(\"\\n\")}\"\n # swallow errors\n end", "def cashboard_rescue_exception\n logger.error '^^^ CASHBOARD SPECIFIC INFO FOR ABOVE ERROR'\n logger.error '--------------------------------------------------------------------------------'\n begin\n logger.error \"URL : #{request.env['PATH_INFO']}\"\n logger.error \"BROWSER: #{request.env['HTTP_USER_AGENT']}\"\n logger.error \"IP ADDR: #{request.env['REMOTE_ADDR']}\"\n # Try to find account if it's not set\n @account ||= Account.find_by_subdomain(account_subdomain)\n if @account\n logger.error \"ACCOUNT: #{@account.subdomain}\"\n end\n if @user\n logger.error \"USER : #{@user.inspect}\\n\"\n end\n rescue\n logger.error '...An error happend logging specific errors...wtf?'\n end\n logger.error '--------------------------------------------------------------------------------'\n logger.error ''\n end", "def pass_exception\n throw :next_exception_handler\n end", "def log_additional_data\n if Rails.application.secrets[:sentry_dsn].present?\n Raven.user_context(\n id: current_user&.id,\n email: current_user&.email,\n ip_address: request.ip\n )\n\n Raven.tags_context(\n domain: current_account&.domain,\n account_prefix: current_account&.account_prefix\n )\n\n # You can also set extra context using `Raven.extra_context`\n # Raven.extra_context app: url, environment: Rails.env, time: Time.now\n else\n request.env[\"exception_notifier.exception_data\"] = { user: current_user, account: current_account }\n end\n end", "def log_http_call(payload); end", "def log_http_call(payload); end", "def visit_exception\n exception = object.value\n\n puts(\n EXCEPTION_ERROR_MESSAGE % [\n exception.inspect,\n exception.backtrace.join(\"\\n\")\n ]\n )\n end", "def enter_exception_context(exception); end", "def write_exception_to_log(ex, exception_context, timestamp, log_context = {})\n ActiveSupport::Deprecation.silence do\n log_message = \"#{exception_context}\\n#{ex.class}: (#{encode_utf8(ex.message.to_s)}):\\n \" + clean_backtrace(ex).join(\"\\n \") + \"\\n\\n\"\n\n if ex.is_a?(Warning)\n ExceptionHandling.logger.warn(\"\\nExceptionHandlingWarning (Warning:#{timestamp}) #{log_message}\", **log_context)\n else\n ExceptionHandling.logger.fatal(\"\\nExceptionHandlingError (Error:#{timestamp}) #{log_message}\", **log_context)\n end\n end\n end", "def exceptions_app=(_arg0); end", "def exceptions_app=(_arg0); end", "def log_error(ex)\n if @config.logger.respond_to?(:error)\n @config.logger.error(\"CrashHook Error: #{ex.inspect}\")\n elsif @config.logger.kind_of?(IO)\n @config.logger.puts(\"CrashHook Error: #{ex.inspect}\")\n end\n end", "def fatal(object, **rest)\n protect do\n emit Log::Event.ify(object, severity: __method__, rest: rest)\n end\n end", "def append(*args)\n super\n rescue NotStored\n rescue Error => e\n log_exception e\n end", "def capture_exception(url: nil, headers: nil, body: nil, squash_configuration: nil, no_proxy_env: nil)\n #FUTURE: Required keyword args, for Ruby 2.1+\n #def capture_exception(url:, headers:, body:, squash_configuration:, no_proxy_env: nil)\n fail \"Missing required keyword arg\" unless url && headers && body && squash_configuration\n\n # If things fail, it's useful to know how long it caused the exception-capture to block the\n # calling process:\n start = Time.now\n\n begin\n Timeout::timeout(configuration.capture_timeout, CaptureTimeoutError) do\n #NB: Backburner doesn't seem able to #perform with keyword args:\n Backburner.enqueue(ExceptionQueue, url, headers, body, squash_configuration, no_proxy_env)\n end\n\n rescue *WORKER_ERRORS => e\n failsafe_handler(\n e, message: \"whilst trying to connect to Beanstalk\", time_start: start,\n args: {\n url: url,\n headers: headers,\n body: body,\n squash_configuration: squash_configuration,\n no_proxy_env: no_proxy_env\n }\n )\n raise\n end\n end", "def instrument(name, payload={})\n start name, payload\n begin\n yield payload\n rescue Exception => e\n payload[:exception] = [e.class.name, e.message]\n raise e\n ensure\n finish name, payload\n end\n end", "def handle_receiving_exception(e)\n end", "def capture(&block)\n if block\n begin\n block.call\n rescue Error => e\n raise # Don't capture Opbeat errors\n rescue Exception => e\n self.captureException(e)\n raise\n end\n else\n # Install at_exit hook\n at_exit do\n if $!\n logger.debug \"Caught a post-mortem exception: #{$!.inspect}\"\n self.capture_exception($!)\n end\n end\n end\n end", "def record_error_with_less_nodes\n @supervisor.increment_error_count\n\n dashes = '-' * 90\n\n @error = %{#{exception.message}\\n#{exception.backtrace.join(\"\\n\")}\n#{dashes}\\nQUEUE ELEMENT:\\n#{@element.inspect}\n#{dashes}\\nRAW PAYLOAD:\\n#{@response.inspect}\n#{dashes}\\nRAW BODY:\\n#{@response_body.inspect}\n#{dashes}\\nPARSED PAYLOAD:\\n#{@entity.inspect}}\n\n log(\"#{'=' * 90}\\nERROR processing data!#{@error}\")\nend", "def log_exception(exception, extra = {})\n process_exception(exception, extra: extra)\n end", "def error(object, **rest)\n protect do\n emit Log::Event.ify(object, severity: __method__, rest: rest)\n end\n end", "def invoke_with_call_chain(*args)\n super\n @logger.flush\n exit(1) if respond_to?(:error?) && error?\n end", "def notify_exception_raised exception\n end", "def backtrace\n wrapper.application_trace\n end", "def log_and_raise(logger, exception, message, shift=1)\n if logger.is_a?(ZTK::Logger)\n logger.shift(:fatal, shift) { \"EXCEPTION: #{exception.inspect} - #{message.inspect}\" }\n else\n logger.fatal { \"EXCEPTION: #{exception.inspect} - #{message.inspect}\" }\n end\n raise exception, message\n end", "def exceptions_app; end", "def exceptions_app; end", "def original_exception; end", "def log_error_to_remote(request, exception)\n if defined?(::Honeybadger) && !Honeybadger.configuration.api_key.nil?\n Honeybadger.notify_or_ignore(exception, {\n rack_env: request.env,\n environment_name: ENV[\"RACK_ENV\"]\n })\n else\n logger.debug(\"Honeybadger not configured, not sending exception there.\")\n end\n end", "def report_exception(service_class, service_data, exception)\n backtrace = Array(exception.backtrace)[0..500]\n\n data = {\n 'app' => 'github-services',\n 'type' => 'exception',\n 'class' => exception.class.to_s,\n 'server' => settings.hostname,\n 'message' => exception.message[0..254],\n 'backtrace' => backtrace.join(\"\\n\"),\n 'rollup' => Digest::MD5.hexdigest(exception.class.to_s + backtrace[0]),\n 'service' => service_class.to_s\n }\n\n if exception.kind_of?(Service::Error)\n if exception.original_exception\n data['original_class'] = exception.original_exception.to_s\n data['backtrace'] = exception.original_exception.backtrace.join(\"\\n\")\n data['message'] = exception.original_exception.message[0..254]\n end\n elsif !exception.kind_of?(Service::TimeoutError)\n data['original_class'] = data['class']\n data['class'] = 'Service::Error'\n end\n\n if service_class == Service::Web\n data['service_data'] = service_data.inspect\n end\n\n if settings.hostname =~ /^sh1\\.(rs|stg)\\.github\\.com$/\n # run only in github's production environment\n Net::HTTP.new('haystack', 80).\n post('/async', \"json=#{Rack::Utils.escape(data.to_json)}\")\n else\n $stderr.puts data[ 'message' ]\n $stderr.puts data[ 'backtrace' ]\n end\n\n rescue => boom\n $stderr.puts \"reporting exception failed:\"\n $stderr.puts \"#{boom.class}: #{boom}\"\n $stderr.puts \"#{boom.backtrace.join(\"\\n\")}\"\n # swallow errors\n end", "def hubssolib_set_exception_data(e)\n HubSsoLib::Crypto.encode_object(e.message, request.remote_ip)\n end", "def extract_information_from(env)\n exception = env['action_dispatch.exception']\n exception_wrapper = ActionDispatch::ExceptionWrapper.new(env, exception)\n @rescue_response = ActionDispatch::ExceptionWrapper.rescue_responses[exception.class.name]\n @message = exception.message\n @status_code = exception_wrapper.status_code\n end", "def report_error(exception, params = {}, &block)\n # TODO: log to Rails log\n notify_airbrake(exception, params, &block)\n end", "def gather_framework_errors(source)\n if @application_exceptions\n has_application_errors = true\n else\n @application_exceptions = []\n end\n yield\n rescue Exception => e\n add_framework_error(e, source)\n ensure\n if !has_application_errors\n process_pending_application_exceptions\n end\n end", "def notify_exception(e)\n # ignore exception because the exception caused tuple server is down...\n Util.ignore_exception do\n write(Tuple[:exception].new(uuid, agent_type, e))\n end\n end", "def error(event)\n Firehose.logger.error \"WS connection `#{@req.path}` error. Message: `#{event.message.inspect}`\"\n end", "def handle_exceptions_gracefully\n\n begin\n\n yield\n\n rescue => se\n\n Rails.logger.error(\"Exception in API: #{se.message} trace: #{se.backtrace}\")\n\n ExceptionNotifier.notify_exception(\n se,\n env: request.env\n )\n\n r = Result::Base.error(\n internal_id: 'ac_3',\n general_error_identifier: 'something_went_wrong'\n )\n\n return render_api_response(r)\n\n end\n\n end", "def exception_handler; end", "def trace( crashfile, template )\n end", "def handle_failure(queue, request, exception, execution_time)\n event = LogStash::Event.new\n apply_metadata(event, request)\n\n event.tag(\"_sdee_failure\")\n\n # This is also in the metadata, but we send it anyone because we want this\n # persisted by default, whereas metadata isn't. People don't like mysterious errors\n event.set(\"[sdee_failure]\", {\n \"request\" => structure_request(request),\n \"error\" => exception.to_s,\n \"backtrace\" => exception.backtrace,\n \"runtime_seconds\" => execution_time\n })\n\n queue << event\n rescue StandardError, java.lang.Exception => e\n @logger.error? && @logger.error(\"Cannot read URL or send the error as an event!\",\n :exception => e,\n :exception_message => e.message,\n :exception_backtrace => e.backtrace,\n :url => request\n )\n end", "def record_exception(e = nil, error_message = nil, attributes: {})\n current_span = OpenTelemetry::Trace.current_span\n current_span.status = OpenTelemetry::Trace::Status.error(error_message || e.message)\n current_span.record_exception(e, attributes: format_attributes(attributes))\n end", "def throw_hook(bytecode)\n logger.debug(\"throw_hook: #{bytecode}\")\n JSTRAP_CONTINUE\n end", "def catch_exceptions; end", "def log_invalid_stripe_request(exception)\n # logs stripe exception\n ActiveSupport::Notifications.instrument 'anyplace.stripe_action.failed', exception\n end", "def capture(&block)\n if block\n begin\n block.call\n rescue Error => e\n raise # Don't capture Raven errors\n rescue Exception => e\n evt = Event.capture_exception(e)\n send(evt) if evt\n raise\n end\n else\n # Install at_exit hook\n at_exit do\n if $!\n logger.debug \"Caught a post-mortem exception: #{$!.inspect}\"\n evt = Event.capture_exception($!)\n send(evt) if evt\n end\n end\n end\n end", "def __crash_handler__(actor, reason)\n if reason # is nil if the actor exits normally\n @lowdown_crash_conditions_mutex.synchronize do\n @lowdown_crash_conditions.each do |condition|\n condition.signal(reason)\n end\n end\n end\n super\n end", "def post_sqreen_exception(exception)\n post('sqreen_exception', exception.to_hash, {}, 5)\n rescue *NET_ERRORS => e\n Sqreen.log.warn(format('Could not post exception (network down? %s) %s',\n e.inspect,\n exception.to_hash.inspect))\n nil\n end", "def postFailResult(exception,caseId)\n puts \"----------------------------------------------------------------------------------\"\n puts \"\"\n puts exception\n caseInfo = @testRailUtility.getCase(caseId)\n #puts \"$$$$$$$$$$$$$$$$$$$$$\"\n #puts caseInfo['id']\n @passedLogs = @objRollbar.addLog(\"[Result ] Failed\")\n @passedLogs = @objRollbar.addLog(\"#{exception}\")\n #puts \"postResult---->#{@passedLogs[caseInfo['id'].to_s]}\"\n #puts @passedLogs[caseInfo['id']]\n @objRollbar.postRollbarData(caseInfo['id'], caseInfo['title'], @passedLogs[caseInfo['id'].to_s])\n #puts \"&&&&&&&&&&&&&&&&&&&\"\n Rollbar.error(exception)\n @testRailUtility.postResult(caseId,\"Result for case #{caseId} is #{@passedLogs[caseInfo['id'].to_s]}\",5,@runId)\n raise exception\nend", "def instrument(name, payload = {})\n handle = build_handle(name, payload)\n handle.start\n begin\n yield payload if block_given?\n rescue Exception => e\n payload[:exception] = [e.class.name, e.message]\n payload[:exception_object] = e\n raise e\n ensure\n handle.finish\n end\n end", "def send_error_email exception\n begin\n data = {\n path: request.path,\n current_user: current_user.try(:email),\n referer: request.referer,\n params: params,\n exception: exception.inspect,\n user_agent: request.user_agent,\n http_accept: request.env['HTTP_ACCEPT'],\n ip: request.ip,\n backtrace: exception.backtrace\n }\n\n if Rails.env.production?\n DebugEmailWorker.perform_async({\n from: 'ivong@themarshallproject.org',\n to: 'ivong+exception@themarshallproject.org',\n subject: \"[#{ENV['RACK_ENV']}] EndRun Exception\",\n text_body: JSON.pretty_generate(data)\n })\n end\n rescue\n logger.error \"Error while reporting error! Not reported! #{$!.inspect}\" # this happens if the API call fails.\n end\n\n raise # reraise the initial error\n end", "def run\n print_debug 'In #run'\n audit self.class.payloads, self.class.options\n end", "def stack_trace; end", "def backtrace_cleaner; end", "def touched\n crash\n end", "def wrapped_exception; end", "def log_result_faults\n if not @result.passed?\n faults = @result.failures + @result.errors\n faults.each_with_index do |fault, index|\n output_log(\"\\n%3d) %s\\n\" % [index + 1, fault.long_desc])\n end\n @result.coredumps.each do |hostname, corelist|\n output_log(\"Coredumps on host #{hostname}:\\n\")\n corelist.each {|core| output(core.corefilename)}\n output_log(\"Binaries and corefiles saved in #{hostname}:#{corelist.first.coredir}\\n\")\n end\n end\n end", "def track_exception(exception, extra = {})\n process_exception(exception, sentry: true, extra: extra)\n end", "def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end", "def log_entry(line)\n raw = line.split(@@break)\n map = Hash.new\n raw.each do |keys|\n parts = keys.split(@@value)\n map.store(parts[0],parts[1])\n end\n #unless USEMEMCACHE != true\n # if Staticentry.get_cache(Digest::MD5.hexdigest(map['data'] + map['logtype_id'].to_s)).nil?\n # static = Logtype.find(map['logtype_id']).staticentries.new\n # static.data = map['data']\n # static.save\n # end\n #else\n static = Logtype.find(map['logtype_id']).staticentries.new\n static.data = map['data']\n static.save\n #end\n unless USEMEMCACHE != true\n static = Staticentry.get_cache(Digest::MD5.hexdigest(map['data'] + map['logtype_id'].to_s))\n else\n static = Staticentry.find(Digest::MD5.hexdigest(map['data'] + map['logtype_id'].to_s))\n end\n event = static.events.new\n event.etime = map['etime'].to_i\n event.loglevel_id = map['loglevel_id'].to_i\n event.payload = map['payload']\n event.logtype_id = map['logtype_id'].to_i\n event.agent_id = map['agent_id'].to_i\n begin\n a = Agent.find(map['agent_id'])\n l = Logtype.find(map['logtype_id'])\n if a.logtypes.member?(l)\n if check_key(a, map['authkey']) \n event.save\n else\n ActiveRecord::Base.logger.error \"Event dropped -- invalid agent authkey sent for #{a.name}\"\n send_data \"1\"\n end\n else\n ActiveRecord::Base.logger.error \"Event dropped -- Agent #{a.name} is not a member of logtype #{l.name}\"\n send_data \"2\"\n end\n rescue ActiveRecord::RecordNotFound\n ActiveRecord::Base.logger.error \"Event dropped -- invalid agent_id or logtype_id specified\"\n send_data \"3\"\n end\n port, ip = Socket.unpack_sockaddr_in(get_peername)\n host = Socket.getaddrinfo(ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][2]\n ActiveRecord::Base.logger.debug \"New event logged from #{host} \\n -- Log data: #{line}\"\n end", "def stacktrace=(_arg0); end", "def with_backtrace(&block)\n begin\n log \"Yielding backtrace block\"\n yield if block_given?\n Snooze::Post.snooze!\n rescue Exception => detail\n handle_post_response { Snooze::Post.exception!(@clock_id, detail.backtrace.join(\"\\n \")) }\n end\n end" ]
[ "0.60967845", "0.53365004", "0.52355564", "0.5174961", "0.5152744", "0.51387566", "0.5121802", "0.511532", "0.51037663", "0.5096618", "0.5059202", "0.5047573", "0.5032194", "0.50313455", "0.49913314", "0.4985346", "0.49847648", "0.49829665", "0.49736038", "0.49377817", "0.49335432", "0.49284622", "0.49123245", "0.48958007", "0.48840272", "0.48829472", "0.4881421", "0.48803914", "0.48738724", "0.48635012", "0.4854908", "0.48054048", "0.4793201", "0.4769729", "0.476129", "0.47605315", "0.4754976", "0.47438943", "0.47421935", "0.47396597", "0.47388527", "0.4720597", "0.47165236", "0.47116545", "0.47116545", "0.4711072", "0.46940568", "0.46910784", "0.46708542", "0.46708542", "0.4667618", "0.46593574", "0.4656308", "0.46558332", "0.46515626", "0.46435833", "0.46419403", "0.46407205", "0.46366313", "0.46324173", "0.4626348", "0.46253413", "0.46223703", "0.46176305", "0.4607072", "0.4607072", "0.4603179", "0.45927933", "0.45908752", "0.45872086", "0.45831594", "0.45812383", "0.45763358", "0.45690826", "0.45682436", "0.45679498", "0.45659202", "0.45610425", "0.45540673", "0.4551547", "0.4547561", "0.45457736", "0.45389143", "0.45323956", "0.45299527", "0.45208782", "0.45206663", "0.4518683", "0.4518079", "0.45040897", "0.44954428", "0.44952077", "0.44950947", "0.44946954", "0.44835538", "0.4476291", "0.44711733", "0.44708237", "0.44700933", "0.4469045" ]
0.607135
1
The canonical time this exception occurred. Other notifiers leave this to the collector to set, we however take time more seriously and use this figure internally to detect processing time irregularities. Returns UNIX UTC timestamp integer.
def timestamp Time.now.utc.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canonical_time\n Time.parse(timestamp).utc.iso8601\n end", "def timestamp\n Time.at((self[:tsh].to_i << 32 | self[:tsl].to_i) * ts_resol)\n end", "def timestamp\n Time.at((self.tsh << 32 | self.tsl) * ts_resol)\n end", "def timestamp\n _timestamp.as_time\n end", "def this_event_time\n @event[\"server_gmt\"].to_i\n end", "def timestamp\n _timestamp.as_time\n end", "def to_i\n # Thread-safety: It is possible that the value of @timestamp may be\n # calculated multiple times in concurrently executing threads. It is not\n # worth the overhead of locking to ensure that @timestamp is only\n # calculated once.\n\n unless @timestamp\n @timestamp = to_time.to_i\n end\n\n @timestamp\n end", "def seconds_since_seen\n Time.now - (last_seen || Time.at(0))\n end", "def processed_at\n @processed_at ||= begin\n groups = *mapping_for(:processed_at).match(/(\\d{2})\\/(\\d{2})\\/(\\d{4}) ([\\d:]+)/sm)\n Time.parse(\"#{groups[3]}-#{groups[2]}-#{groups[1]} #{groups[4]}\")\n end\n end", "def unixtime\n Time.now.to_i.to_s\n end", "def to_i\n # Thread-safety: It is possible that the value of @timestamp may be \n # calculated multiple times in concurrently executing threads. It is not \n # worth the overhead of locking to ensure that @timestamp is only \n # calculated once.\n \n unless @timestamp\n result = to_time.to_i\n return result if frozen?\n @timestamp = result\n end\n \n @timestamp\n end", "def to_time\n Time.at(CF.CFDateGetAbsoluteTime(self) + CF.kCFAbsoluteTimeIntervalSince1970)\n end", "def to_i\n seconds_since_unix_epoch.to_i\n end", "def last_timestamp\n lines.last.first\n rescue\n 0\n end", "def last_epoch_time; end", "def to_i\n\t\tseconds_since_unix_epoch.to_i\n\tend", "def to_i\n # Thread-safety: It is possible that the value of @timestamp may be\n # calculated multiple times in concurrently executing threads. It is not\n # worth the overhead of locking to ensure that @timestamp is only\n # calculated once.\n\n unless @timestamp\n if @timestamp_with_offset\n @timestamp = @timestamp_with_offset.timestamp + @timestamp_with_offset.utc_offset\n else\n time = to_time\n @timestamp = time.to_i + time.utc_offset\n end\n end\n\n @timestamp\n end", "def last_entry_time\n last_entry = db.last_entry_temp.flatten.first\n last_entry ? Time.at(last_entry) : nil\n end", "def time\n if @time.nil?\n time_string = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:updated/text()\",\n \"atom03:updated/text()\",\n \"atom:updated/text()\",\n \"updated/text()\",\n \"atom10:modified/text()\",\n \"atom03:modified/text()\",\n \"atom:modified/text()\",\n \"modified/text()\",\n \"time/text()\",\n \"lastBuildDate/text()\",\n \"atom10:issued/text()\",\n \"atom03:issued/text()\",\n \"atom:issued/text()\",\n \"issued/text()\",\n \"atom10:published/text()\",\n \"atom03:published/text()\",\n \"atom:published/text()\",\n \"published/text()\",\n \"dc:date/text()\",\n \"pubDate/text()\",\n \"date/text()\"\n ], :select_result_value => true)\n begin\n unless time_string.blank?\n @time = Time.parse(time_string).gmtime\n else\n if self.configurations[:timestamp_estimation_enabled]\n @time = Time.now.gmtime\n end\n end\n rescue\n if self.configurations[:timestamp_estimation_enabled]\n @time = Time.now.gmtime\n end\n end\n end\n return @time\n end", "def current_timestamp\n @c_tstmp ||= current_time.to_i\n end", "def current_timestamp\n @c_tstamp ||= current_time.to_f\n end", "def ctime_t\n Time.at(ctime * 0.001)\n end", "def timestamp\n Time.parse(message.date.to_s).utc\n end", "def get_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "def current_time\r\n return @owner.timestamp.to_i - @start.to_i\r\n end", "def time\n @time ||= Time.at( timestamp / 1_000_000.0 )\n end", "def failure_date_time\n return @failure_date_time\n end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def utc\n unless @_utc then\n @_utc = true\n @vals = LIBC.new.c_gmtime(@tv_sec)\n end\n return self # .to_i # TOTAL FUCKING HACK\n end", "def center_entry_time(center = queue.center)\n if sig = center_entry_sig(center)\n sig.date\n else\n pmr.create_time\n end\n end", "def timestamp\n ((Time.now.to_f - StartTime)*1000).round\n end", "def error_time\n @@state[@server] && @@state[@server][:time]\n end", "def get_time_running\n\tu = get_unix_time\n\tt = -9\n\tif @TIME > 0\n\t\tt = u - @TIME\n\tend\nend", "def processed_date_time\n return @processed_date_time\n end", "def processed_date_time\n return @processed_date_time\n end", "def time_of_day\n occurred_at.to_time.in_time_zone(device.zone).to_s(:local)\n end", "def get_timestamp(time)\r\n srandom_r time\r\n t0 = random_r\r\n t1 = 0x17dc65df;\r\n hi = (t0 * t1) >> 32;\r\n t2 = t0 >> 31;\r\n t3 = hi >> 23;\r\n t3 = t3 - t2;\r\n t4 = t3 * 0x55d4a80;\r\n t0 = t0 - t4;\r\n t0 = t0 + 0x989680;\r\n\r\n ieee754_round(t0)\r\n end", "def last_written\n wtime = (@cred_struct[:last_written][:dw_high_date_time] << 32) +\n (@cred_struct[:last_written][:dw_low_date_time])\n Time.at((wtime - 116444736000000000) / 10000000)\n end", "def fix_timestamp(time, unique)\n Time.at time.to_i + (Zlib::crc32(unique.to_s) % 1000).to_f / 1000\nend", "def timestamp\n @timestamp ||= Time.parse(@origdate)\n end", "def sent_at_seconds_since_epoch\n Time.current.utc.to_i\n end", "def time_counter\n counter = Time.new.to_i - @time_counter\n return counter < 0 ? 0 : counter\n end", "def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def to_time()\n #This is a stub, used for indexing\n end", "def to_i\n return @tv_sec\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def generation_time\n Time.at(data.unpack(\"N\")[0]).utc\n end", "def timestamp\n nil\n end", "def timestamp_to_time num\n Time.at(num / 1000.0 + AssumedTimezoneAdjust, num % 1000).utc\n end", "def ctime\n end", "def local_asctime\n @time.getlocal.asctime\n end", "def timestamp(unit = :float_second)\n Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)\n end", "def epoch_now()\n Time.now.to_i\n end", "def timestamp(time)\n date = @file[/(\\w+ \\d+, \\d+)/]\n ASF::Board::TIMEZONE.parse(\"#{date} #{time}\").to_i * 1000\n end", "def launch_time\n DateTime.parse(\"2015-02-04 13:00:00 UTC\")\n end", "def ctime() end", "def clock_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "def ctime() end", "def ctime() end", "def timestamp\n time = Time.now.getutc\n\n secs = time.to_i\n millis = time.nsec/1000000\n\n return @last if @millis == millis && @secs == secs\n\n unless secs == @secs\n @secs = secs\n @date = time.strftime('%Y-%m-%d %H:%M:%S.')\n end\n\n @millis = millis\n @last = @date + \"00#{millis}\"[-3..-1]\n end", "def to_i\n return self.time.to_i\n end", "def last_reported_date_time\n return @last_reported_date_time\n end", "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "def datetime_timestamp\n return Date.parse(self.date).to_time\n end", "def epoch_time\n return time + epoch\n end", "def seconds_since_last\n last.blank? ? 0 : (timestamp_server - last.timestamp_server)\n end", "def timestamp\n #data[\"timestamp\"] as? TimeInterval ?? 0\n timestamp = data[\"timestamp\"]\n timestamp.to_i || 0\n end", "def time_as_timestamp\n date = @date\n if @date.kind_of? String\n date = Date.parse(@date).to_time.to_i\n end\n\n date\n end", "def time_sec; Time.now.sec; end", "def absolute_secs\n Time.now.to_i\n end", "def get_start_time()\n return process_stamp(@start_time)\n end", "def processed_at\n @data.has_key?('processed_at') ? Time.parse(data['processed_at']) : nil\n end", "def local_time\n iso_time\n end", "def master_last_seen_unix_timestamp()\n @master_last_seen_unix_timestamp ||= 0\n end", "def point_time_in_ms(point)\n if point == \"last\"\n latest_point = GetLastTsPoint.call(TsPoint, 'value', self.id)\n else\n latest_point = GetFirstTsPoint.call(TsPoint, 'value', self.id)\n end\n\n if(defined? latest_point.to_a.first['time'])\n latest_time_ms = Time.parse(latest_point.to_a.first['time'])\n else\n latest_time_ms = \"None\"\n end \n \n return latest_time_ms\n end", "def poa_time\n # Check if there's a recipient, and if it has a timezone, it it does use that to set tz\n representative_tz_from_recipient = @hearing.representative_recipient&.timezone\n return normalized_time(representative_tz_from_recipient) if representative_tz_from_recipient.present?\n # If there's a virtual hearing, use that tz even if it's empty\n return normalized_time(@hearing.virtual_hearing[:representative_tz]) if @hearing.virtual_hearing.present?\n\n # No recipient and no virtual hearing? Use the normalized_time fallback\n normalized_time(nil)\n end", "def creation_epoch\n saved_at.try(:to_i)\n end", "def time\n @time ||= incorporate_utc_offset(@utc, utc_offset)\n end", "def compute_timestamp(logline)\n timestamp = logline.hour * 3600 + logline.minute * 60 + logline.second\n # assume we just advanced to the next day in case we got a lower timestamp than last one\n timestamp += LogLine::Resolution * offset\n if timestamp < last_timestamp\n self.offset = offset + 1\n timestamp += LogLine::Resolution\n end\n timestamp\n end", "def to_ms()\n time = Time.now\n start = Time.new(1970,1,1)\n ((time.to_f - start.to_f) * 1000.0).to_i\nend", "def now_in_ms\n Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)\n end", "def now_in_ms\n Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)\n end", "def process_creation_date_time\n return @process_creation_date_time\n end", "def monotonic_timestamp\n return nil unless @ctx.key?(:monotonic_ts)\n @monotonic_timestamp ||= Time.at(0, @ctx[:monotonic_ts].first)\n end", "def created_time\n ctime\n end", "def timestamp\n Time.at((attributes[:timestamp] || Time.now).to_i)\n end", "def first_seen_date_time\n return @first_seen_date_time\n end", "def first_seen_date_time\n return @first_seen_date_time\n end", "def local_ctime\n @time.getlocal.ctime\n end", "def datetime_stamp\n Time.now.utc.iso8601\n end", "def __evolve_time__\n __mongoize_time__.utc\n end", "def timestamps\n @timestamps ||= bytes[T_BYTES].each_slice(4).map do |t_bytes|\n ByteArray.to_i(t_bytes)\n end.reject{ |t| t == 0 }\n end", "def current_timestamp\n Time.now.to_i\n end", "def build_time\n return nil if self.received_at.blank?\n self.created_at - self.received_at\n end", "def timestamp_value\n @timestamp_value ||=\n ((@time_hi_and_version & 0b1111_1111_1111) << 48) |\n (@time_mid << 32) | @time_low\n end" ]
[ "0.6385008", "0.61927515", "0.6068136", "0.6032304", "0.5980395", "0.59446514", "0.57899314", "0.5763626", "0.5758183", "0.5752457", "0.5751187", "0.5744088", "0.5741157", "0.56950486", "0.5692983", "0.5680432", "0.56763273", "0.5672918", "0.5667088", "0.5637004", "0.56356496", "0.56313366", "0.56293637", "0.5625294", "0.5600101", "0.5599894", "0.5597212", "0.5592319", "0.5582669", "0.5580725", "0.5565125", "0.5549553", "0.5544832", "0.5541646", "0.5541646", "0.5540947", "0.55377775", "0.5529298", "0.55264163", "0.55229264", "0.55132705", "0.5501094", "0.5497422", "0.5468404", "0.5468404", "0.5468404", "0.5461624", "0.5458419", "0.54545", "0.54545", "0.5449519", "0.5428607", "0.54119146", "0.54105127", "0.54000664", "0.53987175", "0.53962654", "0.5394199", "0.53924143", "0.53907746", "0.538892", "0.538892", "0.5382893", "0.53823775", "0.5354861", "0.5344396", "0.5344396", "0.5344396", "0.53419274", "0.5321768", "0.53167963", "0.53157467", "0.5315343", "0.53153044", "0.5314101", "0.5312995", "0.53062135", "0.53026325", "0.5300814", "0.5294888", "0.5288297", "0.5286857", "0.52863765", "0.5284709", "0.5284077", "0.52804166", "0.52804166", "0.52726966", "0.52674305", "0.52588946", "0.52536297", "0.525352", "0.525352", "0.5251453", "0.52453", "0.52436775", "0.5242928", "0.52417964", "0.52402097", "0.52401525" ]
0.5996415
4
Various meta data about this notifier gem
def notifier { :name => "crashlog", :version => CrashLog::VERSION, :language => 'Ruby' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Email delivery (rfc6037) for CalDAV scheduling',\n 'link' => 'http://sabre.io/dav/scheduling/'\n }\n end", "def metadata\n msg['metadata']||{}\n end", "def notification_metadata\n data.notification_metadata\n end", "def meta_data\n data = []\n data << \"@#{@mention}\" unless @mention.empty?\n data << Array.new(@priority + 1).join('!') if @priority > 0\n data\n end", "def agentx_information\n super\n end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def meta\n {\n exp: 1.day.from_now.to_i,\n iss: 'issuser_name',\n aud: 'client'\n }\n end", "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generates HTML indexes and debug information for your sabre/dav server',\n 'link' => 'http://sabre.io/dav/browser-plugin/'\n }\n end", "def info; end", "def info; end", "def info\n raise \"Not yet implemented\"\n end", "def info\n @info ||= {}\n end", "def setup_info\n {}\n end", "def meta\n {\n source: @host,\n favicon: @favicon,\n url: @url,\n title: title,\n description: @description,\n keywords: keywords,\n image_url: @main_image,\n extractable: extractable?\n }\n end", "def meta_information\n @meta_hash ||= {}\n end", "def system_information\n super\n end", "def system_information\n super\n end", "def metadata\n @metadata.tap do |h|\n # This represents the minimal set of attribute methods that should be available in every subclass.\n h[:mime_type] = mime_type if mime_type\n h[:filename] = filename if filename\n h[:digest] = digest if digest\n h[:size] = size if size\n h[:last_modified] = last_modified if last_modified\n end\n end", "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => nil,\n 'link' => nil\n }\n end", "def info()\n #This is a stub, used for indexing\n end", "def info\n {\n :name => self.name,\n :signature => self.signature,\n }\n end", "def rpm_package_information\n super\n end", "def metadata\n @meta_data\n end", "def notify\n if !@config['external']\n base = MU.structToHash(cloud_desc)\n end\n base ||= {}\n\n base\n end", "def meta_data\n @meta_data ||= @internal_struct[:meta_data]\n end", "def verifiable_info\n {}\n end", "def verifiable_info\n {}\n end", "def notify\n description = if !@config['external']\n MU.structToHash(cloud_desc)\n else\n {}\n end\n description.delete(:etag) if description\n description\n end", "def meta\n {}\n end", "def INFO_FIELDS\n %w(name created updated type ref user description comments)\n end", "def metadata\n {\n :name => \"QRCode Raplet\",\n :description => \"Shows a QRCode under phone numbers in the HUD\",\n :welcome_text => %q{\n <p>In order to see this raplet in action, connect your Google Contacts\n to Rapportive and then click on a phone number.</p>\n <p>You'll then be able to take a photo of the QRCode instead of having\n to type the number into your phone.</p>\n },\n :provider_name => \"Conrad Irwin\",\n :provider_url => \"http://github.com/ConradIrwin/qrcode-raplet\",\n :type => 'telephony'\n }\n end", "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'The Core plugin provides a lot of the basic functionality required by WebDAV, such as a default implementation for all HTTP and WebDAV methods.',\n 'link' => nil\n }\n end", "def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end", "def metadata\n {\n Title: 'Maestrano Monthly Invoice',\n Author: 'Maestrano',\n Subject: 'Maestrano Monthly Invoice',\n Producer: 'Maestrano',\n CreationDate: Time.now\n }\n end", "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for WebDAV Collection Sync (rfc6578)',\n 'link' => 'http://sabre.io/dav/sync/'\n }\n end", "def info\n @info ||= {}\n end", "def meta\n @d[:meta]\n end", "def metadata\n @metadata ||= {}\n end", "def meta\n self.class.instance_variable_get(:@__meta)\n end", "def metadata\n # TODO Move into {NRSER::Props::Metadata}?\n # \n unless NRSER::Props::Metadata.has_metadata? self\n instance_variable_set \\\n NRSER::Props::Metadata::VARIABLE_NAME,\n NRSER::Props::Metadata.new( self )\n end\n \n NRSER::Props::Metadata.metadata_for self\n end", "def metadata\n @metadata ||= {}\n end", "def notify\n descriptor = MU.structToHash(cloud_desc)\n descriptor[\"cloud_id\"] = @mu_name\n descriptor\n end", "def about\n raise NotImplementedError, 'this should be overridden by concrete sub-class'\n end", "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generic authentication plugin',\n 'link' => 'http://sabre.io/dav/authentication/'\n }\n end", "def metadata\n {\n :user_id => user.id.to_s,\n :user => user.to_s.truncate(500),\n (subscription.subscribable_type.downcase + '_id').to_sym => subscription.subscribable.id.to_s,\n subscription.subscribable_type.downcase.to_sym => subscription.subscribable.to_s\n }\n end", "def metadata\n case object.package_type\n when 'composer'\n object.composer_metadatum\n when 'conan'\n object.conan_metadatum\n when 'maven'\n object.maven_metadatum\n when 'nuget'\n object.nuget_metadatum\n when 'pypi'\n object.pypi_metadatum\n else\n nil\n end\n end", "def info\n @info\n end", "def info\n @info\n end", "def info\n fill_usage_info\n end", "def additional_info\n nil\n end", "def info\n date = self.updated_at.to_s(:short)\n wrote = self.system_log? ? \"\" : \" wrote\"\n private = self.private? ? \" [private]\" : \"\"\n \"[#{date}] #{self.byline}#{wrote}#{private}\"\n end", "def info\n date = self.updated_at.to_s(:short)\n wrote = self.system_log? ? \"\" : \" wrote\"\n private = self.private? ? \" [private]\" : \"\"\n \"[#{date}] #{self.byline}#{wrote}#{private}\"\n end", "def description\n self[:message]\n end", "def metadata\n\t super() + \" [BackTracker]\"\n\tend", "def meta\n type = self.type\n return nil if type == :unknown\n return @raw['message'][\"headers\"][\"header\"].to_s if type == :query\n return @item['id'] if type == :notify\n nil\n end", "def extra\n {\n identifier_type: raw_info[\"identifierType\"],\n method: raw_info[\"method\"],\n assurance_level: raw_info[\"assuranceLevel\"],\n status: raw_info[\"status\"]\n }\n end", "def get_info\n \"here is some info on#{self.name}: #{self.about}\"\n end", "def iiif_suppressed_metadata\n super + [\n :electronic_locations,\n :gbl_suppressed_override,\n :rendered_coverage,\n :rendered_links\n ]\n end", "def notifier; end", "def notifier; end", "def attributes(*args)\n hash = super\n if @instance_options[:detailed] == true\n hash[:checklists] = checklists\n hash[:current_timer] = current_timer\n end\n hash\n end", "def metadata\n self[:metadata] || {}\n end", "def notifier_type\n options[:notifier_type]\n end", "def metadata\n @data[:metadata]\n end", "def include_meta_info\n true\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def notes\n super()\n\n section = __method__\n text = \"\"\n html = \"\"\n\n frontend_url = generate_frontend_url\n if frontend_url\n text += \"Frontend URL: #{frontend_url}\\n\\n\"\n add_short_text(\"additional_info\", \"View logs here: #{frontend_url}\")\n html += \"<b>Frontend URL</b>: #{frontend_url}<br><br>\"\n end\n\n add_text(section, text)\n add_html(section, html)\n end", "def notify\n base = MU.structToHash(cloud_desc)\n base.delete(:etag)\n base[\"cloud_id\"] = @cloud_id\n\n base\n end", "def info\n super(MARKETPLACEAPP_METHODS[:info], 'MARKETPLACEAPP')\n end", "def my_info\r\n end", "def further_details \n {\n 'agent.name' => 'agent.major_version',\n 'agent.os' => 'agent.name',\n 'agent.major_version' => 'agent.full_version',\n 'agent.engine_name' => 'agent.engine_version',\n 'silverlight_major_version' => 'silverlight_version',\n 'flash_major_version' => 'flash_version',\n 'country' => 'city',\n 'requested_locale_major' => 'requested_locale_minor',\n }\n end", "def meta\n Meta.get(self)\n end", "def description\n info[\"Description\"]\n end", "def server_info()\n #This is a stub, used for indexing\n end", "def site_meta\n end", "def site_meta\n end", "def metadata\n self.class.metadata[__name__] || {}\n end", "def info(msg, request=nil)\n super(with_extra_request_info(msg, request))\n end", "def get_info\n end", "def get_info\n end", "def get_info\n end", "def info\n name = extract_app\n attrs = heroku.info(name)\n\n attrs[:web_url] ||= \"http://#{attrs[:name]}.#{heroku.host}/\"\n attrs[:git_url] ||= \"git@#{heroku.host}:#{attrs[:name]}.git\"\n\n if options[:raw] then\n attrs.keys.sort_by { |a| a.to_s }.each do |key|\n case key\n when :addons then\n display \"addons=#{attrs[:addons].map { |a| a[\"name\"] }.sort.join(\",\")}\"\n when :collaborators then\n display \"collaborators=#{attrs[:collaborators].map { |c| c[:email] }.sort.join(\",\")}\"\n else\n display \"#{key}=#{attrs[key]}\"\n end\n end\n else\n display \"=== #{attrs[:name]}\"\n display \"Web URL: #{attrs[:web_url]}\"\n display \"Domain name: http://#{attrs[:domain_name]}/\" if attrs[:domain_name]\n display \"Git Repo: #{attrs[:git_url]}\"\n display \"Dynos: #{attrs[:dynos]}\" unless attrs[:stack] == \"cedar\"\n display \"Workers: #{attrs[:workers]}\" unless attrs[:stack] == \"cedar\"\n display \"Repo size: #{format_bytes(attrs[:repo_size])}\" if attrs[:repo_size]\n display \"Slug size: #{format_bytes(attrs[:slug_size])}\" if attrs[:slug_size]\n display \"Stack: #{attrs[:stack]}\" if attrs[:stack]\n\n if attrs[:dyno_hours].is_a?(Hash)\n formatted_hours = attrs[:dyno_hours].keys.map do |type|\n \"%s - %0.2f dyno-hours\" % [ type.to_s.capitalize, attrs[:dyno_hours][type] ]\n end\n display \"Dyno usage: %s\" % formatted_hours.join(\"\\n \")\n end\n\n if attrs[:database_size]\n data = format_bytes(attrs[:database_size])\n if tables = attrs[:database_tables]\n data = data.gsub('(empty)', '0K') + \" in #{quantify(\"table\", tables)}\"\n end\n display \"Data size: #{data}\"\n end\n\n if attrs[:cron_next_run]\n display \"Next cron: #{format_date(attrs[:cron_next_run])} (scheduled)\"\n end\n if attrs[:cron_finished_at]\n display \"Last cron: #{format_date(attrs[:cron_finished_at])} (finished)\"\n end\n\n unless attrs[:addons].empty?\n display \"Addons: \" + attrs[:addons].map { |a| a['description'] }.join(', ')\n end\n\n display \"Owner: #{attrs[:owner]}\"\n collaborators = attrs[:collaborators].delete_if { |c| c[:email] == attrs[:owner] }\n unless collaborators.empty?\n first = true\n lead = \"Collaborators:\"\n attrs[:collaborators].each do |collaborator|\n display \"#{first ? lead : ' ' * lead.length} #{collaborator[:email]}\"\n first = false\n end\n end\n\n if attrs[:create_status] != \"complete\"\n display \"Create Status: #{attrs[:create_status]}\"\n end\n end\n end", "def metadata\n {\n line: \"#{method.upcase} #{uri}\",\n headers: headers,\n body: body,\n }.compact\n end", "def info()\n return nil\n end", "def further_details \n {\n 'referer_host' => 'referer_path',\n 'referer_path' => 'referer_params',\n \n 'agent.name' => 'agent.major_version',\n 'agent.os' => 'agent.name',\n 'agent.major_version' => 'agent.full_version',\n 'agent.engine_name' => 'agent.engine_version', \n }\n end", "def details\n tp self, \"slack_id\", \"name\", \"topic\", \"member_count\"\n end", "def details; end", "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Adds support for caldav-sharing.',\n 'link' => 'http://sabre.io/dav/caldav-sharing/'\n }\n end", "def veteran_info; end", "def info\n nil\n end", "def cmd_notify_help\n\t\t\t\tputs \"Run notify_set_user, notify_set_webhook, and notify_set_source to setup Slack config. Then run notify_save to save them for later. Use notify_test to test your config and load it from the YAML file in the future. Finally, run notify_start when you have your listener setup.\"\n\t\t\tend", "def set_package_info\n download_and_extract_package\n parse_package_description\n @package_hash = filter_into_package @package_desc\n @version_hash = filter_into_version @package_desc\n @author_hash = filter_into_author @package_desc[\"Author\"]\n @maintainer_hash = filter_into_author @package_desc[\"Maintainer\"]\n end", "def metadata=(_); end" ]
[ "0.66314024", "0.64211375", "0.63781476", "0.6167987", "0.61629486", "0.61572576", "0.61572576", "0.61572576", "0.61572576", "0.61572576", "0.61572576", "0.61572576", "0.61546105", "0.6125259", "0.61089736", "0.61089736", "0.6091981", "0.6071879", "0.6067872", "0.60361326", "0.60313934", "0.5999355", "0.5999355", "0.599492", "0.5994713", "0.5962018", "0.59254986", "0.5921069", "0.5911018", "0.59086573", "0.5906327", "0.58934337", "0.58934337", "0.58846056", "0.5879895", "0.5853441", "0.58513063", "0.5850472", "0.58415616", "0.58396375", "0.58374214", "0.582948", "0.5806451", "0.5798114", "0.57933336", "0.5777762", "0.57631874", "0.57549393", "0.5751217", "0.57425153", "0.5734668", "0.5733407", "0.5720963", "0.5716249", "0.5715102", "0.57083195", "0.56856763", "0.56856763", "0.56802726", "0.566724", "0.5667149", "0.56670594", "0.5662256", "0.56442124", "0.56402075", "0.56402075", "0.5622325", "0.5622137", "0.5603625", "0.56008327", "0.5592652", "0.55906516", "0.55906516", "0.55776125", "0.5577194", "0.55763674", "0.5568968", "0.55629355", "0.5555048", "0.55508745", "0.5546351", "0.5543073", "0.5543073", "0.55362815", "0.5533256", "0.55323565", "0.55323565", "0.55323565", "0.5531999", "0.5530393", "0.5529685", "0.55291355", "0.5523763", "0.5519329", "0.5512174", "0.5506939", "0.5496607", "0.549464", "0.54881316", "0.54825836" ]
0.6367681
3
Write a `guessing_game` method. The computer should choose a number between 1 and 100. Prompt the user to `guess a number`. Each time through a play loop, get a guess from the user. Print the number guessed and whether it was `too high` or `too low`. Track the number of guesses the player takes. When the player guesses the number, print out what the number was and how many guesses the player needed.
def guessing_game computer_number = rand(1..100) guesses = 0 while true guesses += 1 puts "guess a number" user_number = gets.chomp.to_i puts user_number #finish loop when the user's name and computer's number is same break if computer_number == user_number status = computer_number > user_number ? "low" : "high" puts "too #{status}" end puts "#{guesses}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guessing_game\n\tputs \"Guess a number between 1 and 100\"\n\tcorrect = Random.new.rand(1..100)\n\tnum_guesses = 1\n\tcurrent_guess = gets.chomp.to_i\n\n\twhile current_guess != correct\n\t\tif current_guess > correct \n\t\t\tputs \"The number is lower than #{current_guess}. Guess again\"\n\t\telsif current_guess < correct\n\t\t\tputs \"The number is higher than #{current_guess}. Guess again\"\n\t\tend\n\t\tcurrent_guess = gets.chomp.to_i\n\t\tnum_guesses = num_guesses + 1\n\tend\n\tputs \"You guessed #{correct} in #{num_guesses} tries!\"\nend", "def guessing_game\n\tprint \"Hello, what should I call you? \"\n\tname = gets.chomp\n\tnumber = rand(100) + 1\n\tguesses_remaining = 10\n\tis_correct = false\n\tputs \"Welcome #{name}! It's time to play Guess My Number!\"\n\tputs \"I'm thinking of a number between 1 and 100, can you guess what it is?\"\n\twhile guesses_remaining > 0\n\t\tif guesses_remaining == 1\n\t\t\tputs \"You only have 1 guess remaining!!!\"\n\t\telse\n\t\t\tputs \"You have #{guesses_remaining} guesses remaining.\"\n\t\tend\n\t\tputs \"What do you guess?\"\n\t\tguess = gets.to_i\n\t\tguesses_remaining -= 1\n\t\tif guess == number\n\t\t\tif (10 - guesses_remaining) == 1\n\t\t\t\tputs \"Good job, #{name}! You guessed my number in only 1 guess!!!\"\n\t\t\telse\n\t\t\t\tputs \"Good job, #{name}! You guessed my number in #{10 - guesses_remaining} guesses!\"\n\t\t\tend\n\t\t\tis_correct = true\n\t\t\texit\n\t\telsif guess > number\n\t\t\tputs \"Oops, your guess was too HIGH!\"\n\t\telse\n\t\t\tputs \"Oops, your guess was too LOW!\"\n\t\tend\n\tend\n\n\tunless is_correct\n\t\tputs \"Sorry, you didn't get my number. It was #{number}!\"\n\t\tputs \"Better luck next time!\"\n\t\tplay_again?\n\tend\nend", "def guessingGame()\n\t# Track number of tries\n\ttries = 1;\n\n\t# Generate a random number to start the game off.\n\tsecretNumber = rand(0..100)\n\n\tputs \"Guess a number between 1 and 100\"\n\n\twhile true\n\t\tputs \"Enter 'q' to end the game and see the secret number\"\n\t\tguess = gets.chomp()\n\n\t\tif guess.to_i == secretNumber\n\t\t\tputs \"Bingo Bango! The secret number was #{guess}\"\n\t\t\tputs \"You got it in #{tries} tries\"\n\t\t\tbreak;\n\t\telsif guess == 'q'\n\t\t\tputs \"The secret number is: #{secretNumber}\"\n\n\t\t\tputs \"Play again? (y/n)\"\n\t\t\treplay = gets.chomp()\n\t\t\t\n\t\t\tunless replay == 'y' || replay == 'n'\n\t\t\t\tputs \"Play again? (y/n)\"\n\t\t\t\treplay = gets.chomp()\n\n\t\t\telse\n\t\t\t\tif replay == 'y'\n\t\t\t\t\tguessingGame()\n\t\t\t\telsif replay == 'n'\n\t\t\t\t\tputs \"Game Over\"\n\t\t\t\t\tbreak;\n\t\t\t\tend\n\t\t\tend\n\t\telsif guess.to_i < secretNumber\n\t\t\tputs \"Guess a higher number\"\n\t\t\ttries += 1\n\t\telsif guess.to_i > secretNumber\n\t\t\tputs \"Guess a lower number\"\n\t\t\ttries += 1\n\t\tend\t\n\tend\nend", "def guessing_game\n computer_choice = rand(1..100)\n puts \"Let's play a guessing game!\"\n puts \"Computer's got a number...\"\n user_guess = 0\n guesses = 0\n while user_guess != computer_choice\n puts \"Guess the number!\"\n user_guess = gets.chomp.to_i\n puts user_guess\n guesses += 1\n if user_guess > computer_choice\n puts \"Too high...\"\n elsif user_guess < computer_choice\n puts \"Too low...\"\n elsif user_guess == computer_choice\n puts \"You got it! It was #{computer_choice}!\"\n puts \"You got it in #{guesses} guesses!\"\n puts \"Thanks for playing :)\"\n break\n end\n end\nend", "def guessing_game\n guesses = 0\n answer = rand(1..100)\n guess = nil\n\n until guess == answer\n puts \"guess a number\"\n guess = gets.chomp.to_i\n\n puts \"#{guess} is too high\" if guess > answer\n puts \"#{guess} is too low\" if guess < answer\n\n guesses += 1\n end\n\n puts \"#{answer} was the correct answer! It took you #{guesses} guesses to come up with that!\"\nend", "def guessing_game(guess_count)\n puts 'Guess a number between 1 and 100.'\n guess = gets.chomp.to_i\n number = 48\n if guess < number\n puts \"The number is higher than #{guess}. Guess again\"\n guess_count += 1\n guessing_game(guess_count)\n elsif guess > number\n puts \"The number is lower than #{guess}. Guess again\"\n guess_count += 1\n guessing_game(guess_count)\n else\n guess_count += 1\n puts \"You got it in #{guess_count} tries!\"\n end\nend", "def play_game\r\n\r\n #Call on the generate_number method in order to get a random number\r\n number = generate_number\r\n $noOfGuesses = 0 \r\n\r\n #Loop until the player inputs a valid answer\r\n loop do\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n \r\n\r\n if $noOfGuesses > $maxGameGuesses then\r\n print \"You exceeded the allowed number of guesses of \" + $maxGameGuesses.to_s + \".\"\r\n print \"\\nYou lose! Please try again.\"\r\n print \"\\n\\nPress enter to continue.\"\r\n Console_Screen.pause \r\n break\r\n end\r\n\r\n if $cheatMode == true then\r\n print \"\\nShh.... the answer is \" + number.to_s \r\n end\r\n\r\n #Prompt the player to make a guess\r\n print \"\\n\\nEnter your guess and press the Enter key: \"\r\n \r\n \r\n reply = STDIN.gets #Collect the player's answer\r\n reply.chop! #Remove the end of line character\r\n\r\n reply = reply.to_i\r\n\r\n if reply < 1 || reply > $maxChallengeRange then\r\n Console_Screen.cls\r\n print \"\\nInvalid entry. Please enter a number between 1 and \" + $maxChallengeRange.to_s\r\n print \"\\n\\nPlease press enter to continue.\"\r\n Console_Screen.pause\r\n redo #Redo the current iteration of the loop\r\n end\r\n \r\n $noOfGuesses = $noOfGuesses + 1\r\n \r\n #Analyze the player's guess to determine if it is correct\r\n if reply == number then #The player's guess was correct\r\n Console_Screen.cls #Clear the display area\r\n print \"You have guessed the number! Press enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n break #Exit loop\r\n elsif reply < number then #The player's guess was too low\r\n Console_Screen.cls #Clear the display area\r\n print \"Your guess is too low! Press Enter to continue.\\n\\n\"\r\n Console_Screen.pause #Pause the game\r\n elsif reply > number then #The player's guess was too high\r\n Console_Screen.cls #Clear the display area\r\n print \"Your guess is too high! Press Enter to continue.\\n\\n\"\r\n Console_Screen.pause #Pause the game\r\n end\r\n\r\n \r\n \r\n end\r\n\r\n end", "def guessing_game\n chosen_num = Random.new.rand(100) + 1\n guesses = 0\n\n if chosen_num == 0 then raise NoMoreInput end\n\n begin\n puts \"Guess a number between 1 and 100:\"\n guess = gets.chomp.to_i\n puts \"#{guess}\"\n\n if guess > chosen_num\n puts \"too high\"\n elsif guess < chosen_num\n puts \"too low\"\n end\n guesses += 1\n end until guess == chosen_num\n\n puts \"You guessed right in #{guesses}! It was #{guess}\"\nend", "def guessgame\n prev_guess = 0\n comp_guess = ((rand * 100) + 1).floor\n attempts = 10\n while attempts >= 1\n print \"Guess the number : \"\n user_guess = gets.chomp.to_i\n if user_guess != prev_guess\n if user_guess > comp_guess\n puts 'Guess was higher'\n elsif user_guess < comp_guess\n puts \"Guess was lower\"\n else\n puts \"You are correct, the answer is #{comp_guess} indeed!\"\n break\n end\n attempts -= 1\n prev_guess = user_guess\n else\n puts \"Guess was same as last attempt, try a different number\"\n end\n puts \"You have #{attempts} attempts left\"\n end\nend", "def play_game\n\n\t#call on the generate_number method to get a random number\n number = generate_number\n\n #loop unt the player inputs a valid answer\n loop do \n \tConsole_Screen.cls\n\n \t#prompt the player to make a guess\n \tprint \"\\nEnter your guess and press the Enter key: \"\n\n \treply = STDIN.gets #collect the player's answer\n \treply.chop! #remove the end of line character\n \treply = reply.to_i #conver the player's guess to an integer\n\n \t#validate the player's input only allowing gueses from 1 to 100\n \tif reply == \"c\"\n\n \t\tConsole_Screen.cls\n\n \t\tSQ.display_credits\n \t\tputs $gameCount\n \t\tbreak\n \telsif reply < 1 or reply > 1000 then\n \t\tConsole_Screen.cls\n \t\tprint \"Guesses must be between 1 and 1000. Press Enter to continue\"\n\n \t\tConsole_Screen.pause\n \t\tredo #redo the current iteration of the loop\n end\n\n #analyze the players guess to determine if it is correct\n if reply == number then #the player's guess was correct\n\n \tConsole_Screen.cls #clear the display area\n \t$noOfGuesses = $noOfGuesses + 1\n \tprint \"You have guessed the number! Press Enter to continue.\"\n \tConsole_Screen.pause #pause the game\n \tbreak #exit loop\n elsif reply < number then #the player's guess was too low\n\n \tConsole_Screen.cls #clear the display area\n \t$noOfGuesses = $noOfGuesses + 1\n \tprint \"Your guess is too low! Press Enter to continue.\"\n \tConsole_Screen.pause #puse the game\n \n elsif reply > number then\n\n \tConsole_Screen.cls #clear the display are\n \t$noOfGuesses = $noOfGuesses + 1\n \tprint \"Your guess is too high! Press Enter to conitnue.\"\n \tConsole_Screen.pause #pause the game\n\n end\n\nend\nend", "def play_game(value)\r\n\r\n #Call on the generate_number method in order to get a random number\r\n number = generate_number \r\n\r\n\tif value == \"c\"\r\n\t\tConsole_Screen.cls\r\n\t\tputs \"\\n\\nCHEAT MODE: secret number is \" + number.to_s \r\n\t\tConsole_Screen.cls\r\n\tend\r\n\t\r\n #Loop until the player inputs a valid answer\r\n loop do\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Prompt the player to make a guess\r\n print \"\\nEnter your guess and press the Enter key: \"\r\n \r\n reply = STDIN.gets #Collect the player's answer\r\n reply.chop! #Remove the end of line character\r\n reply = reply.to_i #Convert the player's guess to an integer\r\n \r\n\t #Increment Guesses Variable\r\n\t $noOfGuesses += 1\r\n\t\r\n #Validate the player's input only allowing guesses between 1 and 100\r\n if reply < 1 or reply > 1000 then\r\n\t \r\n\t\tConsole_Screen.cls #clear screen\r\n\t\t\r\n\t\tputs \"\\nInvalid input was entered!\"\r\n\t\tprint \"\\n\\Only use numbers from 1 to 1000 for guesses. Press enter to continue.\" \r\n\t\t\r\n\t\tConsole_Screen.pause\r\n\t \r\n redo #Redo the current iteration of the loop\r\n end\r\n \r\n #Analyze the player's guess to determine if it is correct\r\n if reply == number then #The player's guess was correct\r\n Console_Screen.cls #Clear the display area\r\n print \"You have guessed the number! Press enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n break #Exit loop\r\n elsif reply < number then #The player's guess was too low\r\n Console_Screen.cls #Clear the display area\r\n print \"Your guess is too low! Press Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n elsif reply > number then #The player's guess was too high\r\n Console_Screen.cls #Clear the display area\r\n print \"Your guess is too high! Press Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n end\r\n \r\n\t\tif $noOfGuesses >= 10\t\t#Max guess attemps (10)\r\n\t\tConsole_Screen.cls \t#clear screen\r\n\t\t\tprint \"Your \" + $noOfGuesses.to_s + \" guesses are at max allowable attempts. Press enter to continue.\"\r\n\t\t\tConsole_Screen.pause\t#pause the game\r\n\t\t\tbreak\t#break loop\r\n\t\tend\r\n end\r\n\r\n end", "def num_guess_game\n puts \"Let's play the number guessing game! Guess any number between 1 to 100\"\n num = rand(101)\n guess = \"\" #initialize var for the loop so that guess remains in scope.\n until guess == num\n guess = gets.chomp.to_i\n if !guess.between?(1,100) #for cases where input is a) outside the range and b) not a number.\n puts \"That guess was not between 1 to 100. Try again\"\n elsif guess < num\n puts \"Your guess is too low! Guess again\"\n else\n puts \"Your guess is too high! Guess again\"\n end\n end\n puts \"Your guess is correct! Are you psychic?\"\nend", "def challenge5 \n\tcounter = 1\n\tnumber = rand(1..100)\n\tputs \"Guess a number between 1 and 100\"\n\tguess = gets.chomp.to_i\n\n\twhile guess != number do\n\t\tif guess > 100 || guess < 0\n\t\t\tputs \"Please guess a number between 1 and 100. Guess again\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\telsif guess < number\n\t\t\tputs \"the number is greater than #{guess}. Guess again.\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\telsif guess > number\n\t\t\tputs \"the number is less than #{guess}. Guess again.\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\tend\n\tend\n\tputs \"You got it in #{counter} attempt(s)!\"\nend", "def guess\n puts 'Guess a number between 1-100, You only have 5 tries to get it right.'\n\n guess = gets.to_i\n\n if guess == @number\n puts 'WOW!! You guessed it on the first try!'\n else\n keep_guessing guess\n end\n end", "def number_guess\n\tsecret_num = rand(101)\n\tchances = 5\n\twhile chances > 0\n\t\tputs \"Guess a number between 1 and 100!\"\n\t\tresponse = gets.chomp.to_i\n\t\tif chances == 1\n\t\t\tputs \"LOSER\"\n\t\t\tbreak\n\t\telsif response == secret_num\n\t\t\tputs \"WINNER!\"\n\t\t\tbreak\n\t\telsif response > secret_num\n\t\t\tputs \"Your guess was too high!\"\n\t\t\tchances -= 1\n\t\telse \n\t\t\tputs \"Your guess was too low!\"\n\t\t\tchances -= 1\n\t\tend\n\tend\nend", "def ask_for_guess_number \n\tputs \"Please enter a number between 1 and 10:\"\n\t@guessed_number = gets.to_i\n\tif @guessed_number == @secret_number\n\t\tputs \"Congratulations! You won the game!\"\n\t\t#Player won the game, so return true\n\t\treturn true\n\telse\n\t\t#Determine if the number was too high or low\n\t\tif @guessed_number > @secret_number\n\t\t\tputs \"Your guess was too high\"\n\t\telse\n\t\t\tputs \"Your guess was too low\"\n\t\tend\n\t\t#Player lost the guess, so return false\n\t\treturn false\n\tend\nend", "def game(mode, count, rangeL, rangeH, number)\n puts `clear`\n puts \"---------------------\"\n puts \"Welcome to #{mode} mode!\"\n puts \"---------------------\"\n puts \"Please enter a number to guess between #{rangeL} and #{rangeH}.\"\n guess = gets.chomp.to_i\n count += 1 \n while guess != number \n if guess > number \n puts \"You guessed to high\"\n count += 1\n puts \"Please enter a number to guess between #{rangeL} and #{rangeH}.\"\n guess = gets.chomp.to_i\n elsif guess < number \n puts \"You guessed to low\"\n count += 1 \n puts \"Please enter a number to guess between #{rangeL} and #{rangeH}.\"\n guess = gets.chomp.to_i\n end\n end \n puts \"You guessed the number in #{count} attempts!\"\nend", "def guess(max_number)\n number_of_guesses = 0\n correct_number = rand(max_number) + 1\n guess = 0\n puts \"I've picked a random number between 1 and #{max_number}.\\n\\n\"\n while (guess != correct_number)\n print \"What is your guess? \"\n guess = gets.chomp.to_i\n number_of_guesses += 1\n if (guess > correct_number)\n puts \"Too High!\"\n elsif (guess < correct_number)\n puts \"Too Low!\"\n else\n puts \"You got it in #{number_of_guesses} guesses. Good job!\"\n end\n end\nend", "def guessing_game\n answer = rand(1..10)\n print \"What is your guess?\"\n guess = gets.chomp\n if\n guess.to_i > answer\n puts \"Your guess is too high.\"\n elsif\n guess.to_i < answer\n puts \"Your guess is too low.\"\n else\n puts \"Your guess is correct.\"\n end\n \n print \"What is your guess?\"\n guess = gets.chomp\n if\n guess.to_i > answer\n puts \"Your guess is too high.\"\n elsif\n guess.to_i < answer\n puts \"Your guess is too low.\"\n else\n puts \"Your guess is correct.\"\n end\n \n print \"What is your guess?\"\n guess = gets.chomp\n if\n guess.to_i > answer\n puts \"Your guess is too high.\"\n elsif\n guess.to_i < answer\n puts \"Your guess is too low.\"\n else\n puts \"Your guess is correct.\"\n end\n \n puts \"The answer was\"\n puts answer\nend", "def guess()\n num = rand(1..100)\n count = 0\n puts \"Guess between 1 and 100\"\n\n while ((response = gets.chomp.to_i) != num)\n if (num > response)\n puts \"The number is higher than %s\" % response\n count += 1\n else\n puts \"The number is lower than %s\" % response\n count += 1\n end\n end\n puts \"Congratulations! The number was %s\" % num\n puts \"You got it in %s tries\" % count\nend", "def guessNumber guess\n\tnum = 25\n\tif num == guess\n\t\tputs \"You got it!\"\n\telsif num > guess\n\t\tputs \"Guess was too high!\"\n\telse\n\t\tputs \"Guess was too low!\"\n\tend\nend", "def game(name,max,tries)\n secret_number = rand(1..max)\n puts \"Make your first guess. Type in a number when you are ready and click enter.\"\n guess_previous = 999999\n guess = gets.to_i\n bad_counter = 0\n for i in 1..tries\n \tif guess == 0\n \t\tbad_guess(i,guess,secret_number,name,bad_counter,tries)\n \t\tbad_counter = bad_counter + 1\n \telsif guess == secret_number\n \t\thardergame = correct_guess(i,guess,secret_number,name)\n \t\treturn hardergame\n \telsif guess == guess_previous\n \t\tputs \"What are you thinking? You picked #{guess} before!\"\n \t\twrong_guess(i,guess,secret_number,name,tries)\t\n \telse \n \t\twrong_guess(i,guess,secret_number,name,tries)\t \t\t\n \tend\n \tguess_previous = guess\n \tguess = gets.to_i\n end\nend", "def ask_user_guess (total_games = 3)\n puts \"Please guess a nunmber between 1 and 10!\"\n user_guess = gets\n user_guess = user_guess.chomp.to_i\n if user_guess == secret_number\n puts \"That's correct! Congratulations!!! Game over!\"\n elsif\n user_guess > secret_number\n total_games = total_games -1\n \tif total_games > 0\n \t puts \"Too high! Guess again! You have #{total_games} games left\"\n \t ask_user_guess(total_games)\n \telse\n \t puts \"Sorry, no more guesses. The correct answer was 3. Game over!\"\n \tend\n else\n total_games = total_games -1\n \tif total_games > 0\n puts \"Too low! Guess again You have #{total_games} games left\"\n \t ask_user_guess(total_games)\n \telse\n \t puts \"Sorry, no more guesses. The correct answer was 3. Game over!\"\n \tend\n end\nend", "def play_game \n\n @number_guesses = 0\n @start_time = Time.now\n puts \"I have generated a secret code, a sequence of four colors: (R)ed, (G)reen, (B)lue, and (Y)ellow\"\n\n game_over = false \n\n until game_over \n \n guess = get_guess\n\n exit_game if guess.upcase == \"Q\" \n guess = @secret_code if guess.upcase == \"C\" # provide option to cheat\n\n if validate_guess(guess)\n @number_guesses += 1\n # add_guess_to_history(guess_report(guess))\n display_history(guess)\n\n if guess.upcase == @secret_code\n game_over = true \n end_game\n else\n puts \"Please guess again.\" \n end\n end\n end\n end", "def guess_number guess\n\tnumber = 25\n\tunless guess == number\n\t\tif guess < number\n\t\t\tputs \"Guess was too low!\"\n\t\telsif guess > number\n\t\t\tputs \"Guess was too high!\"\n\t\tend\n\telse\n\t\tputs \"You got it!\"\n\tend\nend", "def wrong_ans\n puts \"What do you think it is ?\"\n @guess_no = gets.chomp.to_i\n\n if @guess_no > @rand_no\n puts \"go a little lower\"\n elsif @guess_no < @rand_no\n puts \"go a little higher\"\n end\n\n @chances += 1\nend", "def calculate\n new_guess\n while @guess != @random_num\n if (@guess <= 100) && (@guess > @random_num)\n guesslower\n elsif (@guess >= 1) && (@guess < @random_num)\n guesshigher\n end\n end\n guesscongrats\n end", "def start_game\n puts print_created_by\n\n puts \"What is your name?\"\n @player.name = $stdin.gets.chomp\n puts \"secret_numb: #{@secret_numb.secret_number}\"\n puts \"Welcome to my game, #{@player.name}.\"\n puts \"You have #{guesses_allowed} tries to guess a number between 1 and #{@secret_numb.set_of_numbers.length}.\"\n\n\n puts \"What is your #{current_guess_count + 1}st guess?\"\n @current_guess = $stdin.gets.strip.to_i\n increment_guess_count\n\n\n while @current_guess_count <= @guesses_allowed && guess_correct?(@current_guess) do\n increment_guess_count\n puts \"What is your #{current_guess_count}#{get_num_suffex(@current_guess_count)} guess?\"\n @current_guess = $stdin.gets.strip.to_i\n end\n end", "def guess\n number = 22\n guess = gets.to_i\n if guess > number\n p 'too high!'\n guess\n elsif guess < number\n p 'too low!'\n guess\n else\n p 'you got it.'\n end\nend", "def guess_the_number\n prog_num=rand(1..20)\ncounter=0\nwhile counter < 10\nnumber=user_guessing\ncounter+=1\nif number>prog_num\n if number-(prog_num)>5\n puts \"too large try no.#{counter}\"\n else number-(prog_num)>5\n puts \"bit large try no.#{counter}\"\n end\nelsif number<prog_num\n if (prog_num)-number>5\n puts \"too small try no.#{counter}\"\n else (prog_num)-number>5\n puts \"bit small try no.#{counter}\"\n end\nelsif number==prog_num\n return puts \"you win after #{counter} try(s).\"\nend\nend\nend", "def play\n number = rand(10)\n loop do\n guess = gets.chomp.to_i # don't want the new line, need to convert to integer\n break if guess == number\n guess < number ? (puts 'too low') : (puts 'too high')\n end\n puts 'You guessed it!'\nend", "def results(guess)\n if guess == @number\n puts 'Congratulations you guessed the right number!'\n else\n puts \"Correct answer was #{@number}. You ran out of guesses.\"\n end\n end", "def guess_number guess\n number = 25\n if guess == number\n return \"You got it!\"\n elsif guess > number\n return \"Guess was too high!\"\n else\n return \"Guess was too low!\"\n end\nend", "def guess_number guess\n number = 25\n if number == guess\n puts \"You got it!\"\n elsif number > guess\n puts \"Guess was too high!\"\n else number < guess\n puts \"Guess was too low!\"\n end\nend", "def run_guessing_game \n # arguments? I guess we don't need any here\n # this will be our runner\n # communicates with the user\n puts \"Guess a number between 1 and 6.\"\n # rspec specifies 1 to 6 and the text...\n puts \"Or type 'exit' to exit the CLI.\" \n user_guess = gets.strip.to_s\n # assigns a variable to user's input\n # theoretically, we should check for whether it is an integer, but that is outside the scope of the program\n while user_guess != \"exit\" do\n # I tried \"while human_guess.class == Fixnum do\", but that did not work\n # system generates random number between 1 and 6\n # can we use until? that could work I think\n random_number = rand(1..6).to_s # \n # because we don't want 0, so easier to specify a range, than do rand(5)+1 and assign a variable to that\n # .to_s because also includes 'exit' \n # the problem here is that it does not account for entries between 1 and 6, but I guess that is the user's fault\n if user_guess != random_number\n puts \"The computer guessed #{random_number}. \\rTry again!\\n\\n\"\n run_guessing_game\n else \n puts \"You guessed the correct number! \\n\\n\"\n run_guessing_game\n end # ends if statement \n break\n end # ends while loop\n puts \"Goodbye!\" # this happens if the user prompt is 'exit', so this is the opposite of the while condition\nend", "def compare(guess)\n\t#if correct then user wins, end game\n\tif guess == secret_num\n\t\tprint \"great job you got it!!!!!\"\n\t\treturn\n\t#if guess to low ask for another try\n\telsif guess < secret_num\n\t\tprint \"too low try again\"\n\t\tguesses -= 1\n\t\tprint \"you have #{guesses} more attempt(s)\"\n\t#if too high ask for another try\n\telse\n\t\tprint \"too high try again\"\n\t\tguesses -= 1\n\t\tprint \"you have #{guesses} more attempts(s)\"\n\tend\nend", "def check_guess(guess,answer,win)\n\tif win != true #If the player has not won yet\n\t@@answer = \"X\" \n\t\tif @@turns == 0\n\t\t\t@@answer = @@secret_number\n\t\t\t@@secret_number = rand(100)\n\t\t\t@@turns = 5\n\t\t\t@@color = \"white\"\n\t\t\treturn \"GAME OVER!\"\n\t\telsif @@turns != 0\n\t\t\tif guess > 100 or guess < 0\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"Invalid input!\"\n\t\t\telsif (guess - answer).abs <= 5 and (guess - answer).abs != 0\n\t\t\t\t@@turns -= 1\n\t\t\t\t@@color = \"#ff9999\"\n\t\t\t\treturn \"You're very close!\"\n\t\t\telsif (guess - answer).abs == 0\n\t\t\t\twin = true\n\t\t\t\t@@color = \"#b2ffb2\"\n\t\t\t\t@@answer = @@secret_number\n\t\t\t\t@@turns = 5\n\t\t\t\t@@secret_number = rand(100)\n\t\t\t\treturn \"You Won! Congrats.\"\n\t\t\telsif (guess - answer).abs <= 10\n\t\t\t\t@@turns -= 1\n\t\t\t\t@@color = \"#ff7f7f\"\n\t\t\t\treturn \"You're close!\"\n\t\t\telsif (guess - answer).abs <= 15\n\t\t\t\t@@color = \"#ff4c4c\"\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"Not very close!\"\n\t\t\telsif (guess - answer).abs > 15\n\t\t\t\t@@color = \"#ff0000\"\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"You're hopeless!\"\n\t\t\tend\n\t\tend\t\n\telsif win == true\t#If the player won!\n\t\t@@answer = @@secret_number\n\t\t@@secret_number = rand(100)\n\t\t@@turns = 5\n\t\treturn \"You Won!\"\n\tend\nend", "def run_guessing_game\n comp_num = computer_num\n prompt_user\n user_num = user_input\n \n if user_num == comp_num\n puts \"You guessed the correct number!\"\n elsif user_num == \"exit\"\n puts \"Goodbye!\"\n else\n puts \"Sorry! The computer guessed #{comp_num}.\"\n end\n \nend", "def guess_the_number(prog_num)\ncounter=0\nwhile counter < 10\nnumber=user_guessing\ncounter+=1\nif number>prog_num\n if number-(prog_num)>5\n puts \"cooold try no.#{counter}\"\n else\n puts \"hooot try no.#{counter}\"\n end\nelsif number<prog_num\n if (prog_num)-number>5\n puts \"cold try no.#{counter}\"\n else\n puts \"hot try no.#{counter}\"\n end\nelsif number==prog_num\n return puts \"you win after #{counter} try(s).\"\nend\nend\nend", "def guesses_left(number_guesses)\n\tif number_guesses == 0\n\t\tputs \"Sorry, you're out of guesses. Game over!\"\n\telsif number_guesses == 1\n\t\tputs \"You have 1 more guess left. No pressure.\"\n\t\tputs \"What's your last guess?\"\n\t\tguess = gets.to_i\n\t\tok_guess = valid_guess(guess)\n\t\tsecret_number = 7\n\t\tputs game_over(ok_guess, secret_number)\n\telsif number_guesses == 2\n\t\tputs \"You have 2 more guesses left.\"\n\t\tputs \"What is your second guess?\"\n\t\tguess = gets.to_i\n\t\tok_guess = valid_guess(guess)\n\t\tsecret_number = 7 # I shouldn't have to add in secret_number. (Instance variable? Hash as argument?)\n\t\tputs if_correct(ok_guess, number_guesses, secret_number) # Goes back to STEP 5(b) to see if correct\n\tend\nend", "def run_guessing_game\n\tuser_number =\"\"\n\twhile user_number != \"exit\"\n\t\tcom_number = rand(1..6)\n\t\tputs \"Guess a number between 1 and 6.\"\n\t\tuser_number = gets.chomp\n\t\tif com_number == user_number.to_i\n\t\t\tputs \"You guessed the correct number!\"\n\t\telse \n\t\t\tputs \"The computer guessed #{com_number}.\"\n\t\tend\n\tend\n\texit_guessing_cli\nend", "def check_users_number\n tries_left = 3\n @random_number = rand(1..10)\n puts \"Your SECRET NUMBAH has been chosen - guess a numbah between 1 and 10!\"\n until tries_left == 0\n player_guess = gets.strip.to_i\n if player_guess == @random_number\n puts \"OH MY GAWD YOU GUESSED THE SECRET NUMBAH, #{@random_number}! YOU WIN!\"\n @did_they_win = true\n break\n elsif tries_left > 0\n tries_left -=1\n if player_guess > @random_number\n puts \"You guessed too high, silly! You have #{tries_left} guesses before the game is over enter a another number\" if tries_left > 0\n else\n puts \"You guessed too low, silly! You have #{tries_left} guesses before the game is over enter a another number\" if tries_left > 0\n end\n end\n if tries_left == 0\n @did_they_win = false\n print \"You didn't guess it was #{@random_number}. Better luck next time!\"\n end\n end\nend", "def compare_guess(guess)\n\t# if correct, inform they've won\n\tif guess == secret_number\n\t\tputs \"What are you, psychic? That's correct, you win!\"\n\t# if low, reduce remaining guesses and tell them to guess higher, then exit to re-prompt\n\telsif guess < secret_number\n\t\tputs \"That's a little low, try something higher.\"\n\t\tnumber_of_guesses -= 1\n\t\tputs \"You have #{remaining_guesses} guesses remaining.\"\n\tend\n\t# if high, reduce remaining guesses and tell them to guess lower, then exit to re-prompt\n\telse\n\t\tputs \"That's a little high, try something lower.\"\n\t\tnumber_of_guesses -= 1\n\t\tputs \"You have #{remaining_guesses} guesses remaining.\"\n\tend", "def guess_number guess\n number = 25\n puts \"Your guess is too high!\" unless guess < number+1\n puts \"Your guess is too low!\" unless guess > number-1\n puts \"You got it\" unless guess != number\nend", "def run_guessing_game\n gaming = true\n\n\n while gaming do\n random = rand(1..6)\n puts \"Guess a number between 1 and 6.\"\n user = gets.chomp\n\n if user == \"exit\"\n puts \"Goodbye!\"\n playing = false\n break\n\n elsif random == user.to_i\n puts \"You guessed the correct number!\"\n\n else\n puts \"The computer guessed #{random}.\"\n\n end\n end\nend", "def player_game(player)\n until player.guess_count >= @@MAX_GUESS || player.guess == @secret_code\n puts \"You have #{@@MAX_GUESS-player.guess_count} guesses left.\"\n player.ask_for_guess\n guess_result = check_code(player.guess, @secret_code)\n unless guess_result[0] == 4 && guess_result[1] == 4\n display_guess_results(guess_result)\n end\n end\n display_end_game(player)\n end", "def run_guessing_game\n\tguess = \" \"\n\twhile guess != \"exit\" \n\t\tputs \"Guess a number between 1 and 6.\"\n\t\tguess = gets.chomp\n\t\trandom_num = rand(1..6).to_s\n\t\t#binding.pry\n\t\tif guess == random_num\n\t\t\tputs \"You guessed the correct number!\"\t\t\n\t\telse\t\n\t\t\tputs \"The computer guessed #{random_num}.\"\n\t\tend\n\tputs \"Goodbye!\"\nend\nend", "def play_round\n\t\t# Initialize a secret number\n\t\tself.get_secret_number\n\n\t\t# Create a local variable for guesses so that we can pay multiple rounds\n\t\t# Reset self.solved for similar reasons\n\t\tguesses_left = self.guesses\n\t\tself.solved = false\n\n\t\t# Loop through asking the player for a guess and checking it against the secret number\n\t\twhile self.solved != true && guesses_left > 0\n\t\t\t# Get another guess from the player\n\t\t\tputs \"\\nWhat is your guess!?\"\n\t\t\tself.solved = self.is_guess_correct(gets)\n\n\t\t\t# If the player input a number out of range, tell them\n\t\t\tif self.solved == \"Out of range\"\n\t\t\t\t# This mistake does not cost the player a guess\n\t\t\t\tputs \"\\nThe number is between 1 and #{@range}, please guess again\"\n\n\t\t\t# If player's guess is wrong tell them in which direction they were wrong\n\t\t\telsif self.solved == \"high\"\n\t\t\t\tguesses_left -= 1\n\t\t\t\tputs \"\\nYour guess was too high! You have #{guesses_left} guesses left!\"\n\n\t\t\telsif self.solved == \"low\"\n\t\t\t\tguesses_left -= 1\n\t\t\t\tputs \"\\nYour guess was too low! You have #{guesses_left} guesses left!\"\n\t\t\tend\n\n\t\tend\n\n\t\t# See if the player has won or lost\n\t\tif self.solved == true\n\t\t\tself.player_won\n\t\telse\n\t\t\tself.player_lost\n\t\tend\n\n\t\treturn self.play_another_round\n\tend", "def game_play\n self.new_round # Start new round\n loop do\n puts \"Your Guess:\"\n @input = gets.chomp # Gets user input by making a prompt and capturing the input, chomp method removes the new line which would otherwise be stored in the input string\n if @input != \"/\"\n if @@word.legal?(@input)\n if self.check_guess\n puts \"Correct! You got the answer in #{@guess_count} guesses!\" # Use string interpolation instead of concatenating to include guess count\n\n self.new_round\n puts @current_word\n end\n puts \"You have #{MAX_GUESS - @guess_count} guesses remaining.\\n?????\" # Calculations can be made in string interpolation too\n else\n puts \"That guess doesn't count! Your guess can only be 5 characters in length, contain no duplicate letters and only contain letters.\" # Guess isn't a legal word\n end\n self.check_lost # Check if player has exhausted amount of guesses\n else\n exit\n end\n\t\tend\n\tend", "def play\n\t\tputs \"Hello, welcome to my game!\"\n\n\t\tNUMBER_OF_ROUNDS.times do \n\t\t\tround = Round.new\n\t\t\tround.play\n\t\t\tputs \"You made #{round.number_of_guesses} guesses.\"\n\t\t\tadd_guesses(round.number_of_guesses)\n\t\t\tif round.won?\n\t\t\t\t@win_count += 1\n\t\t\tend\n\t\tend\n\t\tputs \"Your average number of guesses is #{average_guesses}.\"\n\t\tputs \"Your total correct guess is #{@win_count}\"\n\t\n\tend", "def knowTheGameTrick\n\tputs \"Do you wanna know the trick of this game?\"\n\tputs \"If YES then type 1 and if NO then type 2.\"\n\tuserAnswer = gets\n\n\tif userAnswer.to_i == 1\n\t\tputs \"This game is designed according to halving technique (can also be called as Binary Search) where you are given only certain chances.\"\n\t\tputs \"Since computer says you whether the guessed number was high or low, you have to always guess the middle number and go on guessing the middle number everytime the range changes.\"\n\telse\n\t\tputs \"I guess, you probably knew the trick of the game. Thanks for playing. Enjoy!\"\n\tend\n\nend", "def guess(number)\n @number = number\n solved? ? :correct : @number > @answer ? :high : :low\n end", "def prompt(guess, answer, tried_again)\n\n\tif guess == answer\n\n\t\t# if a user wins give them the option to play the game again\n\n\t\tputs \"Congratulations! You chose wisely\" \n\t\tputs \"Would you like to play again? Yes or No?\"\n\t\t\ttried_again = false\n\t\t\tanswer_2 = gets.chomp.downcase\n\t\t\tcase answer_2\n\t\t\t\twhen \"yes\" then start_game(tried_again)\n\t\t\t\twhen \"y\" then start_game(tried_again)\n\t\t\t\telse\n\t\t\t\t\treturn true\n\t\t\tend\n\telse\n\n\t\t# tell the user if their guess are 'higher' or 'lower' than the correct number\n\n\t\tif guess > answer \n\t\t\tputs \"You chose too high with #{guess}.\"\n\t\t\tif tried_again == true \n\t\t\t\tanswer_temp(guess, answer)\n\t\t\tend\n\t\telse\n\t\t\tputs \"You chose too low with #{guess}.\"\n\t\t\tif tried_again == true \n\t\t\t\tanswer_temp(guess, answer)\n\t\t\tend\n\t\tend\n\n\t\t# give them the option to play the game again\n\n\t\tputs \"Would you like to try again? Yes or No?\"\n\t\t\ttried_again = true\n\t\t\tanswer_2 = gets.chomp.downcase\n\t\t\tcase answer_2\n\t\t\t\twhen \"yes\" then input(answer, tried_again)\n\t\t\t\twhen \"y\" then input(answer, tried_again)\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\tend\n\tend\n\nend", "def valid_guess(guess) \n\twhile guess < 1 || guess > 10 \n\t\tputs \"Oops! Invalid number. Please guess a number between 1 and 10. What's your guess?\"\n\t\tguess = gets.to_i\n\tend\n\tok_guess = guess\nend", "def run(strategy, game)\n strategy.newGame\n while game.gameStatus == :KEEP_GUESSING\n #puts game\n guess = strategy.nextGuess(game)\n #puts guess\n guess.makeGuess(game)\n end\n puts game\n game.currentScore\nend", "def run_guessing_game\n #guess = nil\n random_number = rand\n puts \"Guess a number between 1 and 6.\"\n while true\n response = gets.chomp\n if response == \"exit\"\n puts \"Goodbye!\"\n return\n end\n guess = response.to_i\n #binding.pry\n if guess == random_number\n puts \"You guessed the correct number!\"\n else\n puts \"The computer guessed #{random_number}.\"\n #binding.pry\n end\n end\nend", "def play\n\n\tsecret_choice = SecretNumber.new\n\tsecret_number = secret_choice.random\n\n\tplayer = Player.new\n\tplayer.name\n\n\n\t#Welcome the player to the game\nputs \"Welcome to the guessing a number game!\"\n\n#Let them know who created the game\nputs \"Do you want to play? (yes/no)\"\n\n\ndecision = false\nwhile decision == false\n\tplay = gets.chomp\nif play.to_s.downcase == \"yes\"\n\tputs \"Awesome\"\n\tdecision = true\nelsif play.to_s.downcase == \"no\"\n\tputs \"please play with me... okay?\"\nelse puts \"answer yes or no please :)\"\nend\nend\n\n\n\nsleep 1\n\n#Ask for the player's name and personally greet them by saying \"hi Player_name!\"\n\n\n#Communicate the rules of the game\nputs \"Here are the rules of the game\"\nsleep 0.75\nputs \"I am thinking of a number between 1 and 10.\"\nsleep 0.75\nputs \"You have three tries to guess the secret number.\"\nsleep 0.75\nputs \"If you fail 3 times...\"\nsleep 0.75\nputs \"you lose and I win\"\nsleep 0.75\n\n#for fun, ask then if they are ready to play\nputs \"Are you ready to play the game?\"\ndecision = false\nwhile decision == false\n\tplay = gets.chomp\nif play.to_s.downcase == \"yes\"\n\tputs \"Awesome\"\n\tdecision = true\nelsif play.to_s.downcase == \"no\"\n\tputs \"please play with me... okay?\"\nelse puts \"answer yes or no please :)\"\nend\nend\n\n#Ask the user for their guess\n#Verify if their guess is correct, if it is corrrect, congratulate them and end the game\n#Let the player know how many guesses they have left\n#If the player does not guess the answer in 3 tries let them know they lost and tell them the number\n\nguessNumber = 3\nwhile guessNumber > 0 \n\tputs \"What do you think the secret number is?\"\n\tguess = gets.chomp\nif secret_number == guess.to_i\n\tputs \"OMG, you won!! \"+secret_number.to_s+\" was totally my number!! Nice Job\"\n\tsleep 0.5\n\tputs \"Game Over\"\n\tbreak\nelsif secret_number != guess.to_i\n\tputs \"I'm sorry, but you did not guess correctly\"\n\tguessNumber -= 1\n\t\tif guessNumber > 1\n\t\tputs \"You have \"+guessNumber.to_s+\" more guesses left...\"\n\t\telse puts \"You have \"+guessNumber.to_s+\" more guess left...\"\n\t\tend\n\tend\nend\n\nif guessNumber.to_i < 1\n\tputs \"Oh, jeez... it looks like you have lost\"\n\tsleep 0.5\n\tputs \"The secret number was \"+secret_number.to_s\n\tputs \"Game Over\"\nend\t\n\n\n\n\n\nend", "def guess_number(game, guess_num)\n if @length == guess_num.to_i\n puts \"Thanks for playing! You have used all your guesses.\"\n if @blanks == @word_array\n puts \"Good Job! You Win!\"\n puts \"The word was: #{@word}\"\n else @blanks != @word_array\n puts \"Not sorry to rub it in.. You Lose!\"\n puts \"The word was: #{@word}\"\n end\n return false\n else\n puts \"You have used #{guess_num} out of #{@length} guesses.\"\n return true\n end\n\n end", "def run_guessing_game\n\n player_guess = ''\n\n until player_guess == 'exit'\n welcome\n player_guess = get_player_guess\n check_guess(player_guess)\n end\nend", "def guess(input)\n @last_guess = input\n compare(input)\n @turns += 1\n end", "def guess(input)\n @last_guess = input\n compare(input)\n @turns += 1\n end", "def game(guess)\n case\n when guess < 0\n puts \"#{guess} is not a positive number.\"\n when guess <= 50\n puts \"#{guess} is between 0 and 50.\"\n when guess <= 100\n puts \"#{guess} is between 51 and 100.\"\n else\n puts \"#{guess} is over 100.\"\n end\nend", "def guess_the_number(guess, num)\n if guess == num\n puts \"that's the number!\"\n else\n puts \"not the same number\"\n end\nend", "def if_correct(ok_guess, number_guesses, secret_number) \n\tnumber_guesses = number_guesses - 1\t# STEP 6 - Subtracts one of the player's guesses\n\t\tif ok_guess == secret_number\n\t\t\tputs \"Congratulations! You got it right! You win!!!\"\n\t\telsif ok_guess < secret_number \n\t\t\tputs \"Good try, but guess a little higher.\"\n\t\t\tputs guesses_left(number_guesses) # STEP 7 - Tells the player how many guesses s/he has left\n\t\telse ok_guess > secret_number\n\t\t\tputs \"Good try, but guess a little lower.\"\n\t\t\tputs guesses_left(number_guesses) # STEP 7 - Tells the player how many guesses s/he has left\n\t\tend\nend", "def play\n 10.times do |i|\n \n# i is the chance number\n puts \"This is chance #{i+1} of 10\"\n \n# current guess is what player typed in\n current_guess = @player.guess_code\n \n# standing is based on method evaluate guess with paramater current guess from above\n standing = evaluate_guess(current_guess)\n \n# if correct for all 4\n if standing[:exact].length == 4\n# display to user\n puts \"You won!\"\n return\n else\n puts \"#{standing[:exact].length} Exact Matches\"\n puts \"#{standing[:near].length} Near Matches\"\n end\n end\n \n# if reached end of loop, that means guesses out & not all perfectly matched\n\n # If we make it this far, we have used up \n # all of our turns and lost.\n puts \"You lost!\"\n return\n end", "def guess_number_3\n tries = 1\n random_number = rand(10) # rand gives a random number between 0 and x-1\n puts \"Guess a number, any number!\"\n answer = gets.chomp.to_i\n while answer != random_number\n puts \"Please guess again. You have had #{tries} tries so far.\"\n tries += 1\n answer = gets.chomp.to_i\n end\n puts \"You guessed correctly! The random number is #{random_number}.\"\n puts \"It took you #{tries} tries to guess the number correctly.\"\nend", "def game (your_number)\nnumber = [0,1,2,3,4,5,6,7,8,9].sample\nif number == your_number \n\tp \"you win\" \nelsif number < your_number\n\tp \"too high\"\nelsif number > your_number\n\tp \"too low\"\n\n\tend\nend", "def check_guess (guess, secret_number, num_guesses)\n if guess == secret_number\n puts \"You WIN! It was #{guess}!\"\n exit\n elsif num_guesses == 3\n puts \"You LOSE! The secret number was #{secret_number}.\"\n puts \"Sucker.\"\n elsif guess > secret_number\n puts \"The secret number is LOWER than #{guess}.\"\n else\n puts \"The secret number is HIGHER than #{guess}.\"\n end\nend", "def guessing_game\n\n if @comp == @ans\n puts \"#{@comp} is equal to #{@ans}. Congrats!\"\n\n else\n while @comp != @ans do\n puts \"#{@comp} - Is my guess high or low.\"\n hint = gets.chomp.downcase\n\n if hint == \"high\"\n @comp = rand(1...@comp)\n guessing_game\n\n elsif hint == \"low\"\n @comp = rand(@comp..25)\n guessing_game\n end\n end\n end\n \nend", "def guess_number_1\n random_number = rand(10) # rand gives a random number between 0 and x-1\n puts \"Guess a number, any number!\"\n answer = gets.chomp.to_i\n if answer == random_number\n puts \"You guessed right, the number is #{random_number}.\"\n else\n puts \"Unfortunately, that's not quite right. The number is #{random_number}.\"\n end\nend", "def guess_number_2\n random_number = rand(10) # rand gives a random number between 0 and x-1\n puts \"Guess a number, any number!\"\n answer = gets.chomp.to_i\n while answer != random_number\n puts \"Please guess again\"\n answer = gets.chomp.to_i\n end\n puts \"You guessed correctly! The random number is #{random_number}.\"\nend", "def game_guess\n if path == \"/game\" && verb == \"POST\"\n number = client.read\n game.guess(number)\n redirect(client)\n end\n end", "def guess(msg, num)\n num = num.to_i\n if @started\n @tries += 1\n if @tries > 5\n msg.reply(\"Sorry, you have tried the maximum number of times. The random number was #{@random_number}\")\n @started = false\n @tries = 0\n return\n end\n\n if @random_number == num\n msg.reply(\"Correct! You win a shitty cookie! It took you #{@tries} tries!\")\n @started = false\n @tries = 0\n return\n end\n\n measure = @random_number / 5\n measures = [\n measure,\n measure * 2,\n measure * 3,\n measure * 4,\n measure * 5\n ]\n\n diff = num - @random_number\n diff = diff.abs\n\n if @tries == 1\n if num.between?(measures[4], @random_number + measures[4])\n msg.reply('You are on fire!'.freeze)\n elsif num.between?(measures[3], @random_number + measures[3])\n msg.reply('You are warm.'.freeze)\n elsif num.between?(measures[2], @random_number + measures[2])\n msg.reply('You are pretty neutral.'.freeze)\n elsif num.between?(measures[1], @random_number + measures[1])\n msg.reply('You are cold.'.freeze)\n elsif num.between?(measures[0], @random_number + measures[0])\n msg.reply('You are fucking freezing!'.freeze)\n end\n elsif diff < @previous_difference\n msg.reply('You are warmer.'.freeze)\n else\n msg.reply('You are colder.'.freeze)\n end\n\n @previous_difference = diff\n else\n msg.reply('You must start the game first.'.freeze)\n end\n end", "def play_game\n\t\twhile @turn < 13\n\t\t\tputs \"Lets see if you figured out my code!\"\n\t\t\tputs \"Please select four colors as your guess. They can either mix and match or all be the same\"\n\t\t\tputs \"No spaces please!\"\n\t\t\tputs \"Your choices are 'R', 'G', 'B', 'Y', 'H', 'P'.\"\n\t\t\tguess = gets.chomp.upcase\n\t\t\tfeedback = compare(guess)\n\t\t\tif feedback == [\"O\", \"O\", \"O\", \"O\"]\n\t\t\t\tputs \"~~~~~~~~~~~\"\n\t\t\t\tputs \"You won!!!!\"\n\t\t\t\tputs \"~~~~~~~~~~~\"\n\t\t\t\tputs \"You have cracked the code of #{@master_code}\"\n\t\t\t\texit\n\t\t\telse\n\t\t\t\tputs \"Sorry! Guess again\"\n\t\t\t\tputs \"Here is currently what you have right #{feedback}\"\n\t\t\t\tputs \"---------------\"\n\t\t\t\tputs \"---------------\"\n\t\t\t\t@turn += 1\n\t\t\t\tputs \"That was turn number \" + @turn.to_s\n\t\t\t\tplay_game\n\t\t\tend\n\t\t\tputs \"You reached your max of 12 turns....game over!\"\n\t\tend\n\tend", "def guess_number_4\n tries = 1\n random_number = rand(10) # rand gives a random number between 0 and x-1\n puts \"Guess a number, any number!\"\n answer = gets.chomp.to_i\n while answer != random_number\n if answer > random_number\n location = \"lower\"\n else\n location = \"greater\"\n end\n puts \"Please guess again. You have had #{tries} tries so far. The random number is\n #{location} than the number you have just guessed.\" \n tries += 1\n answer = gets.chomp.to_i\n end\n puts \"You guessed correctly! The random number is #{random_number}.\"\n puts \"It took you #{tries} tries to guess the number correctly.\"\nend", "def play\n over = false\n\n until over\n display_score\n @board.render\n @guesses = []\n prompt\n if same_card?(@guesses[0], @guesses[1])\n puts \"you got it! Go again!\"\n @guesses[0].reveal_card\n @guesses[1].reveal_card\n @score[current_player] += 1\n else\n @guesses[0].hide\n @guesses[1].hide\n puts \"you suck! Go #{previous_player} is up.\"\n next_player!\n end\n\n\n over = true if board.won?\n end\n end", "def guess(guess)\n if guess.is_a?(Integer)\n @guess = guess\n else\n raise ArgumentError.new(\"You must provide an integer\") \n end\n @solved = false\n if @guess > @answer\n puts \"Your guess is high. Is it solved? #{@solved}\"\n return :high\n elsif @guess == @answer\n # Changed the instance variable if it is true\n @solved = true\n puts \"Your guess is correct. Is it solved? #{@solved}\" \n return :correct\n else\n print \"Your guess is low. Is it solved? #{@solved}\" \n return :low\n end \n end", "def guess(guess,event)\n case @status\n when :new, :finished\n 'You need to start a game first: `!rfk start`'\n when :running\n if guess == @kitten\n # We currently get a warning trying to send a message and add a reaction\n # [WARN : ct-3 @ 2018-02-26 17:49:52.182] Locking RL mutex (key: [:channels_cid_messages_mid_reactions_emoji_me, 417679731291324417]) for 1.0 seconds preemptively\n #event.message.react('😸') # Smiley Cat\n @status=:finished\n \"#{event.message.author.mention} Woo you found kitten\"\n elsif @guesses.include?(guess)\n \"#{event.message.author.mention} someone already guessed `#{guess}`, the kitten doesn't move during a game\"\n else\n @guesses << guess\n \"#{event.message.author.mention} You found `#{@nki[guess]}` but that's not a kitten!\"\n end\n else\n puts \"We got a guess of #{guess} but not in a known state of #{@state}\"\n \"Wibble not sure what's happening here\"\n end\n end", "def guess_number_1\n random_number = rand(100) # rand gives random number between 0 and x-1\n puts \"Guess a number any number\"\nend", "def guess(guess)\r\n\t\t# Make sure the guess is either a letter or the whole word\r\n\t\tif guess.length != 1 && guess.length != @win_word.length\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp \"Guess a letter, or the complete word!\"\r\n\t\t# check for repeated guesses\r\n\t\telsif @past_guesses.include? guess\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"You guessed that already!\"\r\n\t\t# check if they guessed the entire word correctly\r\n\t\telsif guess == @win_word\r\n\t\t\twin\r\n\t\t# if the letter is not in the word\r\n\t\telsif !@win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tif @remaining_guesses == 1\r\n\t\t\t\tlose\r\n\t\t\telse\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tp @hint\r\n\t\t\tp \"Sorry, try again!\"\r\n\t\t\tend\r\n\t\t# if the letter is in the word\r\n\t\telsif @win_word.include? guess\r\n\t\t\t# Add guess to arrayof past guesses\r\n\t\t\t@past_guesses << guess\r\n\t\t\tguesses_remaining\r\n\t\t\tp @remaining_guesses.to_s + \" guesses left\"\r\n\t\t\tupdate_hint(guess)\r\n\t\t\tif @hint_str == @win_word\r\n\t\t\t\twin\r\n\t\t\telse\r\n\t\t\t\tp \"Nice guess!\"\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tp \"Error\"\r\n\t\tend\r\n\r\n\tend", "def guess_number_2\n random_number = rand(100) # rand gives random number between 0 and x-1\n puts \"Guess a number any number\"\nend", "def game_play\n until game_over\n graphic\n guess\n end\n end", "def bad_guess(i,guess,secret_number,name,bad_counter,tries)\n\tleft = tries-i\n \tcase \n \twhen bad_counter==0\n \t\tputs \"Come on. WAKE UP #{name}. Type in a number. Now you have #{left} tries left. You are making it easy for me!\"\n \twhen bad_counter==1\n \t\tputs \"Really? Try again #{name}. Type in a NUMBER not a word! You have #{left} tries left.\"\n \twhen bad_counter==2\n \t\tputs \"How many times do I need to tell you to type in a number. You might as well stop playing. You have #{left} tries left.\"\n \twhen left == 0\n \t\tputs \"Game Over #{name}. The number is #{secret_number}. You lost.\"\n \t\tabort(\"Thank you for playing!\")\n #break\n \telse\n \t\tputs \"I am ignoring your input. You have #{left} tries left.\"\n \tend\n\n\nend", "def play\n display_welcome_message\n loop do\n number_of_games = 0\n loop do\n computer.choose(@human)\n human.choose\n display_moves\n increment_game_count\n puts\n display_winner\n display_score\n update_win_history\n number_of_games += 1\n puts\n break if first_to_score?(10)\n end\n display_final_outcome\n reset_game\n break unless play_again?\n end\n display_goodbye_message\n end", "def gameplay\n \n game_setup # Calls the game_setup method\n human = true # declare a boolean variable\n \n # whan human score and computer score are both less than the target score given by the user than enter the loop\n while human_score.to_i < target_score.to_i && computer_score.to_i < target_score.to_i\n \n # Conditional statment to check if it's human or computer's turn\n if human == true\n # Human's turn\n puts \"It is now #{name}\\'s turn\", \"\"\n puts \"Whoever gets to #{target_score} wins\" \n human_turn # Calls the human turn method \n human = false # After human turn ends set the human turn boolean value to false \n else \n # Computer's turn\n puts \"It is now the computer\\'s turn \\n\"\n puts \"Whoever gets to #{target_score} wins\"\n computer_turn # Calls the computer turn method \n human = true # Set human boolean value to true \n end\n\n # Output score\n puts \"Current Scores: \"\n puts \"\\t#{name}: #{human_score}\"\n puts \"\\tComputer: #{computer_score}\"\n end\n\n # Announce Winner\n puts \"We have a winner\"\n \n end", "def play\n puts \"Let's play 'Bulls and Cows'! (if you are stuck enter 'resign' or 'quit')\"\n loop do \n prompt()\n @user_try = gets.chomp()\n if @user_try == 'resign'\n @result = :resign\n puts \"Number was #{@guess_num.join}\"\n break\n end\n if @user_try == 'quit'\n @result = :quit\n puts \"Number was #{@guess_num.join}\"\n break\n end\n @result = test() if correct?\n end\n return @result\n end", "def input\n\n\tanswer = rand(10) + 1\n\n\tputs \"\\n\\nGuess a number between 1 and 100 correctly.\"\n\tguess = gets.chomp.to_i\n\n\tif guess < 101 && guess > 0 \n\t\tprompt(guess, answer)\n\telse\n\t\tputs \"The cowboy with wise old eyes sighs.. you lost your chance for free admission.\" \n\t\treturn false\n\tend\n\nend", "def run_guessing_game\n \n random_num = rand(6) + 1\n guess_num_between_1_6 = \"\"\n user_input = \"exit\" \nend", "def input(answer, tried_again)\n\n\tputs \"\\nGuess a number between 1 and 100 correctly.\"\n\tguess = gets.chomp.to_i\n\n\tif guess < 101 && guess > 0 \n\t\tprompt(guess, answer, tried_again)\n\telse\n\t\tputs \"The cowboy with wise old eyes sighs.. you lost your chance for free admission.\" \n\t\treturn false\n\tend\n\n\nend", "def wrong_guess(i,guess,secret_number,name,tries)\n\tleft = tries - i\n case\n when i==1\n \tputs \"You wish it was #{guess} but it is not. You have #{left} tries left. Make another guess.\"\n \tif guess>secret_number\n \t puts \"\\nLet me give you a hint. Your guess is too high.\"\n \telse\n puts \"\\nLet me give you a hint. Your guess is too low.\"\n\tend \n when i==2\n \tputs \"Wrong again! You have #{left} tries left! Make another guess.\"\n \tif guess>secret_number\n \t puts \"\\nLet me give you a hint. Your guess is too high.\"\n \telse\n puts \"\\nLet me give you a hint. Your guess is too low.\"\n\tend \n when i==tries\n \tputs \"You ran out of luck and squandered all your chances! Game Over #{name}! The number is #{secret_number}.\"\n \tabort(\"Thank you for playing!\")\n else\n \tputs \"Still wrong. You have #{left} tries left.\"\n \tif guess>secret_number\n \t puts \"\\nLet me give you a hint. Your guess is too high.\"\n \telse\n puts \"\\nLet me give you a hint. Your guess is too low.\"\n\tend \n end\nend", "def play\n reset\n loop do\n break if @guesses == 0 || @win == true\n status_message\n enter_number\n evaluation_message\n end\n lose_message if @guesses == 0 && @win == false\n end", "def play\n #keep running this loop till game over. could also do while both lives > 0 instead of definding game over\n until game_over do\n \n next_round\n \n # setting current player\n current_player = @players[0]\n \n # player is asked question via chomps\n new_question = Question.new\n puts \"#{current_player.name}: What does #{new_question.num_1} plus #{new_question.num_2} equal?\"\n answer = $stdin.gets.chomp.to_i\n if answer == new_question.answer\n puts \"#{current_player.name}: YES! You are correct.\"\n else \n puts \"#{current_player.name}: Seriously? No!\"\n current_player.hp_loss\n end\n \n # show game status\n current_hp\n\n #could add sleep (sleep 1) to add wait time between rounds\n\n end\n # show winner once above until loop is done\n display_winner\n\n end", "def check_guess (guess, answer)\n if guess == answer\n puts 'Correct!'\n return true\n elsif guess < answer\n puts 'Guess higher!'\n return false\n elsif guess > answer\n puts 'Guess lower!'\n return false\n end\nend", "def run_guessing_game\n picked_number = rand(6) +1 \n \n puts \"Guess my number. It is a number between 1 and 6\"\n input = gets.chomp\n\n if(input == 'exit')\n puts \"Goodbye!\"\n elsif (input.to_i == picked_number)\n puts \"You guessed the correct number!\"\n else \n puts \"Sorry! The computer guessed #{picked_number}.\"\n end\nend", "def guess(guesses)\n\n total_guesses = 0\n guesses_array = []\n guessed_correctly = false\n\n while (total_guesses < guesses && guessed_correctly==false)\n\n break if !increment_operator\n equation = create_equation\n\n result = evaluate_equation(equation)\n stringresult = guessed_string(equation, result, @expected_result)\n\n guesses_array.push(stringresult)\n guessed_correctly=true if result == @expected_result\n total_guesses += 1\n\n end\n\n guesses_array.each do |a|\n p a\n end\n\n \"Guesses: #{total_guesses} Best Guess: #{best_guess(guesses_array)}\"\n end", "def run_guessing_game\n random_number = rand(6)+1\n user_input = gets.chomp\n\n if(user_input == 'exit')\n puts \"Goodbye!\"\n elsif(user_input.to_i == random_number)\n puts \"You guessed the correct number!\"\n else\n puts \"Sorry! The computer guessed #{random_number}.\"\n end\nend", "def guess(guess)\n \t@guess = guess\n \treturn :correct if solved?\n \t@guess > @answer ? :high : :low\n end", "def eval_num(secret_num, guess, tries)\n\tif guess == secret_num\n\t\tcongrats(secret_num, tries)\n\telsif tries >= 3\n\t\tputs \"\\nSorry that was your last try. Better luck next time!\"\n\telse\n\t\tif guess > 10\n\t\t\tputs \"\\nWhoa whoa whoa.. your guess is way too large! Remember it's a number from 1-10.\"\n\t\telsif guess < 1\n\t\t\tputs \"\\nOkay.. let me jog your memory.. Remember it's a number from 1-10.\"\n\t\telse\n\t\t\tif guess > secret_num\n\t\t\t\tputs \"\\nA little lower.. Almost there.\"\n\t\t\telsif guess < secret_num\n\t\t\t\tputs \"\\nA little higher.. You got this.\"\n\t\t\tend\n\t\tend\n\t\ttry_again(secret_num, tries)\n\tend\nend", "def run_guessing_game\n puts \"Guess a number between 1 and 6:\"\n answer = gets.chomp\n #debugger\n rand_number = rand(1..6)\n\n if answer == 'exit'\n exit\n elsif answer.to_i == rand_number\n puts \"You guessed the correct number!\"\n run_guessing_game\n else\n puts \"The computer guessed #{rand_number}.\"\n run_guessing_game\n end\n\nend", "def game()\n $match_index_arr = []\n $guessed = []\n $turns = 10\n $index = 0\n $end_game = false\n\n get_word()\n puts $hangman[$index]\n show_word()\n loop do \n get_letter()\n letter_match()\n no_match()\n puts $hangman[$index]\n remaining_guesses()\n dash_to_letter()\n puts \"\"\n show_word()\n puts \"\"\n guessed_wrong_letter()\n game_over()\n if $end_game\n break\n end\n check_guess_count()\n end\n return\n end" ]
[ "0.830622", "0.8221844", "0.8044226", "0.8008212", "0.7981089", "0.7833231", "0.7823104", "0.7723602", "0.7723475", "0.7697836", "0.7669743", "0.7581475", "0.7558235", "0.75367606", "0.7511483", "0.750588", "0.748702", "0.7436092", "0.7408859", "0.7381138", "0.7375729", "0.7335075", "0.728113", "0.72629225", "0.72310114", "0.7188271", "0.7183142", "0.7136006", "0.7135497", "0.7132506", "0.70995945", "0.70762146", "0.70751125", "0.7064056", "0.7044601", "0.7017184", "0.7002757", "0.69992125", "0.6997422", "0.69866145", "0.69755274", "0.69684184", "0.69678944", "0.6965565", "0.6957924", "0.69530934", "0.69426185", "0.6917862", "0.6912354", "0.6909545", "0.68813455", "0.6850846", "0.68473816", "0.6831122", "0.67998606", "0.67987055", "0.67959553", "0.67951393", "0.67939633", "0.6783291", "0.6783291", "0.6774929", "0.6762921", "0.6751795", "0.67488146", "0.67353636", "0.6729974", "0.67105246", "0.67051107", "0.668185", "0.66816705", "0.66809756", "0.66763765", "0.6669157", "0.6668804", "0.66551363", "0.6648464", "0.6638097", "0.66339767", "0.66274244", "0.66252136", "0.66128635", "0.66091996", "0.6605885", "0.658928", "0.65752965", "0.65719634", "0.6571559", "0.6569004", "0.65677655", "0.65633035", "0.65600014", "0.6543912", "0.652935", "0.65209866", "0.6520548", "0.6520444", "0.65201706", "0.6509079", "0.6502471" ]
0.7762621
7
Returns a redirect reason or nil, if no redirect should be made
def redirect_reason(community:, host:, no_communities:, app_domain:) community = Maybe(community).map { |c| DataTypes.create_community(c) }.or_else(nil) if no_communities :no_marketplaces elsif community.nil? && !no_communities :not_found elsif community && community[:deleted] :deleted elsif community && community[:hold] :hold elsif community && community[:closed] :closed elsif community && community[:domain].present? && community[:use_domain] && host != community[:domain] :use_domain elsif community && community[:domain].present? && !community[:use_domain] && host == community[:domain] :use_ident elsif community && host == "www.#{community[:ident]}.#{app_domain}" :www_ident end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end", "def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end", "def redirect?; end", "def redirection(url = nil)\n url ||= @uri.to_s\n response = Browser.get(url)\n\n if response.code == 301 || response.code == 302\n redirection = response.headers_hash['location']\n\n # Let's check if there is a redirection in the redirection\n if (other_redirection = redirection(redirection))\n redirection = other_redirection\n end\n end\n\n redirection\n end", "def check_redirect\n url = \"http://autodiscover.#{@domain}/autodiscover/autodiscover.svc\"\n begin\n res = HTTPClient.head(url)\n rescue\n return nil\n end\n return nil unless res.status_code == 302\n @redirect = res.header[\"Location\"][0]\n end", "def redirect\n if !params[:redirect].blank? && redirection = Redirect.find_by_redirect_url(params[:redirect])\n query_string = URI.parse(request.url).query rescue nil\n redirect = query_string.blank? ? redirection.url : \"#{redirection.url}?#{query_string}\"\n redirect_to redirect\n elsif params[:redirect].blank?\n Rails.logger.warn \"Redirect with no parameter requested.\"\n head :status => 404\n else\n Rails.logger.warn \"Unknown redirection requested: #{params[:redirect]}\"\n head :status => 404\n end\n end", "def redirect?\n\t\t\thttp_response = Net::HTTP.get_response(URI.parse(@page[:url]))\n\t\t\thttp_response == Net::HTTPRedirection\n\t\trescue Net::HTTPBadResponse\n\t\t\t# Dont do anything, as it is supposed to be raised.\n\t\tend", "def redirect?\n (300..307).include?(code)\n end", "def redirected?\n raise @invalid_uri_error if invalid_uri_error?\n raise @fetch_error if fetch_error?\n @redirect_log.size > 1\n end", "def redirect?\n (300..307).include?(@code)\n end", "def redirected?\n !!headers[\"Location\"]\n end", "def redirect where, opts={}\n where = current.request.env['HTTP_REFERER'].or('/') if where == :back\n where = \"#{current.request.path}#{where}\" if where[0,1] == '?'\n where = current.host + where unless where.include?('://')\n\n # local redirect\n if where.include?(current.host)\n redirect_var = Lux.config.redirect_var || :_r\n\n url = Url.new where\n url[redirect_var] = current.request.params[redirect_var].to_i + 1\n\n where =\n if opts.delete(:silent)\n url.delete redirect_var\n url.to_s\n else\n url[redirect_var] > 3 ? '/' : url.to_s\n end\n end\n\n @status = opts.delete(:status) || 302\n opts.map { |k,v| flash.send(k, v) }\n\n @body = %[redirecting to #{where}\\n\\n#{opts.values.join(\"\\n\")}]\n\n @headers['location'] = where\n @headers['access-control-expose-headers'] ||= 'Location'\n\n throw :done\n end", "def redirect_back(redirect_opts = nil)\n redirect_opts ||= {:controller => :errata}\n request.env[\"HTTP_REFERER\"] ? redirect_to(request.env[\"HTTP_REFERER\"]) : redirect_to(redirect_opts)\n end", "def redirect_url\n @data[:redirect_url]\n end", "def redirect_url\n @data[:redirect_url]\n end", "def redirect?\n # redirects are 3xx\n return @status >= 300 && @status < 400\n end", "def http_redirect?(code)\n http_status?(:redirect, code)\n end", "def is_redirect?\n @code.in? REDIRECT_RESPONSE_CODES\n end", "def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend", "def redirect?\n 300 <= code && code < 400\n end", "def follow_redirect?; end", "def redirection?\n (300...400).include?(@status_code)\n end", "def redirect_uri\n @payload.present? ? @payload['redirect'] : @redirect_uri\n end", "def redirection?\n (300..399).cover?(code)\n end", "def check_for_redirection\n begin\n response = Net::HTTP.get_response(self.thumbnail_url)\n rescue\n return :abort\n end\n if '302' == response.code\n self.thumbnail_url = response['location']\n end\n end", "def negative_failure_message\n \"expected#{inspect_target} not to redirect\"\n end", "def failure_message\n \"expected#{inspect_target} to redirect\"\n end", "def redirect_url; end", "def redirect_ok; end", "def redirect_ok; end", "def redirect?\n @response.is_a? Net::HTTPRedirection\n end", "def http_redirect?\n @get_resp.kind_of?(Net::HTTPRedirection)\n end", "def http_redirect?\n @get_resp.kind_of?(Net::HTTPRedirection)\n end", "def actual_uri\n redirects_to or uri\n end", "def get_location_or_redirect(options = {})\n redirect_to(options) if get_location() == nil\n end", "def redirected?\r\n @Out.redirected?\r\n end", "def redirect\n if @short.nil?\n redirect_to \"/\"\n else\n # raise\n @plain_url = Short.decrypt(@short)\n redirect_to @plain_url\n end\n end", "def redirect?()\n txt = this.get\n if (txt =~ /#REDIRECT\\s+\\[\\[(.*)\\]\\]/)\n return $1\n else\n return false\n end\n end", "def getRedirectUrl\n raise ArgumentError, \"Response body doesnot exist\" if @_responseBody.nil? || @_responseBody.empty?\n resObj = toObject\n return false if resObj.redirect_url.nil? || resObj.redirect_url.empty?\n resObj.redirect_url\n end", "def redirects; end", "def is_unsuccesful?\n is_error? || is_redirect?\n end", "def rescue_redirect(exception)\n redirect_to exception.url\n end", "def redirect_to_not_found\n if Petit.configuration.not_found_destination\n redirect Petit.configuration.not_found_destination, 303\n else\n return_not_found\n end\n end", "def do_fallback action\n do_redirect fallback_path\n end", "def redirect(location, status = '302'); request.redirect(location, status); end", "def redirect_to\n return @redirect_to\n end", "def redirect_url\n @redirect_url ||= pxpay_request.url rescue add_gateway_error\n end", "def redirect_url (response)\r\n\tif response.nil?\r\n\t\treturn\r\n\tend\r\n\tif response == ''\r\n\t\treturn\r\n\tend\r\n if response['location'].nil?\r\n response.body.match(/<a href=\\\"([^>]+)\\\">/i)[1]\r\n else\r\n response['location']\r\n end\r\n end", "def redirects_to_page\n nil\n end", "def redirects_to_page\n nil\n end", "def redirect(uri)\n [ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',\n 'Location' => uri},\n [] ]\n end", "def ensure_redirect response, url_matcher\n expect(response.code).to eq('301').or eq('302')\n expect(response.header['location']).to match url_matcher\n # href = document(response.body).css('a').attr('href').value\n # expect(href).to match url_matcher\n response.header['location']\n end", "def redirect_ok=(_arg0); end", "def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end", "def assert_redirect(res, location)\n assert_in_array [\"301\", \"302\", \"303\", \"307\"], res.code\n assert_header res, \"Location\", location\n end", "def redirect?\n (300..399).include?(@code)\n end", "def redirect?\n (300..399).include?(@code)\n end", "def redirect?\n (300..399).include?(@code)\n end", "def http_temporary_redirect?(code)\n http_status?(:temp_redirect, code)\n end", "def follow_redirect\n get extract_redirection_url\n end", "def be_redirected\n BeRedirected.new\nend", "def is_permanent_redirect?\n @code == 301\n end", "def filter_redirect; end", "def filter_redirect; end", "def redirect_to options = {}\n @has_redirect = options\n end", "def sanitize_redirect_url\n referer = params[:referer].blank? ? request.referer : params[:referer]\n\n if referer && (referer =~ %r|^https?://#{request.host}#{root_path}| ||\n referer =~ %r|^https?://#{request.host}:#{request.port}#{root_path}|)\n #self-referencing absolute url, make it relative\n referer.sub!(%r|^https?://#{request.host}(:#{request.port})?|, '')\n elsif referer && referer =~ %r|^(\\w+:)?//|\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use third party url for post login redirect: #{referer}\")\n referer = nil\n end\n\n if referer && referer_blacklist.any? {|blacklisted| referer.starts_with?(blacklisted) }\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use a blacklisted url for post login redirect: #{referer}\")\n referer = nil\n elsif referer && referer[0,1] != '/'\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use partial path for post login redirect: #{referer}\")\n referer = nil\n end\n\n return referer || root_path\n end", "def redirect_ok\n @agent.redirect_ok\n end", "def is_redirection?\n code.to_i >= 300 && code.to_i <= 399\n end", "def get_redirection_url (site)\n\t\tputs \"getter to retrieve the redirection URL from the site store.\" if @verbose\n\t\tsite=site.strip.downcase\n\t\tif @known_sites.key?(site)\n\t\t\treturn @known_sites[site]['redirection']\n\t\telse\n\t\t\tputs \"Unknown site: #{site}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn nil\n\tend", "def redirect_url\n @_redirect_url ||= public_child_redirect_url || controller_and_action_url ||\n nil\n end", "def redirect!(url, opts = {})\n self.headers[\"Location\"] = url\n self.status = opts[:permanent] ? 301 : 302\n self.status = opts[:status] if opts[:status]\n self.body = opts[:message] || \"<div>You are being redirected to <a href='#{url}'>#{url}</a></div>\"\n halt!\n return true\n end", "def redirect_403\n return hit_error(403) unless current_user\n end", "def redirect?\n @status.between?(300, 399) if @status\n end", "def redirect\n # Does it exist?\n if url = Redirect.find_by_short_url(params[:id])\n # # Increment count\n # url.update_attributes(count: url.count + 1)\n # Add redirect to history\n RedirectHistory.create(redirect_id: url.id, notes: \"params: #{params}\")\n # Redirect\n redirect_to url.full_url\n else\n redirect_to redirects_path\n end\n end", "def redirection\n short = params[\"short\"]\n\n if short.nil?\n redirect_to root_url\n else\n link = Link.find_by(shortened: short)\n\n if link.nil?\n redirect_to root_url\n else\n redirect_to link.destination\n end\n end\n end", "def get_redirect_code(url)\n passed = true\n bad_codes = [204,206,400,404,408,500,501,502,503,504,505]\n\n\n\n counter = 0\n possible_redirect = []\n code = nil\n\n # Collect codes\n while code != 200 && bad_codes.include?(code) == false do\n possible_redirect << @entries[counter].response.status\n \n puts @entries[counter].response.status\n code = @entries[counter].response.status\n counter = counter + 1\n end\n\n # 301 Wrong Scenario test\n if(@url.include? \"maxRedirect=true\")\n if(possible_redirect.include?(301))\n # begin\n # campaign = @browser.evaluate_script(\"omnCampaignID\")\n # rescue\n # campaign = @browser.evaluate_script(\"app.omniMap.CampaignID\")\n # end\n\n # if campaign.downcase.include?(\"core\") == false\n passed == false\n # end\n end\n end\n\n possible_redirect.each do |code_to_check|\n if bad_codes.include?(code_to_check)\n passed == false\n end\n end\n\n\n return {result: passed, codes: possible_redirect}\n end", "def redirect_if(condition=true, error_msg='Error!', redirect_url=nil)\n return false if !condition || redirect_url.nil?\n flash[:error] = error_msg\n redirect_to redirect_url\n true\n end", "def redirect_target\n if defined?(@redirect_target)\n @redirect_target\n else\n results = Article.find_by_sql([\"select articles.* from articles, redirects where redirects.redirect_source_repository_id = ? and redirects.redirect_source_local_id = ? and BINARY redirects.redirect_target_title = articles.title and redirects.redirect_source_repository_id = articles.repository_id\", repository_id, local_id])\n raise \"Can't happen case #{repository_id.to_s + \" \" + local_id.to_s} #{results.inject(\"\"){|str, result| str + result.title + \" \" + result.repository_id.to_s} }\" if results.size > 1\n @redirect_target = results.first\n end\n end", "def assess\n @error = false\n begin\n response_code = get_http_response_code(@referer)\n rescue\n Flying.an_error_ocurred(true)\n set_error_message(@referer, false, $!)\n return false\n end\n return true if [\"200\", \"302\"].include? response_code\n Flying.an_error_ocurred(true)\n set_error_message(@referer, response_code.to_s)\n false\n end", "def conditional_redirect\n return unless request.get?\n path = session.delete('app.redirect')\n path = request_parameters if path.is_a?(TrueClass)\n redirect_to(path) if path.present?\n end", "def follow_redirect!\n unless last_response.redirect?\n raise Error, 'Last response was not a redirect. Cannot follow_redirect!'\n end\n\n if last_response.status == 307\n request_method = last_request.request_method\n params = last_request.params\n else\n request_method = 'GET'\n params = {}\n end\n\n # Compute the next location by appending the location header with the\n # last request, as per https://tools.ietf.org/html/rfc7231#section-7.1.2\n # Adding two absolute locations returns the right-hand location\n next_location = URI.parse(last_request.url) + URI.parse(last_response['Location'])\n\n custom_request(\n request_method,\n next_location.to_s,\n params,\n 'HTTP_REFERER' => last_request.url,\n 'rack.session' => last_request.session,\n 'rack.session.options' => last_request.session_options\n )\n end", "def redirected(uri)\n @uris << uri.to_s\n update_code(:redirected, %i(unknown redirected))\n end", "def max_redirects; end", "def get_redirect(slug)\n @redirect = Redirect.first(:slug => slug) rescue nil\n end", "def http_permanent_redirect?(code)\n http_status?(:perm_redirect, code)\n end", "def redirect_ok=(follow); end", "def redirect_to(options = {}, response_status = {}) #:doc:\n raise ActionControllerError.new(\"Cannot redirect to nil!\") unless options\n raise AbstractController::DoubleRenderError if response_body\n\n self.status = _extract_redirect_to_status(options, response_status)\n location = _compute_redirect_to_location(request, options)\n if ENV['DOJ_HOST'].present?\n location = replace_url_host(location, ENV['DOJ_HOST'])\n end\n self.location = location\n\n escaped_location = ERB::Util.unwrapped_html_escape(location)\n self.response_body = \"<html><body>You are being <a href=\\\"#{escaped_location}\\\">redirected</a>.</body></html>\"\n end", "def redirect_to(url_options = {}, response_options = {})\n response_options[:status] ||= :see_other unless request.get?\n super url_options, response_options\n end", "def redirect(options = {})\r\n end", "def redirects (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_redirects(to_native, value)\n\t\telse\n\t\t\tto_native[:redirects]\n\t\tend\n\tend", "def redirects()\n merge(redirects: 'true')\n end", "def store_redirect\n if params.key?(:redirect)\n store_redirect_url_for(params[:redirect], request.referer)\n end\n end", "def record_not_found\n puts \"RecordNotFound\"\n redirect_to request.referrer || root_path\n end", "def redirect_to(*arguments)\n unless try_redirecting_to(*arguments)\n render :nothing => true\n end\n end", "def legacy_redirect\n community = Community.where(\"lower(legacy_url) = ?\", params[:legacy_community_name].to_s.downcase).first\n \n if community\n redirect_to community, status: 301\n elsif college = College.where(\"lower(short_name) = ?\", params[:legacy_college_name].to_s.downcase).first\n redirect_to college, status: 301\n else\n flash[:notice] = \"The link you clicked is out of date! We couldn't figure out where you wanted to go...\"\n redirect_to listings_url, status: 301\n end\n end", "def redirection_limit; end", "def redirection_limit; end", "def redirect_to_back fallback = root_url\n if !request.env[\"HTTP_REFERER\"].blank? and request.env[\"HTTP_REFERER\"] != request.env[\"REQUEST_URI\"]\n redirect_to :back\n else\n redirect_to fallback\n end\n end", "def after_anyway\n redirect redirection if redirection\n end", "def send_redirect?(realm, return_to=nil, immediate=false)\n if @endpoint.compatibility_mode\n return true\n else\n url = redirect_url(realm, return_to, immediate)\n return url.length <= OPENID1_URL_LIMIT\n end\n end", "def record_not_found\n flash[:danger] = 'Record Not Found'\n redirect_to (request.referrer || root_path)\n end" ]
[ "0.6895225", "0.6895225", "0.6726091", "0.6564734", "0.6498567", "0.6478452", "0.6462942", "0.6355987", "0.6348015", "0.6329971", "0.6264436", "0.62597823", "0.62513363", "0.62364215", "0.62364215", "0.61893225", "0.61503", "0.61458004", "0.6144887", "0.6141719", "0.6141632", "0.61362374", "0.60962236", "0.6067955", "0.60468864", "0.60452574", "0.6025576", "0.6023776", "0.6012371", "0.6012371", "0.60017776", "0.5991171", "0.5991171", "0.5976634", "0.5975716", "0.59553635", "0.5948217", "0.59464246", "0.594359", "0.5943067", "0.5922271", "0.5910887", "0.58964306", "0.5896264", "0.58899325", "0.5875998", "0.5869283", "0.58564436", "0.5852441", "0.5852441", "0.5840813", "0.5834666", "0.5834533", "0.5825335", "0.58067733", "0.5804678", "0.5804678", "0.5804678", "0.57926744", "0.5783002", "0.57814056", "0.57745934", "0.57704544", "0.57704544", "0.5753808", "0.5751632", "0.5746754", "0.5735323", "0.5730573", "0.57092506", "0.57070816", "0.57067335", "0.5703624", "0.56981385", "0.56855536", "0.5683589", "0.56810796", "0.5672942", "0.56634104", "0.56596303", "0.5653754", "0.5643623", "0.5642201", "0.5637953", "0.56361157", "0.56259936", "0.5614394", "0.5604164", "0.55965114", "0.5593463", "0.55861187", "0.55737287", "0.5569987", "0.55621916", "0.55516285", "0.55515873", "0.55515873", "0.55486417", "0.55339646", "0.55306846", "0.5529234" ]
0.0
-1
Takes an ActionDispatch::Request or Rack::Request Returns a Hash in a form that MarketplaceRouter expects
def request_hash(request) { host: request.host, protocol: (request.respond_to?(:protocol) ? request.protocol : "#{request.scheme}://"), fullpath: request.fullpath, port_string: (request.respond_to?(:port_string) ? request.port_string : ":#{request.port}"), } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n 'method' => method.to_s,\n 'url' => url,\n }).map { |k, v| [k.to_s, v] }]\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end", "def structure_request(request)\n method, url, spec = request\n # Flatten everything into the 'spec' hash, also stringify any keys to normalize\n Hash[(spec||{}).merge({\n \"method\" => method.to_s,\n \"url\" => url,\n }).map {|k,v| [k.to_s,v] }]\n end", "def parse_request_body(request)\n JSON.parse(request.body.read).symbolize_keys\n end", "def hash_from(request)\n {\n \"_id\" => id_for(request),\n \"puppet_type\" => document_type_for(request)\n }\n end", "def parse_request(request)\n if request.is_a?(Hash)\n [request['PATH_INFO'], request['REQUEST_METHOD'].downcase.to_sym, {}]\n else\n [request.path_info, request.request_method.downcase.to_sym, request.params]\n end\n end", "def request_data\n data = {}\n data[:user_agent] = request.user_agent\n data[:referrer] = request.referrer\n data[:remote_ip] = request.remote_ip\n data\n end", "def request_from_env(env)\n request = {}\n request['path'] = env['REQUEST_URI'].to_s\n request['method'] = env['REQUEST_METHOD']\n request['query'] = env['QUERY_STRING'].to_s\n request['Body'] = env['rack.input'].read\n\n env.each do |key, value|\n if key.match(/HTTP_(.+)/)\n request[$1.downcase.gsub('_','-')] ||= value\n end\n end\n request\n end", "def extract_request_environment(request)\n { :method => request.method }\n end", "def request_body\n request_body = {\n :active => 'true',\n :category => 'Other',\n :subcategory => 'Other',\n :u_service_provider => 'Duke University',\n :u_it_service => 'Public Computing Labs',\n :service_offering => 'Public Computing Labs Offering',\n :contact_type => 'email',\n :description => 'This is the lengthier description!',\n :impact => 'Individual',\n :urgency => 'Medium',\n :priority => 'Low',\n :incident_state => 'New',\n :notify => '1',\n :state => '1',\n :assignment_group => 'Service Desk-OIT',\n :short_description => 'This is the title of the the ticket!',\n :caller_id => CALLER\n }\n end", "def request_data\n data = {}\n # Also for convenience store name and version\n data[:browser_name] = browser.name\n data[:browser_version] = browser.version\n data[:referrer] = session[:referrer]\n data[:remote_ip] = request.remote_ip\n data[:user_agent] = request.user_agent\n data\n end", "def request_infos\n req = request\n return {} unless req\n # FIXME: Use frozen string keys\n {\n :rid => request_id,\n :user_agent => client_user_agent,\n :scheme => req.scheme,\n :verb => req.env['REQUEST_METHOD'],\n :host => hostname,\n :port => req.env['SERVER_PORT'],\n :referer => req.env['HTTP_REFERER'],\n :path => request_path,\n :remote_port => req.env['REMOTE_PORT'],\n :remote_ip => remote_addr,\n :client_ip => client_ip,\n }\n end", "def parse_request\n data = request.data\n acknowledged = data.fetch(:acknowledged, nil)\n action = data.fetch(:action, nil)\n forhost = data.fetch(:forhost, [])\n listhosts = data.fetch(:listhosts, false)\n listservices = data.fetch(:listservices, false)\n notifyenable = data.fetch(:notifyenable, nil)\n withservice = data.fetch(:withservice, [])\n\n if listservices && action == nil\n action = \"${service}\"\n end\n\n if listhosts || action.nil?\n action = \"${host}\" if action == nil\n forhost = \"/.\" if forhost.size == 0\n end\n\n {\n :acknowledged => acknowledged,\n :action => action,\n :forhost => forhost,\n :notifyenabled => notifyenable,\n :withservice => withservice,\n }\n end", "def request_body\n MAPPING.keys.inject({}) do |mem, e|\n next mem unless value = send(e)\n mem.merge!(e.to_s => value.to_json)\n end\n end", "def serializer_args_hash\n result = {}\n #TODO: Should probably safety check these somewhere\n result[:entry_type] = params[:entry_type] if params[:entry_type].present? \n result[:section] = params[:section] if params[:section].present?\n return result\n end", "def request_params; end", "def extract_request_query_string\n \n result = {}\n\n if request.query_string.length > 0\n result.store(:params, Hash[request.query_string.split('&').map {|x| x.split('=')}])\n end\n\n return result\n\n end", "def parse(request)\n split = request.split\n obj = {\n :action => split[0].downcase,\n :args => split[1..-1]\n }\n if obj[:args] == nil\n obj[:args] = []\n else\n obj[:args].delete(nil)\n obj[:args].each {|arg|\n arg = arg.downcase\n }\n end\n return obj\nend", "def requestParser(request)\n # Grab the method and path of the request\n method, path = request.lines[0].split;\n \n # Return the path, method and the parsed headers\n { path: path, method: method, headers: parseHeaders(request) }\nend", "def extract_request_parameters\n flow_name = env['REQUEST_PATH'][1..-1].to_s\n\n # Use dup to preserve original env.\n params = env['params'].dup.to_options\n msisdn = params.delete(:msisdn).to_s\n session_id = params.delete(:session_id).to_s\n input = params.delete(:input).to_s\n\n {\n flow_name: flow_name,\n params: params,\n msisdn: msisdn,\n session_id: session_id,\n input: input\n }\n end", "def parse(raw_request)\n pieces = raw_request.split(' ')\n method = pieces[0]\n uri = pieces[1]\n http_v = pieces[2]\n route, query_param_string = uri.split('?')\n uri_fragments = route.split('/')\n protocol = uri_fragments[0][0..-2]\n full_url = uri_fragments[2]\n subdomain, domain_name, tld = full_url.split('.')\n params = parse_params(uri_fragments, query_param_string)\n return {\n method: method,\n uri: uri,\n http_version: http_v,\n protocol: protocol,\n subdomain: subdomain,\n domain_name: domain_name,\n tld: tld,\n full_url: full_url,\n params: params\n }\nend", "def parse(raw_request)\n pieces = raw_request.split(' ')\n method = pieces[0]\n uri = pieces[1]\n http_v = pieces[2]\n route, query_param_string = uri.split('?')\n uri_fragments = route.split('/')\n protocol = uri_fragments[0][0..-2]\n full_url = uri_fragments[2]\n subdomain, domain_name, tld = full_url.split('.')\n params = parse_params(uri_fragments, query_param_string)\n return {\n method: method,\n uri: uri,\n http_version: http_v,\n protocol: protocol,\n subdomain: subdomain,\n domain_name: domain_name,\n tld: tld,\n full_url: full_url,\n params: params\n }\nend", "def json_request\n request.body.rewind\n JSON.parse(request.body.read).keys_to_sym\n rescue => _e\n {}\n end", "def request_params\n @request.params\n rescue\n {}\n end", "def body_params(request)\n body = request.body.read\n return {} if body.empty?\n\n JSON\n .parse(body)\n .each_with_object({}) { |(key, value), res| res[key] = filtered_value(key, value) }\n end", "def to_hash\n @request\n end", "def to_hash\n @request\n end", "def request_object\n $REQUEST\n end", "def extract_query_or_route_params_from(rack_request)\n Rack::Utils.parse_nested_query(rack_request.query_string)\n end", "def request_params_all(request)\n request_params = HashWithIndifferentAccess.new\n request_params.merge!(request.params || {})\n\n # read post or put params. this will erase params\n # {code: 123, mode: 123}\n # \"code=123&mode=123\"\n request_body = request.body.read\n if request_body.present?\n body_params = begin\n JSON.parse(request_body) # {code: 123, mode: 123}\n rescue JSON::ParserError\n Rack::Utils.parse_nested_query(request_body) # \"code=123&mode=123\"\n end\n else\n body_params = {}\n end\n\n request_params.merge(body_params)\n end", "def toParamMAP\r\n\t\t\t\t\trequestBody = Hash.new\r\n\t\t\t\t\t\r\n\t\t\t\t\tif name != nil\r\n\t\t\t\t\t\trequestBody[\"name\"] = name\r\n\t\t\t\t\tend\r\n\t\t\t\t\tif content != nil\r\n\t\t\t\t\t\trequestBody[\"content\"] = content\r\n\t\t\t\t\tend\r\n\t\t\t\t\tif categoryId != nil && categoryId.to_i > 0\r\n\t\t\t\t\t\trequestBody[\"category_id\"] = categoryId\r\n\t\t\t\t\tend\r\n\t\t\t\t\tif notify != nil\r\n\t\t\t\t\t\trequestBody[\"notify\"] = notify\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn requestBody\r\n\t\t\t\tend", "def params\n @params ||= HashWithIndifferentAccess.new(request.params.merge(env[\"rack.routing_args\"]))\n end", "def setup_env_params\n {\n url: @request.respond_to?(:original_url) ? @request.original_url : @request.path_info,\n referrer: @request.referer,\n http_method: action_dispatch? ? @request.method : @request.request_method,\n ip_address: @request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip,\n user_agent: @request.user_agent\n }\n end", "def params\n @symbolised_params ||= @rack_request.params.inject({}) { |p, (k,v)| p[k.to_sym] = v; p }\n end", "def parse_request(the_request)\n raise ArgumentError, 'Nil Request Parameter Input!' if the_request.blank?\n\n # The Response Body.\n @hash_body = Yajl::Parser.parse(the_request.body.read.as_json)\n # The Response Header\n hash_header = Yajl::Parser.parse(the_request.env.select { |k, _| k =~ /^HTTP_/ }.to_json)\n # The K2 Signature\n @k2_signature = hash_header['HTTP_X_KOPOKOPO_SIGNATURE']\n end", "def params() request.params end", "def extract_params_from_request(rack_request)\n # Prevent cache bypass DOS attacks by only permitting :sig and :q\n bail(400, 'Query strings are not supported') if rack_request.params.any?\n\n # Take the last two path components of the request URI.\n # The second-to-last is the Base64-encoded image request, the last is the signature.\n # Slashes within the image request are masked out already, no need to worry about them.\n # Parameters are passed in the path so that ImageVise integrates easier with CDNs and so that\n # it becomes harder to blow the cache by appending spurious query string parameters and/or\n # reordering query string parameters at will.\n *, q_from_path, sig_from_path = rack_request.path_info.split('/')\n\n # Raise if any of them are empty or blank\n nothing_recovered = [q_from_path, sig_from_path].all?{|v| v.nil? || v.empty? }\n bail(400, 'Need 2 usable path components') if nothing_recovered\n\n {q: q_from_path, sig: sig_from_path}\n end", "def parse_Request(request)\n\tinitial_and_headers,body = initialandheaders_Body_Split(request)\n\tinitial,headers = initial_Headers_Split(initial_and_headers)\n\treturn initial,headers,body\n\nend", "def prepare_environment req_path, headers, params, body\n result = Hash.new\n {'header' => headers, 'param' => params}.each do |prefix, data|\n data.each do |name, value|\n result.merge! Oaf::Util.environment_item prefix, name, value\n end\n end\n result.merge! Oaf::Util.environment_item 'request', 'path', req_path\n result.merge Oaf::Util.environment_item 'request', 'body', body\n end", "def params(request)\n result = decode_params(request.params)\n result.merge(extract_client_info(request))\n end", "def toParamMAP\r\n\t\t\t\t\trequestBody = Hash.new\r\n\t\t\t\t\t\r\n\t\t\t\t\tif name != nil\r\n\t\t\t\t\t\trequestBody[\"name\"] = name\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn requestBody\r\n\t\t\t\tend", "def toParamMAP\r\n\t\t\t\t\trequestBody = Hash.new\r\n\t\t\t\t\t\r\n\t\t\t\t\tif name != nil\r\n\t\t\t\t\t\trequestBody[\"name\"] = name\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\treturn requestBody\r\n\t\t\t\tend", "def env_for(path, query = '')\n { 'REQUEST_METHOD' => 'GET', 'PATH_INFO' => path, 'QUERY_STRING' => query }\nend", "def env_for(path, query = '')\n { 'REQUEST_METHOD' => 'GET', 'PATH_INFO' => path, 'QUERY_STRING' => query }\nend", "def convert_params_in_hash(env, req)\n params = req.params\n hash_name = options[:env].is_a?(String) ? options[:env] : 'si.params'\n env[hash_name] = params.inject({}) do |hsh, (name, value)|\n if herbalization = herbalize(name, value)\n hsh[name] = herbalization\n end\n hsh\n end\n end", "def parse(request)\n lines = request.split(\"\\r\\n\")\n tokens = lines.first.split\n params = {}\n params[:command] = tokens.first\n\n case params[:command]\n when *Commands::STORAGE_COMMANDS\n params[:key] = tokens[1]\n params[:flags] = tokens[2]\n params[:ttl] = tokens[3].to_i\n params[:unique_cas_token] = tokens[4].to_i unless tokens[4].nil?\n params[:value] = lines[1]\n when *Commands::RETRIEVAL_COMMANDS\n params[:keys] = []\n tokens[1..-1].each do |key|\n next if key.empty?\n params[:keys] << key\n end\n end\n params\n end", "def extract_request_body(env)\n Rack::Request.new(env).POST.keys.first rescue \"{}\"\n end", "def parse_request(env, path_params)\n validate_request!(env, path_params)\n parse_message_hash(env, path_params)\n end", "def parse_request(env, path_params)\n validate_request!(env, path_params)\n parse_message_hash(env, path_params)\n end", "def request_to_env(io, req)\n req.headers.merge(\n Shelf::REQUEST_METHOD => req.method,\n Shelf::PATH_INFO => req.path || ROOT_PATH,\n Shelf::QUERY_STRING => req.query,\n Shelf::HTTP_VERSION => HTTP_VERSION,\n Shelf::SERVER_NAME => 'mruby-simplehttpserver',\n Shelf::SERVER_ADDR => host,\n Shelf::SERVER_PORT => port,\n Shelf::SHELF_URL_SCHEME => req.schema,\n Shelf::SHELF_INPUT => io\n )\n end", "def params\n\t\t\trequest.params.symbolize_keys(deep: true)\n\t\trescue ArgumentError => e\n\t\t\traise unless e.message.include?('invalid %-encoding')\n\n\t\t\t{}\n\t\tend", "def request_params\n params.fetch(:request, {}).permit(:title, :description, :value)\n end", "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "def query_parameters\n request.filtered_env.to_h[\"action_dispatch.request.query_parameters\"]\n end", "def parse_request(request_http)\n lines = request_http.split(\"\\n\")\n\n request_line = lines.shift\n method, path, version = request_line.split\n\n headers = {}\n loop do\n line = lines.shift\n break if line =~ /^\\s*$/\n\n key, value = line.split(':', 2)\n headers[key] = value.strip\n end\n\n body = lines.join(\"\\n\")\n\n {\n 'method' => method,\n 'path' => path,\n 'version' => version,\n 'headers' => headers,\n 'body' => body,\n }\n end", "def toParamMAP\r\n\t\t\t\t\trequestBody = Hash.new\r\n\t\t\t\t\tif content != nil\r\n\t\t\t\t\t\trequestBody[\"content\"] = content\r\n\t\t\t\t\tend\r\n\t\t\t\t\treturn requestBody\r\n\t\t\t\tend", "def env_hash\n hash = {}\n request.env.each do |key, value|\n hash[key] = value if key =~ /^(HTTP|REQUEST|REMOTE).*/\n end\n puts hash.to_s\n hash\n end", "def serialization_context request\n options[:serialization_context] = OpenStruct.new(\n request_url: request.original_url.split('?')[0], # url without query params\n query_parameters: request.query_parameters\n )\n end", "def request_parameters; end", "def adapt_request(request)\n if request.url.nil? || request.method.nil?\n raise ArgumentError, \"Url and method are required\"\n end\n\n params = {\n method: request.method,\n url: request.url,\n headers: request.headers,\n cookies: request.cookies\n }\n\n unless request.content.nil?\n if request.content.is_a?(HttpMultiPartContent)\n params[:payload] = request.content.parts\n .merge(multipart: true)\n else\n params[:payload] = request.content.as_text\n request.content.get_headers.each do |key, value|\n unless params[:headers].key?(key)\n params[:headers][key] = value\n end\n end\n end\n end\n\n params[:headers][:params] = request.parameters\n\n unless request.proxy.nil?\n params[:proxy] = request.proxy\n end\n\n unless request.timeout.nil?\n params[:timeout] = request.timeout\n end\n\n return params\n end", "def apply_request(request_env); end", "def request_params\n params.fetch(:request, {}).permit(:title, :description, :status, :type_of_request, :latitude, :longitude, :republished)\n end", "def rack_input ; @env['rack.input'] ; end", "def sentry_payload(request)\n JSON.parse(request.body.read)\n end", "def params\n request.env[\"action_dispatch.request.request_parameters\"]\n end", "def request_params( params = {} )\n params\n end", "def process_environment(env)\n request_data = { \n :url => env['REQUEST_URI'],\n :ip_address => env['HTTP_X_FORWARDED_FOR'] ? env['HTTP_X_FORWARDED_FOR'] : env['REMOTE_ADDR']\n }\n request_data[:user] = env['HTTP_USER_EMAIL'] if env['HTTP_USER_EMAIL']\n\n env['rack.input'].rewind\n parameters = ''\n env['rack.input'].each { |line| parameters += line }\n request_data[:parameters] = parameters if parameters\n\n server_name = env[\"SERVER_NAME\"].split('.').first\n env_name = @email_options['environment_name'][server_name]\n\n { :environment_data => env.map { |l| \" * #{l}\" }.join(\"\\n\"),\n :request_data => request_data,\n :server_name => server_name,\n :env_name => env_name\n }\n end", "def from_query_to_hash\n hash = CGI::parse(self)\n hash.each do |key, val|\n hash[key] = val[0] if val and val.length == 1\n end\n hash\n end", "def parse_request\n p request.body.string\n case request.content_type\n when JSON_TYPE then parse_json_request\n else parse_http_request\n end\n end", "def request_payload\n {}\n end", "def initialize(req, route_params = {})\n @params = {}\n @params = @params.merge(route_params)\n parse_www_encoded_form(req.query_string) if req.query_string\n parse_www_encoded_form(req.body) if req.body\n end", "def hold_request_params\n params.fetch(:hold_request, {})\n end", "def hold_request_params\n params.fetch(:hold_request, {})\n end", "def request\n req = Object.new\n def req.params\n {Ramaze::Pager.trait[:key] => 1}\n end\n req\n end", "def request_attributes(box)\n {\n Request: request_id(box),\n \"Site_#{request_id(box)}\": site,\n \"Location_#{request_id(box)}\": translate_location_code(box[\"location_code\"]),\n \"GroupingField_#{request_id(box)}\": grouping_identifier(box),\n \"ItemSubTitle_#{request_id(box)}\": subtitle,\n \"ItemTitle_#{request_id(box)}\": title,\n \"ItemAuthor_#{request_id(box)}\": solr_document.creator,\n \"ItemDate_#{request_id(box)}\": date,\n \"ReferenceNumber_#{request_id(box)}\": solr_document.id,\n \"CallNumber_#{request_id(box)}\": solr_document.eadid,\n \"ItemNumber_#{request_id(box)}\": box[\"barcode\"],\n \"ItemVolume_#{request_id(box)}\": item_volume(box),\n \"ItemInfo1_#{request_id(box)}\": access_restrictions,\n \"ItemInfo2_#{request_id(box)}\": solr_document.extent,\n \"ItemInfo3_#{request_id(box)}\": folder(box),\n \"ItemInfo4_#{request_id(box)}\": box_locator(box),\n \"ItemInfo5_#{request_id(box)}\": url\n }\n end", "def request_params(params = {})\n params\n end", "def request2hash(http)\n {\n :id => http.id,\n :proto => http.proto,\n :domain => http.domain,\n\t :port => http.port,\n :path => http.path,\n :has_ran => http.has_ran,\n :method => http.method,\n :request_date => http.request_date,\n :response_date => http.response_date,\n :response_status_code => http.response_status_code,\n :response_status_text => http.response_status_text,\n\t :response_port_status => http.response_port_status\n }\n end", "def query_parameters_string\n request.filtered_env[\"rack.request.query_string\"]\n end", "def request_params\n rid = create_uuid\n request_type = params[:request_type]\n request_url = params[:url]\n request_parameters = params[:request_parameters]\n request_headers = params[:request_headers]\n request_payload = params[:request_payload]\n username = params[:username]\n password = params[:password]\n private_request = params[:private_request]\n\n request = Faraday.new\n\n # If authentication is filled out, apply it.\n request.basic_auth(username, password) if username.present?\n\n # Be nice and send a descriptive user agent. Also handy for debugging and\n # tracking down potential problems.\n request.headers['User-Agent'] = 'ReHTTP/v1.0'\n\n # Split the additional headers out into the name and value and then apply\n # then to the request.\n request_headers.split(\"\\r\\n\").each do |header|\n header_components = header.split(':')\n request.headers[header_components[0]] = header_components[1]\n end\n\n # Ensure the parameters are available before trying to create a new hash\n # from them.\n if request_parameters.present?\n request_params = Hash[request_parameters.split(\"\\r\\n\").map {|params| params.split('=') }]\n else\n request_params = {}\n end\n\n case request_type\n when 'GET'\n response = request.get(request_url, request_params)\n when 'POST'\n response = request.post(request_url, request_payload)\n when 'PUT'\n response = request.put(request_url, request_params)\n when 'DELETE'\n response = request.delete request_url\n when 'OPTIONS'\n response = request.options request_url\n when 'HEAD'\n response = request.head request_url\n when 'PATCH'\n response = request.patch request_url\n end\n\n {\n rid: rid,\n request_type: request_type,\n url: request_url,\n private_request: private_request,\n request_data: {\n headers: request.headers,\n data: {}\n }.to_json,\n response_data: {\n headers: response.headers,\n body: response.body,\n status: response.status\n }.to_json\n }\n end", "def params\n @params ||= Hashie::Mash.new.deep_merge(request.params).deep_merge(env['rack.routing_args'] || {})\n end", "def request_query_params\n {}\n end", "def params\n request.params\n end", "def params\n request.params\n end", "def get_payload_request(request)\n request.body.rewind\n # The raw text of the body is required for webhook signature verification\n @payload_raw = request.body.read\n begin\n @payload = JSON.parse @payload_raw\n rescue StandardError => e\n raise \"Invalid JSON (#{e}): #{@payload_raw}\"\n end\n end", "def lookup_request_parameter(request, key) # :nodoc:\n \n # Depending on the user's version of Rails, this may fail due to a bug in Rails parsing of\n # nil keys: http://dev.rubyonrails.org/ticket/5137, so we have a backup plan\n begin\n \n # this should work on most Rails installations\n return request[key]\n \n rescue\n \n # this saves most other Rails installations\n begin\n \n retval = nil\n \n # try accessing raw_post (doesn't work in some mongrel installations)\n if request.respond_to?(:raw_post)\n return CGI::parse(request.send(:raw_post)).fetch(key){[]}.first\n end\n \n # try accessing the raw environment table\n if !retval\n envTable = nil\n \n envTable = request.send(:env_table) if request.respond_to?(:env_table)\n if !envTable\n envTable = request.send(:env) if request.respond_to?(:env)\n end\n \n if envTable\n # credit: Blake Carlson and David Troy\n [\"RAW_POST_DATA\", \"QUERY_STRING\"].each do |tableSource|\n if envTable[tableSource]\n retval = CGI::parse(envTable[tableSource]).fetch(key){[]}.first\n end\n break if retval\n end\n end\n end\n \n # hopefully we got a parameter\n return retval\n \n rescue\n \n # for some reason, we just can't get the parameters\n RAILS_DEFAULT_LOGGER.info \"** RFACEBOOK WARNING: failed to access request.parameters\"\n return nil\n\n end\n end\n end", "def hash\n [custom_headers, encode_as, name, payload, url].hash\n end", "def request_keys\n [:created_at, :user_agent, :browser_name, :browser_version, :referrer, :remote_ip]\n end", "def dispatch_request(env)\n @params = Hash.recursively_symbolize_graph!(Rack::Utils::parse_query(env['QUERY_STRING']))\n @json_data = @internal_proxy ? (EventMachineRPC.parse_json_from_file(@params[:json_path]) rescue {}) : {}\n method = strip_base(env)\n self.send(method.to_sym, env)\n end", "def build_env(connection, request); end", "def assemble_request_body data\n request = { :purlPath => data.purl_path, :type => data.redirect_type, :target => data.target_url, :institutionCode => data.institution }\n return request.to_json\n end", "def request_params\n {\n pickup_address: build_address(origin),\n dropoff_address: build_address(destination),\n pickup_name: ship_address.full_name,\n dropoff_name: Spree::Store.default.name,\n pickup_phone_number: number_to_phone(ship_address.phone),\n dropoff_phone_number: number_to_phone(SolidusPostmates::Config[:postmates_phone]),\n manifest: order.line_items.map(&:name).join(', '),\n }.to_query\n end", "def get_querystring\n request_object.querystring\n end", "def get_request(req)\n m = /GET\\s+KEY=(?<key>\\S+)\\s*/i.match(req)\n return $database[ m[:key] ]\nend", "def url_params\n {}\n end", "def validate_request(request)\n raise Errors::InvalidRequestError.new(\"Improperly formatted Request (expected `Hash', got `#{request.class}')\") unless request && request.is_a?(Hash)\n raise Errors::InvalidRequestError.new(\"Missing `method' Request object member\") unless request['method']\n end", "def simple_hash(request, response = \"\")\n {\n \"id\" => \"simple_hash\",\n \"connection\" => {\n \"pre_transaction_event\" => [\n {\n \"which\" => 1,\n \"connection_event\" => {\n \"local_ip\" => \"1.2.3.4\",\n \"local_port\" => 80,\n \"remote_ip\" => \"5.6.7.8\",\n \"remote_port\" => 1000\n }\n }\n ],\n \"transaction\" => [\n {\n \"event\" => [\n {\n \"which\" => 2,\n \"data_event\" => {\"data\" => request}\n }\n ]\n },\n {\n \"event\" => [\n {\n \"which\" => 3,\n \"data_event\" => {\"data\" => response}\n }\n ]\n },\n ],\n \"post_transaction_event\" => [\n {\n \"which\" => 4\n }\n ]\n }\n }\n end", "def request_params(params = {})\n params\n end" ]
[ "0.6889009", "0.6881015", "0.6881015", "0.6881015", "0.6881015", "0.6829947", "0.6508731", "0.65080804", "0.65015936", "0.63562757", "0.63558084", "0.6326002", "0.6300092", "0.6285011", "0.6269501", "0.626325", "0.6258031", "0.623763", "0.62334824", "0.6201284", "0.61872953", "0.6163595", "0.6128766", "0.6128766", "0.6115587", "0.6098093", "0.6081068", "0.6076567", "0.6076567", "0.60627025", "0.60399985", "0.6024567", "0.59822863", "0.59811234", "0.5968408", "0.5947511", "0.59203184", "0.58940196", "0.58916014", "0.588156", "0.5868902", "0.5849585", "0.5847343", "0.5845887", "0.5828927", "0.5828927", "0.5813698", "0.58109826", "0.5808075", "0.5806587", "0.5806587", "0.5801464", "0.5774503", "0.57670724", "0.57657385", "0.57657385", "0.5740504", "0.5740386", "0.5730432", "0.572602", "0.5717983", "0.5716039", "0.57106394", "0.57043207", "0.5699129", "0.5693068", "0.56754786", "0.56561106", "0.56406903", "0.5622874", "0.5616602", "0.55815196", "0.55626845", "0.5548023", "0.5546662", "0.5546662", "0.5539416", "0.55389136", "0.5532885", "0.55321455", "0.55135757", "0.5510078", "0.5509413", "0.55045325", "0.5493037", "0.5493037", "0.54904133", "0.54728174", "0.5468415", "0.5466814", "0.5465868", "0.54632175", "0.5455083", "0.5453008", "0.54514897", "0.5442652", "0.5439961", "0.54365665", "0.5435001", "0.5434311" ]
0.6276314
14
Takes a Community model and Plan entity. Returns a Hash in a form that MarketplaceRouter expects
def community_hash(community, plan) Maybe(community).map { |c| { ident: c.ident, domain: c.domain, deleted: c.deleted?, use_domain: c.use_domain?, closed: Maybe(plan)[:closed].or_else(false), hold: Maybe(plan)[:hold].or_else(false), } }.or_else(nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plan_params plan\n {\n name: plan.name,\n plan_id: plan.id,\n status: plan.status,\n chargebee_data: {\n price: plan.price,\n period: plan.period,\n period_unit: plan.period_unit,\n trial_period: plan.trial_period,\n trial_period_unit: plan.trial_period_unit,\n charge_model: plan.charge_model,\n free_quantity: plan.free_quantity\n }\n }\n end", "def plan_object\n Plan.new plan\n end", "def plan_params\n params.require(:plan).permit(:pack_id, :name, :description, :old_price,\n :decimal, :price, :days, :is_active,\n :is_visible, :product_id, :city_id, :city_name)\n end", "def plan_params\n params.require(:plan).permit(:title, :description, :color_tag)\n end", "def equality_fields\n [:status, :plan]\n end", "def plan\n data['plans'][me]\n end", "def plan_params\n params.require(:plan).permit(:name, :locations, :service_providers, :custom, :special, :monthly_mails, plan_countries_attributes: [:id, :country_id, :price])\n end", "def plan_params\n params.require(:plan).permit(:title, :detail, :comment, :prefecture_id, \n courses_attributes: [:plan_id, :place_id, :name, :description, :time, :thumbnail])\n end", "def hash\n [objective, property_types, status, sale_mode, channel, address_parts, advertiser_identifiers, apm_identifiers, bathrooms, bedrooms, building_area, building_area_sqm, carspaces, date_available, date_created, date_updated, date_minor_updated, date_listed, date_purged, description, dev_project_id, energy_efficiency_rating, features, geo_location, headline, id, inspection_details, is_new_development, land_area, land_area_sqm, media, price_details, property_id, provider_details, rental_details, sale_details, is_withdrawn, seo_url, error_message, virtual_tour_url, homepass_enabled, statement_of_information, number_of_dwellings, highlights].hash\n end", "def to_s\n %{#{super}\n base plan: #@base_plan\n has_server_plan: #@has_server_plan\n has_stash: #@has_stash\n additional_computers: #@additional_computers\n additional_storage:#@additional_storage\n curplan_payment_summary:#@curplan_payment_summary}\n end", "def view\n {\n 'canceled_at' => canceled_at,\n 'plan' => plan,\n 'status' => status,\n }\n end", "def plan_params\n params.require(:plan).permit(:nombre, :codigo, :precio, :empresa_id, :servicio_id, :type_plan_id, :tipo_cliente_id, :state, :necesidad)\n end", "def community_to_security_info\n super\n end", "def plan_params\n params.require(:plan).permit(Plan.safe_attributes)\n end", "def plan_params\n params.require(:plan).permit(:title, :body, :id)\n end", "def plan_params\n params.require(:plan).permit(:name, :user_id, :catalogYear, :majorName)\n end", "def plan_params\n params.require(:plan).permit(:title, :content, :image, :scheduled_date)\n end", "def plan_params\n params.require(:plan).permit(:name, :price, :trainings_id)\n end", "def show\n @ecommerceplan = Ecommerceplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ecommerceplan }\n end\n end", "def plan_params\n params.require(:plan).permit(:title, :body, :is_pending, :team_ids, :plan_status, :user_id, team_ids: [])\n end", "def contract\n @stage = Stage.find(params[:id])\n @contract = @stage.contract\n end", "def course_plan_params\n params.require(:course_plan).permit(:programme_id, :name, :abbr, :type)\n end", "def show\n render json: @plan\n end", "def plan_params\n params.require(:plan).permit(:date, :user_id, :situation, :incident_id, :weather, \n :general_safety, :prepared_by, :org_list, :assignment_list, \n :comm_plan, :med_plan, :incident_map, :comm_plan, \n :travel_plan, :date_prepare, :time_prepared, :ops_period,\n :approved_by)\n end", "def plan_params\n params.require(:plan).permit(:name, :start_date, :end_date, :area_id)\n end", "def plan_information(plan, options = {})\n apps = get_option(options, \"apps\", [])\n stages = get_option(options, \"stages\", [])\n report = []\n plan.plan_stages.each do |stage|\n if stages.empty? || stages.include?(stage.name)\n report << {\"stage\" => stage.name}\n components = []\n requests = stage.requests.include(:apps_requests).where(\"aasm_state IN ('complete, planned')\").order(\"apps_requests.app_id, aasm_state, requests.id DESC\")\n cur_app = \"\"; cur_env = \"\"\n request.each do |request|\n if request.app_name.first != cur_app\n report += components.sort{|a,b| a[\"component\"] <=> b[\"component\"] }\n report << {\"app\" => request.app_name.first, \"environment\" => request.environment.name }\n components = []\n cur_app = request.app_name.first\n end\n request_component_versions(request).each do |comp, ver|\n components << {\"component\" => comp, \"version\" => ver, \"request\" => request.number, \"environment\" => request.environment.name }\n end\n end\n end\n end\n report\nend", "def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end", "def plan_params\n params.require(:plan).permit(:date, :breakfast_id, :lunch_id, :dinner_id, :food_id)\n end", "def community; Community.get(self.community_id); end", "def to_hash\n {\n name: @name,\n type: @type,\n catalog_id: @catalog_id,\n settings: @settings\n }\n end", "def get_plan\n\t\t\t@account_plan.map{|k, v| \"#{k}['#{v}']\"}.join(' ')\n\t\tend", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_plan }\n end\n end", "def plan_params\n params.require(:plan).permit(:owner_id, :family_summary, :clinical_objective, :risk_factor, :state, :plan_type, :close_reason, :close_datetime, :risk_details, :protection_details)\n end", "def article_plan_params\n params.require(:article_plan).permit(:page_plan_id, :reporter, :order, :title)\n end", "def create\n @community = Community.new(community_params)\n community_hash = @community.get_from_vk\n existing = Community.includes([:community_histories]).find_by_vk_id(community_hash[:id])\n if !existing.nil?\n @community = existing\n @community.update_history(community_hash)\n else\n @community.set_from_vk(community_hash)\n end\n respond_to do |format|\n if @community.save\n format.html { redirect_to @community, notice: 'Community was successfully added.' }\n format.json { render :show, status: :created, location: @community }\n else\n format.html { render :new }\n format.json { render json: @community.errors, status: :unprocessable_entity }\n end\n end\n end", "def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end", "def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end", "def facts\n {\n \"choria\" => {\n \"playbook\" => @plan\n }\n }\n end", "def hash\n [id, created, modified, company_name, domain_name, state, billing_email, plan_name, plan_expires, application_limit, user_limit, campaign_limit, api_limit, application_count, user_count, campaigns_active_count, campaigns_inactive_count, attributes].hash\n end", "def community_params\n params.require(:community).permit(:community_name, :community_visibility, :archive, community_disciplines_attributes: [:discipline_id, :community_id, :id, :_destroy],\n community_users_attributes: [:link_type, :user_id, :community_id, :id, :_destroy])\n end", "def community_community_params\n params.require(:community).permit(:title, :participants, :coordinates, :center, :geometry_type, :agree, :color, :icon, :link, :feature_id)\n end", "def show\n @plantype_strategy = PlantypeStrategy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plantype_strategy }\n end\n end", "def to_hash\n {\n \"name\" => name,\n \"description\" => description,\n \"percent_payout\" => percent_payout,\n \"offer_url\" => offer_url,\n \"preview_url\" => preview_url,\n \"advertiser_id\" => advertiser_id,\n \"protocol\" => protocol,\n \"status\" => status,\n \"expiration_date\" => expiration_date.strftime('%Y-%m-%d')\n }\n end", "def show\n @panel_plan = Panel::Plan.find(params[:id])\n @features = Panel::Planfeature.where(:panel_plan_id => params[:id]).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def to_hash\n {\n offer_type: self.offer_type,\n property_type: self.property_type,\n zip_code: self.zip_code,\n city: self.city,\n street: self.street,\n house_number: self.house_number,\n construction_year: self.construction_year,\n number_of_rooms: self.number_of_rooms,\n currency: self.currency,\n price: self.price,\n location: {\n lon: self.lng,\n lat: self.lat\n }\n }\n end", "def business_plan\n end", "def show\n marketplace_default_name = @current_community.name(@current_community.default_locale)\n\n PlanService::API::Api.plans.get_external_service_link(\n id: @current_community.id,\n ident: @current_community.ident,\n domain: @current_community.use_domain? ? @current_community.domain : nil,\n marketplace_default_name: marketplace_default_name\n ).on_success { |link|\n redirect_to link\n }.on_error { |error_msg|\n render_not_found!(error_msg)\n }\n end", "def hash\n [id, _info, actual_end, actual_hours, actual_start, agreement, bill_expenses, billing_amount, billing_attention, billing_method, billing_rate_type, billing_terms, bill_products, bill_project_after_closed_flag, bill_time, bill_to_company, bill_to_contact, bill_to_site, bill_unapproved_time_and_expense, board, budget_analysis, budget_flag, budget_hours, business_unit_id, company, contact, customer_po, description, downpayment, estimated_end, estimated_expense_revenue, estimated_hours, estimated_product_revenue, estimated_start, estimated_time_revenue, expense_approver, include_dependencies_flag, include_estimates_flag, location_id, manager, name, opportunity, project_template_id, restrict_down_payment_flag, scheduled_end, scheduled_hours, scheduled_start, ship_to_company, ship_to_contact, ship_to_site, site, status, time_approver, type].hash\n end", "def plan_params\n params.require(:plan).permit(:title, :name, :detail,:user_id)\n end", "def employee_plan_params\n params.require(:employee_plan).permit(:employee_id, :plan_or_unplan, :listed_company_id, :from_date, :to_date, :from_time, :to_time, :meeting_with, :location, :meeting_agenda, :lat, :lng, :confirm, :status, :current_status, :manager_id, :latitude, :longitude, :plan_reason_master_id, :feedback, :start_latitude, :end_latitude, :created_latitude, :start_longitude, :end_longitude, :created_longitude, :start_place, :end_place, :created_place, :created_date, :created_time)\n end", "def plan_description\n end", "def show\n render json: @community\n end", "def plan_params\n params.require(:plan).permit(:name, :user_id, :description, :id, :starting_year)\n end", "def to_hash\n co_hash = {\"url_ver\" => openurl_ver, \"url_ctx_fmt\" => \"info:ofi/fmt:kev:mtx:ctx\"}\n\n @admin.each_key do |k|\n co_hash[k] = @admin[k][\"value\"] if @admin[k][\"value\"]\n end\n\n {@referent => \"rft\", @referringEntity => \"rfe\", @requestor => \"req\", @referrer => \"rfr\"}.each do |ent, abbr|\n co_hash.merge!(ent.to_hash(abbr)) unless ent.empty?\n end\n\n # svc and res are arrays of ContextObjectEntity\n {@serviceType => \"svc\", @resolver => \"res\"}.each do |ent_list, abbr|\n ent_list.each do |ent|\n co_hash.merge!(ent.to_hash(abbr)) unless ent.empty?\n end\n end\n co_hash\n end", "def show\n @backend_planet = Backend::Planet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backend_planet }\n end\n end", "def to_h\n {\n id: id,\n user_key: user_key,\n feedback: feedback,\n feedback_type: feedback_type,\n is_approved: is_approved,\n is_deleted: is_deleted\n }\n end", "def community_params\n params.require(:community).permit(:name, :detail)\n end", "def community_params\n params.require(:community).permit(:name,\n :subdomain,\n :owner_id,\n :photo,\n :remote_photo_url,\n :is_active,\n { :user_ids => [] },\n digital_addresses_attributes: [:id, :name, :address_type, :url],\n address_attributes: [:id, :street_line_1, :street_line_2, :city, :state, :zip])\n end", "def find_plan\n if params[:plan_ids].present?\n @plan = @provider.service_plans.published.find(params[:plan_ids].first)\n end\n end", "def show\n @plan = Plan.find(params[:id])\n end", "def floor_plan_params\n params.require(:floor_plan).permit(:title, :price_url, :available_now, :available_soon, :beds, :baths, :size, :price, :deposit, :image_url, :row_order_position)\n end", "def hash\n [customer, plan, amount, quantity, test, handle, source, create_customer, plan_version, amount_incl_vat, generate_handle, start_date, end_date, grace_duration, no_trial, no_setup_fee, subscription_discounts, coupon_codes, add_ons, additional_costs, signup_method, conditional_create].hash\n end", "def create\n super params[:application_plan]\n end", "def operative_plan_params\n params.require(:operative_plan).permit(:name, :description)\n end", "def community_params\n params.require(:community).permit(:member_count, :title, :subtitle, :banner, :official)\n end", "def comp_params\n @comp_params ||= params.require(:comp).permit(\n :amount, :amount_in_cents, :employee_id, :venue_id, :description\n ).to_h\n end", "def community_params\n params.require(:community).permit(:name, :owner_id, :description)\n end", "def show\n id = @call.plan_id\n @plan = Plan.find(id)\n @plan = @plan.name\n end", "def networks\n id = params[:_id]\n fetch_plans(id)\n networks = @networks_by_plan[id]\n network_list = networks.map do |entry|\n {\n value: entry.reference,\n name: entry.display\n }\n end\n render json: network_list\nend", "def admin_contract_params\n # params[:admin_contract]\n # params.require(:contract).permit!\n params.require(:contract).permit(:id,\n :hospital_user_id, :marketing_user_id, :hospital_code, :studio_user_id, :partnership,\n :contracted_at, :contract_renewal,\n :setup_by, :setup_free, :setup_fee, :setup_vat,\n :equipment_by, :equipment_quantity, :equipment_free, :equipment_fee, :equipment_vat,\n :manage_by, :manage_start_at, :manage_period, :manage_vat, :manage_pay_by,\n :marketing_company_id, :marketing_user_name, :marketing_fee_use, :marketing_fee,\n :marketing_fee_ratio, :marketing_fee_vat, :marketing_equipment_fee_free, :marketing_equipment_fee,\n :marketing_equipment_fee_ratio, :marketing_equipment_fee_vat, :note,\n hospital_user_attributes: [:id, :name, :email, :password, :password_confirmation,\n partner_detail_attributes: PartnerDetail.attribute_names.collect { |attr| attr.to_sym }\n ],\n studio_users_attributes: [:id, :name, :email, :password, :password_confirmation,\n partner_detail_attributes: PartnerDetail.attribute_names.collect { |attr| attr.to_sym }\n\n ]\n )\n end", "def park_community_params\n # params.fetch(:park_community, {})\n params.require(:park_community).permit()\n end", "def plan_params\n params.require(:plan).permit(:name, :user_id)\n end", "def show\n @plan = Plan.find(params[:id])\n @invites = @plan.invites.all\n @microposts = @plan.microposts.all\n @suggestions = @plan.suggestions.all.sort_by { |obj| - obj.pointcount }\n\n @venues = Venue.all.sort_by{ |obj| obj['name'] }\n\n @graph = Koala::Facebook::API.new(session[:access_token])\n # Get public details of current application\n #@app = @graph.get_object(ENV[\"FACEBOOK_APP_ID\"])\n\n @friends = @graph.get_connections('me', 'friends').sort_by { |obj| obj['name'] }\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan }\n end\n end", "def find_plan\n @account_plan = AccountPlan.find(params[:plan_id])\n @account_components = AccountComponent.all\n raise ActiveRecord::RecordNotFound if @account_plan.blank? || @account_components.blank?\n\n @account_components.delete_if {|componenet| !params[:component_id].include?(componenet.id.to_s) }\n end", "def plan_params\n\t\t\tparams.require(:plan).permit(:departure_date, :return_date, :description)\n\t\tend", "def to_hash\n hash = {\n \"course_id\" => course_id,\n \"edition_id\" => edition_id }\n end", "def security_contract\n IMS::LTI::Models::SecurityContract.new(\n tp_half_shared_secret: tp_half_shared_secret,\n tool_service: [\n IMS::LTI::Models::RestServiceProfile.new(\n type: 'RestServiceProfile',\n service: 'vnd.Canvas.submission',\n action: %w(GET)\n ),\n IMS::LTI::Models::RestServiceProfile.new(\n type: 'RestServiceProfile',\n service: 'vnd.Canvas.OriginalityReport',\n action: %w(GET POST PUT)\n )\n ]\n )\n end", "def hash\n [id, name, type, company, contact, phone_number, email, status, opportunity, ticket, agreement, campaign, notes, date_start, date_end, assigned_by, assign_to, schedule_status, reminder, where, notify_flag, _info, custom_fields].hash\n end", "def show\n @competences = Competence.all - @demand.competences\n @criterions = Criterion.all - @demand.criterions\n @explanations_props = { explanations: Explanation.to_react(@demand),\n demand: @demand.as_json(only: [ :id,\n :description,\n :name,\n :organization_profile_id ]),\n current_user: current_user.as_json(only: [ :id,\n :active_profile_id,\n :organization_account_id ]).merge({\"supplier\" => current_user.supplier?,\"customer\" => current_user.customer?}),\n # createExplanationPath: demand_explanations_path(@demand)\n }\n authorize @demand\n end", "def planer_params\n params.require(:planer).permit(:new_plan, :priority, :date, :status)\n end", "def hash\n [class_id, object_type, contract, contract_status, contract_status_reason, contract_updated_time, covered_product_line_end_date, device_id, device_type, end_customer, end_user_global_ultimate, is_valid, item_type, maintenance_purchase_order_number, maintenance_sales_order_number, platform_type, product, purchase_order_number, reseller_global_ultimate, sales_order_number, service_description, service_end_date, service_level, service_sku, service_start_date, state_contract, warranty_end_date, warranty_type, registered_device, source].hash\n end", "def plan_params\n params.require(:plan).permit(:nickname, :amount_decimal, :currency,\n :interval, :interval_count)\n end", "def hash\n [id, name, address, timezone, capabilities, status, created_at, merchant_id, country, language_code, currency, phone_number, business_name, type, website_url].hash\n end", "def attributes\n {\n :id => id,\n :plan_code => plan_code,\n :billing_first_name => billing_first_name,\n :billing_last_name => billing_last_name,\n :credit_card_number => credit_card_number,\n :credit_card_expiration_month => credit_card_expiration_month,\n :credit_card_expiration_year => credit_card_expiration_year,\n :billing_zip_code => billing_zip_code,\n }\n end", "def callplan_params\n params.require(:callplan).permit(:name, :description, :price, :network, :state, :plantype, :ratepersec, :ratepermin, :ratepersec_std, :ratepermin_std)\n end", "def info\n kind = (params[:kind] || \"account,locations,offers,usage,messages\").split(/\\s*,\\s*/)\n \n info = {}\n\n # General account info\n if kind.include?(\"account\")\n info[:account] = {\n :domain => current_account.full_domain,\n :venue_name => current_account.venue_name, \n :venue_address => current_account.venue_address, \n :venue_type => current_account.venue_type, \n :venue_type_other => current_account.venue_type_other,\n :on_hold => current_account.on_hold\n }\n end\n \n # Offers\n if kind.include?(\"offers\")\n info[:offers] = current_account.offers.map do |o|\n { :id => o.id,\n :name => o.name,\n :text => o.text,\n :details => o.details }\n end\n end\n \n # Message format\n if kind.include?(\"messages\")\n info[:messages] = {\n :conf_message => current_account.conf_message,\n :conf_prepend_venue => current_account.conf_prepend_venue,\n :page_message => current_account.page_message,\n :page_prepend_venue => current_account.page_prepend_venue,\n :offer_id => current_account.offer_id\n }\n end\n \n if kind.include?(\"locations\")\n info[:locations] = current_account.locations.map do |l|\n { :id => l.id,\n :name => l.name,\n :internal_id => l.internal_id }\n end\n end\n \n if kind.include?(\"usage\")\n info[:usage] = usage_info\n end\n \n render :text => info.to_json\n end", "def business_plan_params\n params.require(:business_plan).permit(:title, :ownership, :start_plan, :location, :organization_structure, :management_team, :team_gaps, :personnel_plan, :product_desc, :sourcing_and_fulfillment, :technology_used, :expansion_plan, :value_prop, :competitive_advantage, :positioning_statement, :pricing_strategy, :general_promo_strat, :distro_patterns, :sales_strat, :sales_programs, :strategic_partner, :milestone, :segmentation_strategy, :market_needs, :market_trends, :market_growth_potential, :industry_analysis, :industry_participants, :distro_patterns, :buying_patterns, :financial_assumptions, :financial_indicators, :pandl, :cash_flow, :balance_sheet, :long_term)\n end", "def json_format\n object.to_json(\n only: [:id, :title, :key_information, :description],\n methods: [:photo_url, :net_mrp, :mrp_per_unit],\n :include => {\n store: {\n only: [:name, :id],\n methods: [:full_address, :logo_url, :store_rating, :store_distance]\n }\n }\n )\n end", "def show\n @plantype = Plantype.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plantype }\n end\n end", "def hash\n [sales_activity, service_team, company_team, workflow, status_workflow, service_template, opportunity, sales_team, project_manager, knowledge_baseb_article, my_company_president_role, my_company_coo_role, my_company_controller_role, my_company_dispatch_role, my_company_service_manager_role, my_company_duty_manager_role, department_manager, dispatch_member, service_manager, duty_manager, delete_open_time_sheets_flag].hash\n end", "def site_plan_params\n params.require(:site_plan).permit(:product_id, :image)\n end", "def to_s\n %{company name: #@name\n address: #@address\n city: #@city\n state abbrev (for US & CA only): #@state_abbrev\n state: #@state\n country: #@country\n zip: #@zip\n phone: #@phone\n vat_num: #@vat_num\n secruity: #@security}\n end", "def cabinet_transport_params\n permitted = Transport.globalize_attribute_names + [\n :gis_type_name,\n :status,\n :map_layer_id,\n :transport_type_id,\n geo_json_attributes: %i[id geo_type position]\n ]\n params.require(:transport).permit(permitted)\n end", "def to_s\n %{#{super}\n reseller type: #@reseller_type\n reseller quota: #@reseller_quota\n reseller add-on quota: #@reseller_add_on_quota\n has server plan: #@has_server_plan\n has stash grant plan: #@has_stash_grant_plan}\n end", "def community_params\n params.require(:community).permit([:screen_name, :monitor_members, :disabled])\n end", "def new\n @plan = Plan.new\nend", "def call\n result[:plan_features] = plan.features\n end", "def hash\n [id, project_id, description, board, status, agreement, opportunity, parent_phase, wbs_code, bill_time, bill_expenses, bill_products, mark_as_milestone_flag, notes, deadline_date, bill_separately_flag, billing_method, scheduled_hours, scheduled_start, scheduled_end, actual_hours, actual_start, actual_end, budget_hours, location_id, business_unit_id, hourly_rate, billing_start_date, bill_phase_closed_flag, bill_project_closed_flag, downpayment, po_number, po_amount, estimated_time_cost, estimated_expense_cost, estimated_product_cost, estimated_time_revenue, estimated_expense_revenue, estimated_product_revenue, currency, bill_to_company, bill_to_contact, bill_to_site, ship_to_company, ship_to_contact, ship_to_site, _info].hash\n end", "def buy_plan_params\n params.fetch(:buy_plan, {})\n end", "def contract_params\n params.require(:contract).permit(:origin_id, :entity_id, :mode_id, :control_number, :publication_number, :description, :status_id, :contracted_amount_cents, :contracted_amount_currency, :publication_date, :presentation_date, :contact, :warranty, :specification_price, :aclaration_date, :granted_date, :abandonment_date, :region_id, :regulation_id)\n end" ]
[ "0.6311829", "0.5731611", "0.5377128", "0.5279702", "0.5257567", "0.52156913", "0.5193629", "0.51771855", "0.5172494", "0.5156871", "0.5121325", "0.5119473", "0.511445", "0.5104381", "0.5090695", "0.50836575", "0.506335", "0.50598586", "0.50523263", "0.5048519", "0.5013052", "0.5005976", "0.5005496", "0.5002147", "0.49944726", "0.49874002", "0.4987242", "0.49771312", "0.49622154", "0.49605024", "0.49526912", "0.49524456", "0.4947139", "0.4944076", "0.4939028", "0.49310157", "0.49310157", "0.49262336", "0.49253938", "0.49154237", "0.4911005", "0.4907992", "0.49008128", "0.48889494", "0.48879886", "0.4868397", "0.48657292", "0.48632815", "0.4862966", "0.48531857", "0.48488602", "0.48441836", "0.48338816", "0.48326525", "0.48294476", "0.4822159", "0.48182935", "0.48137063", "0.48099837", "0.48098943", "0.4807376", "0.48052573", "0.48008132", "0.47975838", "0.47961342", "0.47915322", "0.47883546", "0.47872564", "0.4783043", "0.47798535", "0.47797522", "0.4766098", "0.47628817", "0.47546056", "0.4751158", "0.4750666", "0.4750646", "0.47443953", "0.4743205", "0.4736824", "0.47291198", "0.47240624", "0.4722153", "0.47215337", "0.47146833", "0.47027823", "0.47022524", "0.46979633", "0.46952832", "0.46938848", "0.46844172", "0.46827522", "0.46729496", "0.46635094", "0.4662344", "0.4658959", "0.4655177", "0.46549278", "0.4648213", "0.4644518" ]
0.64264363
0
GET /private_album_images GET /private_album_images.json
def index @private_album_images = PrivateAlbumImage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def index\n @images = @album.images.all\n end", "def set_private_album_image\n @private_album_image = PrivateAlbumImage.find(params[:id])\n end", "def index\n @private_albums = PrivateAlbum.all\n end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def image\n\t\t@image ||= Image.joins(:album)\n .where(id: params[:id], :albums => {:user_id => user_id})\n .take || halt(404)\n\tend", "def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end", "def show\n album = Album.includes(:album_images).find(params[:id])\n return_hash = album.attributes\n return_hash['album_images'] = album.album_images\n render json: return_hash\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def index\n @pictures = @album.pictures.all\n end", "def list\n @api.get(\"#{@api.path}/Images\")\n end", "def load_album_photos\n # @pictures = Picture.paginate(:page => params[:page], :per_page => 5)\n @curr_album = Album.find(params[:id])\n @pictures = @curr_album.shared_pictures(@login_user.id,params[:page].to_i)\n end", "def show\n @images = @galleries_album.galleries\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def show\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @picture}\n end\n end", "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end", "def fetch_album_images(set_albumName, params = {})\n params = { :cmd => 'fetch-album-images', :set_albumName => set_albumName }.merge(params)\n send_request(params)\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def show\n if !session[:access_token]\n redirect_to :controller => 'sessions', :action => 'connect'\n end\n\n pmocampo = \"30792403\"\n client = Instagram.client(:access_token => session[:access_token])\n \n @user = client.user(pmocampo)\n \n @album = Album.find(params[:id])\n @photos = client.user_recent_media(pmocampo)\n @photos = @photos.select {|p| p.tags.include?(@album.tag)}\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def album_photos\n \n if album\n album.photos\n else\n []\n end\n \n end", "def index\n params[:tag] ? @photos = Photo.tagged_with(params[:tag]) : @photos = Photo.all\n album = params[:album_id]\n @photos = current_user.photos.all.where(album_id: album).with_attached_pictures\n\n end", "def images\n @images ||= Image.find_all_by_listing_id(listing_id, oauth)\n end", "def get_images\n {}\n end", "def images(artist, options={})\n get(:standard, {:method => \"artist.getImages\", :artist => artist}.merge(options))\n end", "def images\n if @group.is_member?(@user)\n @images = @group.uploads.images.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n else\n @images = @group.uploads.images.public.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n end\n respond_to do |format|\n format.js { render :json => basic_uploads_json(@images) }\n end\n end", "def photos(args = {})\r\n return Net::Flickr.instance().photos.get_public_photos(@id, args)\r\n end", "def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def private_gallery\n if !session[:user_id].nil?\n #get friends\n @photos = Photo.joins(\"INNER JOIN users ON users.id= photos.user_id INNER JOIN friends ON users.id = friends.id_two \").where(\"id_one= ? AND photos.is_private = true AND friends.relationship =1 \",session[:user_id].to_s)\n #get their photos\n\n else\n raise ActionController::RoutingError.new('Not Found')\n \n end\n \n end", "def get_photos\n tag = [\"urbanlandscape\",\"architecture\",\"buildings\",\"archidaily\"].sample\n return_hash = HTTParty.get(\"https://api.instagram.com/v1/tags/#{tag}/media/recent?client_id=#{INSTAGRAM_CLIENT_ID}\")\n @instagram_photos = [return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"], return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"],return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"],\n return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"]]\n end", "def show\n @picture = @album.pictures.find(params[:id])\n end", "def album\n @album ||= Album.includes(:images, :poster_image)\n .where(id: params[:id], user_id: user_id)\n .take || halt(404)\n\tend", "def images()\n\t\treturn Images.new(@credentials.client_key, @credentials.get_access_token)\n\tend", "def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end", "def photos(id, group = 'checkin', options = {})\n get(\"venues/#{id}/photos\", {:group => group }.merge(options)).photos\n end", "def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end", "def images_for_gallery gallery_id, info_level = \"Full\", include_photos = \"true\"\n\t\t\t@response = api_request 'LoadPhotoSet', [gallery_id, info_level, include_photos]\n\t\t\traise ZenfolioAPI::ZenfolioAPISessionError, @response['error']['message'] if @response['result'].nil? && @response['error'].length > 0\n\n\t\t\t@response['result']['Photos'].each do |value|\n\t\t\t\taccess_descriptor = ZenfolioAPI::Model::AccessDescriptor.new(:realm_id => value['AccessDescriptor']['RealmId'], \n\t\t\t\t\t:access_type => value['AccessDescriptor']['AccessType'], :is_derived => value['AccessDescriptor']['IsDerived'], \n\t\t\t\t\t:access_mask => value['AccessDescriptor']['AccessMask'], :password_hint => value['AccessDescriptor']['PasswordHint'], \n\t\t\t\t\t:src_password_hint => value['AccessDescriptor']['SrcPasswordHint'])\n\n\t\t\t\t@photos << ZenfolioAPI::Model::Image.new(:id => value['Id'], :width => value['Width'], :height => value['Height'], :sequence => value['Sequence'], \n\t\t\t\t\t:access_descriptor => access_descriptor, :owner => value['Owner'], :title => value['Title'], :mime_type => value['MimeType'], \n\t\t\t\t\t:size => value['Size'], :gallery => value['Gallery'], :original_url => value['OriginalUrl'], :url_core => value['UrlCore'], \n\t\t\t\t\t:url_host => value['UrlHost'], :url_token => value['UrlToken'], :page_url => value['PageUrl'], :mailbox_id => value['MailboxId'], \n\t\t\t\t\t:text_cn => value['TextCn'], :flags => value['Flags'], :is_video => value['IsVideo'], :duration => value['Duration'], :caption => value['Caption'], \n\t\t\t\t\t:file_name => value['FileName'], :uploaded_on => value['UploadedOn']['Value'], :taken_on => value['TakenOn']['Value'], :keywords => value['keywords'], \n\t\t\t\t\t:categories => value['Categories'], :copyright => value['Copyright'], :rotation => value['Rotation'], :exif_tags => value['ExifTags'], :short_exif => value['ShortExif'])\n\t\t\tend\n\n\t\t\t@photos\n\t\tend", "def show\n @photos = Photo.where('album_id' => params[:id]).paginate(:page => params[:page], :per_page => 20)\n end", "def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end", "def _state_photos(state_id)\n get('state/photos', state_id, options: { type: :array })\n end", "def get_flickr_pics (photoset)\n\n api_key = '0dd1537c46575cf8b7b2a2df94156fd9'\n method = 'flickr.photosets.getPhotos'\n format = 'json'\n\n #for testing\n user_id = '128529405@N05'\n photoset_id = '72157648179656437' #ladder pics\n\n base_url = 'https://api.flickr.com/services/rest/'\n\n response = RestClient.get base_url, {\n :params => {\n 'api_key' => api_key,\n 'photoset_id' => photoset,\n 'method' => method,\n 'format' => format,\n 'nojsoncallback' => 1,\n 'extras' => 'original_format'\n }\n }\n\n return response\n\n end", "def set_private_album\n @private_album = PrivateAlbum.find(params[:id])\n end", "def images\n do_client.images.all.select do |image|\n image.public == false && image.type.casecmp('snapshot').zero?\n end.sort_by(&:id).reverse\n rescue DropletKit::Error => e\n e\n end", "def get_all_images(env)\n images_json = get(env, \"#{@session.endpoints[:image]}/images\")\n images = JSON.parse(images_json)['images']\n\n return images if images.empty?\n\n is_v1 = false\n unless images[0].key? 'visibility'\n is_v1 = true\n images_json = get(env, \"#{@session.endpoints[:image]}/images/detail\")\n images = JSON.parse(images_json)['images']\n end\n\n images.map do |i|\n i['visibility'] = i['is_public'] ? 'public' : 'private' if is_v1\n Image.new(i['id'], i['name'], i['visibility'], i['size'], i['min_ram'], i['min_disk'])\n end\n end", "def images\n []\n end", "def list_all_private_images(filter = {})\n storage_accounts = list_all(filter.merge(:skip_accessors_definition => true))\n get_private_images(storage_accounts)\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def index\n @pictures = @museum.pictures.all #Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n id = (params[:id].to_i || 0) * 8\n @pictures = current_user.pictures.limit(8).offset(id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def show\n @album = Album.find(params[:id]) \n @album_images = Image.where(:album_id => @album.id).order(\"mark DESC\").page(params[:page])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post.to_xml(:include => :images) }\n format.json { render :json => @post.to_json(:include => :images) }\n end\n end", "def index\n @album_photos = AlbumPhoto.all\n end", "def show\n\n @picture = Picture.find(params[:id])\n @activity = @picture.album.imageable\n\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @picture }\n end\n end", "def get_gallery(username: nil, folderid: nil, mode: nil, offset: 0, limit: 10)\n params = {}\n params['username'] = username unless username.nil?\n params['mode'] = mode unless mode.nil?\n params['offset'] = offset if offset != 0\n params['limit'] = limit if limit != 10\n unless folderid.nil?\n path = \"/api/v1/oauth2/gallery/#{folderid}\"\n else\n path = '/api/v1/oauth2/gallery/'\n end\n perform(DeviantArt::Gallery, :get, path, params)\n end", "def album\n # @friend_id = params[:object_id] unless (params[:object_id] == 'null' || params[:object_id].blank?)\n # if @friend_id\n # friend_data = current_user.picasa_client.user(@friend_id)\n # @friend_name = friend_data.author.name \n # end\n per_page = (params[:limit] ? params[:limit].to_i : 10)\n search_params = {\n albumId: params[:id],\n pageSize: per_page\n }\n if params[:page_token]\n search_params[:pageToken] = params[:page_token]\n end\n goog = GooglePhotosApi.new( current_user.picasa_identity.token )\n @photos = PicasaPhoto.picasa_request_with_refresh( current_user.picasa_identity ) do\n r = goog.search( search_params )\n @next_page_token = r[\"nextPageToken\"]\n Rails.logger.debug \"[DEBUG] r: #{r}\"\n (r[\"mediaItems\"] || []).map{|mi| PicasaPhoto.new_from_api_response( mi ) }\n end\n # @photos = PicasaPhoto.get_photos_from_album(current_user, params[:id], search_params) \n @synclink_base = params[:synclink_base] unless params[:synclink_base].blank?\n respond_to do |format|\n format.html do\n render :partial => 'photos/photo_list_form', \n :locals => {\n :photos => @photos, \n :index => params[:index],\n :synclink_base => nil, \n :local_photos => false,\n :organized_by_album => true\n }\n end\n end\n end", "def get_gallery\r\n\t\t\timages = ProjectImage.where(project_id: params[:id]).reorder('\"order\" asc')\r\n\r\n\t\t\trender json: { status: 0, result: images.map { |image| { id: image.id, small: image.image.url(:thumb), original: image.image.url, description: image.description } } }\r\n\t\tend", "def show\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def private_album_image_params\n params.require(:private_album_image).permit(:ImageID, :AlbumID)\n end", "def get_albums(person_id, params={})\n @restv9.get_albums(person_id,params)\n end", "def urls( options =nil )\n json = request 'images.getURLs', options, :ImageID => image_id, :ImageKey => key\n \n image = upper_hash_to_lower_hash( json['Image'] )\n image.merge!( :image_id => image[\"id\"] )\n \n OpenStruct.new( image ) \n end", "def show\n authorize @album\n @page = (params[:page] || 1).to_i\n @category = params[:category] || \"all\"\n if @category == \"all\"\n @photos = @album.photos.ordered_by_category\n .ordered_reverse_chronologically_by_created_at\n .page(@page)\n .per(18)\n elsif Photo.categories.keys.include? @category\n @photos = @album.photos.where(category: Photo.categories[@category])\n .ordered_by_category\n .ordered_reverse_chronologically_by_created_at\n .page(@page)\n .per(18)\n else\n @photos = []\n end\n end", "def list_images\n if params[:page].to_s.to_i > 1000\n render(\n status: :too_many_requests,\n content_type: \"text/plain\",\n plain: \"Your queries are killing our server. \" \\\n \"There are much better ways to scrape the images \" \\\n \"from our site. \" \\\n \"Please contact the webmaster.\" \\\n \"And please stop hammering our server!\"\n )\n return\n end\n\n query = create_query(:Image, :all, by: :created_at)\n show_selected_images(query)\n end", "def group_album\n @discussion_group = DiscussionGroup.find(params[:id])\n if @login_user.is_member_of_discussion_group(params[:id].to_i) || @discussion_group.is_public\n @pictures = Image.find_by_sql([\"SELECT DISTINCT i.* FROM discussion_group_discussions dgd\n\t\t\t\t\t LEFT JOIN discussions d on dgd.discussion_id = d.id\n\t\t\t\t\t LEFT JOIN comments c on dgd.discussion_id = c.discussion_id\n\t\t\t\t\t LEFT JOIN images i ON (imageable_id = dgd.id AND imageable_type = 'DiscussionGroup')\n\t\t\t\t\t OR (imageable_id = d.id AND imageable_type = 'Discussion')\n\t\t\t\t\t OR (imageable_id = c.id AND imageable_type = 'Comment')\n \t\t\t\t\tWHERE i.id IS NOT NULL AND dgd.discussion_group_id =? \",params[:id].to_i])\n else\n redirect_to @login_user.profile_path\n end\n end", "def index\n @images = Image.all\n\n render json: @images\n end", "def album\n album = Album.find(params[:id])\n render json: album\n end", "def list_private_images(group = configuration.resource_group)\n storage_accounts = list(group, true)\n get_private_images(storage_accounts)\n end", "def photos(album, options={})\n # Multiquery for photos info + tags\n photos = []\n tags = nil\n comments = nil\n \n if options[:with_tags]\n if resp = @request.do_request { session.fql_multiquery(@query.photos_multi_fql(album.id)) }\n photos = resp['query1']\n # Format tags keyed by photo id\n tags = resp['query2'].inject({}) do |result, element| \n (result[element['pid'].to_i] ||= []) << element['text']\n result\n end\n # Fetch photos' comments\n comments = get_comments(photos.map{|p| p.object_id}.uniq, :object, options)\n DaemonKit.logger.debug \"PHOTO COMMENTS = #{comments.inspect}\"\n end\n else\n photos = @request.do_request { session.get_photos(nil, nil, album.id) }\n end\n\n # We could just return photos and let the client convert them if we wanted to be\n # all general-purpose and all, but YAGNI, right?\n photos.map do |p|\n photo = FacebookProxyObjects::FacebookPhoto.new(p)\n # If tags, find tags for the photo and collect into array\n photo.tags = tags[p.id] if tags && tags[p.id]\n # If comments for this photo, save them to object\n photo.comments = comments[p.object_id] if comments && comments[p.object_id]\n DaemonKit.logger.debug \"FacebookPhoto = #{photo.inspect}\"\n photo\n end\n end", "def get_images\n images = collect_inventory(:private_images) { gather_data_for_this_region(@sas, 'list_all_private_images') }\n rescue ::Azure::Armrest::ApiException => err\n _log.warn(\"Unable to collect Azure private images for: [#{@ems.name}] - [#{@ems.id}]: #{err.message}\")\n else\n process_collection(images, :vms) { |image| parse_image(image) }\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def destroy\n @private_album_image.destroy\n respond_to do |format|\n format.html { redirect_to private_album_images_url }\n format.json { head :no_content }\n end\n end", "def set_album\n @album = Pagealbum.find(params[:id]) rescue Pagealbum.new\n @images=[]\n end", "def get_public_photos(user_id, args = {})\r\n args['user_id'] = user_id\r\n PhotoList.new('flickr.people.getPublicPhotos', args)\r\n end", "def index\n @photos = get_possible_photos\n paginate json: @photos, per_page: 10\n end", "def index\n session_guest.hit_logger(\"photo\")\n @photos = Photo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def index\n render json: Picture.all\n end", "def get_album album_id\n get(\"/albums/#{album_id}\")\n end", "def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def index\n @images = @owner.images\n end", "def show\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album2photo }\n end\n end", "def show\n render json: @picture, status: :ok\n end", "def index\n\t\t@images = current_user.images\n\tend", "def index\n @photos = @allbum.photos\n end", "def get_instagram_photos(location_id)\n return_hash = HTTParty.get(\"https://api.instagram.com/v1/locations/#{location_id}/media/recent?client_id=#{INSTAGRAM_CLIENT_ID}\")\n @instagram_photos = [return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"], return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"],return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"]]\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end", "def show\n #get the user with the url\n @user = User.find(params[:id])\n\n #check if user is the one logged in\n if session[:user_id].to_s == params[:id]\n #then show all his pictures\n @photos = @user.photos\n else\n #show only public pictures\n @photos = @user.photos.where(\"is_private = false\")\n end\n\n end", "def index\n @pictures = current_user.pictures.all\n end", "def rover_images(roverName, **parameters)\n uri = URI(\"#{@rover_url}#{roverName}/photos.html\")\n parameters[:api_key] = @api_key\n uri.query = URI.encode_www_form(parameters)\n response = Net::HTTP.get_response(uri)\n\n return [] unless response.is_a?(Net::HTTPSuccess) # if requests fails, returns empty array\n\n JSON.parse(response.body)['photos']\n end", "def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end", "def room_images(request)\n room_images = RoomImage.select(\n :id,\n :pos_x,\n :pos_y,\n :width,\n :height,\n :blob_id\n ).where(escape_room_id: request.escape_room_id)\n\n return GetRoomImagesResponse.new(false, 'Could not get rooms', nil) if room_images.nil?\n\n user = User.find_by_id(EscapeRoom.find_by_id(request.escape_room_id).user_id)\n data = room_images.map do |k|\n blob_url = if (k.blob_id != 0) && !ActiveStorageBlobs.find_by_id(k.blob_id).nil?\n Rails.application.routes.url_helpers.polymorphic_url(\n user.graphic.blobs.find_by_id(k.blob_id), host: ENV.fetch('BLOB_HOST', 'localhost:3000')\n )\n else\n './assets/images/room1.png'\n end\n { room_image: k,\n src: blob_url }\n end\n GetRoomImagesResponse.new(true, 'Room Images Obtained', data)\n rescue StandardError\n GetRoomImagesResponse.new(false, 'Could not get room images', nil)\n end", "def index\n @gallery_photos = Gallery.find(params[:gallery_id]).photos\n end", "def index\n @photo_albums = PhotoAlbum.all\n @fan_albums = FanPhotoAlbum.not_private\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photo_albums }\n end\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def get_albums(url)\n # should return albums\n # List of Hashes\n \n # must implement \n # - custom site parser\n end", "def index\n @albums = Album.all\n @photos = Photo.find(:all, :order => \"ordering\")\n #@photos = Photo.all\n #Dir.entries(\"app/assets/images/gallery/\").each do |entry|\n # if entry =~ /\\d+\\.jpg/\n # @photos << Photo.new(:mainfile=>\"/assets/gallery/\" + entry,:thumbfile => \"/assets/gallery/\" + entry.gsub(/\\.jpg/,'') + \"_thumb.jpg\" )\n # end\n #end\n if @photos.length == 0\n #redirect_to url_for([:uploader,:admin,:photo])\n redirect_to admin_photos_uploader_url\n else\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end\n\n end", "def images\n images = []\n JSON.parse(resource['/offerings/image'].get)[\"images\"].each do |img|\n images << Image.new(img)\n end\n return images\n end", "def index\n @img_lists = ImgList.all\n render json: @img_lists\n end", "def photos( options = {} )\n Photo.api_query( 'photosets.getPhotos', @client, options.merge(:photoset_id => id) )\n end", "def picasa_albums(options = {})\n return [] unless current_user.has_provider_auth('google')\n PicasaPhoto.picasa_request_with_refresh(current_user.picasa_identity) do\n goog = GooglePhotosApi.new( current_user.picasa_identity.token )\n goog.albums[\"albums\"]\n end\n end" ]
[ "0.7502345", "0.7087396", "0.7041099", "0.69735765", "0.69724345", "0.69284165", "0.69117075", "0.68325365", "0.68223506", "0.67660177", "0.6761047", "0.67549884", "0.6751878", "0.6743444", "0.6694305", "0.6693801", "0.66898006", "0.66894794", "0.6686694", "0.6685078", "0.66734684", "0.66233426", "0.66224295", "0.6618175", "0.65486777", "0.654491", "0.6524711", "0.6505631", "0.64995146", "0.6499371", "0.6471541", "0.64713883", "0.6466525", "0.6456864", "0.6456291", "0.64322996", "0.6417917", "0.6386902", "0.63798225", "0.6373105", "0.6360068", "0.63361084", "0.6321061", "0.6315723", "0.63148427", "0.63122165", "0.6297689", "0.629605", "0.62790006", "0.6277347", "0.62743634", "0.6273145", "0.6249765", "0.62460977", "0.6245472", "0.62449175", "0.6240899", "0.6235734", "0.62292564", "0.621788", "0.62163824", "0.62151915", "0.6213523", "0.6211627", "0.62007886", "0.61994326", "0.6198482", "0.6194787", "0.6190566", "0.61888826", "0.6186492", "0.6184053", "0.61700654", "0.61600757", "0.6154948", "0.61456454", "0.61405057", "0.61276263", "0.612476", "0.6117669", "0.61080843", "0.61044765", "0.60987896", "0.6094907", "0.60943115", "0.60917026", "0.6088027", "0.608395", "0.6076501", "0.6074082", "0.60684603", "0.6065617", "0.6059777", "0.6057624", "0.6057427", "0.60567796", "0.6049403", "0.60400474", "0.6038132", "0.6035138" ]
0.7814888
0
GET /private_album_images/1 GET /private_album_images/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @private_album_images = PrivateAlbumImage.all\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def image\n\t\t@image ||= Image.joins(:album)\n .where(id: params[:id], :albums => {:user_id => user_id})\n .take || halt(404)\n\tend", "def show\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @picture}\n end\n end", "def index\n @images = @album.images.all\n end", "def show\n album = Album.includes(:album_images).find(params[:id])\n return_hash = album.attributes\n return_hash['album_images'] = album.album_images\n render json: return_hash\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def set_private_album_image\n @private_album_image = PrivateAlbumImage.find(params[:id])\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def show\n if !session[:access_token]\n redirect_to :controller => 'sessions', :action => 'connect'\n end\n\n pmocampo = \"30792403\"\n client = Instagram.client(:access_token => session[:access_token])\n \n @user = client.user(pmocampo)\n \n @album = Album.find(params[:id])\n @photos = client.user_recent_media(pmocampo)\n @photos = @photos.select {|p| p.tags.include?(@album.tag)}\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @picture = @album.pictures.find(params[:id])\n end", "def index\n @pictures = @album.pictures.all\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end", "def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end", "def show\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def album\n @album ||= Album.includes(:images, :poster_image)\n .where(id: params[:id], user_id: user_id)\n .take || halt(404)\n\tend", "def show\n @images = @galleries_album.galleries\n end", "def index\n @private_albums = PrivateAlbum.all\n end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def load_album_photos\n # @pictures = Picture.paginate(:page => params[:page], :per_page => 5)\n @curr_album = Album.find(params[:id])\n @pictures = @curr_album.shared_pictures(@login_user.id,params[:page].to_i)\n end", "def album\n album = Album.find(params[:id])\n render json: album\n end", "def fetch_album_images(set_albumName, params = {})\n params = { :cmd => 'fetch-album-images', :set_albumName => set_albumName }.merge(params)\n send_request(params)\n end", "def list\n @api.get(\"#{@api.path}/Images\")\n end", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def show\n\n @picture = Picture.find(params[:id])\n @activity = @picture.album.imageable\n\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @picture }\n end\n end", "def show\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album2photo }\n end\n end", "def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend", "def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def get_album album_id\n get(\"/albums/#{album_id}\")\n end", "def show\n @photos = Photo.where('album_id' => params[:id]).paginate(:page => params[:page], :per_page => 20)\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end", "def index\n id = (params[:id].to_i || 0) * 8\n @pictures = current_user.pictures.limit(8).offset(id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n @album = Album.find(params[:id]) \n @album_images = Image.where(:album_id => @album.id).order(\"mark DESC\").page(params[:page])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post.to_xml(:include => :images) }\n format.json { render :json => @post.to_json(:include => :images) }\n end\n end", "def index\n params[:tag] ? @photos = Photo.tagged_with(params[:tag]) : @photos = Photo.all\n album = params[:album_id]\n @photos = current_user.photos.all.where(album_id: album).with_attached_pictures\n\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def show\n render json: @picture, status: :ok\n end", "def show\n # Pull the selected photo album.\n @photo_tag = PhotoTag.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @photo_tag\n end\n end\n end", "def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagem }\n end\n end", "def show\r\n @photo = Photo.find(params[:id])\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end", "def get_images\n {}\n end", "def get_gallery\r\n\t\t\timages = ProjectImage.where(project_id: params[:id]).reorder('\"order\" asc')\r\n\r\n\t\t\trender json: { status: 0, result: images.map { |image| { id: image.id, small: image.image.url(:thumb), original: image.image.url, description: image.description } } }\r\n\t\tend", "def album_photos\n \n if album\n album.photos\n else\n []\n end\n \n end", "def index\n @images = Image.all\n\n render json: @images\n end", "def index\n @pictures = @museum.pictures.all #Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def get_photos\n tag = [\"urbanlandscape\",\"architecture\",\"buildings\",\"archidaily\"].sample\n return_hash = HTTParty.get(\"https://api.instagram.com/v1/tags/#{tag}/media/recent?client_id=#{INSTAGRAM_CLIENT_ID}\")\n @instagram_photos = [return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"], return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"],return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"],\n return_hash[\"data\"].sample[\"images\"][\"low_resolution\"][\"url\"]]\n end", "def album\n # @friend_id = params[:object_id] unless (params[:object_id] == 'null' || params[:object_id].blank?)\n # if @friend_id\n # friend_data = current_user.picasa_client.user(@friend_id)\n # @friend_name = friend_data.author.name \n # end\n per_page = (params[:limit] ? params[:limit].to_i : 10)\n search_params = {\n albumId: params[:id],\n pageSize: per_page\n }\n if params[:page_token]\n search_params[:pageToken] = params[:page_token]\n end\n goog = GooglePhotosApi.new( current_user.picasa_identity.token )\n @photos = PicasaPhoto.picasa_request_with_refresh( current_user.picasa_identity ) do\n r = goog.search( search_params )\n @next_page_token = r[\"nextPageToken\"]\n Rails.logger.debug \"[DEBUG] r: #{r}\"\n (r[\"mediaItems\"] || []).map{|mi| PicasaPhoto.new_from_api_response( mi ) }\n end\n # @photos = PicasaPhoto.get_photos_from_album(current_user, params[:id], search_params) \n @synclink_base = params[:synclink_base] unless params[:synclink_base].blank?\n respond_to do |format|\n format.html do\n render :partial => 'photos/photo_list_form', \n :locals => {\n :photos => @photos, \n :index => params[:index],\n :synclink_base => nil, \n :local_photos => false,\n :organized_by_album => true\n }\n end\n end\n end", "def get_flickr_pics (photoset)\n\n api_key = '0dd1537c46575cf8b7b2a2df94156fd9'\n method = 'flickr.photosets.getPhotos'\n format = 'json'\n\n #for testing\n user_id = '128529405@N05'\n photoset_id = '72157648179656437' #ladder pics\n\n base_url = 'https://api.flickr.com/services/rest/'\n\n response = RestClient.get base_url, {\n :params => {\n 'api_key' => api_key,\n 'photoset_id' => photoset,\n 'method' => method,\n 'format' => format,\n 'nojsoncallback' => 1,\n 'extras' => 'original_format'\n }\n }\n\n return response\n\n end", "def images\n @images ||= Image.find_all_by_listing_id(listing_id, oauth)\n end", "def index\n render json: Picture.all\n end", "def show\n #@picture = Picture.find(params[:id])\n @picture = @museum.pictures.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @picture }\n end\n end", "def show\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_gallery }\n end\n end", "def images\n if @group.is_member?(@user)\n @images = @group.uploads.images.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n else\n @images = @group.uploads.images.public.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n end\n respond_to do |format|\n format.js { render :json => basic_uploads_json(@images) }\n end\n end", "def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend", "def show\n @photoalbum = Photoalbum.find(params[:id])\n \n # temporary solution to get exif information in photos which are on the server: TODO\n @exifphotos = @photoalbum.photos.where(exif_date: nil, photo_content_type: \"image/jpeg\")\n @exifphotos.each do |p|\n if File.exists?(p.photo.path)\n exif = EXIFR::JPEG.new(p.photo.path)\n p.exif_date = exif.date_time\n if not exif.date_time.nil?\n p.save\n end\n end\n end\n\n @allphotos = @photoalbum.photos.all(:order => 'exif_date DESC, photo_file_name DESC, created_at DESC')\n @photos = @photoalbum.photos.paginate(:page => params[:page], :order => 'exif_date DESC, photo_file_name DESC, created_at DESC', :per_page => 12)\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photoalbum }\n end\n end", "def show\n render json: @picture\n end", "def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end", "def set_album\n @album = Pagealbum.find(params[:id]) rescue Pagealbum.new\n @images=[]\n end", "def index\n @album_photos = AlbumPhoto.all\n end", "def show\n @album = Album.where(id: params[:id]).first\n if @album\n render json: @album, status: 200\n else\n return_not_found \n end\n end", "def show\n authorize @album\n @page = (params[:page] || 1).to_i\n @category = params[:category] || \"all\"\n if @category == \"all\"\n @photos = @album.photos.ordered_by_category\n .ordered_reverse_chronologically_by_created_at\n .page(@page)\n .per(18)\n elsif Photo.categories.keys.include? @category\n @photos = @album.photos.where(category: Photo.categories[@category])\n .ordered_by_category\n .ordered_reverse_chronologically_by_created_at\n .page(@page)\n .per(18)\n else\n @photos = []\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def get_albums(person_id, params={})\n @restv9.get_albums(person_id,params)\n end", "def index\n @photos = @allbum.photos\n end", "def images(artist, options={})\n get(:standard, {:method => \"artist.getImages\", :artist => artist}.merge(options))\n end", "def images_for_gallery gallery_id, info_level = \"Full\", include_photos = \"true\"\n\t\t\t@response = api_request 'LoadPhotoSet', [gallery_id, info_level, include_photos]\n\t\t\traise ZenfolioAPI::ZenfolioAPISessionError, @response['error']['message'] if @response['result'].nil? && @response['error'].length > 0\n\n\t\t\t@response['result']['Photos'].each do |value|\n\t\t\t\taccess_descriptor = ZenfolioAPI::Model::AccessDescriptor.new(:realm_id => value['AccessDescriptor']['RealmId'], \n\t\t\t\t\t:access_type => value['AccessDescriptor']['AccessType'], :is_derived => value['AccessDescriptor']['IsDerived'], \n\t\t\t\t\t:access_mask => value['AccessDescriptor']['AccessMask'], :password_hint => value['AccessDescriptor']['PasswordHint'], \n\t\t\t\t\t:src_password_hint => value['AccessDescriptor']['SrcPasswordHint'])\n\n\t\t\t\t@photos << ZenfolioAPI::Model::Image.new(:id => value['Id'], :width => value['Width'], :height => value['Height'], :sequence => value['Sequence'], \n\t\t\t\t\t:access_descriptor => access_descriptor, :owner => value['Owner'], :title => value['Title'], :mime_type => value['MimeType'], \n\t\t\t\t\t:size => value['Size'], :gallery => value['Gallery'], :original_url => value['OriginalUrl'], :url_core => value['UrlCore'], \n\t\t\t\t\t:url_host => value['UrlHost'], :url_token => value['UrlToken'], :page_url => value['PageUrl'], :mailbox_id => value['MailboxId'], \n\t\t\t\t\t:text_cn => value['TextCn'], :flags => value['Flags'], :is_video => value['IsVideo'], :duration => value['Duration'], :caption => value['Caption'], \n\t\t\t\t\t:file_name => value['FileName'], :uploaded_on => value['UploadedOn']['Value'], :taken_on => value['TakenOn']['Value'], :keywords => value['keywords'], \n\t\t\t\t\t:categories => value['Categories'], :copyright => value['Copyright'], :rotation => value['Rotation'], :exif_tags => value['ExifTags'], :short_exif => value['ShortExif'])\n\t\t\tend\n\n\t\t\t@photos\n\t\tend", "def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def index\n @albums = Album.all\n @photos = Photo.find(:all, :order => \"ordering\")\n #@photos = Photo.all\n #Dir.entries(\"app/assets/images/gallery/\").each do |entry|\n # if entry =~ /\\d+\\.jpg/\n # @photos << Photo.new(:mainfile=>\"/assets/gallery/\" + entry,:thumbfile => \"/assets/gallery/\" + entry.gsub(/\\.jpg/,'') + \"_thumb.jpg\" )\n # end\n #end\n if @photos.length == 0\n #redirect_to url_for([:uploader,:admin,:photo])\n redirect_to admin_photos_uploader_url\n else\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end\n\n end", "def new\n @photo = Photo.new\n @albums = Album.where('user_id=?',session[:user_id]).latest\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def destroy\n @private_album_image.destroy\n respond_to do |format|\n format.html { redirect_to private_album_images_url }\n format.json { head :no_content }\n end\n end", "def set_private_album\n @private_album = PrivateAlbum.find(params[:id])\n end", "def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end", "def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end", "def show\n @album = Album.find(params[:id])\n\n Dir.chdir(Rails.root)\n Dir.chdir(ALBUMS_ROOT + @album.name + \"/pictures\")\n @pictures = Dir.glob(\"*\")\n\n @page_results = @pictures.paginate(:page=>params['page'], :per_page => 4)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @album }\n end\n end", "def show\n @image_group = ImageGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_group }\n end\n end", "def set_album\n @image = Album.find(params[:album_id])\n end", "def show\n @user = User.find(params[:id])\n @pic = Pic.new\n \n \n @pics = Pic.where(\"user_id = ?\", session[:user_id]).limit(3).order(\"created_at DESC\")\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user }\n end\n end", "def show\n @album_photo = AlbumPhoto.find_by(id: 3)\n end", "def index\n @images = @owner.images\n end", "def photos(args = {})\r\n return Net::Flickr.instance().photos.get_public_photos(@id, args)\r\n end", "def index\r\n @photos = Photo.all\r\n\r\n @albums = Album.all\r\n @albums_map = {}\r\n @albums.each do |album| \r\n @albums_map[album.TITLE] = album.ID\r\n end\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end", "def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "def get_all_images(env)\n images_json = get(env, \"#{@session.endpoints[:image]}/images\")\n images = JSON.parse(images_json)['images']\n\n return images if images.empty?\n\n is_v1 = false\n unless images[0].key? 'visibility'\n is_v1 = true\n images_json = get(env, \"#{@session.endpoints[:image]}/images/detail\")\n images = JSON.parse(images_json)['images']\n end\n\n images.map do |i|\n i['visibility'] = i['is_public'] ? 'public' : 'private' if is_v1\n Image.new(i['id'], i['name'], i['visibility'], i['size'], i['min_ram'], i['min_disk'])\n end\n end", "def images()\n\t\treturn Images.new(@credentials.client_key, @credentials.get_access_token)\n\tend", "def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end", "def index\n session_guest.hit_logger(\"photo\")\n @photos = Photo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def get_gallery(username: nil, folderid: nil, mode: nil, offset: 0, limit: 10)\n params = {}\n params['username'] = username unless username.nil?\n params['mode'] = mode unless mode.nil?\n params['offset'] = offset if offset != 0\n params['limit'] = limit if limit != 10\n unless folderid.nil?\n path = \"/api/v1/oauth2/gallery/#{folderid}\"\n else\n path = '/api/v1/oauth2/gallery/'\n end\n perform(DeviantArt::Gallery, :get, path, params)\n end", "def index\n @gallery_photos = Gallery.find(params[:gallery_id]).photos\n end", "def show\n @album = Album.find(params[:id])\n @photos = Photo.where(\"album_id = #{@album.id}\").paginate(:per_page => 18, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @album }\n end\n end", "def show\n @image = Image.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def _state_photos(state_id)\n get('state/photos', state_id, options: { type: :array })\n end", "def show\n @user_album = UserAlbum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_album }\n end\n end", "def album\n @friend_id = params[:object_id] unless (params[:object_id] == 'null' || params[:object_id].blank?)\n if @friend_id\n friend_data = current_user.picasa_client.user(@friend_id)\n @friend_name = friend_data.author.name \n end\n per_page = (params[:limit] ? params[:limit].to_i : 10)\n search_params = {\n :max_results => per_page,\n :start_index => ((params[:page] || 1).to_i * per_page - per_page + 1),\n :picasa_user_id => @friend_id\n }\n @photos = PicasaPhoto.get_photos_from_album(current_user, params[:id], search_params) \n @synclink_base = params[:synclink_base] unless params[:synclink_base].blank?\n respond_to do |format|\n format.html do\n render :partial => 'photos/photo_list_form', \n :locals => {\n :photos => @photos, \n :index => params[:index],\n :synclink_base => nil, \n :local_photos => false,\n :organized_by_album => true\n }\n end\n end\n end", "def album\n @friend_id = params[:object_id] unless (params[:object_id] == 'null' || params[:object_id].blank?)\n if @friend_id\n friend_data = current_user.picasa_client.user(@friend_id)\n @friend_name = friend_data.author.name \n end\n per_page = (params[:limit] ? params[:limit].to_i : 10)\n search_params = {\n :max_results => per_page,\n :start_index => ((params[:page] || 1).to_i * per_page - per_page + 1),\n :picasa_user_id => @friend_id\n }\n @photos = PicasaPhoto.get_photos_from_album(current_user, params[:id], search_params) \n @synclink_base = params[:synclink_base] unless params[:synclink_base].blank?\n respond_to do |format|\n format.html do\n render :partial => 'photos/photo_list_form', \n :locals => {\n :photos => @photos, \n :index => params[:index],\n :synclink_base => nil, \n :local_photos => false,\n :organized_by_album => true\n }\n end\n end\n end", "def index\n @img_lists = ImgList.all\n render json: @img_lists\n end" ]
[ "0.7581941", "0.7577814", "0.73701257", "0.7290138", "0.7189115", "0.71506715", "0.7049646", "0.6952008", "0.69163704", "0.6889026", "0.6867494", "0.68494093", "0.6815739", "0.6788014", "0.6750914", "0.6743128", "0.6717514", "0.671082", "0.6708647", "0.6700362", "0.6681717", "0.6678203", "0.6667074", "0.6665996", "0.66591364", "0.66553885", "0.66457796", "0.66336596", "0.6627197", "0.66125804", "0.6609475", "0.659625", "0.6543813", "0.65410537", "0.6528646", "0.6524493", "0.6515664", "0.6515664", "0.6509348", "0.6475081", "0.6472536", "0.6470164", "0.64280677", "0.6420872", "0.641738", "0.6414619", "0.6406188", "0.64041597", "0.64013505", "0.640087", "0.6399427", "0.63891584", "0.637949", "0.63712645", "0.63702255", "0.63637596", "0.63620126", "0.6355324", "0.6347167", "0.63365364", "0.6334448", "0.632218", "0.63199353", "0.6317882", "0.63143885", "0.6313983", "0.6313055", "0.6300113", "0.62961274", "0.628844", "0.6271348", "0.6268578", "0.62685436", "0.62625164", "0.62581766", "0.6255796", "0.6250115", "0.62491417", "0.6244994", "0.62446594", "0.62435424", "0.6242073", "0.6239463", "0.62373626", "0.62314755", "0.62281513", "0.62255263", "0.6223991", "0.6211935", "0.6207562", "0.62063766", "0.6197577", "0.6197559", "0.6196309", "0.6186732", "0.6181971", "0.6177242", "0.6172937", "0.6163087", "0.6163087", "0.6159977" ]
0.0
-1
POST /private_album_images POST /private_album_images.json
def create @private_album_image = PrivateAlbumImage.new(private_album_image_params) respond_to do |format| if @private_album_image.save format.html { redirect_to @private_album_image, notice: 'Private album image was successfully created.' } format.json { render action: 'show', status: :created, location: @private_album_image } else format.html { render action: 'new' } format.json { render json: @private_album_image.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n images = [params[:images]].flatten\n @album.images << Image.find(images) unless images[0].nil?\n \n if @album.save\n format.html { redirect_to(albums_path, :notice => 'Album was successfully created.') }\n format.xml { render :xml => albums_path, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n ActiveRecord::Base.transaction do\n @album = Album.create!(album_params)\n # 画像登録数が多くなるUIになったらSQLの負荷を減らすためにactiverecord-importを入れる\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end", "def album_params\n params.require(:album).permit(:title, :description, images: [])\n end", "def create\n @album = Pagealbum.new(album_params)\n @images=album_params[:images_attributes].values.map {|x| Image.new(x)} rescue []\n\n respond_to do |format|\n if @album.save\n page=Page.first\n page.albums << @album\n format.html { redirect_to my_album_page_path(id: @album.id), notice: \"Pagealbum was successfully created.\" }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def private_album_image_params\n params.require(:private_album_image).permit(:ImageID, :AlbumID)\n end", "def album_params\n params.require(:album).permit(:name, :student_id, photos_images: [])\n end", "def album_params\n params.require(:album).permit(:name, :description, { images: [] }, :body)\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def update\n ActiveRecord::Base.transaction do\n @album.update!(name: params[:name])\n @album.album_images.destroy_all\n # 画像登録数が多くなるUIになったらSQLの負荷を減らすためにactiverecord-importを入れる\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end", "def set_private_album_image\n @private_album_image = PrivateAlbumImage.find(params[:id])\n end", "def create\n @private_album = PrivateAlbum.new(private_album_params)\n\n respond_to do |format|\n if @private_album.save\n format.html { redirect_to @private_album, notice: 'Private album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @private_album }\n else\n format.html { render action: 'new' }\n format.json { render json: @private_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def batch_upload(images, album_id)\n upload_url = get_upload_url(album_id) \n vk_options = { url: upload_url }\n \n images.slice(0, 5).each_with_index do |image, i|\n vk_options[\"file#{i+1}\"] = get_image_metadata(image)\n end\n \n puts vk_options.inspect\n upload_response = VkontakteApi.upload(vk_options)\n save_response = @agent.photos.save(upload_response)\n \n return save_response.map{ |i| i.pid }\n end", "def create\n # photo = photo.create! params.require(:photo)\n @photo = Photo.new(photo_params)\n @photo.album_id = params[:album_id]\n @photo.user_id = current_user.id\n # @photo.pictures.attach(params[:photo][:picture])\n respond_to do |format|\n if @photo.save(validate: false)\n format.html { redirect_to album_photos_path , notice: \"Photo was successfully created.\" }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n already_uploaded_images_for_same_album = Image.where(\"album_id=?\",params[:image][:album_id])\n raise Exception.new(\"You have already uploaded 25 images for the same album, please try to create new album\") if already_uploaded_images_for_same_album.count == 25\n @image = Image.new\n @image.image_url = params[:image][:image_url]\n @image.tagline = image_params[:tagline]\n date_params = image_params[\"created_date(1i)\"] + \"/\" + image_params[\"created_date(2i)\"] + \"/\" + image_params[\"created_date(3i)\"]\n @image.created_date = date_params\n @image.user_id = current_user.id\n @image.album_id = params[:image][:album_id].to_i\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @private_album_images = PrivateAlbumImage.all\n end", "def test_save_photos \n# album = StudentPhotoAlbum.find_by_guid(313764409611785162)\n# me = Student.find(1)\n# album.save_photos({:upload_files=>{:f1=>uploaded_file('c:/temp/3.zip','image/png')}},me)\n @request.session['student'] = 1 \n post :add_more_files_to_album, :id=>'313764409611785162',:upload_files=>{:f1=>uploaded_file('c:/temp/313.zip')}\n end", "def create\n @image = @album.images.build(image_params)\n\n if @image.save\n redirect_to album_path(@image.album.id), notice: \"The image #{@image.name} has been uploaded.\"\n else\n render \"new\"\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_multiple_photos\n session[:current_images] = (0...8).map{65.+(rand(25)).chr}.join unless session[:current_images]\n @photo = Picture.new(:photo => params[:picture][:path], :photo_detail => \"#{session[:current_images]}\", :share_type => \"99\", :album_id => \"\")\n if @photo.save\n @group_ids = params[:group_ids]\n @group_ids.each do |grp|\n SharedTab.create(:shareable_id=>@photo.id,:group_id=>grp.to_i,:shareable_type=>\"Picture\")\n end if !@group_ids.blank?\n flash[:notice] = \"Photo added successfully.\"\n if @photo.save\n respond_to do |format|\n format.html { #(html response is for browsers using iframe sollution)\n render :json => [@photo.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@photo.to_jq_upload].to_json\n }\n end\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end\n\n end", "def create\n #@picture = Picture.new(picture_params)\n @picture = @album.pictures.build(picture_params) #JRD111115\n\n respond_to do |format|\n if @picture.save\n format.html { redirect_to ([@album, @picture]), notice: 'Picture was successfully created.' }\n format.json { render :show, status: :created, location: @picture}\n else\n format.html { render :new }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def image_params\nparams.require(:image).permit(:name, :avatar, :album_id)\n end", "def create\n @gallery = Gallery.new(gallery_params)\n\n respond_to do |format|\n if @gallery.save\n if params[:images]\n params[:images].each { |image|\n pic = @gallery.pics.create(image: image)\n data = Cloudinary::Uploader.upload(image,@auth)\n pic.public_id = data['secure_url']\n pic.image_file_size = data['bytes']\n pic.save\n }\n end\n\n format.html { redirect_to @gallery, notice: 'Gallery was successfully created.' }\n format.json { render json: @gallery, status: :created, location: @gallery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def destroy\n @private_album_image.destroy\n respond_to do |format|\n format.html { redirect_to private_album_images_url }\n format.json { head :no_content }\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = 'Image Created' if @owner.images << @image\n respond_with @owner, @image\n end", "def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end", "def create\n @album = Album.new(album_params)\n\n not_blank_photos = @album.photos.select do |photo|\n ! photo.title.blank?\n end\n @album.photos = not_blank_photos\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_album\n @album = Pagealbum.find(params[:id]) rescue Pagealbum.new\n @images=[]\n end", "def create\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.build(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html {\n render :json => [@photo.to_jq_image].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@photo.to_jq_image].to_json\n }\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end\n end", "def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end", "def album_photo_params\n params.require(:album_photo).permit(:album_id, photo: [:title, :image, :age_policy_id, :author])\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n #Dir.chdir(\"public/images\")\n Dir.mkdir(@album['directory'])\n flash[:notice] = 'Album was successfully created.'\n #flash[:notice] = Dir.pwd\n format.html { redirect_to @album }\n #format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action = \"new\" }\n #format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = current_admin.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n\n if params[:pictures]\n #===== The magic is here ;)\n params[:pictures].each { |image|\n @listing.pictures.create(file: image)\n }\n end\n\n format.html { redirect_to admin_listings_url, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_photos\n end", "def album_photo_params\n params.require(:album_photo).permit(:album_id,:image)\n end", "def create\r\n @album = Album.new(params[:album])\r\n if (params[:album][:coverpage])\r\n tem_coverPage = upload_file(@album.coverpage,\"app/assets/images/album_images\")\r\n @album.coverpage = \"album_images/\"+tem_coverPage\r\n else\r\n @album.coverpage = \"album_images/album_default.jpg\"\r\n end\r\n @album.owner = session[:user_id]\r\n respond_to do |format|\r\n if @album.save\r\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\r\n format.json { render json: @album, status: :created, location: @album }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @album.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find(params[:album_id])\n #@photo = @album.photos.build(params[:photo])\n @photo = @album.photos.create(params[:photo])\n @album.cover_id ||= @photo.id\n @album.add_participator(current_user)\n @photo.exif_read\n\n\n respond_to do |format|\n if @photo.save && @album.save\n format.html { redirect_to @album, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n format.js \n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def create\n puts params.inspect\n @gallery = Gallery.new\n\n @gallery.user = @current_user\n\n respond_to do |format|\n if @gallery.save\n @gallery.update :image_ids => params[:image_ids]\n format.html { redirect_to @gallery, notice: 'Gallery was successfully created.' }\n format.json { render :json => {url: edit_gallery_path(@gallery)}}\n else\n format.html { render :new }\n format.json { render json: @gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end", "def create\n if params[:photo_files].blank?\n render json: [ 'ファイルを選択してください' ], status: :unprocessable_entity\n return\n end\n\n album = Album.find(params['album_id'])\n # TODO: Transactionかけるとかエラーハンドリングしたい\n params[:photo_files].each do |file|\n photo = Photo.new(image: file, title: '[無題]', album_id: album.id, user_id: current_user.id, exif_at: Photo::set_exif_at(file.path))\n photo.save\n end\n\n # memo Ajaxでのpostはsaveのエラーが画面には表示されないので、自分で出力してあげる\n # あと、pメソッドでログに出力されないため、loggerを使用する\n # logger.debug @photo.errors.full_messages.inspect\n # logger.debug @photo.errors.full_messages.to_sentence\n\n UpdateHistory.create_or_update(album, UpdateHistory::ALBUMPHOTO_CREATE, current_user.id)\n render json: {}, status: :created\n end", "def uploading_pictures\n end", "def create\n puts \"PARAMETERS:::::\"\n puts params.inspect\n\n @album_photo = AlbumPhoto.new(album_photo_params)\n puts \"%%%%%%%%%\"\n puts @album_photo.as_json\n puts params[:album_id]\n puts params[:album_photo][:image]\n @gallery_photos = GalleryPhoto.where(gallery_id: params[:id])\n # puts \"$$$$$$$$$$\"\n # puts @gallery_photos.as_json\n # puts \"$$$$$$$$$$\"\n @album=Album.where(gallery_id: params[:id])\n @album_photos = AlbumPhoto.where(album_id: @album.map(&:id)).to_a\n # puts \"$$$$$$$$$$\"\n # puts @album_photos.as_json\n # puts \"$$$$$$$$$$\"\n @all_photos =@gallery_photos+@album_photos\n # puts \"$$$$$$$$$$\"\n # puts @all_photos.as_json\n # puts \"$$$$$$$$$$\"\n @count = 0\n params[:album_photo][:image].each do |img|\n @a = 1\n @b = 1\n\n puts img.original_filename\n @album_photos.each do |album_photo|\n if album_photo.image_file_name == img.original_filename\n @a = 0\n @count = @count + 1\n break\n end\n end\n @gallery_photos.each do |gallery_photo|\n if gallery_photo.photo_file_name == img.original_filename\n @b = 0\n @count = @count + 1\n break\n end\n end\n if @a != 0 && @b!= 0\n AlbumPhoto.create(image: img,album_id: params[:album_photo][:album_id])\n else\n puts @a\n puts @b\n # redirect_to new_album_photo_path(gallery_id: params[:gallery_id],album_id: params[:album_id])\n end\n end\n puts @count\n redirect_to galleries_galleryhome_path(id: params[:id])\n # respond_to do |format|\n # if @album_photo.save\n # format.html { redirect_to galleries_galleryhome_path(id: params[:id]), notice: 'Album photo was successfully created.' }\n # format.json { render :show, status: :created, location: @album_photo }\n # else\n # format.html { render :new }\n # format.json { render json: @album_photo.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def set_album\n @image = Album.find(params[:album_id])\n end", "def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end", "def images_select_album_create\n title = params[:title]\n album_name = params[:album_name]\n movie_id = params[:edit_movie_id]\n artist_id = params[:edit_artist_id]\n event_id = params[:edit_event_id]\n user_id = current_user.id\n\n album = Album.create(:album_name => album_name)\n images_ids = params[:images_ids]\n post_to_facebook = params[:post_fb]\n images_ids.split(\" \").each do |image_id|\n AlbumImage.create(:album_id => album.id, :image_id => image_id)\n end\n\n album.cover_image_id = images_ids.split(\" \")[0]\n album.save\n\n post_created = false\n\n if !movie_id.empty? && !post_created\n post = Post.create( :title => title , :posting_id => movie_id, \n :posting_type => \"Movie\" , :postable_type => 'Album',\n :postable_id => album.id, :user_id => current_user.id)\n post_created = true\n end\n\n if !artist_id.empty? && !post_created\n post = Post.create( :title => title , :posting_id => artist_id, \n :posting_type => \"Artist\" , :postable_type => 'Album',\n :postable_id => album.id, :user_id => current_user.id)\n post_created = true\n end\n\n if !event_id.empty? && !post_created\n post = Post.create( :title => title , :posting_id => event_id, \n :posting_type => \"Event\" , :postable_type => 'Album',\n :postable_id => album.id, :user_id => current_user.id)\n end\n Post.mention(post,params[:mention_artist_id],params[:mention_movie_id])\n\n #inserting this particular post to the current user feed\n feed = Feed.create(:user_id => user_id ,:post_id => post.id, :post_created_on => post.created_at )\n\n #user score\n action_score = Score.create(:user_id => current_user.id, :score => 20, :action => \"Post created || Album || post id is #{post.id}\")\n total_score = action_score.score\n current_user.score += total_score\n current_user.save\n\n scrap_hash = {}\n\n PostsWorker.perform_async(post.id,1,scrap_hash)\n PostsWorker.perform_async(post.id,2,scrap_hash)\n redirect_to root_url\n\n end", "def create\n \n @album = @user.albums.new(params[:album])\n \n if @album.save\n flash[:notice] = 'User was successfully created.'\n if params[:album][:avatar].blank?\n redirect_to @album\n else\n \n render :action => 'cropping'\n end\n else\n render :action => 'new'\n end\n end", "def create\n \t@album = Album.find(params[:album_id])\n \t@photo = @album.photos.create!(params[:photo])\n \tredirect_to @album, :notice => 'Photo created'\n end", "def create\n @apartment = current_user.apartments.new(apartment_params)\n\n respond_to do |format|\n if @apartment.save\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n @apartment.pictures.create(image: image)\n }\n end\n format.html { redirect_to @apartment, notice: 'Propiedad creada correctamente.' }\n format.json { render :show, status: :created, location: @apartment }\n else\n format.html { render :new }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(params[:album])\n\n album_path = ALBUMS_ROOT + @album.name\n FileUtils.mkdir_p(album_path)\n\n FileUtils.mkdir_p(album_path + \"/pictures\")\n FileUtils.mkdir_p(album_path + \"/thumbnail\")\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to(@album, :notice => 'Album was successfully created.') }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n # original code\n\n # @image_set = ImageSet.create(image_set_params)\n\n # render json: @image_set\n\n# code for imageMagick\n @image_set = current_user.image_sets.guild(image_set_params)\n authorize @image_set\n if @image_set.save\n # to handle multiple image upload on create\n if params[:images]\n params[:images].each {|image|\n @image_set.images.create(image: image)\n }\n end\n flash[:notice] = \"Your image set has been created.\"\n redirect_to @image_set\n else\n flash[:alert] = \"Something went wrong.\"\n render 'new'\n end\n\n end", "def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.json { render json: @image, status: :created, location: [:admin, @image] }\n else\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def song_save_image\r\n\r\n\t\t@song = Song.find(params[:song_id])\r\n\t\t@artist = Artist.find_by_url_slug(params[:url_slug])\r\n\r\n\t\t@song.image = \"https://\"+IMAGE_BUCKET+\".s3.amazonaws.com/Three_Repeater-\"+@artist.url_slug+\"-\"+@song.id.to_s+\"-\"+params[:file_name]\r\n\r\n\t\t@song.update_column(:image,@song.image)\r\n\r\n\t\tlogger.info(\"song image= \"+@song.image.to_s)\r\n\r\n\t\trespond_to do |f|\r\n\r\n\t\t\tf.json {\r\n\t\t\t\trender :json => {\r\n\t\t\t\t\t\t:success => true}\r\n\t\t\t}\r\n\r\n\t\tend\r\n\r\n\tend", "def create\n @album = current_user.albums.build(params[:album])\n if @album.save\n flash[:notice] = 'Album was successfully created.'\n redirect_to(album_pictures_path(@album))\n else\n render :action => \"new\"\n end\n end", "def index\n @images = @album.images.all\n end", "def create\n @picture = Picture.create!(picture_params)\n render json: @picture, status: :created\n end", "def photo_params\n params.require(:photo).permit(:name, :album, :mode, :folder_id, :image)\n end", "def create\n @picture = Picture.new(params[:picture])\n @picture.user = current_user\n @activity = @picture.album.imageable\n\n respond_to do |format|\n if @picture.save\n format.html { redirect_to [@activity, @picture], notice: 'Picture was successfully created.' }\n format.json { render json: @picture, status: :created, location: @picture }\n else\n format.html { render action: \"new\" }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def images_select_album_create_render\n @images_ids = []\n images_ids = params[:image_ids]\n images_ids.each do |image_id|\n if image_id[-1] == \"&\"\n image_id[-1]=\"\"\n end\n @images_ids << image_id\n end\n end", "def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.json { render :json => { url: @image.image.url} }\n else\n \n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = @allbum.photos.new(params[:photo])\n respond_to do |format|\n if @photo.save\n format.html { redirect_to new_allbum_photo_path, notice:\"Saved,You can add more images...\" }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_album_params\n params.require(:item_album).permit(:item_id,:image)\n end", "def create\n @results = []\n\n unless params[:files].nil?\n params[:files].each do |data|\n img = Image.new\n img.filename = data.original_filename\n img.data = data.read\n img.upload_id = params[:uuid]\n img.visitation_form_id = params[:formId]\n img.image_type = params[:imageType]\n img.content_type = data.content_type\n #img.temp_index = params[:birdIndex]\n img.bird_id = params[:birdId]\n\n if !img.save\n render :json => { :errors => img.errors.full_messages }, :status => 400 and return\n else\n @results << { name: img.filename, imageType: img.image_type, id: img.id }\n end\n end\n end\n\n render json: { files: @results }\n end", "def create\n @picture = @album.pictures.new(picture_params)\n @client = Kairos::Client.new(app_id: APP_ID,\n app_key: APP_KEY)\n respond_to do |format|\n if @picture.save\n format.html { redirect_to album_picture_path(@album, @picture), notice: 'Picture was successfully created.' }\n format.json { render :show, status: :created, location: @picture }\n \n puts \"HEEEEEEEYYYYYYYYY\"\n p @picture.photo.url\n p @client\n p @picture.album.name\n\n p picture_up = \"https://mysterious-ocean-1513.herokuapp.com\" + @picture.photo.url\n \n p @client.enroll(url: picture_up,\n subject_id: 'Brian1001',\n gallery_name: @picture.album.name,\n selector: 'SETPOSE'\n )\n\n else\n format.html { render :new }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photoalbum = Photoalbum.new(params[:photoalbum])\n\n respond_to do |format|\n if @photoalbum.save\n format.html { redirect_to edit_photoalbum_path @photoalbum, notice: 'Photoalbum was successfully created.' }\n format.json { render json: @photoalbum, status: :created, location: @photoalbum }\n else\n format.html { render 'new' }\n format.json { render json: @photoalbum.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @album = Album.new\n @photo = @album.photos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create\n @album_ownership = AlbumOwnership.new\n @album_ownership.album = @album\n @album_ownership.user = current_user\n\n unless @album_ownership.save\n render json: @album_ownership.errors, status: :unprocessable_entity\n end\n end", "def create\n @galleries_album = Galleries::Album.new(galleries_album_params)\n @galleries_album.user = current_user\n respond_to do |format|\n if @galleries_album.save\n format.html { redirect_to @galleries_album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @galleries_album }\n else\n format.html { render :new }\n format.json { render json: @galleries_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.new(allowed_params_album)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render :show, status: :created, location: @album }\n else\n format.html { render :new }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_photo(album_id, photo_id, file, filename)\n \n end", "def photo_params\n params.require(:photo).permit(:image, :album_id, :caption)\n end", "def private_album_params\n params.require(:private_album).permit(:Name, :UserID)\n end", "def create\n @picture = @album.pictures.build(params[:picture])\n\n if @picture.save\n flash[:notice] = 'Picture was successfully uploaded.'\n redirect_to(album_pictures_path(@album))\n else\n @pictures = @album.pictures.all \n render :action => \"index\" \n end\n end", "def fetch_album_images(set_albumName, params = {})\n params = { :cmd => 'fetch-album-images', :set_albumName => set_albumName }.merge(params)\n send_request(params)\n end", "def show\n album = Album.includes(:album_images).find(params[:id])\n return_hash = album.attributes\n return_hash['album_images'] = album.album_images\n render json: return_hash\n end", "def create\n if session[:user_id]\n user = User.find_by_id(session[:user_id])\n params[:img][:by] = user.id\n end\n @img = Img.new(params[:img])\n\n respond_to do |format|\n if @img.save\n format.html { redirect_to(@img, :notice => 'Img was successfully uploaded.') }\n format.xml { render :xml => @img, :status => :created, :location => @img }\n unless session[:user_id]\n unless session[:imgs]\n session[:imgs] = []\n end\n session[:imgs].push(@img.id)\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @img.errors, :status => :unprocessable_entity }\n end\n end\n end", "def album_params\n params.require(:album).permit(:nome, :ano, :banda_id, :image)\n end", "def create\n @galleries_gallery = @galleries_album.galleries.new(galleries_gallery_params)\n @galleries_gallery.user = current_user\n respond_to do |format|\n if @galleries_gallery.save\n format.html { redirect_to galleries_album_gallery_path(@galleries_gallery), notice: 'Gallery was successfully created.' }\n # format.json { render :show, status: :created, location: @galleries_gallery }\n format.json { render json: {files: [@galleries_gallery.to_jq_upload] }, status: :created}\n\n else\n format.html { render :new }\n format.json { render json: @galleries_gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @myalbum = Pagealbum.find(params[:id])\n\n @images=album_params[:images_attributes].values.map {|x| Image.new(x)} rescue []\n p @myalbum.errors\n p @album.errors\n\n respond_to do |format|\n if @myalbum && @myalbum.errors && @myalbum.errors.full_messages.length > 0\n p @myalbum.errors\n @album=@myalbum\n format.html { render :edit, status: :unprocessable_entity, notice: \"Add pictures.\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n elsif @album.update(album_params)\n format.html { redirect_to my_album_page_path(id: @album.id), notice: \"Pagealbum was successfully updated.\" }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def album_params\n params.require(:album).permit(:image, :recomendacion)\n end", "def album_params\n params.require(:pagealbum).permit(:title, :images_attributes,:images=>{},:images_attributes=>{},:images=>[])\n \n rescue ActionController::ParameterMissing\n @myalbum.errors.add(:base, \"Add some pictures.\")\n\n end", "def metadata_for_album_photos\n commentables = Commentable.find_for_album_photos(params[:album_id])\n render_commentables(commentables)\n end", "def create\n @album = Album.new(params[:album])\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to group_url(@album.group), notice: 'Album was successfully created.' }\n format.json { render json: @album, status: :created, location: @album }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n params[:tag] ? @photos = Photo.tagged_with(params[:tag]) : @photos = Photo.all\n album = params[:album_id]\n @photos = current_user.photos.all.where(album_id: album).with_attached_pictures\n\n end", "def set_private_album\n @private_album = PrivateAlbum.find(params[:id])\n end", "def create\n image = Image.create(image_params)\n\n if image.new_record?\n render json: { errors: image.errors.messages }, status: 422\n else\n render json: image, status: 201\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @albums = get_current_albums\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: 'Фотография была успешно добавлена.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @pictures = @album.pictures.all \n @picture = @album.pictures.build\n end", "def create\n @user = current_account\n # @category = Category.new(category_params)\n @category = @user.categories.build(category_params)\n respond_to do |format|\n if @category.save\n unless params[:images].nil?\n params[:images]['url'].each do |img|\n @image = @category.images.create!(url: img, category_id: @category.id)\n end\n end\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render :index, status: :created, location: @category } \n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def photo_params\n params.require(:photo).permit(:title, :photo, :album_id)\n end", "def group_album\n @discussion_group = DiscussionGroup.find(params[:id])\n if @login_user.is_member_of_discussion_group(params[:id].to_i) || @discussion_group.is_public\n @pictures = Image.find_by_sql([\"SELECT DISTINCT i.* FROM discussion_group_discussions dgd\n\t\t\t\t\t LEFT JOIN discussions d on dgd.discussion_id = d.id\n\t\t\t\t\t LEFT JOIN comments c on dgd.discussion_id = c.discussion_id\n\t\t\t\t\t LEFT JOIN images i ON (imageable_id = dgd.id AND imageable_type = 'DiscussionGroup')\n\t\t\t\t\t OR (imageable_id = d.id AND imageable_type = 'Discussion')\n\t\t\t\t\t OR (imageable_id = c.id AND imageable_type = 'Comment')\n \t\t\t\t\tWHERE i.id IS NOT NULL AND dgd.discussion_group_id =? \",params[:id].to_i])\n else\n redirect_to @login_user.profile_path\n end\n end", "def create\n @album2photo = Album2photo.new(params[:album2photo])\n\n respond_to do |format|\n if @album2photo.save\n format.html { redirect_to @album2photo, notice: 'Album2photo was successfully created.' }\n format.json { render json: @album2photo, status: :created, location: @album2photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album2photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image_collection = ImageCollection.new(image_collection_params)\n\n respond_to do |format|\n if @image_collection.save\n image_collection_params[:attached_images].reject(&:empty?).each do |id|\n @image_collection.images << Image.find(id)\n end\n\n @image_collection.save\n\n format.html { redirect_to @image_collection, notice: 'Image collection was successfully created.' }\n format.json { render :show, status: :created, location: @image_collection }\n else\n format.html { render :new }\n format.json { render json: @image_collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_image\n obtain_product_image_params\n pi = ProductImage.new(picture: @image_params)\n @product.product_images << pi\n render json: @product.simple_info, status: :ok\n rescue => e\n render json: { error: e }, status: :bad_request\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.file = params[:file]\n\n respond_to do |format|\n if @photo.save\n format.html { render :text => \"FILEID:\" + @photo.file.album.url }\n format.json { render :nothing => true }\n else\n format.html { render :text => \"ERRORS:\" + @photo.errors.full_messages.join(\" \"), :status => 500 }\n format.json { render json => @photo.errors, :status => 500 }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_path(@photo.album), notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { redirect_to album_path(@photo.album), notice: @photo.errors.full_messages.join(', ') }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user = @current_user\n if @photo.save\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.70358884", "0.6958725", "0.68498844", "0.68260425", "0.6766401", "0.6743341", "0.661099", "0.6588316", "0.6468611", "0.6462717", "0.6452367", "0.64280766", "0.64179707", "0.64128506", "0.6407221", "0.64051026", "0.639881", "0.63375807", "0.6289237", "0.62540025", "0.62381786", "0.623805", "0.6212388", "0.6211595", "0.6210342", "0.62087846", "0.62003875", "0.6183745", "0.6178208", "0.61743784", "0.6171288", "0.6151517", "0.61512667", "0.6149455", "0.6134588", "0.61335725", "0.6132057", "0.6114368", "0.60855246", "0.6066312", "0.60627973", "0.60512066", "0.6042532", "0.60405415", "0.6038154", "0.603445", "0.6024015", "0.60177195", "0.6006385", "0.59959924", "0.59956366", "0.599244", "0.5992168", "0.59854025", "0.598111", "0.59796107", "0.59789205", "0.5950036", "0.59470856", "0.59384584", "0.59347624", "0.5928581", "0.5926744", "0.59218365", "0.59180814", "0.5908926", "0.59087867", "0.59061766", "0.5905253", "0.59051234", "0.5899646", "0.5897731", "0.5894399", "0.5892004", "0.5885156", "0.5877618", "0.58693635", "0.5869339", "0.5863341", "0.5854237", "0.58510715", "0.5849536", "0.5846587", "0.5844981", "0.5835632", "0.58324516", "0.5831275", "0.58311236", "0.5830101", "0.58294207", "0.58285886", "0.58176357", "0.5814467", "0.5814085", "0.58137053", "0.58084595", "0.5803225", "0.57966846", "0.57959753", "0.5794236" ]
0.70301104
1
PATCH/PUT /private_album_images/1 PATCH/PUT /private_album_images/1.json
def update respond_to do |format| if @private_album_image.update(private_album_image_params) format.html { redirect_to @private_album_image, notice: 'Private album image was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @private_album_image.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n \n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = @album.images.find(params[:id])\n @image.update(image_params)\n redirect_to album_path(@image.album.id)\n end", "def update\n respond_to do |format|\n if @private_album.update(private_album_params)\n format.html { redirect_to @private_album, notice: 'Private album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @private_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_photo(album_id, photo_id, file, filename)\n \n end", "def update\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n if @album.pictures.find(params[:id]).update_attributes(picture_params)\n format.html { redirect_to album_pictures_url(@album), notice: 'Picture was successfully updated.' }\n format.json { render :show, status: :ok, location: @album.picture }\n else\n format.html { render :edit }\n format.json { render json: @album.picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ActiveRecord::Base.transaction do\n @album.update!(name: params[:name])\n @album.album_images.destroy_all\n # 画像登録数が多くなるUIになったらSQLの負荷を減らすためにactiverecord-importを入れる\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end", "def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update\n @albums = get_current_albums\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to photos_url, notice: 'Фотография была успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album_photo.update(album_photo_params)\n format.html { redirect_to @album_photo, notice: 'Album photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @album_photo }\n else\n format.html { render :edit }\n format.json { render json: @album_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end", "def update\n \n @album = @user.albums.find(params[:id])\n respond_to do |format|\n format.js { render 'new' }\n format.html{\n if @album.update_attributes params[:album]\n @album.avatar.reprocess!\n flash[:notice] = 'User was successfully updated.'\n if params[:album][:avatar].blank?\n redirect_to @album\n else\n \n render :action => 'cropping'\n end\n else\n render :action => \"edit\"\n end}\n end\n end", "def update\n authorize! :update, @album\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to edit_admin_album_path(@album.id), notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(allowed_params_album)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to user_customer_album_photos_url(@user, @customer, @album), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = @allbum.photos.find(params[:id])\n#\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to edit_allbum_photos_path(@allbum,@photo), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.with_attached_pictures.find(params[:id])\n @photo.user_id = current_user.id\n #@photo.update\n # raise @photo.inspect\n respond_to do |format|\n if @photo.update(photo_params)\n # raise @photo.inspect\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find( params[:id])\n if @photo.update_attributes(params[:photo])\n flash[:notice] = \"Photo updated!\"\n if params[:bucket_id]\n redirect_to bucket_album_photo_path( params[:bucket_id], params[:album_id], @photo )\n elsif params[:album_id]\n redirect_to album_photo_path( params[:album_id], @photo )\n else\n redirect_to @photo\n end\n else\n render :action => :edit\n end\n end", "def update\n @photo = current_user.photos.find_by_id(params[:id])\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n elsif @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end", "def update\n @album = current_user.albums.find(params[:id])\n\n respond_to do |format|\n if @Album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @Album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @picture = @album.pictures.find(params[:id])\n \n if @picture.update_attributes(params[:picture])\n flash[:notice] = 'Picture was successfully updated.'\n redirect_to(album_pictures_path(@album))\n else\n render :action => \"edit\" \n end\n end", "def update_album(person_id,album_id, caption, location='', privacy='Everyone')\n @restv9.update_album(person_id,album_id, caption, location, privacy)\n end", "def update\n @gallery = Gallery.find(params[:gallery_id])\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to gallery_path(@photo.gallery), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n if @album2photo.update_attributes(params[:album2photo])\n format.html { redirect_to @album2photo, notice: 'Album2photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album2photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to album_url(@album), notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @picture.update(picture_params)\n format.html { redirect_to album_pictures_path, notice: 'Picture was successfully updated.' }\n format.json { render :show, status: :ok, location: @picture }\n else\n format.html { render :edit }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @galleries_album.update(galleries_album_params)\n format.html { redirect_to @galleries_album, notice: 'Album was successfully updated.' }\n format.json { render :show, status: :ok, location: @galleries_album }\n else\n format.html { render :edit }\n format.json { render json: @galleries_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: \"Album was successfully updated.\" }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to [@photo.album, @photo], notice: '写真情報を変更しました。' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_back fallback_location: @photo.album, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @album = Album.find(params[:id])\r\n if params[:album][:coverpage]\r\n tem_coverPage = upload_file(params[:album][:coverpage],\"app/assets/images/album_images\")\r\n params[:album][:coverpage] = \"album_images/\"+tem_coverPage\r\n end\r\n\r\n respond_to do |format|\r\n\r\n if @album.update_attributes(params[:album])\r\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @album.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'El album a sido actualizado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_private_album_image\n @private_album_image = PrivateAlbumImage.find(params[:id])\n end", "def update\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, notice: 'Album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @myalbum = Pagealbum.find(params[:id])\n\n @images=album_params[:images_attributes].values.map {|x| Image.new(x)} rescue []\n p @myalbum.errors\n p @album.errors\n\n respond_to do |format|\n if @myalbum && @myalbum.errors && @myalbum.errors.full_messages.length > 0\n p @myalbum.errors\n @album=@myalbum\n format.html { render :edit, status: :unprocessable_entity, notice: \"Add pictures.\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n elsif @album.update(album_params)\n format.html { redirect_to my_album_page_path(id: @album.id), notice: \"Pagealbum was successfully updated.\" }\n format.json { render :show, status: :ok, location: @album }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to [@gallery,@image], notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gallery.update(gallery_params)\n if params[:images]\n params[:images].each { |image|\n pic = @gallery.pics.create(image: image)\n data = Cloudinary::Uploader.upload(image,@auth)\n pic.public_id = data['secure_url']\n pic.image_file_size = data['bytes']\n pic.save\n }\n end\n format.html { redirect_to @gallery, notice: 'Gallery was successfully updated.' }\n format.json { render :show, status: :ok, location: @gallery }\n else\n format.html { render :edit }\n format.json { render json: @gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_user\n if current_user.role == \"admin\"\n \n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n format.html { redirect_to @album, flash: {success: \"Gratulacje! Zaktualizowano album '#{@album.tytul}\"}}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n \n else\n \tredirect_to root_url, flash: {error: t('errors.messages.permissions')}\n end\n else\n redirect_to :login, flash: {notice: t('errors.messages.login_to_see')}\n end\n end", "def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"index\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @icesled.update(icesled_params)\n if params[:images]\n @icesled.gallery ||= Gallery.new\n params[:images].each do |image|\n @icesled.gallery.images.create(image: image)\n end\n unless @icesled.image_file_size\n @icesled.update(image: @icesled.gallery.images.first.image)\n end\n end\n format.html { redirect_to @icesled, notice: 'Icesled was successfully updated.' }\n format.json { render :show, status: :ok, location: @icesled }\n else\n format.html { render :edit }\n format.json { render json: @icesled.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n # TODO: check if photo belongs to current user!\n if @photo.update_attributes(photo_params)\n render :show\n else\n render json: @photo.errors.full_messages, status:422\n end\n end", "def update\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n if @image_gallery.update_attributes(params[:image_gallery])\n format.html { redirect_to @image_gallery, notice: 'Image gallery was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Updated successfully.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'Album was successfully updated.'\n format.html { redirect_to @album }\n format.json { head :no_content }\n else\n format.html { render action = \"edit\" }\n # format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gallery = Gallery.find(params[:id])\n @gallery.update_attributes(params[:gallery])\n respond_with(@gallery, :status => :updated)\n end", "def update\n @photo = Photo.find(params[:id])\n authorize! :update, @photo\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.collection, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n old_image_id=@food_group.image_id\n #if params[:food_group][:image_attributes][:image_path] == nil\n if @food_group.update(food_group_params)\n #byebug\n if params[:food_group][:image_attributes][:image_path] == nil\n @food_group.update(:image_id=>old_image_id)\n end\n @food_group.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to action: \"index\", notice: 'Food group was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_group }\n else\n format.html { render :edit }\n format.json { render json: @food_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_attributes(attributes = {},user,images_directory)\n Rails.logger.debug \"Call to photo.update_attributes\"\n if self.valid? #Validate if the Photo object is valid\n Rails.logger.debug \"The photo is valid!\"\n file = attributes[:file]#Set the photo file object\n if !file.blank? #Validate if a file was supplied by the user\n images_directory =images_directory.blank? ? @@images_directory : images_directory #Validate if an image_directory was supplied, otherwise we use the default one\n file_s3_path = Util.upload_image(images_directory,file) #Upload the new image\n if !attributes[:previous_picture].blank? #Validate if there was a previous image file tied to the photo node\n Util.delete_image(attributes[:previous_picture]) #Delete the previous image file\n end\n else\n file_s3_path = self.file #If none was provided, keep the original file\n end\n #Create a raw photo object\n photo_req = { 'title'=>attributes[:title],\n 'description'=>attributes[:description],\n 'url'=>file_s3_path,\n 'date'=> Util.date_to_epoch(attributes[:date]), #Turn the date to epoch\n 'ownerId'=> self.owner_id \n } \n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n\n rest_response = MwHttpRequest.http_put_request(reqUrl,photo_req,user['email'],user['password']) #Make the PUT call to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n photo = Photo.rest_to_photo(rest_response.body)\n return true, photo #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n else\n Rails.logger.debug self.errors.full_messages\n return false, self.errors.full_messages #Return invalid object error\n end\n end", "def update\n authorize @album\n if @album.update(album_params)\n redirect_to @album, notice: 'Album was successfully updated.'\n else\n render :edit\n end\n end", "def set_album_photo\n @album_photo = AlbumPhoto.find(params[:id])\n @album = Admin::Album.find(params[:album_id])\n end", "def update_description\n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.description = params[:description]\n @photo.save()\n render :json => @photo\n end", "def update\n @photoalbum = Photoalbum.find(params[:id])\n\n respond_to do |format|\n if @photoalbum.update_attributes(params[:photoalbum], :as => (current_user.admin? ? :admin : :default))\n format.html { redirect_to @photoalbum, notice: 'Photoalbum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photoalbum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo_album = PhotoAlbum.find(params[:id])\n\n respond_to do |format|\n if @photo_album.update_attributes(params[:photo_album])\n flash[:notice] = 'PhotoAlbum was successfully updated.'\n format.html { redirect_to(user_photo_albums_url(current_user)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @picture.update(picture_params)\n head :no_content\n else\n render json: @picture.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n save_to_json\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_album = UserAlbum.find(params[:id])\n\n respond_to do |format|\n if @user_album.update_attributes(params[:user_album])\n format.html { redirect_to @user_album, notice: 'User album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gallery_photo.update(gallery_photo_params)\n format.html { redirect_to @gallery_photo, notice: 'Gallery photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @gallery_photo }\n else\n format.html { render :edit }\n format.json { render json: @gallery_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photogallery.update(photogallery_params)\n format.html { redirect_to @photogallery, notice: 'Photogallery was successfully updated.' }\n format.json { render :show, status: :ok, location: @photogallery }\n else\n format.html { render :edit }\n format.json { render json: @photogallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash[:notice] = 'Image Successfully updated' if @image.update_attributes! params[:image]\n respond_with @owner, @image\n end", "def update\n @food.build_image(params['image']) do |t|\n if params['food']['image']['data']\n t.data = Base64.encode64(params['food']['image']['data'].read)\n t.filename = params['food']['image']['data'].original_filename\n t.mime_type = params['food']['image']['data'].content_type\n end\n end \n @food.name = @food.name.capitalize\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n if @image.update(image_params)\n render json: {status: \"success\", data: {image:@image}}, status: :ok\n else\n render json: @comment.errors, status: 404\n end\n end", "def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to '/galleries/' + params[:galery_id].to_s, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo_album = PhotoAlbum.find(params[:id])\n\n respond_to do |format|\n if @photo_album.update_attributes(params[:photo_album])\n flash[:notice] = 'PhotoAlbum was successfully updated.'\n format.html { redirect_to(@photo_album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to artist_album_url(@artist,@album), notice: 'album was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_album.update(item_album_params)\n format.html { redirect_to @item_album, notice: 'Item album was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_album }\n else\n format.html { render :edit }\n format.json { render json: @item_album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(photo_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n params = image_params\n params[\"tags\"] = params[\"tags\"].delete_suffix(',')\n\n respond_to do |format|\n if @image.update(params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.photoable, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"forms\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @car.update(car_params)\n unless params[:photos].blank?\n params[:photos]['image'].each do |p|\n @photo = @car.photos.create!(:image => p, :car_id => @car.id)\n end\n end\n format.html { redirect_to @car, notice: 'Car was successfully updated.' }\n format.json { render :show, status: :ok, location: @car }\n else\n format.html { render :edit }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @picture.update(picture_params)\n create_image_tumb(@picture)\n format.html { redirect_to @picture, notice: 'Picture was successfully updated.' }\n format.json { render :show, status: :ok, location: @picture }\n else\n format.html { render :edit }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album.update(album_params)\n format.html { redirect_to @album, notice: 'アルバム情報を更新しました。' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @photo_album.update_attributes(params[:photo_album])\n flash[:notice] = 'PhotoAlbum was successfully updated.'\n format.html { redirect_to(@photo_album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo_album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image_gallery.update(image_gallery_params)\n format.html { redirect_to @image_gallery, notice: 'Image gallery was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_gallery }\n else\n format.html { render :edit }\n format.json { render json: @image_gallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @photo.update(photo_params)\n return render json: {info: 'Photo successfully updated'}\n else\n return render json: {exception: 'PhotoException', message: @photo.errors.full_messages}, status: 400\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, :notice => 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pic.update(pic_params)\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @sample_photo.update(sample_photo_params)\n render json: @sample_photo, status: :ok\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end", "def update\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n if @imagem.update_attributes(params[:imagem])\n format.html { redirect_to @imagem, notice: 'Imagem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imagem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(album_params[:id])\n respond_to do |format|\n if @album.update_attributes(album_params)\n flash[:success] = 'The album was successfully updated.'\n format.html { redirect_to edit_album_url(@album.id) }\n format.json { render json: { rows: [@album.marshall], status: 200, total: 1 } }\n else\n base = 'Failed to save the album. '\n flash[:error] = 'An error occured while updating the album.'\n format.html { render action: 'edit', alert: base + @album.errors.full_messages.to_sentence + '.' }\n format.json { render json: { errors: @album.errors, status: :unprocessable_entity } }\n end\n end\n end", "def update\n @album = current_account.albums.find(params[:id])\n\n respond_to do |format|\n if @album.update_attributes(params[:album])\n flash[:notice] = 'album was successfully updated.'\n format.html { redirect_to(@album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n @item.images.delete_all\n unless params.require(:item)[:images_id].nil?\n params.require(:item)[:images_id].each do |id|\n image = Image.find_by_id(id)\n (@item.images << image) unless image.nil?\n end\n end\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pic = Asset.find(params[:id])\n\n respond_to do |format|\n if @pic.update_attributes(params[:asset])\n format.html { redirect_to new_admin_assets_path, notice: 'ok' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_photo_album\n\t\tphoto_ids.each do |photo_id|\n\t\t\tphoto = SquarePhoto.find( photo_id )\n\t\t\tself.photo_album.square_photos << photo\n\t\tend\n\tend", "def update\n @gallery = Gallery.find(params[:id])\n\n\n if !params[:gallery][:thumbnail].nil?\n #We need to update the S3 file too\n #1- Remove the old file\n begin\n AWS::S3::S3Object.find(@gallery.thumbnail, @@BUCKET).delete\n rescue Exception=>e\n # handle e\n end\n\n #2- Add the new file\n uploaded_io = params[:gallery][:thumbnail]\n filename = sanitize_filename(uploaded_io.original_filename)\n filepath = \"arts/pic\" + Time.now.to_i.to_s + filename\n AWS::S3::S3Object.store(filepath, uploaded_io.read, @@BUCKET, :access => :public_read)\n url = AWS::S3::S3Object.url_for(filepath, @@BUCKET, :authenticated => false)\n params[:gallery][:thumbnail] = url\n end\n\n respond_to do |format|\n if @gallery.update_attributes(params[:gallery])\n format.html { redirect_to @gallery, :notice => 'Gallery was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @gallery.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.73571384", "0.7031816", "0.69092375", "0.6908788", "0.687213", "0.6820628", "0.6749838", "0.6691485", "0.6640333", "0.66399324", "0.6630723", "0.662082", "0.66140354", "0.6613091", "0.6589555", "0.6547795", "0.65395373", "0.6498759", "0.6474465", "0.6465543", "0.6448792", "0.64448977", "0.6391469", "0.6378041", "0.63596505", "0.63523895", "0.6342164", "0.6342164", "0.6342164", "0.633311", "0.633311", "0.633311", "0.6325654", "0.6320399", "0.6315862", "0.630607", "0.6291696", "0.62864774", "0.6281061", "0.6276286", "0.6274028", "0.6272776", "0.6272464", "0.6272081", "0.6272081", "0.6252522", "0.624456", "0.6231155", "0.623055", "0.62190986", "0.62131375", "0.62128663", "0.62112916", "0.6210229", "0.62054664", "0.6198338", "0.61888576", "0.6184721", "0.61827046", "0.6181217", "0.61791986", "0.6177239", "0.6172733", "0.6167439", "0.6164384", "0.61526525", "0.6147557", "0.6134602", "0.61308414", "0.6119399", "0.6106367", "0.61048007", "0.61044765", "0.6102456", "0.60957855", "0.60906583", "0.60900885", "0.6083683", "0.6077965", "0.6072883", "0.6065442", "0.60599333", "0.6058996", "0.60536015", "0.6051512", "0.60474586", "0.6045824", "0.6040944", "0.6040944", "0.6040944", "0.6040944", "0.6030348", "0.6025145", "0.60220766", "0.6020876", "0.6018242", "0.6016868", "0.60114956", "0.6008967", "0.6000339" ]
0.72819173
1
DELETE /private_album_images/1 DELETE /private_album_images/1.json
def destroy @private_album_image.destroy respond_to do |format| format.html { redirect_to private_album_images_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n \t@album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @private_album.destroy\n respond_to do |format|\n format.html { redirect_to private_albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n # Dir.chdir(\"public/images\")\n Dir.delete(@album['directory'])\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_album_url(@album) }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :ok }\n end\n end", "def destroy\n @picture = @album.pictures.find(params[:id]) #JRD111115\n @picture.destroy\n respond_to do |format|\n format.html { redirect_to album_pictures_url(@album), notice: 'Picture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:album_id])\n @image = @album.images.find(params[:id])\n @image.destroy\n redirect_to album_path(@image.album.id), notice: \"The image #{@image.name} has been deleted.\"\n end", "def destroy\n @photoalbum = Photoalbum.find(params[:id])\n @photoalbum.destroy\n\n respond_to do |format|\n format.html { redirect_to photoalbums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.images.clear\n @album.save!\n @album.destroy\n Image.all(:conditions => {:album_id => params[:id]}).each do |x| \n x.album_id = nil\n x.save\n end\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n album=@photo.album\n @photo.destroy\n save_to_json\n respond_to do |format|\n format.html { redirect_to album_path(album), notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album_id\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n @album = @photo.album\n\n respond_to do |format|\n format.html { redirect_to @album, notice: \"写真を削除しました。\" }\n format.json { head :ok }\n end\n end", "def destroy\n @album2photo = Album2photo.find(params[:id])\n @album2photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album2photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def destroy\n @album.destroy\n render json: @album\n end", "def destroy\n alb=@photo.album\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to alb, notice: 'Фотография успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = @allbum.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to allbum_photos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @album = @user.albums.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find( params[:id])\n @album = @photo.album\n if @photo.destroy\n if params[:bucket_id]\n redirect_to bucket_album_path( params[:bucket_id], @album )\n else\n redirect_to @album\n end\n else\n redirect_to @photo\n end\n end", "def destroy\n @album_photo.destroy\n respond_to do |format|\n format.html { redirect_to album_photos_url, notice: 'Album photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gallery.delete\n respond_to do |format|\n format.html { redirect_to galleries_url, notice: 'Gallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album = current_user.albums.find(params[:id])\n @Album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { render json: { status: 200 } }\n end\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_admin_gallery_path(:id=>@gallery.id) }\n format.json { render :json => true }\n end\n end", "def destroy\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n render :json => true\n end", "def destroy\n @pic.destroy\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_album = PhotoAlbum.find(params[:id])\n @photo_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @imagem = Imagem.find(params[:id])\n @imagem.destroy\n\n respond_to do |format|\n format.html { redirect_to imagems_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n\n # Destroy s3 objects\n aws_s3_delete(@photo.key)\n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n aws_s3_delete(@photo[\"thumbnail_key_#{thumbnail_size}\"])\n end\n\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @gallery = Gallery.find(params[:id])\n\n begin\n AWS::S3::S3Object.find(@gallery.thumbnail, @@BUCKET).delete\n rescue Exception=>e\n # handle e\n end\n \n @gallery.destroy\n\n respond_to do |format|\n format.html { redirect_to galleries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "def delete\n photo_id = params[:photoId]\n photo = Photo.find(photo_id)\n\n if (photo.nil?)\n raise Exceptions::PhotoHuntError.new(404, 'Photo with given ID does not exist')\n elsif (photo.owner_user_id != session[:user_id])\n raise Exceptions::PhotoHuntError.new(404, 'Photo with given ID does not exist')\n else\n photo.destroy\n end\n\n # TODO(samstern): Figure out why this method works but the Android client\n # reports failure\n render json: 'Photo successfully deleted'\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to @photo.item }\n format.json { head :no_content }\n end\n end", "def destroy\n image = Image.find(params[:id])\n if image.user_id == current_user.id\n image.destroy\n render json:{}, status:201\n end\n end", "def destroy\n # authorize\n authorize! :delete, @album\n @album.destroy\n \n render nothing:true\n flash[:notice] = 'Xóa album thành công.'\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user\n if current_user.role == \"admin\"\n \n @album = Album.find(params[:id])\n @zdjecia_albumu = Image.find_all_by_nr_albumu(@album.id)\n @zdjecia_albumu.each {|r| r.destroy }\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/galeria\", flash: {success: 'Gratulacje! Usunięto Album wraz z wszystkimi zdjęciami!'}}\n format.json { head :no_content }\n end\n \n else\n \tredirect_to root_url, flash: {error: t('errors.messages.permissions')}\n end\n else\n redirect_to :login, flash: {notice: t('errors.messages.login_to_see')}\n end\n end", "def destroy\n @avatar.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @albumm = Albumm.find(params[:id])\n @albumm.destroy\n\n respond_to do |format|\n format.html { redirect_to albumms_url }\n format.json { head :no_content }\n end\n end", "def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "def destroy\n @album_item = AlbumItem.find(params[:id])\n @album_item.destroy\n\n respond_to do |format|\n format.html { redirect_to album_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_album = UserAlbum.find(params[:id])\n @user_album.destroy\n\n respond_to do |format|\n format.html { redirect_to user_albums_url }\n format.json { head :no_content }\n end\n end", "def delete photo_id\n @flickr.photos.delete(photo_id: photo_id)\n end", "def destroy\n @picture.destroy\n respond_to do |format|\n format.html { redirect_to album_pictures_path, notice: 'Picture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @picture = Picture.find(params[:id])\n @picture.destroy\n render :json => true\n end", "def destroy\n @image_gallery = ImageGallery.find(params[:id])\n @image_gallery.destroy\n\n respond_to do |format|\n format.html { redirect_to image_galleries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_photo = Photo.find(params[:id])\n @admin_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_album.destroy\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n\n head :no_content\n end", "def destroy\n @pic = Pic.find(params[:id])\n @pic.destroy\n\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@picture = Picture.find(params[:id])\n @picture = @museum.pictures.find(params[:id])\n directory = \"public/data\"\n path = File.join(directory, @picture.name)\n if File.exist?(path)\n File.delete(path) \n end\n @picture.destroy\n\n respond_to do |format|\n #format.html { redirect_to pictures_url }\n format.html { redirect_to museum_pictures_path(@museum) }\n format.json { head :no_content }\n end\n end", "def destroy\n @grm_pic = GrmPic.find(params[:id])\n @grm_pic.destroy\n\n respond_to do |format|\n format.html { redirect_to grm_pics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_album.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_albums_url) }\n format.xml { head :ok }\n end\n end", "def delete_picture\n @pic = Picture.find(params[:id])\n if @pic.album.user_id==@login_user.id\n if @pic.destroy\n render :text=>\"Success\"\n else\n render :text=>\"Fail\"\n end\n else\n render :text=>\"Not your photo\"\n end\n end", "def destroy\n @album.destroy\n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'El album a sido removido satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rock_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo.photo.destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @albums = Album.all\n @album = Album.find(params[:id])\n @album.destroy\n \n respond_to do |format|\n format.html { redirect_to albums_url, notice: 'Album was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.75851434", "0.7518786", "0.7511975", "0.75039047", "0.7412196", "0.7358814", "0.7337884", "0.7320177", "0.73031056", "0.7298864", "0.7291708", "0.72791886", "0.7259161", "0.7238636", "0.7218582", "0.7206611", "0.7185427", "0.71839875", "0.7149847", "0.7126101", "0.7126075", "0.71190834", "0.71118385", "0.7110574", "0.7098725", "0.7081061", "0.7081061", "0.7081061", "0.7081061", "0.7081061", "0.7079954", "0.7072136", "0.70710945", "0.70703536", "0.70679533", "0.70679533", "0.70679533", "0.7051714", "0.7035968", "0.7035968", "0.7035968", "0.7035968", "0.7035968", "0.7035968", "0.70316696", "0.70274365", "0.7019775", "0.7018996", "0.701598", "0.7013801", "0.7008694", "0.700738", "0.7006696", "0.7003801", "0.7002814", "0.70025826", "0.69943535", "0.69943535", "0.69943535", "0.69943535", "0.69943535", "0.69943535", "0.69943535", "0.6994166", "0.6991889", "0.69906706", "0.6987967", "0.6986983", "0.69652516", "0.6961281", "0.6961031", "0.69599956", "0.6959169", "0.69584197", "0.69578713", "0.69493914", "0.69490266", "0.6948466", "0.69481874", "0.6947575", "0.6947389", "0.69427454", "0.6930797", "0.69216126", "0.6920391", "0.6919664", "0.6915684", "0.6909", "0.69059086", "0.6897127", "0.6897127", "0.6897127", "0.6897127", "0.6897127", "0.6897127", "0.6892443", "0.68884164", "0.68833864", "0.68833864", "0.68833864" ]
0.8040722
0
Use callbacks to share common setup or constraints between actions.
def set_private_album_image @private_album_image = PrivateAlbumImage.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def private_album_image_params params.require(:private_album_image).permit(:ImageID, :AlbumID) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new if !@name.nil? && @name.to_s.length > 250 invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 250.') end invalid_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if !@uuid.nil? && @uuid !~ pattern\n invalid_properties.push(\"invalid value for \\\"uuid\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if !@vdisk_id.nil? && @vdisk_id !~ pattern\n invalid_properties.push(\"invalid value for \\\"vdisk_id\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @style.nil?\n invalid_properties.push('invalid value for \"style\", style cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if !@name.nil? && @name.to_s.length > 31\n invalid_properties.push('invalid value for \"name\", the character length must be smaller than or equal to 31.')\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n if !@name.nil? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@wwpn.nil? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @is_object_icon.nil?\n invalid_properties.push('invalid value for \"is_object_icon\", is_object_icon cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @input_currency.nil?\n invalid_properties.push('invalid value for \"input_currency\", input_currency cannot be nil.')\n end\n\n if @sender.nil?\n invalid_properties.push('invalid value for \"sender\", sender cannot be nil.')\n end\n\n if @recipients.nil?\n invalid_properties.push('invalid value for \"recipients\", recipients cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @index.nil?\n invalid_properties.push('invalid value for \"index\", index cannot be nil.')\n end\n\n if @orientation.nil?\n invalid_properties.push('invalid value for \"orientation\", orientation cannot be nil.')\n end\n\n if @size.nil?\n invalid_properties.push('invalid value for \"size\", size cannot be nil.')\n end\n\n if @type.nil?\n invalid_properties.push('invalid value for \"type\", type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @direction.nil?\n invalid_properties.push('invalid value for \"direction\", direction cannot be nil.')\n end\n\n if @shape.nil?\n invalid_properties.push('invalid value for \"shape\", shape cannot be nil.')\n end\n\n if @linear_angle.nil?\n invalid_properties.push('invalid value for \"linear_angle\", linear_angle cannot be nil.')\n end\n\n if @is_scaled.nil?\n invalid_properties.push('invalid value for \"is_scaled\", is_scaled cannot be nil.')\n end\n\n if @tile_flip.nil?\n invalid_properties.push('invalid value for \"tile_flip\", tile_flip cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @format.nil?\n invalid_properties.push('invalid value for \"format\", format cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end" ]
[ "0.76497203", "0.76497203", "0.76497203", "0.76497203", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7356452", "0.7334807", "0.72685325", "0.7238964", "0.7231359", "0.72258264", "0.7208294", "0.71760833", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241", "0.7170241" ]
0.0
-1
Check to see if the all the properties in the model are valid
def valid? return false if !@name.nil? && @name.to_s.length > 250 true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_properties\n true\n end", "def validate_properties\n true\n end", "def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end", "def valid_attributes?\n true\n end", "def valid_attributes?\n attribute_errors.empty?\n end", "def valid?\n return false if @property_code.nil?\n return false if @property_name.nil?\n return false if @location.nil?\n return false if @total_price.nil?\n return false if @min_daily_rate.nil?\n return true\n end", "def validate_presence_of(klazz, properties)\r\n instance = klazz.new \r\n instance.should_not be_valid\r\n \r\n properties.each do |property| \r\n instance.errors.should be_invalid(property)\r\n err_properties = instance.errors[property]\r\n if err_properties.is_a? Array\r\n err_properties.include?(ActiveRecord::Errors.default_error_messages[:blank]).should be_true\r\n else\r\n err_properties.should == ActiveRecord::Errors.default_error_messages[:blank] \r\n end\r\n end \r\n end", "def validate_attributes!(attributes)\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n raise UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if invalid_properties.size > 0\n end", "def model_valid?\n true\n end", "def model_valid?\n true\n end", "def valid?\n self.errors = []\n self.content_type.fields.each do |field|\n if field.required\n if self.dynamic_getter(field.name).blank?\n self.errors << field.name\n end\n end\n end\n self.errors.blank?\n end", "def valid?\n validate\n @model.errors.on(:preferences).blank?\n end", "def validate_properties\n if @properties.keys.count > 0\n if @properties.key?(:label)\n unless @properties[:label] =~ /^[a-zA-Z][\\w|\\s]*$/\n raise 'property label validation error'\n end\n end\n\n if @properties.key?(:default_aggregate)\n unless @properties[:default_aggregate] =~ /^max$|^min$|^avg$|^count$/i\n raise 'property default_aggregate validation error'\n end\n end\n end\n end", "def validate_properties\n @properties.each do |property, values|\n valid_values = validate_values(property, values)\n\n if valid_values.is_a?(Array) && valid_values == [] || valid_values.nil?\n @properties.delete(property)\n else\n @properties[property] = valid_values\n end\n end\n end", "def validate\n valid?\n end", "def validate_attributes!(attributes)\n return attributes if attributes.blank?\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n invalid_properties.reject! { |name| self.respond_to?(\"#{name}=\") }\n fail UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if !invalid_properties.empty?\n end", "def is_valid; end", "def valid?\n # TODO validate nested objects\n output = super\n errors.empty? && output\n end", "def property_checks\n errors.add(:base, \"You can't have a Thing without properties\") if property_keys.empty?\n\n self.property_keys.each do |key|\n errors.add(:properties, \"'#{key}' is an invalid property for this List\") unless available_property_keys.include?(key)\n end\n end", "def valid_for_attributes( model, attributes )\n unless model.valid?\n errors = model.errors\n our_errors = Array.new\n errors.each { |attr,error|\n if attributes.include? attr\n our_errors << [attr,error]\n end\n }\n errors.clear\n our_errors.each { |attr,error| errors.add(attr,error) }\n return false unless errors.empty?\n end\n return true\n end", "def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end", "def valid?\n return false if !super\n return false if @index.nil?\n return false if @orientation.nil?\n orientation_validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical'])\n return false unless orientation_validator.valid?(@orientation)\n return false if @size.nil?\n size_validator = EnumAttributeValidator.new('String', ['Full', 'Half', 'Quarter'])\n return false unless size_validator.valid?(@size)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Title', 'Body', 'CenteredTitle', 'Subtitle', 'DateAndTime', 'SlideNumber', 'Footer', 'Header', 'Object', 'Chart', 'Table', 'ClipArt', 'Diagram', 'Media', 'SlideImage', 'Picture'])\n return false unless type_validator.valid?(@type)\n true\n end", "def validate\n validate_string_attributes\n @relations.map(&:validate)\n end", "def is_valid?\n end", "def run_validations\n true\n end", "def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end", "def checkAttributeRequirements\n if @valid_attributes.empty?\n @error_text = \"No valid attributes found\"\n return false\n elsif (@mandatory_attributes_from_db & @valid_attributes) != @mandatory_attributes_from_db\n missing_attr = @mandatory_attributes_from_db - (@mandatory_attributes_from_db & @valid_attributes)\n\n x_attr_txt = \"\"\n missing_attr.each {|x_attr| x_attr_txt += x_attr[:name] + \", \"}\n @error_text = \"Mandatory attributes #{x_attr_txt[0..-3]} is/are missing\"\n return false\n end\n\n return true\n end", "def validations\n {}\n end", "def validatable?\n true\n end", "def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end", "def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end", "def validate\n validate_root\n validate_associated\n valid?\n end", "def validate\n true\n end", "def valid?\n return false if @id.nil?\n return false if @created.nil?\n return false if @modified.nil?\n return false if @company_name.nil?\n return false if @company_name.to_s.length < 1\n return false if @domain_name.nil?\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"active\", \"deactivated\"])\n return false unless state_validator.valid?(@state)\n return false if @billing_email.nil?\n return false if @application_count.nil?\n return false if @user_count.nil?\n return false if @campaigns_active_count.nil?\n return false if @campaigns_inactive_count.nil?\n true\n end", "def valid?\n _errors_before = self.errors.dup\n _s = super\n validate_attributes\n _errors_before.each { |e| append_error(_errors_before,e) }\n self.errors.empty?\n end", "def valid?\n true\n end", "def validate!\n expected_props, required_props = @properties.keys, @required\n\n unless is_a?(Dialect) || is_a?(Template)\n expected_props = expected_props + INHERITED_PROPERTIES.keys\n end\n\n # It has only expected properties (exclude metadata)\n keys = self.keys - [:\"@context\"]\n keys = keys.reject {|k| k.to_s.include?(':')} unless is_a?(Dialect)\n raise \"#{type} has unexpected keys: #{keys - expected_props}\" unless keys.all? {|k| expected_props.include?(k)}\n\n # It has required properties\n raise \"#{type} missing required keys: #{required_props & keys}\" unless (required_props & keys) == required_props\n\n # Every property is valid\n keys.each do |key|\n value = self[key]\n is_valid = case key\n when :columns\n column_names = value.map(&:name)\n value.is_a?(Array) &&\n value.all? {|v| v.is_a?(Column) && v.validate!} &&\n begin\n # The name properties of the column descriptions must be unique within a given table description.\n column_names = value.map(&:name)\n raise \"Columns must have unique names\" if column_names.uniq != column_names\n true\n end\n when :commentPrefix then value.is_a?(String) && value.length == 1\n when :datatype then value.is_a?(String) && DATATYPES.keys.map(&:to_s).include?(value)\n when :default then value.is_a?(String)\n when :delimiter then value.is_a?(String) && value.length == 1\n when :dialect then value.is_a?(Dialect) && value.validate!\n when :doubleQuote then %w(true false 1 0).include?(value.to_s.downcase)\n when :encoding then Encoding.find(value)\n when :foreignKeys\n # An array of foreign key definitions that define how the values from specified columns within this table link to rows within this table or other tables. A foreign key definition is a JSON object with the properties:\n value.is_a?(Array) && value.all? do |fk|\n raise \"Foreign key must be an object\" unless fk.is_a?(Hash)\n columns, reference = fk['columns'], fk['reference']\n raise \"Foreign key missing columns and reference\" unless columns && reference\n raise \"Foreign key has extra entries\" unless fk.keys.length == 2\n raise \"Foreign key must reference columns\" unless Array(columns).all? {|k| self.columns.any? {|c| c.name == k}}\n raise \"Foreign key reference must be an Object\" unless reference.is_a?(Hash)\n\n if reference.has_key?('resource')\n raise \"Foreign key having a resource reference, must not have a schema\" if reference.has_key?('schema')\n # FIXME resource is a URL of a specific resource (table) which must exist\n elsif reference.has_key?('schema')\n # FIXME schema is a URL of a specific schema which must exist\n end\n # FIXME: columns\n true\n end\n when :format then value.is_a?(String)\n when :header then %w(true false 1 0).include?(value.to_s.downcase)\n when :headerColumnCount, :headerRowCount\n value.is_a?(Numeric) && value.integer? && value > 0\n when :length\n # Applications must raise an error if length, maxLength or minLength are specified and the cell value is not a list (ie separator is not specified), a string or one of its subtypes, or a binary value.\n raise \"Use if minLength or maxLength with length requires separator\" if self[:minLength] || self[:maxLength] && !self[:separator]\n raise \"Use of both length and minLength requires they be equal\" unless self.fetch(:minLength, value) == value\n raise \"Use of both length and maxLength requires they be equal\" unless self.fetch(:maxLength, value) == value\n value.is_a?(Numeric) && value.integer? && value > 0\n when :language then BCP47::Language.identify(value)\n when :lineTerminator then value.is_a?(String)\n when :minimum, :maximum, :minInclusive, :maxInclusive, :minExclusive, :maxExclusive\n value.is_a?(Numeric) ||\n RDF::Literal::Date.new(value).valid? ||\n RDF::Literal::Time.new(value).valid? ||\n RDF::Literal::DateTime.new(value).valid?\n when :minLength, :maxLength\n value.is_a?(Numeric) && value.integer? && value > 0\n when :name then value.is_a?(String) && !name.start_with?(\"_\")\n when :notes then value.is_a?(Array) && value.all? {|v| v.is_a?(Hash)}\n when :null then value.is_a?(String)\n when :predicateUrl then Array(value).all? {|v| RDF::URI(v).valid?}\n when :primaryKey\n # A column reference property that holds either a single reference to a column description object or an array of references.\n Array(value).all? do |k|\n self.columns.any? {|c| c.name == k}\n end\n when :quoteChar then value.is_a?(String) && value.length == 1\n when :required then %w(true false 1 0).include?(value.to_s.downcase)\n when :resources then value.is_a?(Array) && value.all? {|v| v.is_a?(Table) && v.validate!}\n when :schema then value.is_a?(Schema) && value.validate!\n when :separator then value.nil? || value.is_a?(String) && value.length == 1\n when :skipInitialSpace then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipBlankRows then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipColumns then value.is_a?(Numeric) && value.integer? && value >= 0\n when :skipRows then value.is_a?(Numeric) && value.integer? && value >= 0\n when :source then %w(json rdf).include?(value)\n when :\"table-direction\" then %w(rtl ltr default).include?(value)\n when :targetFormat, :templateFormat then RDF::URI(value).valid?\n when :templates then value.is_a?(Array) && value.all? {|v| v.is_a?(Template) && v.validate!}\n when :\"text-direction\" then %w(rtl ltr).include?(value)\n when :title then valid_natural_language_property?(value)\n when :trim then %w(true false 1 0 start end).include?(value.to_s.downcase)\n when :urlTemplate then value.is_a?(String)\n when :@id then @id.valid?\n when :@type then value.to_sym == type\n else\n raise \"?!?! shouldn't get here for key #{key}\"\n end\n raise \"#{type} has invalid #{key}: #{value.inspect}\" unless is_valid\n end\n\n self\n end", "def valid?\n return false if @subject_property.nil?\n return false if @proprietorship.nil?\n proprietorship_validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Sole\", \"Joint\"])\n return false unless proprietorship_validator.valid?(@proprietorship)\n return false if @surname.nil?\n return false if @forename.nil?\n return false if @middle_name.nil?\n return true\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless object_type_validator.valid?(@object_type)\n hardware_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless hardware_status_validator.valid?(@hardware_status)\n reason_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless reason_validator.valid?(@reason)\n software_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless software_status_validator.valid?(@software_status)\n status_validator = EnumAttributeValidator.new('String', [\"Incomplete\", \"Not-Found\", \"Not-Listed\", \"Validated\", \"Not-Evaluated\"])\n return false unless status_validator.valid?(@status)\n true && super\n end", "def core_attributes_valid\n core_attributes = [@rateable, @rater, @ratee, @rating_type]\n return if core_attributes.all? { |atr| atr.present? && atr.valid? }\n errors.add('message', 'Not all core attributes present and valid.')\n end", "def valid?\n super\n errors.empty?\n end", "def valid?\n \n if @account_id.nil?\n false\n elsif @campaign_id.nil?\n false\n elsif @csp_id.nil?\n false\n elsif @status.nil?\n false\n elsif @create_date.nil?\n false\n elsif @auto_renewal.nil?\n false\n elsif @brand_id.nil?\n false\n elsif @usecase.nil?\n false\n elsif @sub_usecases.nil?\n false\n elsif @description.nil?\n false\n elsif @embedded_link.nil?\n false\n elsif @embedded_phone.nil?\n false\n elsif @affiliate_marketing.nil?\n false\n elsif @number_pool.nil?\n false\n elsif @age_gated.nil?\n false\n elsif @direct_lending.nil?\n false\n elsif @subscriber_optin.nil?\n false\n elsif @subscriber_optout.nil?\n false\n elsif @subscriber_help.nil?\n false\n elsif @sample1.nil?\n false\n elsif @mock.nil?\n false\n else\n list_invalid_properties.length() == 0\n end\n end", "def valid?(metadata)\n validate.each do |attr|\n return false if metadata[attr.to_sym].nil? || metadata[attr.to_sym].zero?\n end\n end", "def is_valid\n return true\n end", "def validate_attrs\n @target.present? && !@target.errors.any? && @actor.present? && @action_key.present?\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if !@name.nil? && @name.to_s.length > 31\n invalid_properties.push('invalid value for \"name\", the character length must be smaller than or equal to 31.')\n end\n\n pattern = Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n if !@name.nil? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@wwpn.nil? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end", "def valid_save?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n if self.general_info.nil? || self.general_info == \"\"\n valid = false\n end\n\n if self.technical_specs.nil? || self.technical_specs == \"\"\n valid = false\n end\n\n if self.where_to_buy.nil? || self.where_to_buy == \"\"\n valid = false\n end\n\n return valid\n end", "def valid?\n schema.validate(self)\n end", "def valid?\n reset_errors\n valid_date?\n valid_user?\n valid_activity_type?\n self.errors.empty?\n end", "def valid?\n validate\n end", "def product_attributes_must_not_be_empty\n\n\t\t# Instance\n\t\tproduct = Product.new\n\n\t\tassert product.invalid?\n\t\tassert product.errors[:title].any?\n\t\tassert product.errors[:description].any?\n\t\tassert product.errors[:price].any?\n\t\tassert product.errors[:image_url].any?\n\tend", "def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if !@front_template_id.nil? && @front_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@back_template_id.nil? && @back_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@front_template_version_id.nil? && @front_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@back_template_version_id.nil? && @back_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n object_validator = EnumAttributeValidator.new('String', [\"postcard\"])\n return false unless object_validator.valid?(@object)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if !@description.nil? && @description.to_s.length > 255\n true\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless object_type_validator.valid?(@object_type)\n ethernet_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless ethernet_switching_mode_validator.valid?(@ethernet_switching_mode)\n fc_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless fc_switching_mode_validator.valid?(@fc_switching_mode)\n management_mode_validator = EnumAttributeValidator.new('String', [\"IntersightStandalone\", \"UCSM\", \"Intersight\"])\n return false unless management_mode_validator.valid?(@management_mode)\n thermal_validator = EnumAttributeValidator.new('String', [\"unknown\", \"ok\", \"upper-non-recoverable\", \"upper-critical\", \"upper-non-critical\", \"lower-non-critical\", \"lower-critical\", \"lower-non-recoverable\"])\n return false unless thermal_validator.valid?(@thermal)\n true && super\n end", "def valid?\n\t\t\t\ttrue\n\t\t\tend", "def validate\r\n validate! rescue false\r\n end", "def validate\n validate_string_attributes\n end", "def valid?\n self.errors = Mongomatic::Errors.new\n do_callback(:before_validate)\n check_required_fields\n validate\n do_callback(:after_validate)\n self.errors.empty?\n end", "def valid\n @valid\n end", "def valid_objects\n all_objects.select { |o| o.valid? }\n end", "def valid?\n return false if @summary.nil?\n return false if @summary.to_s.length > 100\n record_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\"])\n return false unless record_type_validator.valid?(@record_type)\n return false if !@wbs_code.nil? && @wbs_code.to_s.length > 50\n return false if @company.nil?\n return false if !@site_name.nil? && @site_name.to_s.length > 50\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state_identifier.nil? && @state_identifier.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@contact_phone_number.nil? && @contact_phone_number.to_s.length > 20\n return false if !@contact_phone_extension.nil? && @contact_phone_extension.to_s.length > 15\n return false if !@contact_email_address.nil? && @contact_email_address.to_s.length > 250\n severity_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless severity_validator.valid?(@severity)\n impact_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless impact_validator.valid?(@impact)\n return false if !@external_x_ref.nil? && @external_x_ref.to_s.length > 100\n return false if !@po_number.nil? && @po_number.to_s.length > 50\n return false if !@automatic_email_cc.nil? && @automatic_email_cc.to_s.length > 1000\n sub_billing_method_validator = EnumAttributeValidator.new('String', [\"ActualRates\", \"FixedFee\", \"NotToExceed\", \"OverrideRate\"])\n return false unless sub_billing_method_validator.valid?(@sub_billing_method)\n knowledge_base_link_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\", \"KnowledgeBaseArticle\", \"Time\", \"Activity\"])\n return false unless knowledge_base_link_type_validator.valid?(@knowledge_base_link_type)\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n predecessor_type_validator = EnumAttributeValidator.new('String', [\"Ticket\", \"Phase\"])\n return false unless predecessor_type_validator.valid?(@predecessor_type)\n return true\n end", "def validate!\n true\n end", "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless object_type_validator.valid?(@object_type)\n return false if !@name.nil? && @name.to_s.length > 31\n return false if !@name.nil? && @name !~ Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n return false if !@static_wwpn_address.nil? && @static_wwpn_address !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n type_validator = EnumAttributeValidator.new('String', [\"fc-initiator\", \"fc-nvme-initiator\", \"fc-nvme-target\", \"fc-target\"])\n return false unless type_validator.valid?(@type)\n return false if !@wwpn.nil? && @wwpn !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n wwpn_address_type_validator = EnumAttributeValidator.new('String', [\"POOL\", \"STATIC\"])\n return false unless wwpn_address_type_validator.valid?(@wwpn_address_type)\n true && super\n end", "def valid?\n validate_survivors and validate_items && validate_records\n end", "def valid?\n return false if @id.nil?\n return false if @next_send.nil?\n return false if @rrule.nil?\n return false if @session.nil?\n return false if @last_sent.nil?\n return false if @contact_name.nil?\n return false if @parameters.nil?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n return false unless type_validator.valid?(@type)\n return false if @summary.nil?\n return false if @text_parameters.nil?\n return false if @first_occurrence.nil?\n return false if @last_occurrence.nil?\n return false if @recipients_count.nil?\n return false if @timezone.nil?\n return false if @completed.nil?\n return false if @avatar.nil?\n return false if @created_at.nil?\n true\n end", "def valid?\n return false if !@description.nil? && @description.to_s.length > 255\n return false if @routing_number.nil?\n return false if @routing_number.to_s.length > 9\n return false if @routing_number.to_s.length < 9\n return false if @account_number.nil?\n return false if @account_number.to_s.length > 17\n return false if @account_type.nil?\n account_type_validator = EnumAttributeValidator.new('String', [\"company\", \"individual\"])\n return false unless account_type_validator.valid?(@account_type)\n return false if @signatory.nil?\n return false if @signatory.to_s.length > 30\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bank_[a-zA-Z0-9]+$/)\n return false if !@signature_url.nil? && @signature_url !~ Regexp.new(/^https:\\/\\/lob-assets\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"bank_account\"])\n return false unless object_validator.valid?(@object)\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n return false if @id.nil?\n return false if @account_id.nil?\n return false if @organization_id.nil?\n return false if @product_id.nil?\n return false if @product_rate_plan_id.nil?\n return false if @name.nil?\n type_validator = EnumAttributeValidator.new('String', [\"Subscription\", \"FixedTerm\", \"Trial\"])\n return false unless type_validator.valid?(@type)\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"Trial\", \"Provisioned\", \"Paid\", \"AwaitingPayment\", \"Cancelled\", \"Failed\", \"Expired\"])\n return false unless state_validator.valid?(@state)\n return false if @initial_period_start.nil?\n return false if @trial_end.nil?\n managed_by_validator = EnumAttributeValidator.new('String', [\"BillForward\", \"Stripe\"])\n return false unless managed_by_validator.valid?(@managed_by)\n return false if @version_start.nil?\n return false if @version_number.nil?\n return false if @current_time.nil?\n failed_payment_behaviour_validator = EnumAttributeValidator.new('String', [\"CancelSubscription\", \"None\"])\n return false unless failed_payment_behaviour_validator.valid?(@failed_payment_behaviour)\n return true\n end", "def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length < 1\n return false if @timezone.nil?\n return false if @timezone.to_s.length < 1\n return false if @currency.nil?\n return false if @currency.to_s.length < 1\n case_sensitivity_validator = EnumAttributeValidator.new('String', [\"sensitive\", \"insensitive-uppercase\", \"insensitive-lowercase\"])\n return false unless case_sensitivity_validator.valid?(@case_sensitivity)\n campaign_priority_validator = EnumAttributeValidator.new('String', [\"universal\", \"stackable\", \"exclusive\"])\n return false unless campaign_priority_validator.valid?(@campaign_priority)\n exclusive_campaigns_strategy_validator = EnumAttributeValidator.new('String', [\"listOrder\", \"lowestDiscount\", \"highestDiscount\"])\n return false unless exclusive_campaigns_strategy_validator.valid?(@exclusive_campaigns_strategy)\n default_discount_scope_validator = EnumAttributeValidator.new('String', [\"sessionTotal\", \"cartItems\", \"additionalCosts\"])\n return false unless default_discount_scope_validator.valid?(@default_discount_scope)\n default_discount_additional_cost_per_item_scope_validator = EnumAttributeValidator.new('String', [\"price\", \"itemTotal\", \"additionalCosts\"])\n return false unless default_discount_additional_cost_per_item_scope_validator.valid?(@default_discount_additional_cost_per_item_scope)\n true\n end", "def valid?\n run_validation\n @errors.empty?\n end", "def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end", "def valid?\n return false if @id.nil?\n return false if @token.nil?\n return false if @tipo.nil?\n tipo_validator = EnumAttributeValidator.new('String', ['fatture', 'proforma', 'ordini', 'preventivi', 'ndc'])\n return false unless tipo_validator.valid?(@tipo)\n return false if @nome.nil?\n return false if @indirizzo_via.nil?\n return false if @indirizzo_cap.nil?\n return false if @indirizzo_citta.nil?\n return false if @indirizzo_provincia.nil?\n return false if @paese.nil?\n lingua_validator = EnumAttributeValidator.new('String', ['it', 'en', 'de'])\n return false unless lingua_validator.valid?(@lingua)\n return false if @piva.nil?\n return false if @cf.nil?\n return false if @numero.nil?\n return false if @valuta.nil?\n return false if @valuta_cambio.nil?\n return false if @prezzi_ivati.nil?\n return false if @importo_netto.nil?\n return false if @importo_iva.nil?\n return false if @importo_totale.nil?\n mostra_totali_validator = EnumAttributeValidator.new('String', ['tutti', 'netto', 'nessuno'])\n return false unless mostra_totali_validator.valid?(@mostra_totali)\n return false if @lista_articoli.nil?\n pa_tipo_cliente_validator = EnumAttributeValidator.new('String', ['PA', 'B2B'])\n return false unless pa_tipo_cliente_validator.valid?(@pa_tipo_cliente)\n pa_tipo_validator = EnumAttributeValidator.new('String', ['ordine', 'convenzione', 'contratto', 'nessuno'])\n return false unless pa_tipo_validator.valid?(@pa_tipo)\n pa_esigibilita_validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n return false unless pa_esigibilita_validator.valid?(@pa_esigibilita)\n true\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end", "def validate\n end", "def valid?\n return false if @to.nil?\n return false if @from.nil?\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^ltr_[a-zA-Z0-9]+$/)\n return false if !@template_id.nil? && @template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@template_version_id.nil? && @template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@url.nil? && @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"letter\"])\n return false unless object_validator.valid?(@object)\n return false if !@description.nil? && @description.to_s.length > 255\n return false if !@tracking_events.nil? && @tracking_events.length > 0\n address_placement_validator = EnumAttributeValidator.new('String', [\"top_first_page\", \"insert_blank_page\", \"bottom_first_page_center\", \"bottom_first_page\"])\n return false unless address_placement_validator.valid?(@address_placement)\n true\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def valid_attributes\n {}\n end", "def supports_validations?\n true\n end", "def valid?\n @errors = self.class.valid_against_schema?(self.class.json_schema, self)\n @errors.empty?\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n return false if @first_name.nil?\n return false if @first_name.to_s.length > 30\n return false if !@last_name.nil? && @last_name.to_s.length > 30\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state.nil? && @state.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@country.nil? && @country.to_s.length > 50\n return false if !@security_identifier.nil? && @security_identifier.to_s.length > 184\n return false if !@title.nil? && @title.to_s.length > 100\n return false if !@school.nil? && @school.to_s.length > 50\n return false if !@nick_name.nil? && @nick_name.to_s.length > 30\n return false if !@significant_other.nil? && @significant_other.to_s.length > 30\n return false if !@portal_password.nil? && @portal_password.to_s.length > 15\n return false if !@portal_security_level.nil? && @portal_security_level > 6.0\n return false if !@portal_security_level.nil? && @portal_security_level < 1.0\n gender_validator = EnumAttributeValidator.new('String', [\"Male\", \"Female\"])\n return false unless gender_validator.valid?(@gender)\n presence_validator = EnumAttributeValidator.new('String', [\"Online\", \"DoNotDisturb\", \"Away\", \"Offline\", \"NoAgent\"])\n return false unless presence_validator.valid?(@presence)\n return true\n end", "def validated?; end", "def valid?\n return false if @name.nil?\n return false if @slug.nil?\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])\n return false unless status_validator.valid?(@status)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['digital', 'physical'])\n return false unless type_validator.valid?(@type)\n return false if @sku.nil?\n return false if @price.nil?\n availability_validator = EnumAttributeValidator.new('String', ['available', 'comingSoon', 'retired'])\n return false unless availability_validator.valid?(@availability)\n stock_status_validator = EnumAttributeValidator.new('String', ['available', 'alert', 'unavailable'])\n return false unless stock_status_validator.valid?(@stock_status)\n return false if @categories.nil?\n true\n end", "def valid?\n self.valid\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end" ]
[ "0.78992486", "0.78992486", "0.70971805", "0.70782334", "0.7032205", "0.7031276", "0.69510347", "0.6869891", "0.6858077", "0.6858077", "0.68287027", "0.6823878", "0.6820306", "0.68144894", "0.6794656", "0.6752167", "0.66843414", "0.6676546", "0.6667755", "0.66296124", "0.66184515", "0.6608204", "0.6599208", "0.6594276", "0.6584302", "0.6580472", "0.6578095", "0.6558585", "0.6555879", "0.6542414", "0.6536983", "0.6533884", "0.65315515", "0.65311855", "0.65267456", "0.65258855", "0.6520786", "0.65205675", "0.6511026", "0.6498394", "0.64966303", "0.64935124", "0.6491113", "0.64885867", "0.6479024", "0.6473706", "0.64679337", "0.6467217", "0.6461245", "0.64601135", "0.64553183", "0.64540446", "0.6447954", "0.64393955", "0.6434162", "0.64312094", "0.6428205", "0.6426148", "0.6412439", "0.64070046", "0.64044213", "0.6403482", "0.6399368", "0.63979715", "0.63858813", "0.63855004", "0.63855004", "0.63855004", "0.63855004", "0.63740236", "0.6367379", "0.63645166", "0.6362151", "0.63599974", "0.6357385", "0.63549066", "0.63549066", "0.63549066", "0.63549066", "0.6354845", "0.6354207", "0.6350302", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.6344303", "0.63435715", "0.63406414", "0.63344824", "0.6333158", "0.63313466", "0.63294095", "0.6327076", "0.63247603", "0.63247603", "0.63247603", "0.63247603" ]
0.0
-1
Custom attribute writer method with validation
def name=(name) if !name.nil? && name.to_s.length > 250 fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 250.' end @name = name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_writer_tag(text); end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def writer(*args)\n attr_writer(*args)\n args\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end", "def attr_writer(sym, *more) end", "def is_attribute?; end", "def validate_exclusion_of(attr); end", "def register_attributes\n raise \"Not implemented in #{self.class}\"\n end", "def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end", "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end", "def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end", "def escape_attr input\n escape input, attr_regexp, attr_mapping\n end", "def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend", "def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end", "def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end", "def write_attribute(attribute, value)\n false\n end", "def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end", "def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end", "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end", "def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend", "def add_attribute(name, &block); end", "def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end", "def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end", "def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end", "def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end", "def print_attribute(*) end", "def attribute(name); end", "def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend", "def attr(name); end", "def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def set_attribute(name, value); end", "def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end", "def validated_attribute_names(params); end", "def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end", "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end", "def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end", "def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end", "def html_attributes(attr); end", "def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end", "def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend", "def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end", "def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end", "def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { \"name\" => \"MyString\" }\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end", "def attr; end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end", "def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end", "def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end", "def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end", "def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def valid_attributes\n { name: 'do this' }\n end", "def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end", "def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end", "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end", "def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end", "def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end", "def valid_attributes\n { name: \"Expert\" }\n end", "def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end", "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end", "def valid_attributes\n { \"username\" => \"MyString\" }\n end", "def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end", "def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end", "def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end", "def has_attributes?; end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "def attr(symbol, writable=false) end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def validate\n validate_string_attributes\n end", "def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end", "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_attributes\n { }\n end", "def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end", "def valid_attributes\n { }\n end", "def valid_attributes\n { }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end", "def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end", "def attribute; end", "def attribute; end" ]
[ "0.6472992", "0.6315012", "0.6315012", "0.62821025", "0.6279224", "0.6211609", "0.61891466", "0.6182247", "0.60683644", "0.6032628", "0.5995443", "0.5988785", "0.5959885", "0.5938289", "0.5931089", "0.58951056", "0.5859927", "0.5851703", "0.58493423", "0.58465594", "0.58328366", "0.5823013", "0.5822229", "0.57850474", "0.5701491", "0.5696689", "0.5682951", "0.5678094", "0.566814", "0.5657499", "0.56555206", "0.5642589", "0.56219065", "0.5615893", "0.56105876", "0.559851", "0.5598089", "0.55940455", "0.5585137", "0.55848545", "0.55796933", "0.5571477", "0.5567006", "0.55667996", "0.55652434", "0.5562926", "0.55600035", "0.55590326", "0.55590326", "0.5554599", "0.5554599", "0.55407417", "0.5534935", "0.5527733", "0.55271375", "0.55238813", "0.5501504", "0.5497003", "0.5496233", "0.54927665", "0.5464706", "0.54617554", "0.5461167", "0.5451583", "0.54498726", "0.54498726", "0.54359984", "0.5430996", "0.5430996", "0.5426488", "0.5418467", "0.54153895", "0.54107565", "0.5407886", "0.5401234", "0.54008496", "0.5400268", "0.53910094", "0.53827274", "0.5377731", "0.5375473", "0.5374833", "0.53720397", "0.5370215", "0.5363264", "0.5361161", "0.5360557", "0.5351706", "0.53514725", "0.53492516", "0.53459316", "0.5341237", "0.5328037", "0.5328037", "0.53230566", "0.53230566", "0.53230566", "0.5319575", "0.531832", "0.5315559", "0.5315559" ]
0.0
-1
Checks equality by comparing each attribute.
def ==(o) return true if self.equal?(o) self.class == o.class && click_rate_formatted == o.click_rate_formatted && created_dts == o.created_dts && deleted == o.deleted && email_campaign_uuid == o.email_campaign_uuid && email_communication_sequence_uuid == o.email_communication_sequence_uuid && end_once_customer_purchases == o.end_once_customer_purchases && end_once_customer_purchases_anywhere == o.end_once_customer_purchases_anywhere && esp_campaign_folder_uuid == o.esp_campaign_folder_uuid && esp_domain_user == o.esp_domain_user && esp_domain_uuid == o.esp_domain_uuid && esp_friendly_name == o.esp_friendly_name && library_item_oid == o.library_item_oid && memberships == o.memberships && merchant_id == o.merchant_id && name == o.name && open_rate_formatted == o.open_rate_formatted && prevent_sending_due_to_spam == o.prevent_sending_due_to_spam && revenue_formatted == o.revenue_formatted && revenue_per_customer_formatted == o.revenue_per_customer_formatted && scheduled_dts == o.scheduled_dts && screenshot_large_full_url == o.screenshot_large_full_url && sms_esp_twilio_uuid == o.sms_esp_twilio_uuid && sms_phone_number == o.sms_phone_number && status == o.status && status_dts == o.status_dts && storefront_oid == o.storefront_oid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n attributes == other.attributes\n end", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n end", "def assert_equal_attributes(object, expected_attributes)\n expected_attributes.each do |index, value|\n assert_equal value, object[index], \"#{index}\"\n end\n end", "def attr_equal?(o)\n self == o and\n self.instance_variables_compare(o).empty? and\n self.attributes == o.attributes\n end", "def same_attributes?(spec)\n @@attributes.all? {|name, default| self.send(name) == spec.send(name) }\n end", "def ==(other)\n self.class.valid_attrs.each do |attr|\n return false if read(attr) != other.read(attr)\n end\n true\n end", "def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\n end", "def ==(other)\n other.present? && self.attributes == other.attributes\n end", "def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end", "def match?(attributes)\n attributes.each do |attr, val|\n return false if send(attr).to_s != val.to_s\n end\n true\n end", "def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end", "def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.send(name) }\n end", "def changed?(comparison)\n attributes.any? do |attribute, value|\n next unless comparison.key?(attribute)\n comparison[attribute] != value\n end\n end", "def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end", "def ==(other)\n if other.kind_of? Details::Attribute\n self.name == other.name && self.value == other.value\n else\n self.value == other\n end\n end", "def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n Attribute === other && \n !(Expression === other) &&\n relation == other.relation && \n name == other.name && \n self.alias == other.alias && \n original_relation == other.original_relation\n end", "def ==(obj)\n if obj.instance_of?(self.class)\n compare_attributes = [\"category_id\", \"combo_item_id\", \"quantity\", \"sequence\"]\n compare_attributes.each do |field|\n if self.send(field) != obj.send(field)\n return false\n end\n end\n return true\n end\n return false\n end", "def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end", "def ==(other)\n case other\n when Chair::Row\n @attributes == other.instance_variable_get('@attributes')\n when Array\n @attributes.values == other\n else false\n end\n end", "def == other\n return false unless other.kind_of? self.class\n attribute_of.all? do |key, val|\n val.get == other.__send__(key)\n end\n end", "def correct_combination?(attr1, attr2, attr3)\n result = false\n if attr1 == attr2 && attr2 == attr3\n result = true\n elsif attr1 != attr2 && attr2 != attr3 && attr1 != attr3\n result = true\n end\n return result\n end", "def ==(other)\n return false if self.class != other.class\n return super if @_lazer_model.required_properties.empty?\n @_lazer_model.required_properties.each do |key_name|\n return false if read_attribute(key_name) != other.read_attribute(key_name)\n end\n true\n end", "def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end", "def verify_attributes(hash, expected)\n return [] unless expected.attributes\n expected.attributes.map{ |a| verify_attribute_value(hash[a.name.to_s], a) }\n end", "def assert_attributes obj, attr_hash\n default_attr_hash = {}\n if obj.respond_to? :default_attr_hash\n default_attr_hash = obj.default_attr_hash\n end\n default_attr_hash.merge(attr_hash).each_pair do |key, value|\n assert_equal value, obj.__send__(key), \"Attribute #{key} of #{obj}\"\n end\n end", "def match_attributes(attrs)\n attrs = Saxxy::Helpers.stringify_keys(attrs)\n attributes.reduce(true) do |b, (k, v)|\n value = attrs[k]\n b && ((!value.nil? && match(v, value)) || (v.nil? && value.nil?))\n end\n end", "def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left != right, message)\n end", "def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end", "def bt_same_value?(other)\n bt_value_attributes == other.bt_value_attributes\n end", "def ==(x)\n return true if object_id == x.object_id\n return false unless x.kind_of?(AttrArray)\n each_with_index do |a, n|\n return false unless a == x[n]\n end\n true\n end", "def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left == right, message)\n end", "def compare_attributes(data_criteria, criteria)\n return false unless data_criteria['dataElementAttributes']&.any?\n\n data_criteria['dataElementAttributes'].map { |dc| dc.except('_id') }.include? criteria['dataElementAttributes'][attribute_index].except('_id')\n end", "def ==(other)\n @klass == other.class && @attributes == strip_active_record(other)\n end", "def ==(other)\n other.is_a?(self.class) &&\n other.attribute == attribute &&\n other.validation == validation &&\n other.expected == expected &&\n other.actual == actual\n end", "def == other\n return false unless self.class == other.class\n [:unit, :frequency, :anchor, :weeks, :monthdays, :weekdays, :times].all? do |attribute|\n self.send(attribute) == other.send(attribute)\n end\n end", "def compare_equal?(item, line_item)\n ![\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n :first_name,\n :last_name,\n :serial_number,\n :purch_order_form_num\n ].detect { |attr| item.send(attr) != line_item.send(attr) }\n end", "def ==(b) # :nodoc:\n ( b.respond_to?(:result_attributes) &&\n result_attributes == b.result_attributes && \n @result_attributes.all?{ |k| send(k) == b.send(k) } )\n end", "def validates_different(*attr_names)\n validates_with ValidatesAll::DifferenceValidator, _merge_attributes(attr_names)\n end", "def identical?\n #Song.first.attributes.each { |v,k| Song.find(:all, :conditions => [\" #{v} like ?\", \"%blah%\"])}\n Song.find(:all, :conditions => [\"name = ? or length = ?\", \"#{self.name}\", self.length]) do |x| \n x.hash == self.hash\n end\n end", "def diff?(model = self.class.find(id))\n self.class.diffable_attributes.each do |attribute|\n return true if send(attribute) != model.send(attribute)\n end\n return false\n end", "def filter_attributes_match?(hash_one, hash_two)\n hash_one.all? do |key, value_one|\n value_two = hash_two[key]\n case\n when value_one == value_two\n true\n when value_one.is_a?(Hash) && value_two.is_a?(Hash)\n filter_attributes_match?(value_one, value_two)\n when hash_one[key].to_s == hash_two[key].to_s\n true\n when value_one.is_a?(String) && value_one.start_with?(\"eval:\")\n eval_attribute_value(value_one, value_two)\n else\n false\n end\n end\n end", "def comparable_attributes\n#\t\tHashWithIndifferentAccess[attributes.select {|k,v| \n#\t\t\t!Abstract.incomparable_attribute_names.include?(k)}]\n\t\tHashWithIndifferentAccess[attributes.select {|k,v| db_fields.include?(k)}]\n\tend", "def all_equal?\n a = self.first\n all? { |b| a == b }\n end", "def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end", "def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end", "def attr_set?(cards, attr)\n array = []\n cards.each do |card|\n # evalutes the string 'attr' and returns the value\n array << card.send(attr)\n end\n\n # only return true if it's all the same or totally different\n return true if array.uniq.count == 1\n return true if array.uniq.count == 3\n return false\n end", "def attribute_changed?(attribute_name)\n (self.diff['attributes']['new']||{})[attribute] != (self.diff['attributes']['old']||{})[attribute]\n end", "def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end", "def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end", "def uniquify_attributes(attributes)\n attributes.each do |ka|\n oldval = send(ka)\n next unless String === oldval\n newval = UniquifierCache.instance.get(self, oldval)\n set_property_value(ka, newval)\n logger.debug { \"Reset #{qp} #{ka} from #{oldval} to unique value #{newval}.\" }\n end\n end", "def eql?(object)\n self.class.equal?(object.class) && attributes == object.attributes\n end", "def multi_element_attr_check( elements )\n wanted = Array.new\n found = Array.new\n elements.each do |element|\n print \".\"\n e = $driver.find_element(element[0].to_sym, element[1])\n wanted << [ element[1], element[2], element[3] ]\n found << [ element[1], element[2], e.attribute(element[2]) ]\n end\n\n found.should == wanted\n end", "def equals(rule)\n element == rule.element && attributes == rule.attributes\n end", "def attr_reader(*args)\n super\n comparison_attrs.concat(args)\n end", "def xml_nodes_match_attrs(xml_nodes, attrs, mismatches = [])\n attrs.each_with_index.each { |attr_set, idx|\n xn = xml_nodes[idx]\n attr_set.each { |(attr_key, attr_val)|\n # Either call method, or hash key, or recurse on children\n # p.name vs. p[:name]\n if :children == attr_key\n # recurse over children\n xml_nodes_match_attrs(xn.children, attr_val, mismatches)\n else\n # compare attrs\n xn_val = xn.methods.include?(attr_key) ? xn.send(attr_key) : xn[attr_key]\n if xn_val != attr_val\n mismatches << { node: xn.name_and_class_path, attr: \"#{ attr_key }: expected #{ attr_val.inspect }, got #{ xn_val.inspect }\" }\n end\n end\n }\n }\n mismatches\n end", "def matches_state_attrs?\n @expected_attrs == state_attrs\n end", "def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left != right, message)\n end", "def eql?(other)\n return false unless super(other)\n return false unless attributes == other.attributes\n return false unless content == other.content\n\n true\n end", "def ==(other)\n return true if other.equal?(self)\n return false unless other.instance_of?(self.class)\n\n self.class.attributes.inject(true) do |memo, attribute|\n attribute_name = attribute.first\n attribute_type = attribute.last[:type]\n\n # Skip associations\n if attribute_type.include?(LazyResource::Resource) || (attribute_type.is_a?(::Array) && attribute_type.first.include?(LazyResource::Resource))\n memo\n else\n memo && self.send(:\"#{attribute_name}\") == other.send(:\"#{attribute_name}\")\n end\n end\n end", "def matches? item, attributes\n\n attributes.map { |attribute, value|\n\n item.send(attribute) == value\n\n }.flatten == [true]\n\n end", "def ==( other ) \n\t\t\tcomparison_attributes = lambda{ |area| [ area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons ]}\n\t\t\tcomparison_attributes.call( self ) == comparison_attributes.call( other )\n\t\tend", "def all_obs_same_attr?(observations, attr)\n exemplar = observations.first.send(attr)\n observations.all? { |o| o.send(attr) == exemplar }\n end", "def eql?(*) end", "def eql?(other)\n return true if equal?(other)\n return false unless self == other\n [:id, :fide_id, :rating, :fide_rating, :title, :gender].each do |m|\n return false if self.send(m) && other.send(m) && self.send(m) != other.send(m)\n end\n true\n end", "def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end", "def ==(val)\n if val.is_a?(Model)\n # Use normal comparison for a model\n super\n else\n # Compare to attributes otherwise\n attributes == val\n end\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n attribute == o.attribute &&\n statistics == o.statistics &&\n other == o.other &&\n total == o.total &&\n missing == o.missing &&\n term_count == o.term_count &&\n term_type == o.term_type &&\n terms == o.terms\n end", "def ==(*several_variants)\n #This is a stub, used for indexing\n end", "def is_equal?(a)\n @amount == a.amount && @code == a.code\n end", "def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left == right, message)\n end", "def comparison_attributes\n except_list = ['id', 'updated_at', 'created_at', 'verified_at']\n except_list << 'alternative_phone' unless Spree::Config[:alternative_shipping_phone]\n except_list << 'company' unless Spree::Config[:company]\n\n a = attributes.except(*except_list)\n a.each{|k, v|\n if v.is_a?(String)\n v = v.downcase.strip.gsub(/\\s+/, ' ')\n a[k] = v.present? ? v : nil\n end\n }\n a['state_name'] = nil if a['state_name'].blank?\n a\n end", "def multi_element_attr_match( elements )\n elements.each do |element|\n print \".\"\n wait_for_element(element[0].to_sym, element[1])\n check_attribute_match(element[0].to_sym, element[1], element[2], element[3])\n end\n end", "def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend", "def test_equality_simple\n value1_ = ::Versionomy.create(:major => 2, :minor => 0, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end", "def ==(other)\n other.is_a?(self.class) &&\n name == other.name &&\n attributes == other.attributes\n end", "def changes(attrs1, attrs2)\n old_attrs = attrs1.slice(*GENERATED_ATTRS)\n new_attrs = attrs2.slice(*GENERATED_ATTRS)\n\n return if old_attrs == new_attrs\n old_attrs.each do |k, v|\n next if new_attrs[k] == v\n @changes << Change.new(nil, k, v, new_attrs[k]) \n end\n end", "def tdiff_equal(node)\n if (self.class == node.class)\n case node\n when Nokogiri::XML::Attr\n (self.name == node.name && self.value == node.value)\n when Nokogiri::XML::Element, Nokogiri::XML::DTD\n self.name == node.name\n when Nokogiri::XML::Text, Nokogiri::XML::Comment\n self.text == node.text\n when Nokogiri::XML::ProcessingInstruction\n (self.name == node.name && self.content = self.content)\n else\n false\n end\n else\n false\n end\n end", "def ==(other)\n name == other.name &&\n color == other.color &&\n age == other.age\n end", "def more_desirable?(attribute_id1, attribute_id2)\n attribute_id1 < attribute_id2\n end", "def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end", "def ==(other)\n # If the classes don't match, they cannot possibly be equal.\n if self.class != other.class\n return false\n end\n\n # If the persisted state doesn't match, they also can never be equal.\n if persisted? != other.persisted?\n return false\n end\n\n # When persisted, check the other's id to see if it's the same,\n # cannot possible be equals if they have different ids.\n if persisted? && id != other.id\n return false\n end\n\n # Finally, compare the attributes hash. If all key/values match,\n # they are considered equal.\n attributes == other.attributes\n end", "def ==(other)\n self.class == other.class &&\n attributes[\"_id\"] == other.attributes[\"_id\"]\n end", "def assert_same_values(expected, actual)\n actual.each_pair do |k,v|\n next unless expected[k]\n assert_equal expected[k], v, \"Values for #{k} are not matching\"\n end\n end", "def assert_equivalent_xml(expected, actual)\n expected_xml = Nokogiri::XML(\"<test-xml>\\n#{expected}\\n</test-xml>\")\n actual_xml = Nokogiri::XML(\"<test-xml>\\n#{actual}\\n</test-xml>\")\n ignored_attributes = %w(style data-disable-with)\n\n equivalent = EquivalentXml.equivalent?(expected_xml, actual_xml, {\n ignore_attr_values: ignored_attributes\n }) do |a, b, result|\n if result === false && b.is_a?(Nokogiri::XML::Element)\n if b.attr('name') == 'utf8'\n # Handle wrapped utf8 hidden field for Rails 4.2+\n result = EquivalentXml.equivalent?(a.child, b)\n end\n if b.delete('data-disable-with')\n # Remove data-disable-with for Rails 5+\n # Workaround because ignoring in EquivalentXml doesn't work\n result = EquivalentXml.equivalent?(a, b)\n end\n if a.attr('type') == 'datetime' && b.attr('type') == 'datetime-local'\n a.delete('type')\n b.delete('type')\n # Handle new datetime type for Rails 5+\n result = EquivalentXml.equivalent?(a, b)\n end\n end\n result\n end\n\n assert equivalent, lambda {\n # using a lambda because diffing is expensive\n Diffy::Diff.new(\n sort_attributes(expected_xml.root),\n sort_attributes(actual_xml.root)\n ).to_s(:color)\n }\n end", "def sync_duplicate_obj_attributes(obj1, obj2)\n duplicate_keys.each do |key|\n unless obj1[key].blank? && obj2[key].blank?\n if obj1[key].blank?\n obj1.send(\"#{key}=\", obj2[key])\n elsif obj2[key].blank?\n obj2.send(\"#{key}=\", obj1[key])\n else # Each obj has a value\n if obj1[key] != obj2[key]\n raise ArgumentError, \"#{key} attribute values on the two objects don't match: #{obj1[key]} vs #{obj2[key]}\"\n end\n end\n end\n end\n end", "def eql?(other)\n return true if equal?(other)\n\n # two instances for different models cannot be equivalent\n return false unless other.kind_of?(model)\n\n # two instances with different keys cannot be equivalent\n return false if key != other.key\n\n # neither object has changed since loaded, so they are equivalent\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n # get all the loaded and non-loaded properties that are not keys,\n # since the key comparison was performed earlier\n loaded, not_loaded = properties.select { |p| !p.key? }.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end", "def assert_event_are_light_equal e1, e2\n return false if e1.class != e2.class\n\n [:subject, :event, :moodid,\n :mood, :music, :location, :taglist, :pickeyword,\n :preformatted, :backdated, :comments, :security, :allowmask,\n :screening,].each do |attr|\n return false if e1.send(attr) != e2.send(attr)\n end\n\n e1.compare_time(e2)\n end", "def eql(expected)\n set_relativity(:eql, expected)\n end", "def modified?( original )\n DATA_ATTRIBUTES.any? { |e| send( e ) != original.send( e )}\n end", "def ==(other)\n @name == other.name && @amount == other.amount\n end", "def ==(other)\n other.kind_of?(self.class) &&\n @name == other.name && @columns == other.columns && @unique == other.unique?\n end", "def match_same_name_attributes(*options)\n\n options = options.extract_options!\n same_name_attributes = @from_table.columns.map(&:name) & @to_table.columns.map(&:name)\n\n if same_name_attributes\n same_name_attributes = columns_from_options(same_name_attributes, options)\n same_name_attributes.each do |same_name_attribute|\n from same_name_attribute, :to => same_name_attribute\n end\n end\n end", "def equal_pair(key, request)\n if @event[\"required\"][key] == request[\"object_attributes\"][key] || event[\"required\"][key] == \"\"\n true\n else\n false\n end\n end", "def assert_equal(att, value, error = [att, :not_equal])\n assert value === send(att), error\n end", "def validate\n matched = {}\n duplicated_attributes = []\n attributes.each do |attribute|\n if matched.has_key?(attribute.name) && matched[attribute.name] == attribute.name_format\n duplicated_attributes << attribute.name unless duplicated_attributes.include?(attribute.name)\n else\n matched[attribute.name] = attribute.name_format\n end\n end\n if !duplicated_attributes.empty?\n raise ValidationError, \"An attribute with the same name and name format may only be specified once. The following attributes were specified multiple times: #{duplicated_attributes.join(',')}\"\n end\n end" ]
[ "0.7291717", "0.7188103", "0.70395297", "0.7007927", "0.68874705", "0.6861532", "0.6707156", "0.6660597", "0.66147524", "0.658478", "0.6584619", "0.6580019", "0.65543133", "0.6543933", "0.65068495", "0.6479513", "0.6456241", "0.6415999", "0.6412208", "0.6412208", "0.6412208", "0.6411266", "0.6380575", "0.63775986", "0.6260147", "0.6246534", "0.6240681", "0.62150854", "0.62014365", "0.6186426", "0.61837834", "0.6164858", "0.61304426", "0.61149454", "0.6097789", "0.6083095", "0.6078927", "0.6067201", "0.60053444", "0.59974694", "0.5994989", "0.5991373", "0.59856457", "0.5985243", "0.5977118", "0.59521115", "0.59428704", "0.59311265", "0.59247756", "0.5921222", "0.5921222", "0.59095234", "0.58795947", "0.58789194", "0.5870439", "0.58598673", "0.58571184", "0.5856412", "0.5855177", "0.58480394", "0.5847516", "0.58370507", "0.5799985", "0.5795313", "0.57880926", "0.57823527", "0.57788265", "0.5776185", "0.57670164", "0.5759791", "0.5758563", "0.5753949", "0.57518554", "0.5750137", "0.57385117", "0.57309806", "0.5729126", "0.572618", "0.57250285", "0.57210624", "0.5712646", "0.5710082", "0.57059866", "0.57036847", "0.5702592", "0.5690256", "0.5674193", "0.56433815", "0.5641553", "0.56216776", "0.56148046", "0.5591313", "0.5587681", "0.55836356", "0.5569298", "0.5550885", "0.5546161", "0.5545665", "0.55422115", "0.5539372", "0.5529004" ]
0.0
-1
Calculates hash code according to all attributes.
def hash [click_rate_formatted, created_dts, deleted, email_campaign_uuid, email_communication_sequence_uuid, end_once_customer_purchases, end_once_customer_purchases_anywhere, esp_campaign_folder_uuid, esp_domain_user, esp_domain_uuid, esp_friendly_name, library_item_oid, memberships, merchant_id, name, open_rate_formatted, prevent_sending_due_to_spam, revenue_formatted, revenue_per_customer_formatted, scheduled_dts, screenshot_large_full_url, sms_esp_twilio_uuid, sms_phone_number, status, status_dts, storefront_oid].hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end", "def hash(*) end", "def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end", "def hash_code; end", "def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end", "def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end", "def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n size.hash ^ rank.hash\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n @hash || calculate_hash!\n end", "def hash\n return name.hash ^ direction.hash ^ lhs.hash ^ rhs.hash\n end", "def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end", "def hash\n id.hash + 32 * bs_request.hash\n end", "def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def hash\n [self.class, self.val, self.attribute].hash\n end", "def hash\n 0\n end", "def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end", "def hash\n self.class.hash ^ key_attributes.hash\n end", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end", "def hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def hash\n\t\t\"#{@x}#{@y}\".hash\n\tend", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end", "def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end", "def hash\n self.class.hash ^ operand.hash\n end", "def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend", "def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end", "def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end", "def hash\n @symbols.hash + 37*positive?.hash\n end", "def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end", "def hash()\n #This is a stub, used for indexing\n end", "def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end", "def hash=(_arg0); end", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n [oct, pc].hash\n end", "def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end", "def hash\n code.hash\n end", "def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end", "def hash\n @vbits.hash\n end", "def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end", "def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end", "def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end", "def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\n end", "def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end", "def hash\n code.hash\n end", "def hash\n\t\t[@a, @b, self.class::D].hash\n\tend", "def consistent_hash\n Zlib.crc32(self.to_yaml, 0)\n end", "def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end", "def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end", "def hash\n @rank.hash ^ @suit.hash\n end", "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "def hash\n @real.hash ^ @image.hash\n end", "def to_hash() end", "def hash_length\n super\n end", "def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end", "def hash() source.hash ^ target.hash; end", "def hash\n [first_name, last_name, address_one, address_two, city, state, zip, phone, email, country_code].hash\n end", "def calculate_hash(input, prep_hashes)\n result = 0\n input.unpack('U*').each do |x|\n result += prep_hashes.hash(x)\n end\n (result % MOD_VALUE).to_s(HEX)\nend", "def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end", "def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end", "def calculate_hash\n\t\toptions = {:firstname => firstname, :email => email, :phone => phone, :txnid => txnid, :surl => surl, :furl => furl, :productinfo => productinfo, :amount => amount}\n\t\tservice = PayuIndia::Helper.new(payment_gateway_key, payment_gateway_salt, options)\n\t\tself.hast = service.generate_checksum\n\tend", "def hash\n [rank, suit].hash\n end", "def hash\n self.class.hash ^ left.hash ^ right.hash\n end", "def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n end", "def hash_code\n hash_code = {}\n self.seq.each do |letter|\n hash_code.keys.include?(letter) ? hash_code[letter] += 1 : hash_code[letter] = 1\n end\n hash_code\n end", "def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end", "def hash\n\n self.h.fei.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end" ]
[ "0.7118691", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.68960655", "0.67847186", "0.6707762", "0.670052", "0.6688737", "0.66705376", "0.6489735", "0.6462376", "0.6462376", "0.64444333", "0.6413127", "0.6395483", "0.63898623", "0.6372129", "0.635671", "0.63370055", "0.62682766", "0.62533766", "0.6246914", "0.6230963", "0.62173444", "0.6214272", "0.6214131", "0.61962456", "0.619165", "0.61866295", "0.6185355", "0.6185355", "0.6153702", "0.6145376", "0.6144877", "0.6139152", "0.6128312", "0.61224943", "0.61217207", "0.61205214", "0.61041045", "0.61000645", "0.60937095", "0.60931146", "0.60818595", "0.60811466", "0.60500103", "0.60322344", "0.6022704", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.6020012", "0.60178953", "0.6014942", "0.5997442", "0.59880185", "0.598736", "0.59799886", "0.5972682", "0.5969595", "0.5969411", "0.59594935", "0.5957466", "0.59423596", "0.5942144", "0.59245354", "0.5924357", "0.5904946", "0.59025365", "0.58536685", "0.5847055", "0.58454466", "0.5845053", "0.58447546", "0.5844059", "0.5842638", "0.5840575", "0.58391696", "0.5825819", "0.5824118", "0.5823615", "0.58184344", "0.5815284", "0.58124787", "0.5810309", "0.5808056", "0.5808056", "0.5808056", "0.5806852", "0.5806852" ]
0.0
-1
Builds the object from hash
def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end", "def build_from_hash(attributes)\n\n end", "def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically from the hash. If the attribute\n # does not already exist, then don't re-add the attribute class and\n # variable, just set it with the value from the hash\n hash.keys.each do |key|\n class_eval { attr_accessor key } unless instance.methods.include?(key.to_sym)\n instance.instance_variable_set \"@#{key}\", hash[key]\n end\n\n instance\n end", "def build(hash, track_changes = true)\n resource = fields.each_with_object(new) do |field, r|\n value = hash.fetch(field.to_s, hash[field.to_sym])\n r.send(\"#{field}=\", value)\n end\n resource.clear_changes! unless track_changes\n resource\n end", "def initialize hash\n @hash = hash\n end", "def build(params)\n return new(params) if params.is_a?(Hash)\n raise(\"unexpected parameter, expected Hash, received #{params.class}\")\n end", "def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend", "def initialize(a_hash)\n from_h(a_hash)\n end", "def initialize\n\t\t\t@hash = {}\n\t\tend", "def initialize(hash)\n @hash = hash\n @converted = {}\n end", "def initialize(hash)\n @short_code = hash[\"short_code\"]\n @name = hash[\"name\"]\n @id = hash[\"id\"]\n end", "def initialize(hash)\n super(hash)\n end", "def initialize\n @h = new_hash\n end", "def new_from_hash(hash)\n if hash == nil\n self.class.new.assign(self)\n else\n hash_obj = hash\n if hash.instance_of?(Hash)\n hash_obj = self.class.new\n merge_hash_into_object(hash, hash_obj)\n end\n instance = self.class.new\n object_assign(instance, hash_obj)\n end\n end", "def initialize(hash={})\n @hash = hash\n end", "def initialize\n @hash = {}\n end", "def initialize\n @hash = {}\n end", "def initialize(hash)\r\n hash.each { |k, v|\r\n # Create getters and setters\r\n self.class.attr_accessor(k)\r\n # Set value for created variable\r\n self.send(\"#{k}=\", v)\r\n }\r\n self.class.all.push(self)\r\n end", "def build!(hash)\n hash.must(::Hash) { raise ArgumentError, \"#{self} expects Hash, but got #{hash.class}\" }\n\n if hash.size != variables.size\n keys1 = variables.keys\n keys2 = hash.keys.map(&:to_s)\n minus = (keys1 - keys2).map{|i| \"-#{i}\"}\n plus = (keys2 - keys1).map{|i| \"+#{i}\"}\n \n msg = \"#{self} expects #{variables.size}, but got #{hash.size} (%s)\" % (minus + plus).join(\",\")\n raise Typed::SizeMismatch, msg\n end\n\n # 'build' just ignore unknown fields, but 'build!' raise errors\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v\n end\n return obj\n end", "def initialize(hash)\n @cw_id = hash[\"cw_id\"]\n @cik = hash[\"cik\"]\n @name = hash[\"company_name\"]\n @irs_number = hash[\"irs_number\"]\n @sic_code = hash[\"sic_code\"]\n @industry = hash[\"industry_name\"]\n @sic_sector = hash[\"sic_sector\"]\n @sector_name = hash[\"sector_name\"]\n @source_type = hash[\"source_type\"]\n @address = hash[\"raw_address\"]\n @country = hash[\"country_code\"]\n @state = hash[\"subdiv_code\"]\n @top_parent_id = hash[\"top_parent_id\"]\n @num_parents = hash[\"num_parents\"]\n @num_children = hash[\"num_children\"]\n @max_year = hash[\"max_year\"]\n @min_year = hash[\"min_year\"]\n end", "def from_hash(hash)\n instance = allocate\n instance.instance_variable_set :@attributes, hash.freeze\n instance\n end", "def from_hash(hash)\n hash = DEFAULTS.merge(hash)\n hash['spdx_id'] = hash.delete('spdx-id')\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end", "def initialize(hash=nil)\n @table = HashWithIndifferentAccess.new\n\n for k,v in hash\n @table[k] = v\n new_ostruct_member(k)\n end if hash\n end", "def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end", "def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end", "def initialize(hash)\n @hash = hash\n @data = resourcify_data\n end", "def from_hash hash\n @id= hash['id']\n\n @admin= hash['admin']\n @username= hash['username']\n @timezone= hash['timezone']\n @email_address= hash['email_address']\n\n @password = nil\n\n @created_at= DateTime.parse(hash['created_at'])\n @updated_at= DateTime.parse(hash['updated_at'])\n end", "def hash_to_obj hash\n OpenStruct.new(hash) rescue raise ConfigError, \"Can't convert setup to object\"\n end", "def initialize(hash)\n load_hash(hash)\n end", "def from_hash( h)\n\t\th.each { |name,attributes|\n\t\t\tklass = Klass.new\n\t\t\tklass.from_hash( { name => attributes } )\n\t\t\tself.add_class( klass)\n\t\t}\n\n\t\t# this is an experiment in handling \"through\" attributes\n\t\t# i.e. enriching the model with the join classes\n\tend", "def initialize(*args)\n super\n # hash = {}\n end", "def build_object(resp)\n return resp unless resp.respond_to?(:merge)\n @build_object ||= final_object_class.new(resp.merge(additional_hash_to_serialize_after_response))\n end", "def from_hash(hash)\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end", "def __convert hash #:nodoc:\n instance = self.class.new\n hash.each do |k, v|\n k = k.to_s if !k.respond_to?(:to_sym) && k.respond_to?(:to_s)\n instance.new_ostruct_member k\n if v.is_a?(Hash)\n v = v[\"type\"] == \"hash\" ? v[\"contents\"] : __convert(v)\n elsif v.is_a?(Array)\n v = v.map{|e| e.instance_of?(Hash) ? __convert(e) : e}\n end\n instance.send \"#{k}=\".to_sym, v\n end\n instance\n end", "def initialize(hash)\n\t\t@id = hash['id']\n\t\t@first_name = hash['first_name']\n\t\t@last_name = hash['last_name']\n\t\t@mentor = hash['mentor']\n\tend", "def initialize(hash={})\n @name = validate_name(hash[:name])\n @description = hash[:description]\n @snmp_opts = hash[:snmp_opts]\n\n save # Save a copy of self to Redis on creation\n end", "def initialize\n @hash_dict = {}\n end", "def initialize(hash=nil)\n @attributes = hash\n @attributes ||= {}\n end", "def initialize(hash={})\n self.init_attrs_from_hash(hash)\n end", "def from_hash(hash)\n apply_nested_hash(hash)\n end", "def initialize(hash)\n # @id = hash[\"id\"]\n # @street_address = hash[\"street_address\"]\n # @city = hash[\"city\"]\n # @state = hash[\"state\"]\n # @zipcode = hash[\"zipcode\"]\n # @country = hash[\"country\"]\n\n #add in correct details\n end", "def from_hash(hash)\n @data_object.user_acc_name = hash['user_acc_name']\n @data_object.user_affiliate = hash['user_affiliate']\n @user_over_13 = hash['user_over_13']\n\n contact.from_hash(hash)\n end", "def initialize(hash)\n @name = hash[\"campaign\"] #decided to change it to \"name\" since this is the campaign class\n date_elements = hash[\"date\"].split(\"/\") #date is being passed in as a string, need this array to create the Date object in the next line\n @date = Date.new(date_elements[2].to_i + 2000, date_elements[0].to_i, date_elements[1].to_i) #added 2000 to year since the program was considering it as the year 15; this creates the date object\n @spend = hash[\"spend\"].to_f #use .to_f to make sure spend comes in as a float instead of a string\n @impressions = hash[\"impressions\"].to_i #need it as an integer for counting purposes later\n @actions = JSON.parse(hash[\"actions\"])#ensures that each action comes in as an array instead of a string\n @@all << self #shovels it into the all array\n end", "def initialize(hash)\n hash.each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end\n @id = hash[\"id\"]\n end", "def initialize (hash)\n hash.each {|key, value|\n self.class.attr_accessor(key)\n self.send((\"#{key}=\"), value)\n }\n @@all << self\n end", "def initialize(hash={})\n @data = Hash.new\n hash.each do |key, value|\n self[key] = value\n end\n end", "def create_from_hash(hash, opts={})\n create_opts = update_or_create_options(hash, opts)\n create { |instance| instance.set(create_opts) }\n end", "def initialize(hash={})\n # assign the attributes here (???)\n hash.each do |k, v| # name = id, name, etc.\n self.send(\"#{k}=\", v)\n # self.k = v # there's no '.k' method\n #binding.pry\n end\n end", "def initialize(hash) #.new\n @name = hash[:name][0]\n @region = hash[:region]\n @population = hash[:population]\n @capital = hash[:capital]\n @flag_link = hash[:flag_link]\n @@all << self\n #binding.pry\n end", "def initialize(hash = {})\n super(hash)\n\n @action = extract_value(hash, :action)\n @clientId = extract_value(hash, :clientId)\n @clientIdAlias = extract_value(hash, :clientIdAlias)\n @clientIdAliasUsed = extract_boolean_value(hash, :clientIdAliasUsed)\n @expiresAt = extract_integer_value(hash, :expiresAt)\n @subject = extract_value(hash, :subject)\n @scopes = extract_value(hash, :scopes)\n @existent = extract_boolean_value(hash, :existent)\n @usable = extract_boolean_value(hash, :usable)\n @sufficient = extract_boolean_value(hash, :sufficient)\n @refreshable = extract_boolean_value(hash, :refreshable)\n @responseContent = extract_value(hash, :responseContent)\n @properties = extract_array_value(hash, :scopes) do |element|\n Authlete::Model::Property.parse(element)\n end\n end", "def initialize( hash )\n\t\t@object_classes = self.parse_objectclasses( hash['objectClasses'] || [] )\n\t\t@attribute_types = self.parse_attribute_types( hash['attributeTypes'] || [] )\n\t\t@ldap_syntaxes = self.parse_ldap_syntaxes( hash['ldapSyntaxes'] || [] )\n\t\t@matching_rules = self.parse_matching_rules( hash['matchingRules'] || [] )\n\t\t@matching_rule_uses = self.parse_matching_rule_uses( hash['matchingRuleUse'] || [] )\n\tend", "def from_hash(hash)\n super(hash)\n verify\n end", "def objects_from_serialized_hash(hash) # :nodoc:\n klass, attributes = Helpers.to_class_and_attributes(hash)\n klass.from_seedable_attributes(attributes)\n end", "def initialize (hash)\n @name = hash [:name]\n @color = hash [:color]\n @robots = hash [:robots]\n @moon_count = hash [:moon_count]\n @cats = hash [:cats]\n #@solar_rotation = solar_rotation .....I dont really understand what a solar rotation is.... it's confusing.....\n @distance_from_the_sun = hash [:distance_from_the_sun]\n end", "def initialize(hash = nil)\n @arguments = 0\n return if hash.nil?\n @name = hash['name']\n @arguments = hash['arguments']\n end", "def _from_hash(hsh)\n hsh.each do |k, v|\n v = restore_hash(v)\n v = v.map { |iv| restore_hash(iv) } if v.is_a?(Array)\n send(:\"#{k}=\", v)\n end\n self\n end", "def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end", "def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end", "def initialize(hash={})\n self.attributes = hash\n end", "def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end", "def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end", "def build(base, object, type = nil, selected_fields = nil)\n return object unless object.is_a?(Hash)\n if _loading?\n Factory.from_db(klass, object, nil, selected_fields)\n else\n Factory.build(klass, object)\n end\n end", "def initialize(hash)\n super(hash)\n @size = hash[\"size\"]\n end", "def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @cost, @salt, @digest = split_hash(self.to_s)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end", "def instantiate hash, extra_attributes={}\n return hash unless hash.kind_of? Hash\n# init = hash.values_at(*@singulars).compact.first\n init = hash[@singular]\n inits = hash[@plural]\n if init\n new init.merge extra_attributes\n elsif inits\n inits.map {|each| new each.merge extra_attributes}\n else\n hash\n end\n end", "def from_hash(values)\n @data_object.team_challenge = values['team_challenge']\n @data_object.team_level = values['team_level']\n @data_object.team_name = values['team_name']\n\n# @mgr_email = values['mgr_email']\n\n names = values['tm_name']\n\n TeamMember::MEMBERS_PER_TEAM.times do |i|\n if names[i].empty?\n @members[i].clear\n else\n @members[i].tm_name = names[i]\n @members[i].tm_grade = values['tm_grade'][i].to_i\n @members[i].tm_dob_mon = values['tm_dob_mon'][i]\n @members[i].tm_dob_day = values['tm_dob_day'][i]\n @members[i].tm_dob_year = values['tm_dob_year'][i]\n @members[i].tm_sex = values['tm_sex'][i]\n end\n end\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def initialize(raw_hash)\n raise Errors::InvalidHash, 'invalid hash' unless valid_hash?(raw_hash)\n\n replace(raw_hash)\n\n @cost, @salt, @digest = split_hash(to_s)\n end", "def initialize( confighash={} )\n\t\tihash = internify_keys( untaint_values(confighash) )\n\t\tmergedhash = DEFAULTS.merge( ihash, &HashMergeFunction )\n\n\t\t@struct = ConfigStruct.new( mergedhash )\n\t\t@create_time = Time.now\n\t\t@name = nil\n\t\t@loader = nil\n\n\t\tsuper()\n\tend", "def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end", "def create(hash={})\n model = self.new(hash)\n model.save\n model\n end", "def from_hash(hash:, klass:)\n validate_class_kit(klass)\n\n @hash_helper.indifferent!(hash)\n entity = klass.new\n attributes = @attribute_helper.get_attributes(klass)\n attributes.each do |attribute|\n key = attribute[:name]\n type = attribute[:type]\n\n #if the hash value is nil skip it\n next if hash[key].nil?\n\n value = if is_class_kit?(type)\n from_hash(hash: hash[key], klass: type)\n elsif type == Array\n hash[key].map do |array_element|\n if attribute[:collection_type].nil?\n array_element\n else\n if is_class_kit?(attribute[:collection_type])\n from_hash(hash: array_element, klass: attribute[:collection_type])\n else\n @value_helper.parse(type: attribute[:collection_type], value: array_element)\n end\n end\n end\n else\n hash[key]\n end\n\n entity.public_send(:\"#{key}=\", value)\n end\n\n entity\n end", "def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = convert(v, k, converter) if converter\n instance.instance_variable_set(:\"@#{k}\", v)\n end\n\n instance\n end", "def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend", "def hash_for_merging(hash)\n new_hash = { id: hash['message_id'].to_i,\n date: Time.at(hash['date'].to_i),\n from: User.new(hash['from'], @bot),\n chat: Chat.new(hash['chat'], @bot) }\n\n type = TYPES.find { |t| hash[t.to_s] }\n new_hash[type] = hash[type.to_s] # TODO: fail if type not found\n\n new_hash\n end", "def initialize(hash)\n @header = Msg::Header.new(hash)\n @body = Msg::Body.new(content_is_json?, hash)\n end", "def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end", "def initialize()\n @hash = {}\n @values = []\n end", "def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end", "def initialize(build)\n @build = build\n @hash = {}\n @already_run = []\n end", "def new_from_hash_marketplace(h)\n self.url = h\n h=h.split('/')\n h=h[h.size-2]\n self.original_id = h\n return self\n end", "def initialize(hash, type, dump)\n self.hash = hash\n self.type = type.to_sym\n self.dump = dump\n end", "def initialize(hash_data, opts: {})\n @hsh = hash_data\n @opts = opts\n\n @title = @hsh[:title]\n @body = @hsh[:body_hash]\n end", "def initialize(hash)\n @color = hash[:color]\n @scent = hash[:scent]\n end", "def initialize(hash = nil)\n hash.each { |key, value| self[key] = value } if !hash.nil? && hash.is_a?(Hash)\n end", "def create(hash)\n NotImplementedError\n end", "def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = instance.convert(v, k, converter) if converter\n instance.send(:\"#{k}=\", v)\n end\n\n instance\n end", "def init_jaxb_json_hash(_o)\n super _o\n @id = String.from_json(_o['id']) unless _o['id'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @description = String.from_json(_o['description']) unless _o['description'].nil?\n @url = String.from_json(_o['url']) unless _o['url'].nil?\n @name = String.from_json(_o['name']) unless _o['name'].nil?\n @organization = Org::Apache::Archiva::Metadata::Model::Organization.from_json(_o['organization']) unless _o['organization'].nil?\n @issueManagement = Org::Apache::Archiva::Metadata::Model::IssueManagement.from_json(_o['issueManagement']) unless _o['issueManagement'].nil?\n @scm = Org::Apache::Archiva::Metadata::Model::Scm.from_json(_o['scm']) unless _o['scm'].nil?\n @ciManagement = Org::Apache::Archiva::Metadata::Model::CiManagement.from_json(_o['ciManagement']) unless _o['ciManagement'].nil?\n if !_o['licenses'].nil?\n @licenses = Array.new\n _oa = _o['licenses']\n _oa.each { | _item | @licenses.push Org::Apache::Archiva::Metadata::Model::License.from_json(_item) }\n end\n if !_o['mailingLists'].nil?\n @mailingLists = Array.new\n _oa = _o['mailingLists']\n _oa.each { | _item | @mailingLists.push Org::Apache::Archiva::Metadata::Model::MailingList.from_json(_item) }\n end\n if !_o['dependencies'].nil?\n @dependencies = Array.new\n _oa = _o['dependencies']\n _oa.each { | _item | @dependencies.push Org::Apache::Archiva::Metadata::Model::Dependency.from_json(_item) }\n end\n @incomplete = Boolean.from_json(_o['incomplete']) unless _o['incomplete'].nil?\n end", "def create_version_hash\n new_version = {}\n new_version['created'] = ''\n new_version['message'] = ''\n new_version['user'] = {}\n # user is #name, # address.\n new_version['user']['name'] = ''\n new_version['user']['address'] = ''\n new_version['state'] = {}\n new_version\n end", "def create_from_hash hash\n values = values_from_hash hash\n unless obj = find(:first, :conditions => values)\n return nil if values[:id]\n obj = create!(values)\n raise ArgumentError, \"#{obj.errors.to_s}\" unless obj.errors.empty?\n end\n obj\n end", "def initialize result_hash={}\n @result_hash = result_hash\n end", "def create_hash(&block); end", "def create_hash(&block); end", "def initialize(attrs={})\n from_hash(attrs)\n end", "def build_request_data(hash)\n {\n :attributes! => {\n addressinfo: { \"xsi:type\" => \"ns2:Map\" },\n },\n username: @username,\n password: @password,\n addressinfo: {\n item: [\n { key: 'name', value: hash[:name] },\n { key: 'address1', value: hash[:address1] },\n { key: 'address2', value: hash[:address2] },\n { key: 'city', value: hash[:city] },\n { key: 'state', value: hash[:state] },\n { key: 'zip', value: hash[:zip] },\n { key: 'fflno', value: hash[:fflno] },\n { key: 'fflexp', value: hash[:fflexp] }\n ]\n },\n testing: @testing\n }\n end", "def init_jaxb_json_hash(_o)\n @groupId = String.from_json(_o['groupId']) unless _o['groupId'].nil?\n @artifactId = String.from_json(_o['artifactId']) unless _o['artifactId'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @packaging = String.from_json(_o['packaging']) unless _o['packaging'].nil?\n @className = String.from_json(_o['className']) unless _o['className'].nil?\n if !_o['repositories'].nil?\n @repositories = Array.new\n _oa = _o['repositories']\n _oa.each { | _item | @repositories.push String.from_json(_item) }\n end\n @bundleVersion = String.from_json(_o['bundleVersion']) unless _o['bundleVersion'].nil?\n @bundleSymbolicName = String.from_json(_o['bundleSymbolicName']) unless _o['bundleSymbolicName'].nil?\n @bundleExportPackage = String.from_json(_o['bundleExportPackage']) unless _o['bundleExportPackage'].nil?\n @bundleExportService = String.from_json(_o['bundleExportService']) unless _o['bundleExportService'].nil?\n @classifier = String.from_json(_o['classifier']) unless _o['classifier'].nil?\n @includePomArtifacts = Boolean.from_json(_o['includePomArtifacts']) unless _o['includePomArtifacts'].nil?\n @queryTerms = String.from_json(_o['queryTerms']) unless _o['queryTerms'].nil?\n @bundleImportPackage = String.from_json(_o['bundleImportPackage']) unless _o['bundleImportPackage'].nil?\n @bundleRequireBundle = String.from_json(_o['bundleRequireBundle']) unless _o['bundleRequireBundle'].nil?\n @pageSize = Fixnum.from_json(_o['pageSize']) unless _o['pageSize'].nil?\n @selectedPage = Fixnum.from_json(_o['selectedPage']) unless _o['selectedPage'].nil?\n end", "def initialize(order_hash)\n @id = order_hash['id']\n @number = order_hash['number']\n @special_instructions = order_hash['special_instructions']\n @total = order_hash['total']\n @total_quantity = order_hash['total_quantity']\n @created_at = order_hash['created_at']\n @updated_at = order_hash['updated_at']\n end", "def from_db_hash *args\n from_hash *args\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end", "def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end" ]
[ "0.8011074", "0.7470833", "0.7457607", "0.7256629", "0.72455454", "0.70060325", "0.6973257", "0.6955014", "0.69459796", "0.69398683", "0.69363195", "0.6917627", "0.6872358", "0.6796184", "0.6783521", "0.67575246", "0.67575246", "0.67560464", "0.67514306", "0.67136854", "0.66667664", "0.6623634", "0.661206", "0.66098964", "0.66098964", "0.6591922", "0.65713006", "0.6547411", "0.6524743", "0.6524143", "0.6513636", "0.650189", "0.6498057", "0.6485853", "0.6483371", "0.6475685", "0.6459916", "0.6454491", "0.6440182", "0.6434778", "0.6401363", "0.63977015", "0.6396885", "0.63910425", "0.63720834", "0.6363958", "0.63597506", "0.6313429", "0.6295958", "0.62923384", "0.62915224", "0.62704456", "0.62703115", "0.62622243", "0.62515473", "0.6249854", "0.6242987", "0.6242987", "0.62426233", "0.62408733", "0.62407595", "0.62321323", "0.62298346", "0.622897", "0.622756", "0.62245685", "0.62217826", "0.6218501", "0.6210329", "0.62091905", "0.620342", "0.6201614", "0.6178616", "0.6166234", "0.61611027", "0.6140086", "0.6126761", "0.61154264", "0.61059844", "0.60980254", "0.60971874", "0.6090533", "0.6064119", "0.6061236", "0.6060324", "0.60599816", "0.60420287", "0.6039776", "0.603712", "0.6033585", "0.6030829", "0.6023582", "0.6023582", "0.6016123", "0.60155296", "0.6014705", "0.6008574", "0.60031897", "0.60024095", "0.60024095", "0.60024095" ]
0.0
-1
Deserializes the data based on type
def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = UltracartClient.const_get(type).new temp_model.build_from_hash(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Telstra_Messaging.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = FattureInCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = IFClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WineShipping.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n DearInventoryRuby.const_get(type).build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Mooncard.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Aimastering.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Harbor1Client.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WellsFargoAchClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ArtikCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Dkron.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Hubspot::Cms::Performance.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SmoochApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SamplifyAPIClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = OpsgenieClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = LemonWayClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n Nodeum.const_get(type).build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TripletexApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = unwiredClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end", "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Quandoo.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end" ]
[ "0.7330926", "0.7274019", "0.72504056", "0.7245751", "0.7218884", "0.7213926", "0.71909", "0.7183136", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71712995", "0.71712995", "0.71712995", "0.71712995", "0.71712995", "0.71632504", "0.71549904", "0.71473306", "0.71413666", "0.71413666", "0.7141116", "0.7141116", "0.7141116", "0.7133874", "0.7133874", "0.7133874", "0.7133874", "0.71333444", "0.71333444", "0.7127688", "0.7125744", "0.71210617", "0.71210617", "0.71190786", "0.71184087", "0.711393", "0.7113519", "0.7113519", "0.7113516", "0.71119875", "0.71119875", "0.71119875", "0.7105169", "0.7105169", "0.7105169", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7104928", "0.7102596", "0.7102596", "0.7102596", "0.7101596", "0.7101596", "0.7101596", "0.70996517", "0.70996517", "0.7097952", "0.7097185", "0.70965225" ]
0.72291344
19
Returns the string representation of the object
def to_s to_hash.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n self.inspect\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end", "def to_s\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end", "def to_s\n self.inspect\n end", "def to_s\n toString()\n end", "def to_s\r\n dump\r\n end", "def to_s\n inspect\n end", "def to_s\n toString\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n\t\t\t@string\n\t\tend", "def to_s\n stringify\n end", "def to_s\n to_h.to_s\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def inspect\n serialize.to_s\n end", "def inspect\n to_s\n end", "def to_s\n @string ||= Builder::ToString.new(self).string\n end", "def to_s\n self\n end", "def to_s()\n serialize.to_s()\n end", "def to_s()\n serialize.to_s()\n end", "def to_s\n string\n end", "def to_s\n inspect\n end", "def to_s\n inspect\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def inspect\n self.to_s\n end", "def inspect\n self.to_s\n end", "def inspect\n to_s\n end", "def inspect\n to_s\n end", "def to_s\n end", "def to_s\n end", "def to_s\n end", "def to_s\n end", "def inspect\n to_s.inspect\n end", "def inspect()\n serialize.to_s()\n end", "def inspect()\n serialize.to_s()\n end", "def inspect\n return self.to_s\n end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end", "def to_s; end" ]
[ "0.901024", "0.89506465", "0.84703195", "0.83409667", "0.8337169", "0.8337169", "0.8332247", "0.82546586", "0.8145818", "0.8144667", "0.81357557", "0.812714", "0.8093436", "0.8086725", "0.8073356", "0.8039774", "0.80308646", "0.80064154", "0.80064154", "0.80064154", "0.80064154", "0.7962831", "0.7962831", "0.7962831", "0.7962831", "0.7954296", "0.79446983", "0.7919419", "0.7909274", "0.78848016", "0.78848016", "0.78841925", "0.788328", "0.788328", "0.78758216", "0.78758216", "0.78758216", "0.78758216", "0.78758216", "0.78758216", "0.78758216", "0.7866813", "0.7866813", "0.7865939", "0.7865939", "0.7850519", "0.7850519", "0.7850519", "0.7850519", "0.7808076", "0.7784745", "0.7784745", "0.7767656", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824", "0.77608824" ]
0.0
-1
to_body is an alias to to_hash (backward compatibility)
def to_body to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_body\r\n to_hash\r\n end", "def to_body\n to_hash\nend", "def to_body\n to_hash\nend" ]
[ "0.84283537", "0.8347048", "0.8347048" ]
0.0
-1
Returns the object in the form of hash
def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n object\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_a.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n return to_s.hash\n end", "def hash\n @hash\n end", "def hash\n @hash.hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def to_hash\n @hash\n end", "def to_hash\n @hash\n end", "def hash\n to_s.hash\n end", "def to_hash\n @hash\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @object\n end", "def to_h\n @hash\n end", "def to_h\n @hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def as_hash\n @hash\n end", "def __getobj__\n @hashobj\n end", "def to_hash() end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n object_id\n end", "def to_hash\n @_hash_\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def to_hash\n to_a.hash\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash\n data.hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\n [self.class, to_h].hash\n end", "def hash\r\n id.hash\r\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n self.to_f.hash\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def to_hash\n return self\n end", "def to_hash(object)\n validate_class_kit(object.class)\n\n @hash_helper.to_hash(object)\n end", "def hash\n return @id.hash\n end", "def to_h\n Hash[ self ]\n end", "def to_hash\n Hash[self]\n end", "def to_h\n @hash.dup\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def to_h\n @hash.dup\n end", "def hash\n model.hash + key.hash\n end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def hash\n [self.class, to_s].hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n self.atoms.hash\n end", "def to_h\n Hash[self]\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end", "def hash\n @id.hash\n end", "def hash\n id.hash\n end", "def hash\n self.class.name.hash\n end", "def to_h\n @_hash.dup\n end", "def hash\n\t\t[@id].hash\n\tend", "def hash\n [self.class, to_s].hash\n end", "def __hash\n @hash\n end" ]
[ "0.8270299", "0.78767854", "0.78726953", "0.7802364", "0.7789188", "0.77806795", "0.7775915", "0.7767511", "0.7760525", "0.7760525", "0.77559966", "0.7731286", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7647042", "0.7647042", "0.7626769", "0.760354", "0.7595938", "0.7582562", "0.7579971", "0.7579971", "0.7535553", "0.7495252", "0.7433835", "0.7411177", "0.73843014", "0.73661345", "0.73658615", "0.73658615", "0.73658615", "0.73600674", "0.7359121", "0.73590857", "0.73590857", "0.73590857", "0.7340058", "0.73356754", "0.7329828", "0.7329828", "0.7329828", "0.73170114", "0.730566", "0.73028016", "0.7294603", "0.72854036", "0.72643596", "0.72637254", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.72620076", "0.726188", "0.72524244", "0.72511965", "0.72511965", "0.72511965", "0.72511965", "0.72511965", "0.72511965", "0.72479564", "0.72474235", "0.72474235", "0.7241066", "0.7229342", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7228758", "0.7224175", "0.72185695", "0.72126305", "0.72116995", "0.71945405", "0.71828544", "0.7181684", "0.7171822", "0.71657544" ]
0.0
-1
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n value.hash\n end", "def hash\n @value.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def to_hash\n @value\n end", "def to_hash\n @value\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def output_hash; end", "def to_hash() end", "def hash\n return to_s.hash\n end", "def hash\n value_id.hash\n end", "def to_hash\n call\n @hash = @value\n @hash\n end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n self.to_f.hash\n end", "def hash\n to_s.hash\n end", "def to_hash(obj = T.unsafe(nil)); end", "def to_h\n @value\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def value_to_hash(value, options = T.unsafe(nil)); end", "def to_s\r\n to_hash.to_s\r\n end", "def _to_hash(value)\r\n if value.is_a?(Array)\r\n value.compact.map{ |v| _to_hash(v) }\r\n elsif value.is_a?(Hash)\r\n {}.tap do |hash|\r\n value.each { |k, v| hash[k] = _to_hash(v) }\r\n end\r\n elsif value.respond_to? :to_hash\r\n value.to_hash\r\n else\r\n value\r\n end\r\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def to_s\n to_hash.to_s\nend", "def to_s\n to_hash.to_s\nend", "def to_h(value)\n return value unless @to_h\n @to_h.call value\n end", "def to_hash\n Hash[to_a]\n end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def to_hash; end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end", "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end" ]
[ "0.6720587", "0.6720587", "0.66691047", "0.66568977", "0.6587778", "0.6452369", "0.64156955", "0.64156955", "0.6382176", "0.6345186", "0.63019073", "0.62231636", "0.61526376", "0.61023515", "0.60785437", "0.60785437", "0.6071557", "0.60354906", "0.60190517", "0.59378713", "0.5902829", "0.5902829", "0.5902829", "0.5902829", "0.5902829", "0.58896965", "0.58896965", "0.5883897", "0.5883897", "0.5866266", "0.58533376", "0.5834969", "0.5820531", "0.5820531", "0.5820531", "0.5820531", "0.5820531", "0.5820531", "0.5820531", "0.5820531", "0.5820531", "0.5820531", "0.5802068", "0.5802068", "0.5798551", "0.57805204", "0.5772481", "0.5772481", "0.5772481", "0.5772481", "0.5772481", "0.5772481", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075", "0.5769075" ]
0.0
-1
Takes in a function to call and executes it
def run_job(func, *args) if self.method(func).arity > 1 self.send(func, *args) else self.send(func, args) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_function(param)\n param.call\n end", "def run(function, arguments)\n\t\t\t\taction = function[0]\n\t\t\t\tfunction = function_for(function)\n\n\t\t\t\tself.send(action, function, *arguments)\n\t\t\tend", "def call(fun, *args)\n call2(nil, fun, *args)\n end", "def call() end", "def call(function, *args)\n context.call(function, *args)\n end", "def call(*) end", "def call(*) end", "def test_method_calls_can_take_and_execute_fn_parm\n result = interpret 'a=~{foo: ->(fn) { %fn }};%a.foo(->() {4})'\n assert_eq result, 4\n end", "def call(value)\n fn[value, *args]\n end", "def call_me(some_code)\n some_code.call\nend", "def call\n @func[*@args]\n end", "def call(*args)\n self.exec(*args)\n end", "def in(function)\n eval(\"firstresult = 1.#{function}; self/firstresult\")\n end", "def general_func_call(fn)\n \"#{@scanner.next.value} #{expr_list(fn)} #{@scanner.next.value}#{@scanner.next.value}\\n\"\n\n end", "def callMe (functionParam)\n yield\n yield\nend", "def exec_proc(fn)\n num = 1\n fn.call # 2 prints\nend", "def FunctionCall(rest, parsed); end", "def call_function(function_name, *args, &block)\n # TRANSLATORS: do not translate variable name strings in these assertions\n Pal::assert_non_empty_string(function_name, 'function_name', false)\n Pal::assert_type(Pal::T_ANY_ARRAY, args, 'args', false)\n internal_evaluator.evaluator.external_call_function(function_name, args, topscope, &block)\n end", "def eval\n execute\n end", "def invoke(fun, args, normal, exception, name = \"\")\n invoke2(nil, fun, args, normal, exception, name)\n end", "def call_function(function_name, *args, &block)\n internal_call_function(closure_scope, function_name, args, &block)\n end", "def call(*command); end", "def call_function(name, *arguments)\n arguments.map!{ |arg| to_json(arg) }\n execute_script(\"#{name}(#{arguments.join(\", \")});\")\nend", "def run_function(name, params)\n payload = Payload.new\n payload.function_name = name\n payload.params = params\n call_route(:function, name, payload)\n end", "def eval_function_call(args, current_cont)\n\t\t\tfunc_slot, func_args = args[:ast], args[:args]\n\t\t\tenv = args[:env]\n\t\t\t\n\t\t\tif func_slot.kind_of? LispSym\n\t\t\t\tbuildin_name = func_slot.val.to_sym\n\t\t\t\tif Buildins.singleton_methods.include? buildin_name\n\t\t\t\t\treturn current_cont.create_after Buildins.method(buildin_name), arg_ast: func_args, env: env\n\t\t\t\telse\n\t\t\t\t\treturn current_cont.heap[:error_handler].with message:\n\t\t\t\t\t\t\"Tried to call unknown buildin with the name \\\"#{buildin_name}\\\"\",\n\t\t\t\t\t\tast: LispPair.new(func_slot, func_args), backtrace: caller(0)\n\t\t\t\tend\n\t\t\telsif func_slot.kind_of? Continuation\n\t\t\t\t# If we got a continuation in the function slot eval its first argument and then\n\t\t\t\t# continue with that continuation.\n\t\t\t\treturn func_slot.create_before method(:eval), ast: func_args.first, env: env\n\t\t\telsif func_slot.kind_of? LispLambda\n\t\t\t\treturn current_cont.create_after method(:eval_lambda), lambda: func_slot, arg_ast: func_args, env: env\n\t\t\telse\n\t\t\t\treturn current_cont.heap[:error_handler].with message:\n\t\t\t\t\t\"Got unknown stuff in the function slot: #{Printer.print(func_slot)}\",\n\t\t\t\t\tast: LispPair.new(func_slot, func_args), backtrace: caller(0)\n\t\t\tend\n\t\tend", "def run(fn)\n C.run_function_pass_manager(self, fn) != 0\n end", "def run(fn)\n C.run_function_pass_manager(self, fn) != 0\n end", "def process_func_call(match, func, func_list, type_table)\n unless func_list.is_a? FunctionList\n raise \"Internal: func_list isn't a FunctionList\"\n end\n unless func.is_a? Function\n raise \"Can only call functions inside other functions\"\n end\n\n expr = process_expression(match[0], func.ident_list, type_table)\n unless expr.is_a?(FunctionExpression)\n raise \"Invalid function call expression?\"\n end\n\n instruction = FunctionCallInstruction.new(func, expr)\n func.add_instruction(instruction)\n\n return true\nend", "def call\n func = get_func(Fiddle::TYPE_VOID)\n if func\n func.call(*@args)\n end\n end", "def call\n eval(@code)\n end", "def system_call(call)\n system_caller.execute(call)\n end", "def invoking\n end", "def execute_functions\n # match functions like func(args);\n @output = @output.gsub(/(\\w+)\\(\"?(.*)\"?\\)\\;/) {|row|\n function_name = Regexp.last_match[1]\n function_parameters = Regexp.last_match[2]\n\n return_content = \"\"\n\n functions = FunctionCollection.new\n args = function_parameters.split(/,/)\n if functions.respond_to? :\"#{function_name}\"\n functions.send(\"#{function_name}\", *args)\n else\n row\n end\n }\n end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def exec; end", "def exec; end", "def call_a_proc(&my_proc)\n my_proc.call\nend", "def invoke; end", "def call(method, *args) rpc_execute(method, *args) end", "def call(callable, *args)\n if callable.is_a?(String) || callable.is_a?(Symbol)\n proc = @library.macros(true)[callable.to_sym]\n fun = @library.functions(true)[callable.to_sym]\n if proc\n count = proc.arity >= 0 ? proc.arity : 0\n if args.count != count\n raise ArgumentError, \"Wrong number of arguments passed to macro (#{args.count} for #{count})\" \n end\n self.instance_exec(*args, &proc)\n elsif fun\n @builder.call(fun, *args.map{|arg| Convert(arg, fun.arg_types[args.index(arg)])})\n else\n raise NoMethodError, \"Function or macro, '#{function.to_s}', does not exist.\"\n end\n elsif callable.kind_of?(LLVM::Script::Function)\n @builder.call(callable, *args.map{|arg| Convert(arg, callable.arg_types[args.index(arg)])})\n elsif callable.kind_of?(LLVM::Value) && (callable.type.kind == :function || callable.type.kind == :pointer)\n @builder.call(callable, *args.map{|arg| Convert(arg)})\n else\n raise ArgumentError, \"Callable passed to call must be a LLVM::Value or a name of a Library function or macro.\"\n end\n end", "def f(*args)\n function.f(*args)\n end", "def invoke\n @proc.call\n end", "def call_function( function, *args )\r\n # Just a simple conversion, which ensures strings are escaped.\r\n arguments = args.map { |value|\r\n if value.is_a?( Hash )\r\n hash_to_json( value )\r\n else\r\n value.inspect\r\n end\r\n }.join( ',' )\r\n function = \"#{function}(#{arguments});\"\r\n execute_script( function )\r\n end", "def call(*args); end", "def call (fn, *args)\n elisp([fn.to_sym, *args])\n end", "def execute_method\n return unless @method\n method(@method).call\n end", "def execute_method\n return unless @method\n method(@method).call\n end", "def invoke\n execute_only(:invoke)\n end", "def call_function(fn_name, args)\n case fn_name\n when 'hiera'\n val = @hiera.lookup(args[0], args[1], @scope)\n if val.nil?\n val = @scope[args[0]]\n end\n if val.nil? && !(args.length >= 2)\n # TODO: display exception coloured in output\n raise Exception, \"undefined variable '#{args[0]}' and no default\"\n end\n val\n when 'hiera_hash'\n @hiera.lookup(args[0], args[1], @scope, resolution_type = :hash)\n when 'template'\n erb, _ = make_erb(args[0])\n erb.result(self.get_binding())\n when 'warning'\n puts red(\"[WARNING]: #{args[0]}\")\n when 'fail'\n raise RuntimeError, args[0]\n else\n raise Exception, \"call_function: unknown function '#{fn_name}'\" if fn_name != 'hiera'\n end\n end", "def call (function, *args)\n\treturn[\n\t\"POP ECX\",function,\n\t\"MOV EAX, [ECX]\",\n\t\"PUSH EAX\", \"NOP\"\n\t].concat(args)\nend", "def execute_callback(callback, *args)\n callback.call(*args) if callback\n end", "def execute_option_function(function, *args)\n args = args.first(function.parameters.length)\n controller.instance_exec(*args, &function)\n end", "def call\n end", "def foo (a, b)\n a.call(b)\nend", "def invoke( function, args, timeout=6 )\n send_question( {\n type: 'invocation',\n function: function,\n args: args\n }, timeout)\n end", "def call_function(function_name, args)\n function_name = Saxon::QName.resolve(function_name).to_java\n transformation_invocation(:callFunction, function_name, function_args(args))\n end", "def call_fns(fns, app)\n fns.each {|fn| app.instance_exec(&fn)}\n end", "def internal_call_function(scope, function_name, args, &block)\n\n the_loader = loader\n unless the_loader\n raise ArgumentError, _(\"Function %{class_name}(): cannot call function '%{function_name}' - no loader specified\") %\n { class_name: self.class.name, function_name: function_name }\n end\n\n func = the_loader.load(:function, function_name)\n if func\n Puppet::Util::Profiler.profile(function_name, [:functions, function_name]) do\n return func.call(scope, *args, &block)\n end\n end\n\n # Check if a 3x function is present. Raise a generic error if it's not to allow upper layers to fill in the details\n # about where in a puppet manifest this error originates. (Such information is not available here).\n loader_scope = closure_scope\n func_3x = Puppet::Parser::Functions.function(function_name, loader_scope.environment) if loader_scope.is_a?(Puppet::Parser::Scope)\n unless func_3x\n raise ArgumentError, _(\"Function %{class_name}(): Unknown function: '%{function_name}'\") %\n { class_name: self.class.name, function_name: function_name }\n end\n\n # Call via 3x API\n # Arguments must be mapped since functions are unaware of the new and magical creatures in 4x.\n # NOTE: Passing an empty string last converts nil/:undef to empty string\n result = scope.send(func_3x, Puppet::Pops::Evaluator::Runtime3FunctionArgumentConverter.map_args(args, loader_scope, ''), &block)\n\n # Prevent non r-value functions from leaking their result (they are not written to care about this)\n Puppet::Parser::Functions.rvalue?(function_name) ? result : nil\n end", "def send_as_functions *args\n args.each {|arg| send_as_function arg}\n self\n end", "def fn\n Fn\n end", "def compute( &math_func )\n math_func.call( 3, 5 )\nend", "def lambdasaurus(some_code)\n\tputs \"I am a header\"\n\tsome_code.call\n\tputs \"I am a footer\"\nend", "def call(method, arguments=[], context)\n value = (@runtime_class.lookup(method) || context.locals[method])\n if value.nil?\n fail 'Undefined method or function. Maybe function was defined after?'\n else\n value.call(self, arguments)\n end\n end", "def call\n end", "def run(argarr)\n #$stderr.puts \"Calling function with arguments #{@args.class}\"\n callargs = Hash.new\n if @args.class == Array\n @args.each do |v|\n callargs[v] = argarr[v]\n end\n elsif @args.class == Symbol and argarr[@args].class == Hash\n argarr[@args].each do |k,v|\n callargs[k] = v\n end\n elsif @args.class == Symbol\n callargs[:__argument] = argarr[@args]\n end\n \n Function[@function].run(callargs)\n retarr = callargs[:__return]\n if ((!@returns) ^ (!retarr)) and (!@returns or !retarr)\n $stderr.puts \"Return from #{@function} failed - expectation was nil xor returns was nil\"\n $stderr.puts \"Non-fatal for now, but shame on you\"\n \n return\n elsif (!@returns) #and by extension retarr has to be nil\n return #this is ok\n elsif (@returns.class == Symbol and retarr.class != Array)\n argarr[@returns] = retarr\n return\n elsif (@returns.class == Array and retarr.class != Array)\n $stderr.puts \"Return from #{@function} failed - expectation was an array but returns wasn't\"\n $stderr.puts \"Invalid statement:\"\n YAML.dump(self, $stderr)\n $stderr.puts\n raise \"Function return error - returning from #{@function} expecting returns #{@returns}\"\n end\n #now we know @returns should be an array\n @returns.each do |r|\n argarr[r] = retarr.shift\n end\n end", "def calls; end", "def calls; end", "def _perform(args); end", "def invoker(procObj, param1)\n puts \"Invoking #{procObj} on #{param1.to_s}\"\n procObj.call param1\nend", "def call_method(call_sym, *args, &block)\n call(nil, call_sym, *args, &block)\n end", "def execute(event, obj)\n state_machine.run_callback event.name, obj do |obj|\n execute_action(event, obj)\n end\n end", "def call_from(function_spec)\n resolved_params = []\n\n @spec['params'].each do |param|\n resolved_params << function_spec.resolve_wrapped_param(param)\n end\n\n \"#{@spec['name']}( #{resolved_params.join(', ')} )\"\n end", "def use_function(name)\n call \"_#{name}\"\n end", "def execute_callback(callback, *args)\n (callback.arity == 2 ? callback.call(*args[0, 2]) : callback.call(*args)) if callback\n end", "def execute(key, object)\n function = @events[key] if @events.key?(key)\n function.call(key, object) if function\n end", "def call(*args)\n __call__( args )\n end", "def invoke(args)\n @call_back.call *args\n end", "def call(f)\n CAS::Help.assert(f, Hash)\n Math::tan(@x.call(f))\n end", "def run(argarr)\n callargs = Hash.new\n if @args.class == Array\n @args.each do |v|\n callargs[v] = argarr[v]\n end\n elsif @args.class == Symbol and argarr[@args].class == Hash\n argarr[@args].each do |k,v|\n callargs[k] = v\n end\n elsif @args.class == Symbol\n callargs[:__argument] = argarr[@args]\n end\n \n Function[@function].run(callargs)\n retarr = callargs[:__return]\n if ((!@returns) ^ (!retarr)) and (!@returns or !retarr)\n $stderr.puts \"Return from #{@function} failed - expectation was nil xor returns was nil\"\n $stderr.puts \"Non-fatal for now, but shame on you\"\n \n return\n elsif (!@returns) #and by extension retarr has to be nil\n return #this is ok\n elsif (@returns.class == Symbol and retarr.class != Array)\n argarr[@returns] = retarr\n return\n elsif (@returns.class == Array and retarr.class != Array)\n $stderr.puts \"Return from #{@function} failed - expectation was an array but returns wasn't\"\n $stderr.puts \"Invalid statement:\"\n YAML.dump(self, $stderr)\n $stderr.puts\n raise \"Function return error - returning from #{@function} expecting returns #{@returns}\"\n end\n #now we know @returns should be an array\n @returns.each do |r|\n argarr[r] = retarr.shift\n end\n end", "def call *args\n\t\t\t@code.call *args\n\t\tend", "def call\n moduleFunction\n end", "def call(f)\n CAS::Help.assert(f, Hash)\n Math::sin(@x.call(f))\n end", "def call_method_from_string(str_method)\n eval(str_method)\nend", "def do_it(code)\n eval(code)\nrescue \n puts \"Cannot do it!\"\nend", "def call_as_function(ctx,object,thisObject,argumentCount,arguments,exception)\n JS::Lib.JSObjectCallAsFunction(ctx,object,thisObject,argumentCount,arguments,exception)\n end", "def call event\n fire(event)\n end", "def exec(command, &block); end", "def test2 &action\n puts \"Testing:\\n\\n\"\n action.call\n end", "def invoke(task)\n fn = task.fn.to_s\n i = fn.rindex('.')\n if i\n obj = fn[0, i]\n method = fn[i + 1, fn.length - (i + 1)]\n eval(obj).send(method, *task.args)\n else\n TOPLEVEL.send(fn, *task.args)\n end\n end", "def call(*args)\n\t filtered_args, vm = prepare_call(args)\n\t perform_call(filtered_args, vm)\n\tend", "def generate_call_for_function(function_name, param_hash, function_params)\n output = \"\"\n payload_variable_name = 'parsed_payload'\n function_params.each do |param| \n output += \"#{param} = #{payload_variable_name}['#{param}']\\n\"\n end\n\n joined_param_string = function_params.join(', ')\n output += \"output = #{function_name}(#{joined_param_string})\"\n return output\nend", "def eval script\n # native function. this stub is for documenting only\n end", "def run(name, function, arguments)\n\t\t\t\tdocument = @documents[name]\n\t\t\t\t\n\t\t\t\traise ArgumentError.new(\"Invalid document name #{name}\") unless document\n\t\t\t\t\n\t\t\t\tdocument.run(function, arguments)\n\t\t\tend" ]
[ "0.6921226", "0.6853608", "0.6740197", "0.6728484", "0.6723412", "0.668689", "0.668689", "0.6657126", "0.66467553", "0.661642", "0.66163963", "0.65471727", "0.64883435", "0.6475767", "0.64192724", "0.63902783", "0.637054", "0.6366736", "0.6359319", "0.6344167", "0.6313561", "0.62761414", "0.62738794", "0.6234879", "0.62264836", "0.62165284", "0.62165284", "0.6180452", "0.6178773", "0.614746", "0.61445266", "0.6142831", "0.60877025", "0.6074685", "0.6074685", "0.6074685", "0.6074685", "0.6074685", "0.6074685", "0.6074685", "0.6074685", "0.60662675", "0.60662675", "0.6062764", "0.6060509", "0.6045363", "0.60362166", "0.60323083", "0.60316354", "0.6028458", "0.6008663", "0.6003946", "0.6002667", "0.6002667", "0.5998658", "0.5979451", "0.59567523", "0.59553576", "0.5952285", "0.59456366", "0.59412384", "0.59296876", "0.59168535", "0.5916063", "0.5867778", "0.5855105", "0.58434725", "0.5841622", "0.5837324", "0.5827818", "0.581297", "0.58111906", "0.5802941", "0.5802941", "0.57995445", "0.57909256", "0.5788096", "0.5786509", "0.57821786", "0.5764106", "0.5749021", "0.5735677", "0.5727249", "0.5724536", "0.5713106", "0.5705321", "0.5704453", "0.5696868", "0.5682632", "0.5679322", "0.56697917", "0.5667882", "0.56605333", "0.56564945", "0.5649383", "0.56463027", "0.5642979", "0.56344444", "0.56278306", "0.5623328" ]
0.60196495
50
add your functions here
def add(a,b) puts "Adding these numbers #{a}, #{b}" a + b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def functions\n\n end", "def set_functions\n super\n end", "def custom; end", "def custom; end", "def methods() end", "def add_actions; end", "def operations; end", "def operations; end", "def set_functions\n super\n # Current Item Functions - Pass a (1-based) numerical position to refer to a specific item line.\n # (Defaults to 1.)\n function(:item_selector) {|which = 1| b.checkbox(:id => \"checkId_line#{which-1}_control\")}\n function(:item_barcode_link) {|which = 1| b.div(:id => \"Barcode_line#{which-1}\").a}\n function(:item_title) {|which = 1| b.span(:id => \"title_line#{which-1}_control\")}\n function(:item_author) {|which = 1| b.span(:id => \"author_line#{which-1}_control\")}\n function(:item_location) {|which = 1| b.span(:id => \"itemLocation_line#{which-1}_control\")}\n function(:item_call_number) {|which = 1| b.span(:id => \"itemCallNumber_line#{which-1}_control\")}\n function(:item_number_of_renewals) {|which = 1| b.span(:id => \"currentNoOfrenew_line#{which-1}_control\")}\n function(:item_due_date) {|which = 1| b.span(:id => \"loanDueDate_line#{which-1}_control\")}\n function(:item_claims_return_note) {|which = 1| b.span(:id => \"claimsReturnNote_line#{which-1}_control\")}\n function(:item_claims_return_date) {|which = 1| b.span(:id => \"claimsReturnDate_line#{which-1}_control\")}\n # Checked Out Items Functions - Pass a (1-based) numerical position to refer to a specific item line.\n # (Defaults to 1.)\n function(:co_item_selector) {|which = 1| b.checkbox(:id => \"checkIdRenewal_line#{which-1}_control\")}\n function(:co_item_barcode_link) {|which = 1| b.div(:id => \"BarcodeRenewal_line#{which-1}\").a}\n function(:co_item_title) {|which = 1| b.span(:id => \"titleRenewal_line#{which-1}_control\")}\n function(:co_item_author) {|which = 1| b.span(:id => \"authorRenewal_line#{which-1}_control\")}\n function(:co_item_location) {|which = 1| b.span(:id => \"itemLocationRenewal_line#{which-1}_control\")}\n function(:co_item_call_number) {|which = 1| b.span(:id => \"itemCallNumberRenewal_line#{which-1}_control\")}\n function(:co_item_number_of_renewals) {|which = 1| b.span(:id => \"previousNoOfrenew_line#{which-1}_control\")}\n function(:co_item_due_date) {|which = 1| b.span(:id => \"loanDueDateRenewal_line#{which-1}_control\")}\n function(:co_item_claims_return_note) {|which = 1| b.span(:id => \"claimsReturnNoteRenewal_line#{which-1}_control\")}\n function(:co_item_claims_return_date) {|which = 1| b.span(:id => \"claimsReturnDateRenewal_line#{which-1}_control\")}\n end", "def helpers; end", "def helpers; end", "def helpers; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def callbacks; end", "def callbacks; end", "def factions\n \n end", "def zuruecksetzen()\n end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def define_helpers; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def guct\n end", "def stuff\n end", "def method\n\t\t# code code\n\tend", "def apply\n\t\t\t\t\n\t\t\tend", "def actions; end", "def add\n\nend", "def how_it_works\r\n end", "def suivre; end", "def heroine; end", "def process_custom_method\n # da implementare per eventuali estensioni\n end", "def do()\r\n\tend", "def functions\n fncs = [:entry]\n fncs << :return if @probe.return?\n fncs\n end", "def on_add(clicker)\n end", "def handlers; end", "def handlers; end", "def handlers; end", "def retinaFunc_handler()\n\t\t$funcTable.insert(\"home\",\"void\",Array[])\n\t\t$funcTable.insert(\"openeye\",\"void\",Array[])\n\t\t$funcTable.insert(\"closeeye\",\"void\",Array[])\n\t\t$funcTable.insert(\"forward\",\"void\",Array[{\"ident\"=>\"steps\", \"type\"=>\"number\"}])\n\t\t$funcTable.insert(\"backward\",\"void\",Array[{\"ident\"=>\"steps\", \"type\"=>\"number\"}])\n\t\t$funcTable.insert(\"rotater\",\"void\",Array[{\"ident\"=>\"degree\", \"type\"=>\"number\"}])\n\t\t$funcTable.insert(\"rotatel\",\"void\",Array[{\"ident\"=>\"degree\", \"type\"=>\"number\"}])\n\t\t$funcTable.insert(\"setposition\",\"void\",Array[{\"ident\"=>\"x\", \"type\"=>\"number\"}, {\"ident\"=>\"y\", \"type\"=>\"number\"}])\n\t\t$funcTable.insert(\"arc\",\"void\",Array[{\"ident\"=>\"degree\", \"type\"=>\"number\"}, {\"ident\"=>\"radius\", \"type\"=>\"number\"}])\n\tend", "def extended(*) end", "def add_function(name)\n case name\n when :update_timestamp\n return add_function_update_timestamp\n end\n raise \"called add_function on undefined function '#{name}'\"\n end", "def spouse; end", "def extrato\n\n end", "def output_functions\n @global_functions.until_empty! do |label, func|\n pos = func.body.respond_to?(:position) ? func.body.position : nil\n fname = pos ? pos.filename : nil\n #@e.include(fname) do\n output_function2(func, label, nil)\n #end\n end\n end", "def calls; end", "def calls; end", "def call\n\n\tend", "def call\n\n\tend", "def run_actions; end", "def who_we_are\r\n end", "def menu # can do custom methods within a method/class\n end", "def include_funcs(*funcs)\n @include_funcs = funcs\n end", "def add \n end", "def apply()\n end", "def operation; end", "def action_hook; end", "def add\n\tend", "def rossini; end", "def demo3\n end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def probers; end", "def ...\nend", "def fn\n Fn\n end", "def processor; end", "def invention; end", "def onLoad\n end", "def registers; end", "def relatorios\n end", "def addinfo\n\nend", "def support\n end", "def implementation; end", "def implementation; end", "def commands; end", "def method_added(*) end", "def plugins; end", "def plugins; end", "def plugins; end", "def plugins; end" ]
[ "0.7900806", "0.6795439", "0.66568875", "0.66568875", "0.6592703", "0.6510823", "0.6509568", "0.6509568", "0.62289584", "0.62212217", "0.62212217", "0.62212217", "0.62193656", "0.62193656", "0.62193656", "0.62193656", "0.6132636", "0.6132636", "0.61001045", "0.60548663", "0.6008877", "0.6008877", "0.6008877", "0.6008877", "0.6008877", "0.6008877", "0.6008877", "0.6008877", "0.5986022", "0.59729767", "0.59729767", "0.59729767", "0.59729767", "0.59729767", "0.59729767", "0.59729767", "0.59576654", "0.59576654", "0.59280884", "0.59201604", "0.5899819", "0.5861094", "0.5829684", "0.58292586", "0.58258915", "0.5811537", "0.57860416", "0.5773295", "0.57725143", "0.5761957", "0.57574975", "0.5721009", "0.5721009", "0.5721009", "0.5714934", "0.570595", "0.5696555", "0.5694187", "0.56734097", "0.56639224", "0.566242", "0.566242", "0.56622994", "0.56622994", "0.56618", "0.5652338", "0.5646597", "0.5635796", "0.5632279", "0.56309605", "0.5629827", "0.56218666", "0.56117874", "0.55945575", "0.5581061", "0.55746794", "0.55746794", "0.55746794", "0.55746794", "0.55746794", "0.55746794", "0.55746794", "0.55746794", "0.5571455", "0.55709374", "0.5568574", "0.5565113", "0.5547413", "0.55448955", "0.55395406", "0.5539465", "0.553733", "0.55319715", "0.553098", "0.553098", "0.5524647", "0.552418", "0.55238545", "0.55238545", "0.55238545", "0.55238545" ]
0.0
-1
Internal: Determine what clock to use for the machine we are one. We want the highest resolution clock possible, which should be nanosecond resolution. Get the resolution of each clock id and then return the higest resolution id from the list Returns the clock id to use on this ruby
def determine_clock_id ids_and_resolutions = potential_clock_ids.map { |clock_id| [clock_id, Process.clock_getres(clock_id)] } # Sort them by the resolution - we want the smallest one first ids_and_resolutions.sort_by! { |pair| pair[1] } return ids_and_resolutions.first[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clock24_to_clock_sec(clock)\n check_pre((clock.clock24?))\n ClockSec[(clock.hour*HOUR_IN_SEC) + (clock.min*MIN_IN_SEC) + clock.sec]\nend", "def parent_clock\n buffer = \"\\0\" * SIZEOF_LONG_LONG\n FMOD.invoke(:ChannelGroup_GetDSPClock, self, nil, buffer)\n buffer.unpack1('Q')\n end", "def to_clock_sec(clock)\n if clock.clock24?\n clock24_to_clock_sec(clock)\n elsif clock.clock12?\n clock12_to_clock_sec(clock)\n elsif clock.clock_sec?\n clock\n else\n check_pre(false)\n end\nend", "def dsp_clock\n buffer = \"\\0\" * SIZEOF_LONG_LONG\n FMOD.invoke(:ChannelGroup_GetDSPClock, self, buffer, nil)\n buffer.unpack1('Q')\n end", "def clock_sec(clock)\n to_clock24(clock).sec\nend", "def clock_min(clock)\n to_clock24(clock).min\nend", "def clock\n t = time\n hour = (t * 24).floor\n minute = ((t * 24 * 60) % 60).floor\n second = (t * 24 * 60 * 60) % 60\n [hour, minute, second]\n end", "def clock_sec_to_clock24(clock)\n check_pre((clock.clock_sec?))\n s = clock.seconds.divmod(MIN_IN_SEC)\n m = s[0].divmod(HOUR_IN_MIN)\n h = m[0].divmod(HOURS_OF_DAY)\n Clock24[h[1],m[1],s[1]]\nend", "def clock_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "def clock(frequency)\n# TODO: extract diveder to CONSTANT\n options = {4000 => 0, #4 kHz\n 8000 => 32768, #8 kHz\n 15625 => 16384, #15.625 kHz\n 31250 => 8192, #31.25 kHz\n 62500 => 4096, #62.5 kHz\n 125000 => 2048, #125 kHz\n 250000 => 1024, #250 kHz\n 500000 => 512, #500 kHz\n 1000000 => 256, #1 MHz\n 2000000 => 128, #2 MHz\n 4000000 => 64, #4 MHz\n 8000000 => 32, #8 MHz\n 20000000 => 16 #20 MHz\n }\n divider = options[frequency]\n Rpio.driver.spi_clock(divider)\n end", "def to_clock24(clock)\n if clock.clock24?\n clock\n elsif clock.clock12?\n clock12_to_clock24(clock)\n elsif clock.clock_sec?\n clock_sec_to_clock24(clock)\n else\n check_pre(false)\n end\nend", "def clock_pred(clock)\n to_clock(clock,clock_sec_pred(to_clock_sec(clock)))\nend", "def system_clock_tick\n @@system_clock_tick ||= LibC::sysconf(LibC::SC_CLK_TCK)\n end", "def freq_s\n \"CPU Clock Frequency: #{@clock.frequency} hz\"\n end", "def clock12_to_clock24(clock)\n check_pre((clock.clock12?))\n clock_sec_to_clock24(clock12_to_clock_sec(clock))\nend", "def to_clock(target,value)\n if target.clock24?\n to_clock24(value)\n elsif target.clock12?\n to_clock12(value)\n elsif target.clock_sec?\n to_clock_sec(value)\n else\n check_pre(false)\n end\nend", "def date_time_dimensions_for_resolution(resolution)\n case resolution.to_sym\n when :year then :nearest_year\n when :month then :nearest_month\n when :week then :nearest_week\n when :day then :date\n when :hour then [:date, :nearest_hour]\n when :half_hour then [:date, :nearest_half_hour]\n when :quarter_hour then [:date, :nearest_quarter_hour]\n when :sixth_hour then [:date, :nearest_sixth_hour]\n when :twelfth_hour then [:date, :nearest_twelfth_hour]\n when :minute then [:date, :nearest_minute]\n when :second then [:date, :time]\n else raise \"invalid resolution '#{resolution}'\"\n end\n end", "def clock12_to_clock_sec(clock)\n check_pre((clock.clock12?))\n seconds = (clock.min*MIN_IN_SEC) + clock.sec + ((clock.hour==12) ? 0 : clock.hour*HOUR_IN_SEC)\n ClockSec[ (clock.halve==:AM) ? seconds : seconds+DAY_IN_SEC/2]\nend", "def get_cl(dram_freq, dram_timings)\n tCK = 1000.0 / dram_freq\n dram_timings[:tCK].each {|v| return v[1] if v[0] <= tCK }\nend", "def calculate_resolution(options={})\n defaults = { :resolution => :auto }\n options = defaults.merge(options).symbolize_keys\n time_interval = 0\n\n # Resolution\n if :auto == options[:resolution]\n from_time = time_of_oldest_vote\n distance_in_minutes = (((Time.now.utc - from_time).abs)/60).round\n case distance_in_minutes\n when 0..2: time_interval = 100.years # nothing\n when 3..14: time_interval = 1.minute # 3+ minutes\n when 15..44: time_interval = 5.minutes # 3+ 5 minutes\n when 45..179: time_interval = 15.minutes # 3+ 15 minutes\n when 180..4319: time_interval = 1.hour # 3+ hours\n when 4320..30239: time_interval = 1.day # 3+ days\n when 30240..129599: time_interval = 7.days # 3+ weeks\n when 129600..1577879: time_interval = 1.month # 3+ months\n else time_interval = 1.year # 3+ years\n end\n else\n case options[:resolution]\n when :minute: time_interval = 1.minute\n when :hour: time_interval = 1.hour\n when :day: time_interval = 1.day\n when :week: time_interval = 7.days\n when :month: time_interval = 1.month\n else time_interval = options[:resolution]\n end\n time_interval = options[:resolution]\n end\n time_interval\n end", "def resolution\n if width >= 3800 || height >= 2100 # close to 3860 x 2160\n \"HQ\"\n elsif width >= 1900 || height >= 1000 # close to 1920 x 1080\n \"1080p\"\n elsif width >= 1200 || height >= 700 # close to 1280 x 720\n \"720p\"\n else\n \"SD\"\n end\n end", "def clock_hour24(clock)\n to_clock24(clock).hour\nend", "def clock24_to_clock12(clock)\n check_pre((clock.clock24?))\n clock_sec_to_clock12(clock24_to_clock_sec(clock))\nend", "def update\n if @clock1_measure.nil?\n discipline_freq\n else\n elapsed = @clock1.time - @clock1_measure.local_time\n discipline_freq if elapsed > @frequency_discipline_interval\n end\n if @clock2_measure.nil?\n discipline_phase\n else\n elapsed = @clock2.time - @clock2_measure.local_time\n discipline_phase if elapsed > @phase_discipline_interval\n end\n end", "def ns_to_ck(dram_freq, dram_timings, param_name)\n min_ck = dram_timings[param_name][:ck]\n ns = dram_timings[param_name][:ns]\n if ns then\n ck = (dram_freq * ns / 1000.0).ceil.to_i\n ck = min_ck if min_ck and ck < min_ck\n return ck\n else\n return min_ck\n end\nend", "def determine_scale\n t = poll_time\n if t.min.zero? && t.hour.zero? && t.day == 1\n :month\n elsif t.min.zero? && t.hour.zero?\n :day\n elsif t.min.zero?\n :hour\n else\n :minute\n end\n end", "def timing_ms\n return nil if timing.nil?\n (timing * 1000).to_i\n end", "def get_next_id\n id = java.lang.System.nanoTime.to_s\n $log.info(\"*** get_next_id: \" + id)\n return id\n end", "def clock_gettime\n t = [0,0]\n ChangeTime.new.gett(t)\n t\n end", "def cpu_tck\n `getconf CLK_TCK`.to_i\n rescue\n return 100\n end", "def night_in_secs night_timelimit\n case night_timelimit\n when 1\n return 1209600\n when 2\n return 604800\n when 3\n return 432000\n when 4\n return 259200\n when 5\n return 172800\n when 6\n return 86400\n when 7\n return 43200\n when 8\n return 21600\n when 9\n return 10800\n when 10\n return 7200\n when 11\n return 3600\n when 12\n return 1800\n when 13\n return 900\n when 14\n return 600\n when 15\n return 300\n else\n return -1\n end\n end", "def set_clock\n @clock = Clock.find(params[:id])\n end", "def set_clock\n @clock = Clock.find(params[:id])\n end", "def set_clock\n @clock = Clock.find(params[:id])\n end", "def set_clock\n @clock = Clock.find(params[:id])\n end", "def get_next_id\r\n id = java.lang.System.nanoTime.to_s\r\n $log.info(\"*** get_next_id: \" + id)\r\n return id\r\n end", "def to_clock12(clock)\n if clock.clock24?\n clock24_to_clock12(clock)\n elsif clock.clock12?\n clock\n elsif clock.clock_sec?\n clock_sec_to_clock12(clock)\n else\n check_pre(false)\n end\nend", "def get_best_timing_for_meeting(meeting, event_type, pool_type)\n best_mir = get_best_mir_for_meeting(meeting, event_type, pool_type)\n best_mir ? best_mir.get_timing_instance : nil\n end", "def determine_cpu\n cpu = @info[:cpu] = {}\n\n lscpu = @shell.query('LSCPU', 'lscpu')\n if lscpu.empty?\n cpuinfo = @shell.query('cat /proc/cpuinfo')\n count = cpuinfo.lines.select { |l| l =~ /^processor\\s*: [0-9]/}\n speed = cpuinfo.lines.select { |l| l =~ /MHz/ }\n cpu[:count] = count.size\n cpu[:speed] = speed[0].to_s.gsub(/.* /, '')\n else\n cpu[:count] = lscpu.select { |l| l =~ /CPU\\(s\\)/ }.gsub(/.* /, '')\n cpu[:speed] = lscpu.select { |l| l =~ /MHz/ }.gsub(/.* /, '')\n end\n end", "def getClockId(path)\n return 0 unless path\n fd = IO.sysopen(path, Fcntl::O_RDWR)\n # From missing.h in linuxptp\n fd\n end", "def sync_2600_with(color_clock)\n @riot.tick if color_clock % 3 == 0\n @tia.tick\n @cpu.tick if color_clock % 3 == 2\n end", "def get_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "def setup_clock\n @clock = Clock.new()\n @clock.target_framerate = 50\n\n # Adjust the assumed granularity to match the system.\n # This helps minimize CPU usage on systems with clocks\n # that are more accurate than the default granularity.\n @clock.calibrate\n\n # Make Clock#tick return a ClockTicked event.\n @clock.enable_tick_events\n end", "def clock_hour12(clock)\n to_clock12(clock).hour\nend", "def find_time_slot\n time_slot = check_club_times(next_user_time)\n\n if valid_tee_time?(time_slot)\n time_slot\n else\n go_to_next_day(time_slot)\n end\n end", "def clock_sec_pred(seconds)\n check_pre((seconds.clock_sec?))\n ClockSec[seconds.seconds-1]\nend", "def get_interval_id(time)\n (time.to_i / interval) * interval\n end", "def max24hr_rec(ints)\n max24help(ints.sort) #O(4log4)=> 2.5 on ave 16 at worst\nend", "def clk_freq(secs=1, scale=1)\n tic = sys_clkcounter\n sleep secs\n toc = sys_clkcounter\n (toc - tic) % (1<<32) / scale / secs\n end", "def tclk_multiple\n JTAG_CONFIG[:tclk_multiple]\n end", "def get_clock_out_event\n\t\tclock_events.where(clock_out: nil).last\n\tend", "def midi_clock(*a)\n @output.puts(MIDIMessage::SystemRealtime[\"Clock\"].new.to_a)\n end", "def get_time()\n\tarr_times = [\"Morning\", \"Day\", \"Afternoon\", \"Evening\", \"Night\"]\n\t#binding.pry\n\tif Time.now.strftime(\"%H\").to_i < 12 \n\t\tarr_times[0]\n\telsif Time.now.strftime(\"%H\").to_i < 14\n\t\tarr_times[1]\n\telsif Time.now.strftime(\"%H\").to_i < 18\n\t\tarr_times[2]\n\telsif Time.now.strftime(\"%H\").to_i < 21\n\t\tarr_times[3]\n\telse\n\t\tarr_times[4]\n\tend\nend", "def calc_ts(timeslot, ts_resol)\n this_ts = (timeslot / ts_resol).to_i\n\n [this_ts >> 32, this_ts & 0xffffffff]\n end", "def get_cpu_info(workstation_id); end", "def clock_sec_to_clock12(clock)\n check_pre((clock.clock_sec?))\n s = clock.seconds.divmod(MIN_IN_SEC)\n m = s[0].divmod(HOUR_IN_MIN)\n h = m[0].divmod(HOURS_OF_DAY)\n halve = (h[1]>=HOURS_OF_HALF_DAY) ? :PM : :AM\n hours = (h[1]>=HOURS_OF_HALF_DAY) ? h[1]-HOURS_OF_HALF_DAY : h[1]\n Clock12[halve,(hours==0) ? 12 : hours,m[1],s[1]]\nend", "def find_best_day\n day_array = @days.map do |day|\n day.strftime('%A')\n end\n\n day_hash = day_array.each_with_object(Hash.new(0)) { |o, h| h[o] += 1 }\n day_hash.max_by { |_, v| v }\n end", "def set_time_clock\n @time_clock = TimeClock.find(params[:id])\n end", "def set_time_clock\n @time_clock = TimeClock.find(params[:id])\n end", "def set_clocks(mtime=1)\n @m = mtime\n @t = 4*mtime\n nil\n end", "def to_unit\n timemap.last\n end", "def get_acceptable_call_times\n AvailableTime.all.map{|m|\n if m.pharmacy_id == self.id #should be interger already but casting just in case\n {\"start\" => m.start_time.strftime(\"%H:%M:%S\"), \"stop\" => m.end_time.strftime(\"%H:%M:%S\")}\n else\n nil\n end\n }.compact\n end", "def get_hardware_info()\n results = { summary_string: \"Unknown hardware\" }\n return results if not is_sunxi_hardware()\n\n val = mem_read_word(VER_REG)\n return results if not val\n\n # Check the VER_R_EN bit and set it if necessary\n if (val & (1 << 15)) == 0 then\n mem_write_word(VER_REG, val | (1 << 15))\n val = mem_read_word(VER_REG)\n end\n\n # Test the SoC type\n case val >> 16\n when 0x1623\n results[:soc_type] = \"sun4i\"\n results[:soc_name] = \"Allwinner A10\"\n when 0x1625\n results[:soc_type] = \"sun5i\"\n case (mem_read_word(SID_KEY2) >> 12) & 0xF\n when 0\n results[:soc_name] = \"Allwinner A12\"\n when 3\n results[:soc_name] = \"Allwinner A13\"\n when 7\n results[:soc_name] = \"Allwinner A10s\"\n end\n when 0x1633\n results[:soc_type] = \"sun6i\"\n results[:soc_name] = \"Allwinner A31(s)\"\n when 0x1650\n results[:soc_type] = \"sun8i\"\n results[:soc_name] = \"Allwinner A23\"\n when 0x1651\n results[:soc_type] = \"sun7i\"\n results[:soc_name] = \"Allwinner A20\"\n end\n\n # Parse the dram info\n data = `a10-meminfo`\n dram_chip_density = 0\n dram_bus_width = 0\n dram_io_width = 0\n if data =~ /dram_clk\\s*\\=\\s*(\\d+)/ then\n results[:dram_clock] = $1.to_i\n end\n if data =~ /mbus_clk\\s*\\=\\s*(\\d+)/ then\n results[:mbus_clock] = $1.to_i\n end\n if data =~ /dram_chip_density\\s*\\=\\s*(\\d+)/ then\n dram_chip_density = $1.to_i\n end\n if data =~ /dram_bus_width\\s*\\=\\s*(\\d+)/ then\n dram_bus_width = $1.to_i\n end\n if data =~ /dram_io_width\\s*\\=\\s*(\\d+)/ then\n dram_io_width = $1.to_i\n end\n results[:dram_size] = dram_bus_width * dram_chip_density /\n (dram_io_width * 8)\n results[:dram_bus_width] = dram_bus_width\n\n results[:summary_string] = sprintf(\"SoC: %s\",\n (results[:soc_name] or \"unknown\"))\n\n if results[:dram_clock] then\n results[:summary_string] += sprintf(\", DRAM: %d MiB, %d-bit, %d MHz\",\n results[:dram_size],\n results[:dram_bus_width],\n results[:dram_clock])\n end\n\n if results[:mbus_clock] && results[:mbus_clock] != 0 then\n results[:summary_string] += sprintf(\", MBUS: %d MHz\",\n results[:mbus_clock])\n end\n\n return results\nend", "def print_clock\n puts @clock.join(', ')\n end", "def make_clock\n @clock = Clock.new()\n @clock.target_framerate = 30\n @clock.calibrate\n end", "def grandfather_clock &block\n current_hour = Time.new.hour\n if current_hour > 12\n current_hour = current_hour - 12\n current_hour.times do\n block.call\n end\n else\n current_hour.times do\n block.call\n end\n end\nend", "def clock_halve(clock)\n to_clock12(clock).halve\nend", "def sync_2600_with(color_clock)\n riot.tick if color_clock % 3 == 0\n @graphics.each &:tick\n cpu.tick if color_clock % 3 == 2\n end", "def cpu_select\n highest, hidx = 0, 0\n\n @cpu_hand.cards.each_with_index do |c, idx|\n val = c.value\n\n if @total + val <= 31\n add_cpu_card_to_set( idx ) && return if excellent?( c )\n\n highest, hidx = val, idx if val > highest\n end\n end\n\n # No excellent card, so use the highest layable card\n\n add_cpu_card_to_set( hidx )\n end", "def symbol_per_sec\n return 1/MCS::SEC_PER_SYMBOL\n end", "def best_time(event)\n registrant_best_times.find_by(event: event) || registrant_choices.joins(:event_choice).merge(EventChoice.where(cell_type: \"best_time\", event: event)).first\n end", "def find_most_asleep_time_for(guard_id)\n obj = {}\n @guard_map[guard_id][:sleep_times].each do |arr|\n (arr[0]..arr[1]).each do |num|\n obj[num] = (obj[num] || 0) + 1\n end\n end\n\n obj.max_by { |_k, v| v}[0]\n end", "def calculate_display_time\n case @display_granularity\n when :one_minute \n min = @fuzzed.min\n when :ten_minute\n min = (@fuzzed.min / 10) * 10\n when :one_hour\n min = 0\n end\n\n @display = Time.mktime( @fuzzed.year, @fuzzed.month, @fuzzed.day, @fuzzed.hour, min, 0, 0)\n end", "def grandfather_clock &block\n hour = (Time.new.hour + 11)%12 + 1\n\n hour.times(&block)\nend", "def next_closest_time(time)\n store = Array.new(9)\n past = []\n\n time.split('').each do |num| \n if (num.ord >= 48 && num.ord <= 57)\n store[num.to_i] = true \n past.push(num.to_i)\n end\n end\n\n future = past\n place = 3\n until (place == -1)\n limit = find_limit(place, past[place])\n if next_greatest(store, past[place], limit)\n if place == 1 && next_greatest(store, past[place], limit) >= 5 && future[0] == 2\n next_num = next_greatest(store, 0, 2)\n future[0] = next_num\n future[1] = next_num\n else \n future[place] = next_greatest(store, past[place], limit)\n end\n break\n else\n future[place] = lowest(store)\n place -= 1\n end\n end\n\n future[0..1].join(\"\").to_s + \":\" + future[2..3].join(\"\").to_s\nend", "def day_in_secs day_timelimit\n case day_timelimit\n when 1\n return 1209600\n when 2\n return 604800\n when 3\n return 432000\n when 4\n return 259200\n when 5\n return 172800\n when 6\n return 86400\n when 7\n return 43200\n when 8\n return 21600\n when 9\n return 10800\n when 10\n return 7200\n when 11\n return 3600\n when 12\n return 1800\n when 13\n return 900\n when 14\n return 600\n when 15\n return 300\n else\n return -1\n end\n end", "def find_ppi(width, height)\n sc = screen_config(width, height)\n return sc ? sc[:ppi] : nil\n end", "def next_time\n\n schedule_info\n end", "def calculate_thread_times\r\n # Cache thread times since this is an expensive\r\n # operation with the required sorting \r\n @result.threads.each do |thread_id, methods|\r\n top = methods.sort.last\r\n \r\n thread_time = 0.01\r\n thread_time = top.total_time if top.total_time > 0\r\n\r\n @thread_times[thread_id] = thread_time \r\n end\r\n end", "def platform_id\n case handle\n when \"nokia_6260\"\n 0x101fb3f4\n when \"nokia_6600\"\n 0x101f7963\n when \"nokia_6630\"\n 0x101f7964\n when \"nokia_7610\"\n 0x101fd5db\n when \"nokia_e61\"\n 0x20001858\n when \"nokia_n70\", \"nokia_n72\"\n 0x10200f9a\n else\n raise\n end\n end", "def grandfather_clock &block\n hour = Time.new.hour\n if hour >= 13\n hour = hour - 12\n end\n if hour == 0\n hour = 12\n end\n hour.times do\n block.call\n end\nend", "def now\n @clock\n end", "def time\n [self.game_begins, [self.game_ends, Time.now].min].max\n end", "def get_month_time_clock\r\n\t\tKpiImportedMonthValue.joins(:kpi_imported_value).where(\"time_clocks=? AND date=?\", true, date).first.try(:plan_value)\r\n\tend", "def get_next_sub_wfid\n\n i = [\n $$, Time.now.to_f.to_s, self.hash.to_s, @h['fei'].inspect\n ].join('-').hash\n\n @@sub_wfid_counter = (@@sub_wfid_counter + 1) % 1000\n i = i * 1000 + (@@sub_wfid_counter)\n\n (i < 0 ? \"1#{i * -1}\" : \"0#{i}\").to_s\n end", "def grandfather_clock &block\r\n hour = (Time.new.hour + 11)%12 + 1\r\n\r\n hour.times(&block)\r\nend", "def make_clock\n @clock = Clock.new()\n @clock.target_framerate = 50\n @clock.calibrate\n @clock.enable_tick_events\n end", "def now_in_ms\n Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)\n end", "def now_in_ms\n Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)\n end", "def formattime()\n\t\tamOrpm = 0\t# this will decide P or A\n\t\ttopResult = ''\t# save top string from the digital clock\n\t\tmiddleResult = ''\t# save middle string from the digital clock\n\t\tbotResult = ''\t\t# save bot string from the digital clock\n\t\t\n\t\thour = gethour().to_i\t# change to integer for hour\n\t\tmin = getminute().to_i\t# change to integer for minute\n\t\t@amOrpm = @t.strftime(\"%p\")\t# this get PM or AM, I used strftime method which provided from the Time class\n\t\tif @amOrpm == \"PM\"\t# if PM\t\n\t\t\tamOrpm = 1\t# save 1\n\t\telse\t\t\t# if AM\n\t\t\tamOrpm = 0\t# save 0\n\t\tend\n\n\t\ttopResult = top(hour,min)\t# Save top string from the digital clock with top method\n\t\tmiddleResult = middle(hour,min)\t# Save middle string from the digital clock with middle method\n\t\tbotResult = bot(hour,min, amOrpm)\t# Save bot string from the digital clock with bot method\n\t\ttotal = topResult + middleResult + botResult\t# save all the string in the total\n\t\treturn total\t\t\t# return total represent perfect digital time\n\tend", "def clock24?\n true\n end", "def midnight\n 86_400 * (Time.now.to_i / 86_400)\nend", "def hw_id\n # Observe that we sort the pathnames before turning them into MAC\n # addresses, because that gives us a stable ordering when run multiple\n # times on the same machine.\n hw_id = Pathname.glob('/sys/class/net/*').select do |sysfs|\n # This should skip everything except Ethernet style interfaces, which is\n # maybe the right thing to do? Different rule to what we use in DHCP\n # though, so maybe we should just skip if name == 'lo'?\n File.read(sysfs + 'type').chomp == '1'\n end.sort.map do |sysfs|\n address = File.read(sysfs + 'address').chomp\n # this ensures that we strip out empty address fields next\n address.empty? ? nil : address\n end.compact.join('_').gsub(':', '').downcase\n\n # Make sure we actually got *some* hardware ID.\n if hw_id.nil? or hw_id.empty?\n raise \"no network interfaces detected; cannot generate a hardware ID\"\n end\n\n hw_id\n end", "def get_seconds_after_midnight_from_hms(h, m, s); end", "def get_seconds_after_midnight_from_hms(h, m, s); end", "def clock &block\n hour = Time.now.hour\n\n # Turn the current hour into a 12 hour clock face equivalent\n if hour == 0\n hour = 12\n elsif hour > 12\n hour = hour % 12\n end\n\n hour.times do | n |\n # Pass each hour number into the block (so it ma use it if needed) adding 1\n # cause .times starts counting from 0.\n yield n + 1\n end\nend", "def measure_id\n \"#{host}-#{plugin_display}-#{type_display}\"\n end", "def night_length night_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def time_format\n return :time12 if new_us_user?\n\n clock_type == '12h' ? :time12 : :time24\n end", "def current_aggregate_times\n # last_capture = Game.find(self.id).captures.last\n # set update reference time to last capture\n current_time = Time.now #last_capture.created_at #self.captures.last.created_at\n \n team_hash = {} # {1 => 300(s), 2 => 0(s), ...}\n # populating the hash\n self.teams.each{|team| team_hash[team] = team.aggregate_time }\n \n # for each node in current game\n self.nodes.each do |node|\n last_capture = node.last_capture\n if last_capture\n time_to_add = current_time - last_capture.created_at \n # update the aggregate time\n team_hash[last_capture.team] += time_to_add\n end\n end\n \n team_hash\n end" ]
[ "0.5930892", "0.5863771", "0.58601826", "0.5806299", "0.5741912", "0.57043856", "0.5542434", "0.5510987", "0.5494828", "0.54886955", "0.5431437", "0.5416595", "0.5387152", "0.5268263", "0.5256649", "0.5221533", "0.52164114", "0.51807314", "0.5171924", "0.5111444", "0.509691", "0.5081763", "0.50075245", "0.49399105", "0.49392998", "0.49189737", "0.48982212", "0.4885654", "0.48808414", "0.48794934", "0.48599482", "0.4840286", "0.4840286", "0.4840286", "0.4840286", "0.4798773", "0.47906217", "0.4780323", "0.47651306", "0.47306326", "0.47304386", "0.47028", "0.47016984", "0.46999127", "0.4695027", "0.4692563", "0.46899325", "0.46889883", "0.46722725", "0.46608013", "0.46575582", "0.4652412", "0.46456048", "0.46331468", "0.46127418", "0.46121928", "0.46073052", "0.46057627", "0.46057627", "0.45953262", "0.45878723", "0.45721373", "0.4566219", "0.45634153", "0.45623246", "0.45591864", "0.45542333", "0.455025", "0.45470995", "0.4535483", "0.45250195", "0.45219773", "0.4515914", "0.45112756", "0.45106742", "0.4495607", "0.44859242", "0.44792473", "0.44782043", "0.4477307", "0.44709113", "0.4455005", "0.44532865", "0.44483477", "0.44454163", "0.44445348", "0.44435227", "0.44328418", "0.44328418", "0.44291577", "0.44256335", "0.4423334", "0.44210783", "0.44033104", "0.44033104", "0.4399201", "0.43878296", "0.4385301", "0.4381309", "0.43776706" ]
0.8332264
0
public instance methods ...................................................
def initialize super @fbnr074p_records = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def initialize\n\t\t\n\tend", "def instance; end", "def instance; end", "def instance; end", "def internal; end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\n \n end", "def initialize\r\n\r\n end", "def initialize\n\n end", "def initialize\n\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize() end", "def public; end", "def public; end", "def initialize()\r\n\r\n end", "def methods() end", "def initialize\n \n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize()\n\t\tend", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n\n\n\n end", "def init\n\n end", "def custom; end", "def custom; end", "def initialize\n \n end", "def initialize\n \n end", "def initialize\n end", "def private_method\n end", "def initialize\n\t\nend", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def initialize()\n\n end", "def init; end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize()\n\tend", "def initialize()\n\tend", "def initialize()\n end", "def wrapper; end", "def init\n end", "def init\n end", "def init\n end", "def initialize()\n end", "def initialize()\n end", "def initialize\n # nothing here for now\n end", "def probers; end", "def schubert; end", "def call\n # implement in subclasses\n end", "def initialize\n # complete\n end", "def initialize\n super\n end", "def initialize\n super\n end" ]
[ "0.8471986", "0.75887525", "0.75887525", "0.7408363", "0.7389037", "0.7389037", "0.7389037", "0.733222", "0.7306463", "0.7306463", "0.7306463", "0.7306463", "0.72930485", "0.7246825", "0.71916157", "0.71916157", "0.7188285", "0.7188285", "0.7188285", "0.7188285", "0.71772283", "0.71772283", "0.71772283", "0.71772283", "0.71772283", "0.71772283", "0.71772283", "0.71772283", "0.71772283", "0.71772283", "0.71772283", "0.717547", "0.7158524", "0.7158524", "0.7155128", "0.7117962", "0.70864844", "0.7083803", "0.7083803", "0.7051571", "0.7049422", "0.7049422", "0.7049422", "0.7049422", "0.7049422", "0.7049422", "0.7049422", "0.7049422", "0.7049422", "0.7049422", "0.7008867", "0.69978327", "0.69662195", "0.69662195", "0.69255924", "0.69255924", "0.6889708", "0.688844", "0.68462354", "0.68315357", "0.68315357", "0.68315357", "0.68315357", "0.68267643", "0.6821341", "0.678897", "0.678897", "0.678897", "0.678897", "0.678897", "0.67836267", "0.67836267", "0.67836267", "0.67836267", "0.67836267", "0.67836267", "0.67836267", "0.67836267", "0.67836267", "0.6782913", "0.6782913", "0.6782913", "0.6782913", "0.6782913", "0.6782913", "0.6778", "0.6778", "0.67705375", "0.6753091", "0.6741016", "0.6741016", "0.6741016", "0.6735953", "0.6735953", "0.6735526", "0.67244315", "0.67237324", "0.6723106", "0.67188394", "0.6716415", "0.6716415" ]
0.0
-1
overridden from parent class ..............................................
def parse(report_file, options_trailer = nil) file = File.open(report_file,'r') build_records_from_file file.readlines file.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def overrides; end", "def custom; end", "def custom; end", "def special\n override\n end", "def implementation; end", "def implementation; end", "def super_class; end", "def super_class; end", "def super_method; end", "def superclass() end", "def tag; raise 'Override this method'; end", "def inherited(base); end", "def virtual; end", "def initialize\n super \n end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def base; self; end", "def initialize()\n # override parent\n end", "def proxy\n super\n end", "def type; super; end", "def base_class; end", "def probers; end", "def initialize\n super\n end", "def initialize\n super\n end", "def internal; end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def extended(*) end", "def initialize\n super()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def source(override); end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end", "def initialize()\n super\n end" ]
[ "0.78555334", "0.75938576", "0.73337984", "0.73337984", "0.71052116", "0.7047717", "0.7047717", "0.6990317", "0.6990317", "0.69891036", "0.69674724", "0.69476146", "0.6947545", "0.6892643", "0.68331325", "0.68123925", "0.68123925", "0.68123925", "0.6777674", "0.6774636", "0.67509604", "0.67108935", "0.6678694", "0.6659641", "0.6653013", "0.6653013", "0.66318876", "0.662561", "0.662561", "0.662561", "0.6600689", "0.6599306", "0.6594979", "0.6594979", "0.6594979", "0.6594979", "0.65907234", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355", "0.6581355" ]
0.0
-1
out the current state.
def display_board(board) #Do stuff fool puts build_row(board[0..2]) print_separator puts build_row(board[3..5]) print_separator puts build_row(board[6..8]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_state; end", "def write_state; end", "def state_out(path:)\n add option: \"-state-out=#{path}\"\n end", "def pop_state\t\n\t\t\t@state_buffer = Proc.new do\n\t\t\t\t@objs2 = []\n\t\t\t\t@current_state = @states.pop\n\t\t\tend\n\t\tend", "def final_state(state)\n final_states(state)\n end", "def state\n @state\n end", "def state\n @state.last\n end", "def state\n @state.last\n end", "def state\n @state\n end", "def write_out_state\n if @options[:out_file]\n filename = @options[:out_file]\n else\n filename = @tmp_state\n end\n @log.debug \"Writing out state into #{filename}\"\n File.open(filename,'w') do |f|\n f.puts YAML.dump(@results)\n end\n end", "def state\n @current_state\n end", "def state\n @state\n end", "def read_state\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state\n @__state\n end", "def write_state\n logger.info \"Writing state back to #{configuration.state_file}\" do\n @run_context.write_state!\n end\n end", "def pop_state\n @state.pop\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def save_state\n return unless @state_writer\n\n @state_writer.call(@state)\n end", "def clear\n current_state.clear\n end", "def __state_internal\n @state\n end", "def state\n @state ||= getStateData()\n end", "def state\n end", "def out= out\n @out = out\n end", "def out= out\n @out = out\n end", "def current_state_string\n string = \"\"\n\n (@size * @size).times{ |i|\n if i % @size == 0\n string << \"\\n\\t\"\n end\n if @state[i]\n string << \"1 \"\n else\n string << \"0 \"\n end\n }\n string << \"\\n\"\n\n return string\n end", "def final_state\n aasm.states.last.name\n end", "def dump_state\n $log.debug \"State: [#{state.to_pretty_s}]\"\n end", "def states; end", "def to_s\r\n s = StringIO.new\r\n newstate = map\r\n @initstate.each_with_index do |sum, i|\r\n if sum != newstate[i]\r\n s.write \"*\"\r\n @initstate[i] = newstate[i]\r\n else\r\n s.write \".\"\r\n end\r\n end\r\n s.rewind;s.read()\r\n end", "def out\n @out\n end", "def enter_state\n end", "def dup_state\r\n @state.dup\r\n end", "def write_state(new_state)\n inputs_mask = 0\n @pins.each_with_index do |pin, i|\n inputs_mask = inputs_mask | 1 << i if pin.input?\n end\n # We use inputs_mask to make sure input pins are always set high\n # (even if they are reading low at the moment)\n @state = new_state\n ex \"i2cset -y #{@i2cbus} #{@addr} 0x#{(@state | inputs_mask).to_s(16)}\"\n end", "def sout(state)\n state = (state ? 0 : 1)\n cmd(\"SOUT#{state}\")\n end", "def peek_current_state\n peek_state.last || @current_state\n end", "def states\n peek_state\n if !@state_queue.empty?\n @current_state = @state_queue.last\n @state_queue,old = [],@state_queue\n old\n else\n []\n end\n end", "def clearState()\n\t\t\t@_previous_state = @_state\n\t\t\t@_state = nil\n\t\tend", "def to_states; end", "def to_states; end", "def clone_state\n if @stack.empty?\n {}\n else\n Marshal.load Marshal.dump(@stack.last)\n end\n end", "def clone_state\n if @stack.empty?\n {}\n else\n Marshal.load Marshal.dump(@stack.last)\n end\n end", "def final_state\n :closed\n end", "def state\n data.state\n end", "def state\n data.state\n end", "def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend", "def output\n @output.clone\n end", "def state\n self.well_info.state\n end", "def save_state\n @saved_state = clone.to_hash\n @changed = {}\n end", "def save_state\n @saved_state = clone.to_hash\n @changed = {}\n end", "def states\n []\n end", "def states\n []\n end", "def state\n @actions << :state\n self.class.mocked_states.shift\n end", "def states\n @states ||= {}\n end", "def state_obj; @_hegemon_states[@_hegemon_state]; end", "def force_final_state\r\n @final_state = true\r\n end", "def state\n @@states[@state]\n end", "def out; end", "def save\n @saved = @state\n end", "def exit_state\n end", "def state\n State.instance\n end", "def clear_state\n @state.clear\n self\n end", "def state_objs; @_hegemon_states.clone; end", "def state\n @gameState.state\n end", "def current_state\n begin\n self.state = ContainerControl::Commands::State.run!(self).state\n rescue ContainerControl::Error\n self.state = :error\n end\n end", "def get_state\n@state.keys\nend", "def switch_state state\n\t\t\t@state_buffer = Proc.new do\n\t\t\t\t@objs2 = []\n\t\t\t\t@current_state = state\n\t\t\t\t@current_state.setup\n\t\t\tend\n\t\tend", "def state(return_current = true)\n peek_state\n if @state_queue.empty?\n @current_state\n elsif return_current\n @current_state = @state_queue.last\n @state_queue.clear\n else\n @current_state = @state_queue.shift\n end\n @current_state\n end", "def fresh_state\n if state == :unknown\n current_state\n else\n state\n end\n end", "def state\n self[:ST]\n end", "def shift_out\n end", "def finished_states\n states - transitive_states\n end", "def state\n @state.first\n end", "def current_state\n find_state(@current_state_name)\n # TODO: add caching, i.e. with `@current_state ||= ...`\n end", "def state=matrix\n @current_state=matrix\n end", "def current_state_t(new_state=nil)\n self.current_state_s(new_state).t\n end", "def closure! \n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| \n\t\tadd_transition(x, temp, \"\") \n\t\tset_final(x, false) }\n\t\t\n\t\t@final = {temp=>true}\n\t\tadd_transition(@start, temp, \"\")\n\t\tadd_transition(temp, @start, \"\")\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end", "def popState()\n\t\t\tif @_state_stack.empty? then\n\t\t\t\tif @_debug_flag then\n\t\t\t\t\t@_debug_stream.puts \"POPPING ON EMPTY STATE STACK.\\n\"\n\t\t\t\tend\n\t\t\t\traise \"empty state stack.\\n\"\n\t\t\telse\n\t\t\t\t@_state = @_state_stack.pop\n\t\t\t\tif @_debug_flag then\n\t\t\t\t\t@_debug_stream.puts \"POP TO STATE : %s\\n\" % @_state.getName\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def get_SaleState()\n \t return @outputs[\"SaleState\"]\n \tend", "def state()\n info[:state]\n end", "def reset_state_at_page_finish\n add_content(\"\\nQ\" * @state_stack.size)\n end", "def to_s\n \"#{name}#{state}\"\n end", "def current_state=(new_state)\n self[:current_state] = FFILib::ReaderStateQuery.pack_state new_state\n end", "def state\n board.state(index)\n end", "def current_state\r\n self.send(self.class.state_column).to_sym\r\n end" ]
[ "0.72624224", "0.72624224", "0.67279774", "0.6647568", "0.6577878", "0.6515", "0.6501546", "0.6501546", "0.64870685", "0.64463556", "0.64091253", "0.63802713", "0.6377393", "0.6373034", "0.6373034", "0.6373034", "0.6373034", "0.6373034", "0.6373034", "0.6373034", "0.6373034", "0.63588417", "0.63357276", "0.63319427", "0.6291798", "0.6291798", "0.6291798", "0.6291798", "0.6291798", "0.6291798", "0.6291798", "0.6291798", "0.6291798", "0.6291798", "0.6253599", "0.61489815", "0.6142751", "0.6136017", "0.6085541", "0.60793364", "0.60793364", "0.6056536", "0.60543466", "0.6042507", "0.6021827", "0.60181546", "0.5969473", "0.59618485", "0.59367794", "0.5919291", "0.5914041", "0.59086084", "0.59047896", "0.5890506", "0.5868111", "0.5868111", "0.58546287", "0.58546287", "0.58488774", "0.5846599", "0.5846599", "0.5789343", "0.5766621", "0.57583034", "0.5757204", "0.5757204", "0.5716297", "0.5716297", "0.5704685", "0.5695442", "0.5682555", "0.56755996", "0.5672346", "0.5666186", "0.566341", "0.5661944", "0.5654881", "0.5652006", "0.564945", "0.5644302", "0.5621505", "0.56165785", "0.5607315", "0.5603241", "0.5599411", "0.55605537", "0.555558", "0.5549666", "0.5545457", "0.5540056", "0.5527195", "0.551189", "0.54918337", "0.54912037", "0.54883766", "0.5486058", "0.54764575", "0.5475445", "0.5460717", "0.5459995", "0.54597" ]
0.0
-1
Create an inbox ruleset Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving
def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {}) data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def add_to_rules(msg)\n # TODO use configatron config parameter for conf dir\n line = \"ACCEPT net:#{msg[2]} fw #{msg[1]}\"\n line << \" \" << msg[3] if msg[3]\n line << \"\\n\"\n lines = []\n\n File.open(rules_file) do |f|\n lines = f.readlines\n end\n\n i = lines.size - 1\n\n while i >= 0 && lines[i] !~ /\\s*#LAST LINE -- ADD YOUR ENTRIES/\n i -= 1\n end\n\n if i >= 0\n a = [line, lines[i]]\n lines[i,i] = a\n\n # TODO ask agent to backup original file\n\n File.open(rules_file, \"w\") do |f|\n f.write lines.join\n end\n\n message = \"#{rules_file} updated, run shorewall restart to reload the rules.\"\n else\n message = \"Can not find last mark line\"\n end\n\n send_response(message)\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def add_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n add_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end", "def setRules(rules, add_to_self: false, ingress: true, egress: false)\n return if rules.nil? or rules.size == 0\n\n if add_to_self\n rules.each { |rule|\n if rule['sgs'].nil?\n new_rule = rule.clone\n new_rule.delete('hosts')\n rule['sgs'] = Array.new if rule['sgs'].nil?\n rule['sgs'] << { \"Ref\" => @cfm_name }\n end\n }\n end\n\n ec2_rules = convertToEc2(rules)\n\n # Creating an empty security group is ok, so don't freak out if we get\n # a null rule list.\n if !ec2_rules.nil?\n ec2_rules.each { |rule|\n next if rule.nil? or rule[:ip_ranges].nil? # XXX whaaat\n rule[:ip_ranges].each { |cidr|\n MU::Cloud::CloudFormation.setCloudFormationProp(\n @cfm_template[@cfm_name],\n \"SecurityGroupIngress\",\n {\n \"IpProtocol\" => rule[:ip_protocol],\n \"FromPort\" => rule[:from_port],\n \"ToPort\" => rule[:to_port],\n \"CidrIp\" => cidr[:cidr_ip]\n }\n )\n }\n }\n end\n\n end", "def add_rule(subject, clauses)\n options = { :body => {\n :Subject => subject,\n :Clauses => clauses }.to_json }\n response = @create_send.post \"/segments/#{segment_id}/rules.json\", options\n end", "def inbound_rules\n @inbound_rules ||= normalized_security_rules.one_direction_rules(\"inbound\")\n end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def create_firewall_rule(rule_hash, firewall_name)\n script_code = +'netsh advfirewall firewall add rule'\n rule_hash.each do |key, val|\n filter_or_append_rule_field(script_code, key, val)\n end\n @@creation_script_cache[firewall_name] = [] if @@creation_script_cache[firewall_name].nil?\n @@creation_script_cache[firewall_name].push(script_code)\n cmd = log_powershell_out('creation', script_code)\n validate_creation_output(cmd.stdout)\n end", "def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...'\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#create_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_rules(rules)\n rules.each do |rule|\n add_rule rule\n end\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def add_rules(rules)\n options = {request: []}\n rules.each do |rule|\n options[:request] << rule.attributes\n end\n response = nil\n if @parent.class == Profitbricks::LoadBalancer\n response = Profitbricks.request :add_firewall_rules_to_load_balancer, options.merge(load_balancer_id: @parent.id)\n self.reload\n else\n response = Profitbricks.request :add_firewall_rules_to_nic, options.merge(nic_id: self.nic_id)\n self.reload\n end\n \n end", "def batch_rules!(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n res = batch_rules(rules, forward_to_replicas, clear_existing_rules, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def receive_inbound_email_from_mail(**kwargs, &block)\n create_inbound_email_from_mail(**kwargs, &block).tap(&:route)\n end", "def create\n @email_params = email_params\n @email_params[:body_plain] = @email_params['body-plain']\n @email_params[:stripped_html] = @email_params['stripped-html']\n @email_params[:body_html] = @email_params['body-html']\n ['body-plain', 'body-html', 'stripped-html'].collect{|p| @email_params.delete(p) }\n @email = Email.new(@email_params)\n @email.conversation_id = @email.find_conversation\n # We check if it's in the spam list. If that is the case, no conversation is created\n if Spam.search_pattern(@email.sender)\n @email.spam = true\n end\n if @email.save\n if @email.conversation\n @email.conversation.update_attribute(:read, false)\n @email.conversation.update_attribute(:answered, false)\n @email.conversation.update_attribute(:archived, false)\n end\n return render nothing: true, code: 200\n else\n return render nothing: true, code: 500\n end\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end", "def add_rule(rule)\n @rulebook.add_rule rule\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def add_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})\n requires :network_acl_id\n\n service.create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options)\n true\n end", "def initialize(rules = [])\n @rules = rules\n end", "def << rule\n rules << rule\n nil\n end", "def migrate_rules\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n source_keys_matching('contact_notification_rules:?*').each do |rules_key|\n\n rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n contact_id = $1\n raise \"Bad regex for '#{rules_key}'\" if contact_id.nil?\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n rules = {\n Flapjack::Data::Acceptor => [],\n Flapjack::Data::Rejector => []\n }\n\n rule_ids = @source_redis.smembers(rules_key)\n rule_ids.each do |rule_id|\n rule_data = @source_redis.hgetall(\"notification_rule:#{rule_id}\")\n\n time_restrictions = Flapjack.load_json(rule_data['time_restrictions'])\n\n entities = Set.new( Flapjack.load_json(rule_data['entities']))\n regex_entities = Set.new( Flapjack.load_json(rule_data['regex_entities']))\n\n tags = Set.new( Flapjack.load_json(rule_data['tags']))\n regex_tags = Set.new( Flapjack.load_json(rule_data['regex_tags']))\n\n # collect specific matches together with regexes\n regex_entities = regex_entities.collect {|re| Regexp.new(re) } +\n entities.to_a.collect {|entity| /\\A#{Regexp.escape(entity)}\\z/}\n regex_tags = regex_tags.collect {|re| Regexp.new(re) } +\n tags.to_a.collect {|tag| /\\A#{Regexp.escape(tag)}\\z/}\n\n acceptor_conditions_by_media = {}\n rejector_conditions_by_media = {}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n media_types = Flapjack.load_json(rule_data[\"#{fail_state}_media\"])\n next if media_types.nil? || media_types.empty?\n\n media_types_str = media_types.sort.join(\"|\")\n blackhole = !!Flapjack.load_json(rule_data[\"#{fail_state}_blackhole\"])\n cond_by_media = blackhole ? rejector_conditions_by_media : acceptor_conditions_by_media\n cond_by_media[media_types_str] ||= []\n cond_by_media[media_types_str] << fail_state\n end\n\n checks_and_tags_for_rule = proc do |rule_klass, cond_by_media|\n\n rule_klass.lock(Flapjack::Data::Check, Flapjack::Data::Tag,\n Flapjack::Data::Contact, Flapjack::Data::Medium) do\n\n cond_by_media.each_pair do |media_types_str, fail_states|\n rule = rule_klass.new\n rule.conditions_list = fail_states.sort.join(\"|\")\n rule.all = regex_entities.empty? && regex_tags.empty?\n rule.time_restrictions = time_restrictions\n rule.save\n raise rule.errors.full_messages.join(\", \") unless rule.persisted?\n\n media_transports = media_types_str.split('|')\n media = contact.media.intersect(:transport => media_transports)\n rule.media.add_ids(*media.ids) unless media.empty?\n\n unless rule.all\n # apply the entities/tag regexes as a filter\n checks = Flapjack::Data::Check.intersect(:id => check_ids).select do |check|\n entity_name = check.name.split(':', 2).first\n if regex_entities.all? {|re| re === entity_name }\n # copying logic from https://github.com/flapjack/flapjack/blob/68a3fd1144a0aa516cf53e8ae5cb83916f78dd94/lib/flapjack/data/notification_rule.rb\n # not sure if this does what we want, but it's how it currently works\n matching_re = []\n check.tags.each do |tag|\n matching_re += regex_tags.select {|re| re === tag.name }\n end\n matching_re.size >= regex_tags.size\n else\n false\n end\n end\n\n tags = checks.collect do |check|\n check_num = check_counts_by_id[check.id]\n if check_num.nil?\n check_num = check_counts_by_id.size + 1\n check_counts_by_id[check.id] = check_num\n end\n\n tag = Flapjack::Data::Tag.new(:name => \"migrated-contact_#{contact_num}-check_#{check_num}\")\n tag.save\n check.tags << tag\n tag\n end\n\n rule.tags.add(*tags) unless tags.empty?\n end\n rules[rule_klass] << rule\n end\n end\n end\n\n checks_and_tags_for_rule.call(Flapjack::Data::Rejector, rejector_conditions_by_media)\n checks_and_tags_for_rule.call(Flapjack::Data::Acceptor, acceptor_conditions_by_media)\n end\n\n rejectors = rules[Flapjack::Data::Rejector]\n contact.rejectors.add(*rejectors) unless rejectors.empty?\n\n acceptors = rules[Flapjack::Data::Acceptor]\n contact.acceptors.add(*acceptors) unless acceptors.empty?\n end\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def rule(cmd, a, &block)\n # Evaluate a block expression and return early if it evaluates to false.\n # If no block is passed it is equivalent to the block: { true }.\n return self if block_given? && !instance_eval(&block)\n\n raise ArgumentError, 'chain is a required argument' unless a[:chain]\n assert_valid_ipaddr(a[:src]) if a[:src]\n assert_valid_ipaddr(a[:dst]) if a[:dst]\n\n # Map of commands for rules\n cmds = {\n add: '-A', delete: '-D', insert: '-I', replace: '-R',\n check: '-C'\n }\n\n a[:proto] ||= 'tcp'\n table = build_option('-t', @table)\n jump = build_option('-j', a[:jump])\n goto = build_option('-g', a[:goto])\n proto = build_option('-p', a[:proto])\n inface = build_option('-i', a[:in])\n outface = build_option('-o', a[:out])\n src = build_option('-s', a[:src])\n dst = build_option('-d', a[:dst])\n match = build_option('-m', a[:match] || @match)\n ports = build_option('--dport', @ports)\n to_port = build_option('--to-port', a[:to_port])\n @buffer << [\n 'iptables', table, cmds[cmd], a[:chain], src, dst, outface,\n inface, proto, match, ports, jump || goto, to_port\n ].compact.join(' ') << \"\\n\"\n self\n end", "def batch_rules(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n client.post(\"#{Protocol.batch_rules_uri(name)}?forwardToReplicas=#{forward_to_replicas}&clearExistingRules=#{clear_existing_rules}\", rules.to_json, :batch, request_options)\n end", "def process_rules *args, &block\n Shotshare::ProcessRuleContainer.instance.rules = \\\n Docile.dsl_eval(Shotshare::Dsl::ProcessRuleBuilder.new, &block).build\nend", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def initialize(rules)\n @rules = rules\n end", "def addRule(hosts, proto: \"tcp\", port: nil, egress: false, port_range: \"0-65535\")\n end", "def notification_rules(opts = {})\n rules = self.notification_rule_ids.inject([]) do |ret, rule_id|\n unless (rule_id.nil? || rule_id == '')\n ret << Flapjack::Data::NotificationRule.find_by_id(rule_id, :redis => @redis)\n end\n ret\n end\n if rules.all? {|r| r.is_specific? } # also true if empty\n rule = self.add_notification_rule({\n :entities => [],\n :regex_entities => [],\n :tags => Set.new([]),\n :regex_tags => Set.new([]),\n :time_restrictions => [],\n :warning_media => ALL_MEDIA,\n :critical_media => ALL_MEDIA,\n :warning_blackhole => false,\n :critical_blackhole => false,\n }, :logger => opts[:logger])\n rules.unshift(rule)\n end\n rules\n end", "def rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"STORING IN SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.add(@db_name, rules, @schema_graph, \"application/rdf+xml\")\n self\n end", "def create()\n\n ensure_prerequsites\n\n rule = {\n rule: {\n recipients: @receipt_rule.email_addresses,\n actions: [\n {\n s3_action: {\n bucket_name: @receipt_rule.s3_bucket,\n object_key_prefix: @receipt_rule.object_key_prefix,\n },\n },\n ],\n enabled: true,\n name: @receipt_rule.rule_name,\n scan_enabled: false,\n tls_policy: 'Optional',\n },\n rule_set_name: @receipt_rule.rule_set_name,\n }\n begin\n @ses.create_receipt_rule(rule)\n rescue Aws::SES::Errors::AlreadyExists\n @ses.update_receipt_rule(rule)\n end\n end", "def add_outbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n add_rule(rule_number, protocol, rule_action, cidr_block, true, options)\n end", "def add(rule); end", "def add_item_routing_rule(rule)\n @item_routing_rules << rule\n end", "def config_fwrules(filtertype, srcaddr, dstaddr, sport, dport, protocol, action, svc_negate, interface,\n int, sub, filter, term, dscp)\n\n\n # Initialize\n newaddobj = false\n\n # Currently an \"input filter\" (v4 or v6) is being translated to a FG interface policy\n # interface policies can only specifically allow traffic (aka no action can be specified)\n if filtertype == :ipv4_input_filter || filtertype == :ipv6_input_filter\n unless action == :accept\n p \"config_fwrules: action type must be accept for interface policy\" if $opts[:verbose]\n return ''\n end\n end\n\n # if action not specified then assume it is accept. *update* This should be verified.\n action = :accept if action == ''\n\n if filtertype == :ipv4_output_filter || filtertype == :ipv6_output_filter\n unless action == :accept || action == :discard\n p \"config_fwrules: action type must be accept or discard, was #{action} for outbound policy filter: #{filter},\\\\\n term: #{term}\" if $opts[:verbose]\n\n return ''\n end\n end\n\n # Initialize local vars, strings, hashes, sets, arrays\n fwconfig = String.new\n # fwconfig += \"### From Filter: #{filter}, Term: #{term}\\n\"\n fwconfig += \" edit 0\\n\"\n fwconfig += \" set comment \\\"From Filter: #{filter}, Term: #{term}\\\" \\n\"\n srcaddr_out = String.new\n dstaddr_out = String.new\n service_out = String.new\n dscp_out = String.new\n\n # Put the srcaddr and dstaddrs in a string format acceptable for applying\n # to a FG firewall policy as srcaddr or dstaddr setting. (aka no punctuation, spaces only)\n if srcaddr.count > 0\n srcaddr.each do |x|\n srcaddr_out += x.to_s + ' '\n end\n else\n srcaddr_out = 'all'\n end\n\n if dstaddr.count > 0\n dstaddr.each do |x|\n dstaddr_out += x.to_s + ' '\n end\n else\n if $opts[:map2sub]\n ### When map2sub enabled, any rules with dstaddr any will be changed from any to the subnet\n ### that the associated interfaces IP is in\n case filtertype\n when :ipv4_output_filter\n if $h_interfaces[int.to_sym][sub.to_sym][:'address_v4_primary'] == nil\n $h_interfaces[int.to_sym][sub.to_sym][:vrrp].each_key do |x|\n unless $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'] == nil\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n end\n else\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:address_v4_primary].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n when :ipv6_output_filter\n if $h_interfaces[int.to_sym][sub.to_sym][:'address_v6_primary'] == nil\n $h_interfaces[int.to_sym][sub.to_sym][:vrrp].each_key do |x|\n unless $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'] == nil\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n end\n else\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:address_v6_primary].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n else\n dstaddr_out = 'all'\n end\n else\n dstaddr_out = 'all'\n end\n end\n\n # For input filters we are creating an inbound interface policy\n if filtertype == :ipv4_input_filter || filtertype == :ipv6_input_filter\n fwconfig += \" set interface #{interface}\\n\"\n fwconfig += \" set srcaddr #{srcaddr_out}\\n\"\n fwconfig += \" set dstaddr #{dstaddr_out}\\n\"\n elsif filtertype == :ipv4_output_filter || filtertype == :ipv6_output_filter\n fwconfig += \" set srcintf any\\n\"\n fwconfig += \" set dstintf #{interface}\\n\"\n fwconfig += \" set srcaddr #{srcaddr_out}\\n\"\n fwconfig += \" set dstaddr #{dstaddr_out}\\n\"\n fwconfig += \" set action #{action}\\n\"\n fwconfig += \" set schedule always\\n\"\n else\n p \"config_fwrules: filtertype not supported, skipping #{filtertype}\"\n end\n\n ## Create the source and/or destination services fg config\n if protocol.include?(:tcp)\n dport.each do |x|\n service_out += \"#{x}-tcp \"\n end\n sport.each do |x|\n service_out += \"#{x}-tcp_source \"\n end\n end\n if protocol.include?(:udp)\n dport.each do |x|\n service_out += \"#{x}-udp \"\n end\n sport.each do |x|\n service_out += \"#{x}-udp_source \"\n end\n end\n\n # If no protocol is specified in the term, then we will add tcp and udp.\n if !(protocol.include?(:tcp) || protocol.include?(:udp) || protocol.include?(:icmp))\n dport.each do |x|\n service_out += \"#{x}-tcp \"\n end\n sport.each do |x|\n service_out += \"#{x}-tcp_source \"\n end\n dport.each do |x|\n service_out += \"#{x}-udp \"\n end\n sport.each do |x|\n service_out += \"#{x}-udp_source \"\n end\n elsif (protocol.include?(:tcp) || protocol.include?(:udp) || protocol.include?(:icmp)) &&\\\n (dport.count == 0 && sport.count == 0)\n protocol.each do |x|\n service_out += \"#{x.to_s.upcase} \"\n end\n elsif protocol.include?(:icmp) && !(protocol.include?(:tcp) || protocol.include?(:udp))\n dport.each do |x|\n service_out += \"ICMP-#{x} \"\n end\n end\n\n service_out = 'ALL' if service_out == ''\n fwconfig += \" set service #{service_out} \\n\"\n\n if svc_negate == 'true'\n fwconfig += \" set service-negate enable \\n\"\n end\n\n # if dscp acls in configured create the dscp fg value\n if dscp.count > 0\n dscp.each do |x|\n\n if $h_dscp_map[x.to_s]\n dscpval = $h_dscp_map[x.to_s]\n dscp_out += dscpval + ' '\n else\n p \"config_fw_fules: No DSCP mapping found for dscp: #{x.to_s}\"\n next\n end\n\n fwconfig += \" set dscp-match enable \\n\"\n fwconfig += \" set dscp-value #{dscp_out} \\n\"\n fwconfig += \" set diffserv-forward enable \\n\"\n fwconfig += \" set diffserv-reverse enable \\n\"\n end\n end\n\n fwconfig += \" next\\n\"\n\n return fwconfig, dstaddr_out if newaddobj == true\n return fwconfig, nil\nend", "def add *rules\n self.set(self, *rules)\n end", "def initialize(rule)\n @rule = rule\n @protocol = @rule[:protocol].downcase.to_sym\n @protocol = :esp if @protocol == :ipsec\n\n @rule_type = @rule[:rule_type].downcase.to_sym\n @icmp_type = @rule[:icmp_type]\n @icmpv6_type = @rule[:icmpv6_type]\n\n @range = @rule[:range]\n @ip = @rule[:ip]\n @ip6 = @rule[:ip6]\n @ip6_global = @rule[:ip6_global]\n @ip6_ula = @rule[:ip6_ula]\n @size = @rule[:size]\n @type = set_type\n end", "def initialize(rules)\n @rules = rules\n end", "def make_mailbox mailbox\n Dir.mkdir(mailbox)\n %w{cur tmp new}.each do |dir|\n Dir.mkdir(File.join(mailbox,dir))\n end\n end", "def add_rule(rule_object)\n\n # store the rule\n @rules[rule_object.name] = rule_object\n\n case\n\n # rule which asserts facts without conditions or questions\n when rule_object.matcher.nil? && rule_object.questions.empty?\n\n # add the rule to the fact rules array, contains rules with only facts\n @fact_rules << rule_object\n\n when rule_object.matcher.nil? && rule_object.questions.count > 0\n\n # rules can be triggered directly\n @start_rules << rule_object\n\n else\n\n # get the matcher\n matcher = rule_object.matcher\n\n # get the matcher type (any / all)\n matcher_type = matcher.type\n\n # generate the ruleby conditions based on the matcher conditions\n conditions = create_conditions matcher.conditions\n\n # switch statement for the matcher type\n case matcher_type\n\n # all the conditions must match\n when :all\n\n # star to convert array to arguments\n rule AND *conditions do |v|\n\n # when rule is applicable, add to possible rules\n rule_handler rule_object\n\n end\n\n # one of the conditions must match\n when :any\n\n # star to convert array to arguments\n rule OR *conditions do |v|\n\n # when rule is applicable, add to possible rules\n rule_handler rule_object\n\n end\n\n else\n raise \"Unknown matcher type #{matcher.type}\"\n\n end\n\n end\n\n end", "def initialize(&block)\n @rules = Sawtooth::Rules::Set.new\n self.instance_eval(&block) if block_given?\n end", "def migrate_rules\n notification_rules_keys = @source_redis.keys('contact_notification_rules:*')\n\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n notification_rules_keys.each do |notification_rules_key|\n\n raise \"Bad regex for '#{notification_rules_key}'\" unless\n notification_rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n\n contact_id = $1\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n rules = []\n\n notification_rule_ids = @source_redis.smembers(notification_rules_key)\n\n notification_rule_ids.each do |notification_rule_id|\n\n notification_rule_data = @source_redis.hgetall(\"notification_rule:#{notification_rule_id}\")\n\n time_restrictions = Flapjack.load_json(notification_rule_data['time_restrictions'])\n\n entities = Set.new( Flapjack.load_json(notification_rule_data['entities']))\n regex_entities = Set.new( Flapjack.load_json(notification_rule_data['regex_entities']))\n\n tags = Set.new( Flapjack.load_json(notification_rule_data['tags']))\n regex_tags = Set.new( Flapjack.load_json(notification_rule_data['regex_tags']))\n\n # collect specific matches together with regexes\n regex_entities = regex_entities.collect {|re| Regexp.new(re) } +\n entities.to_a.collect {|entity| /\\A#{Regexp.escape(entity)}\\z/}\n regex_tags = regex_tags.collect {|re| Regexp.new(re) } +\n tags.to_a.collect {|tag| /\\A#{Regexp.escape(tag)}\\z/}\n\n media_states = {}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n next if !!Flapjack.load_json(notification_rule_data[\"#{fail_state}_blackhole\"])\n media_types = Flapjack.load_json(notification_rule_data[\"#{fail_state}_media\"])\n unless media_types.nil? || media_types.empty?\n media_types_str = media_types.sort.join(\"|\")\n media_states[media_types_str] ||= []\n media_states[media_types_str] << fail_state\n end\n end\n\n media_states.each_pair do |media_types_str, fail_states|\n\n rule = Flapjack::Data::Rule.new\n rule.time_restrictions = time_restrictions\n rule.conditions_list = fail_states.sort.join(\"|\")\n rule.save\n\n media = media_types_str.split('|').each_with_object([]) do |media_type, memo|\n medium = contact.media.intersect(:transport => media_type).all.first\n memo << medium unless medium.nil?\n end\n\n rule.media.add(*media) unless media.empty?\n\n checks_for_rule = Flapjack::Data::Check.intersect(:id => check_ids)\n\n checks = if regex_entities.empty? && regex_tags.empty?\n checks_for_rule.all\n else\n # apply the entities/tag regexes as a filter\n checks_for_rule.select do |check|\n entity_name = check.name.split(':', 2).first\n if regex_entities.all? {|re| re === entity_name }\n # copying logic from https://github.com/flapjack/flapjack/blob/68a3fd1144a0aa516cf53e8ae5cb83916f78dd94/lib/flapjack/data/notification_rule.rb\n # not sure if this does what we want, but it's how it currently works\n matching_re = []\n check_tags.each do |check_tags|\n matching_re += regex_tags.select {|re| re === check_tag }\n end\n matching_re.size >= regex_tags.size\n else\n false\n end\n end\n end\n\n tags = checks.collect do |check|\n\n check_num = check_counts_by_id[check.id]\n if check_num.nil?\n check_num = check_counts_by_id.size + 1\n check_counts_by_id[check.id] = check_num\n end\n\n tag = Flapjack::Data::Tag.new(:name => \"migrated-contact_#{contact_num}-check_#{check_num}|\")\n tag.save\n check.tags << tag\n tag\n end\n\n rule.tags.add(*tags) unless tags.empty?\n rules << rule\n end\n end\n\n contact.rules.add(*rules)\n end\n end", "def set_attend_rule\n @attend_rule = AttendRule.find(params[:id])\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def receive_inbound_email_from_mail(**kwargs, &block); end", "def create_new_rule_set\n ActiveRecord::Base.transaction do\n new_rule_set = StateMachineRuleSet.default_rule_set.create_duplicate_rule_set!(rule_set_name, rule_set_descr)\n new_rule_set.state_transition_guards.where(:type => %w[TpsGuard TpsRhnqaGuard]).update_all(:guard_type => 'info')\n end\n end", "def migrate_rules\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n source_keys_matching('contact_notification_rules:?*').each do |rules_key|\n\n rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n contact_id = Regexp.last_match(1)\n raise \"Bad regex for '#{rules_key}'\" if contact_id.nil?\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n Flapjack::Data::Rule.lock(\n Flapjack::Data::Check,\n Flapjack::Data::Tag,\n Flapjack::Data::Contact,\n Flapjack::Data::Medium\n ) do\n\n new_rule_ids = []\n\n rule_ids = @source_redis.smembers(rules_key)\n rule_ids.each do |rule_id|\n rule_data = @source_redis.hgetall(\"notification_rule:#{rule_id}\")\n\n old_time_restrictions_json = rule_data['time_restrictions']\n\n time_restrictions = if old_time_restrictions_json.nil? || old_time_restrictions_json.empty?\n nil\n else\n old_time_restrictions = Flapjack.load_json(old_time_restrictions_json)\n if old_time_restrictions.nil? || old_time_restrictions.empty?\n []\n elsif old_time_restrictions.is_a?(Hash)\n [rule_time_restriction_to_icecube_schedule(old_time_restrictions, contact.time_zone)]\n elsif old_time_restrictions.is_a?(Array)\n old_time_restrictions.map {|t| rule_time_restriction_to_icecube_schedule(t, contact.time_zone)}\n end\n end\n\n filter_tag_ids = Set.new\n\n old_entities = field_from_rule_json(rule_data, 'entities')\n entity_names = case old_entities\n when String\n Set.new([old_entities])\n when Array\n Set.new(old_entities)\n else\n nil\n end\n\n old_regex_entities = field_from_rule_json(rule_data, 'regex_entities')\n entity_regexes = case old_regex_entities\n when String\n Set.new([Regexp.new(old_regex_entities)])\n when Array\n Set.new(old_regex_entities.map {|re| Regexp.new(re) })\n else\n nil\n end\n\n Flapjack::Data::Tag.intersect(:name => '/^manage_service_\\d+_.+$/').each do |tag|\n next if tag.name.nil? ||\n (tag.name !~ /^manage_service_(\\d+)_(.+)$/)\n # eldest_service_id = Regexp.last_match(1)\n service_name = Regexp.last_match(2)\n\n next unless entity_names.include?(service_name) ||\n entity_regexes.all? {|re| !re.match(service_name).nil? }\n filter_tag_ids << tag.id\n end\n\n\n old_tags = field_from_rule_json(rule_data, 'tags')\n tags = case old_tags\n when String\n Set.new([old_tags])\n when Array\n Set.new(old_tags)\n else\n nil\n end\n\n old_regex_tags = field_from_rule_json(rule_data, 'regex_tags')\n tag_regexes = case old_regex_tags\n when String\n Set.new([Regexp.new(old_regex_tags)])\n when Array\n Set.new(old_regex_tags.map {|re| Regexp.new(re) })\n else\n nil\n end\n\n # start with the initial limited visibility range (overall scope)\n old_tags_checks = Flapjack::Data::Check.intersect(:id => check_ids)\n\n # then limit further by checks with names containing tag words\n unless tags.nil? || tags.empty?\n old_tags_checks = tags.inject(old_tags_checks) do |memo, tag|\n memo.intersect(:name => /(?: |^)#{Regexp.escape(tag)}(?: |$)/)\n end\n end\n\n # and by checks with names matching regexes\n unless tag_regexes.nil? || tag_regexes.empty?\n old_tags_checks = tag_regexes.inject(old_tags_checks) do |memo, tag_regex|\n memo.intersect(:name => /#{tag_regex}/)\n end\n end\n\n unless old_tags_checks.empty?\n tag = Flapjack::Data::Tag.new(:name => \"migrated_rule_#{rule_id}\")\n tag.save!\n tag.checks.add_ids(*old_tags_checks.ids)\n filter_tag_ids << tag.id\n end\n\n normal_rules_to_create = []\n filter_rules_to_create = []\n\n conditions_by_blackhole_and_media = {false => {},\n true => {}}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n media_types = Flapjack.load_json(rule_data[\"#{fail_state}_media\"])\n next if media_types.nil? || media_types.empty?\n\n media_types_str = media_types.sort.join(\"|\")\n blackhole = !!Flapjack.load_json(rule_data[\"#{fail_state}_blackhole\"])\n conditions_by_blackhole_and_media[blackhole][media_types_str] ||= []\n conditions_by_blackhole_and_media[blackhole][media_types_str] << fail_state\n end\n\n # multiplier -- conditions_by_blackhole_and_media[false].size +\n # conditions_by_blackhole_and_media[true].size\n\n [false, true].each do |blackhole|\n normal_rules_to_create += conditions_by_blackhole_and_media[blackhole].each_with_object([]) do |(media_types_str, fail_states), memo|\n media_types = media_types_str.split('|')\n\n rule_media_ids = contact.media.intersect(:transport => media_types).ids\n # if no media to communicate by, don't save the rule\n next if rule_media_ids.empty?\n\n memo << {\n :enabled => true,\n :blackhole => blackhole,\n :strategy => 'global', # filter rule also applies\n :conditions_list => fail_states.sort.join(','),\n :medium_ids => rule_media_ids\n }\n end\n end\n\n # multiply by number of applied time restrictions, if any\n unless time_restrictions.empty?\n replace_rules = time_restrictions.each_with_object([]) do |tr, memo|\n memo += normal_rules_to_create.collect do |r|\n r.merge(:time_restriction => tr)\n end\n end\n\n normal_rules_to_create = replace_rules\n end\n\n unless filter_tag_ids.empty?\n filter_data = {\n :blackhole => true,\n :strategy => 'no_tag'\n }\n\n filter_rules = normal_rules_to_create.each_with_object([]) do |r, memo|\n memo << r.merge(filter_data) unless r[:blackhole]\n end\n\n filter_rules_to_create += filter_rules\n end\n\n new_rule_ids += normal_rules_to_create.collect do |r|\n new_rule_id = SecureRandom.uuid\n r[:id] = new_rule_id\n medium_ids = r.delete(:medium_ids)\n rule = Flapjack::Data::Rule.new(r)\n rule.save!\n rule.media.add_ids(*medium_ids)\n new_rule_id\n end\n\n new_rule_ids += filter_rules_to_create.collect do |r|\n new_rule_id = SecureRandom.uuid\n r[:id] = new_rule_id\n medium_ids = r.delete(:medium_ids)\n rule = Flapjack::Data::Rule.new(r)\n rule.save!\n rule.media.add_ids(*medium_ids)\n rule.tags.add_ids(*filter_tag_ids) unless filter_tag_ids.empty?\n new_rule_id\n end\n end\n\n contact.rules.add_ids(*new_rule_ids) unless new_rule_ids.empty?\n end\n end\n end", "def new_rule(rule)\n Rule.new(rule)\n end", "def rules\n @rules ||= {}\n end", "def rule(expression, &block)\n case expression\n when Hash\n expression.each do |fact, task|\n fact = define_fact(fact)\n task = define_task(task)\n @rules << Rule.new(fact, &task)\n end\n else\n fact = define_fact(expression)\n @rules << Rule.new(fact, &block)\n end\n\n #rule = Rule.new(@_facts, get_rule_options, &procedure)\n #@rules << rule\n #clear_rule_options\n\n return @rules\n end", "def migrate_notification_rules\n notification_rules_keys = @source_redis.keys('contact_notification_rules:*')\n\n notification_rules_keys.each do |notification_rules_key|\n\n raise \"Bad regex for '#{notification_rules_key}'\" unless\n notification_rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n\n contact_id = $1\n\n contact = find_contact(contact_id)\n\n notification_rule_ids = @source_redis.smembers(notification_rules_key)\n\n notification_rule_ids.each do |notification_rule_id|\n\n notification_rule_data = @source_redis.hgetall(\"notification_rule:#{notification_rule_id}\")\n\n nr_fail_states = Flapjack::Data::CheckState.failing_states.collect do |fail_state|\n state = Flapjack::Data::NotificationRuleState.new(:state => fail_state,\n :blackhole => !!Flapjack.load_json(notification_rule_data[\"#{fail_state}_blackhole\"]))\n state.save\n\n media_types = Flapjack.load_json(notification_rule_data[\"#{fail_state}_media\"])\n unless media_types.nil? || media_types.empty?\n state_media = contact.media.intersect(:type => media_types).all\n state.media.add(*state_media) unless state_media.empty?\n end\n state\n end\n\n # TODO Fix\n\n # rule = Flapjack::Data::NotificationRule.new(\n # :id => notification_rule_id,\n # :entities => Set.new( Flapjack.load_json(notification_rule_data['entities'])),\n # :tags => Set.new( Flapjack.load_json(notification_rule_data['tags'])),\n # :time_restrictions => Flapjack.load_json(notification_rule_data['time_restrictions'])\n # )\n # rule.save\n # rule.states.add(*nr_fail_states)\n\n # contact.rules << rule\n end\n end\nend", "def mx_port_forwarding_rules\r\n MXPortForwardingRulesController.instance\r\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def addTeamRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def enable_inbox_replies\n client.post('/api/sendreplies', id: read_attribute(:name), state: true)\n end", "def create_forwarding_rule(body, opts = {})\n data, _status_code, _headers = create_forwarding_rule_with_http_info(body, opts)\n return data\n end", "def set_reminder_rule\n @reminder_rule = ReminderRule.find(params[:id])\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rule name, &body\n self.active_policy[name] = body\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_policy(filtertype)\n\n # Initialize vars, sets, string, hashes, etc\n filter = String.new\n fwconfig = String.new\n result = String.new\n service_negate = String.new\n newaddresses = Set.new\n\n case filtertype\n when :ipv4_input_filter\n fwconfig += \"#### Firewall Interface Policy ####\\n\"\n fwconfig += \"config firewall interface-policy\\n\"\n h_filters = $h_filters\n when :ipv6_input_filter\n fwconfig += \"#### Firewall IPv6 Interface Policy ####\\n\"\n fwconfig += \"config firewall interface-policy6\\n\"\n h_filters = $h_filters6\n when :ipv4_output_filter\n fwconfig += \"#### Firewall Policy ####\\n\"\n fwconfig += \"config firewall policy\\n\"\n h_filters = $h_filters\n when :ipv6_output_filter\n fwconfig += \"#### Firewall IPv6 Policy ####\\n\"\n fwconfig += \"config firewall policy6\\n\"\n h_filters = $h_filters6\n else\n p \"create_fg_intf_policy_rules: filtertype not supported - #{filtertype}\" if $opts[:verbose]\n return\n end\n\n # For each interface/sub-interface, process each unique filter matching the passed filtertype option\n # We are iterating through each used filter and checking the terms for compatibility. If compatible\n # then we will go ahead and process/convert to FG config.\n $h_interfaces.each_key do |int|\n $h_interfaces[int].each_key do |sub|\n if ($opts[:interfacemapout] && $h_ints_map_out.has_key?(\"#{int}-#{sub}\")) || !$opts[:interfacemapout]\n filter = $h_interfaces[int][sub][filtertype]\n\n ruletype = '' # for supportability checks\n filterref = '' # for referenced filters (aka linked filters)\n\n ### if interfacemapout option specified then we will change the dst interace to zone name supplied by file\n if $opts[:interfacemapout]\n interface = $h_ints_map_out[\"#{int}-#{sub}\"]\n else\n interface = \"#{int}-#{sub}\"\n end\n\n unless filter == 'nil' || filter == nil\n if h_filters.has_key?(filter)\n h_filters[filter].each_key do |term|\n\n # check to see if this policy is derived from dscp, forwarding-class, etc. if so, we will skip\n ruletype, filterref = check_rule_support_type(filter, term, h_filters)\n\n # Call action_rule_support_type which will call the right methods to build the fg config\n # based on the juniper filter/term detail, including handling nested filters/terms\n # will return the completed FG config for that filter/term. Also, if int2sub option is enabled\n # may return a list of subnets that need to be additionally created as address objects.\n newconfig, newaddobj = action_rule_support_type(ruletype,\\\n filterref,\\\n h_filters,\\\n filtertype,\\\n filter,\\\n term,\\\n interface,\\\n int,\\\n sub)\n\n fwconfig += newconfig\n\n # Add any new address objects that need to be configured to a set (due to any dst int map)\n newaddresses << newaddobj if newaddobj\n end\n\n else\n p \"create_fg_policy_rules: filter \\\"#{filter} referenced by interface does not exist for #{int}-#{sub}\"\\\n if $opts[:debug] || $opts[:verbose]\n end\n\n end\n else\n p \"Skipping interface #{int}-#{sub} due to, is not included in --interfacemapout file\"\\\n if $opts[:debug] || $opts[:verbose]\n end\n end\n end\n fwconfig += \"end \\n\"\n\n # If new address objects need to be created due that here, and insert them in the config ahead of creating\n # rules that will need to use these objects.\n if newaddresses.count > 0\n newconfig = \"### Additional FW Addresses from derived subnets ###\"\n newconfig += \"config firewall address\\n\"\n\n newaddresses.each do |x|\n newconfig += <<-EOS\n edit #{x}\n set type subnet\n set subnet #{x}\n set comment \"Derived subnet from interface IP due to rule with dst of any\"\n next\n EOS\n end\n\n newconfig += \"end\\n\"\n\n fwconfig = newconfig + fwconfig\n end\n\n return fwconfig\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def create_mailbox name\n log \"LIST #{name}\"\n list = imap.list '', name\n return if list\n log \"CREATE #{name}\"\n imap.create name\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def addRule(hosts,\n proto: \"tcp\",\n port: nil,\n egress: false,\n port_range: \"0-65535\"\n )\n rule = Hash.new\n rule[\"proto\"] = proto\n if hosts.is_a?(String)\n rule[\"hosts\"] = [hosts]\n else\n rule[\"hosts\"] = hosts\n end\n if port != nil\n port = port.to_s if !port.is_a?(String)\n rule[\"port\"] = port\n else\n rule[\"port_range\"] = port_range\n end\n ec2_rule = convertToEc2([rule])\n\n begin\n if egress\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_egress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n else\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_ingress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n end\n rescue Aws::EC2::Errors::InvalidPermissionDuplicate => e\n MU.log \"Attempt to add duplicate rule to #{@cloud_id}\", MU::DEBUG, details: ec2_rule\n end\n end", "def create rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_post_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def update_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n update_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end", "def add_to_allowed_list(email)\n send_contact_command email, 'ADL', '2'\n end", "def create_mailings!\n caffeinate_campaign.to_dripper.drips.each do |drip|\n mailing = Caffeinate::Mailing.new(caffeinate_campaign_subscription: self).from_drip(drip)\n mailing.save!\n end\n caffeinate_campaign.to_dripper.run_callbacks(:on_subscribe, self)\n end", "def <<(rule); end", "def method_missing(rule_set_name, args = {})\n template = Asbestos::RuleSet[rule_set_name]\n raise %{Unknown host DSL call : \"#{rule_set_name}\" for host \"#{name}\"} unless template\n\n @rulesets << \\\n Asbestos::RuleSet.new(rule_set_name, self, template).tap do |rs|\n # override template defaults with provided options\n args.each do |k, v|\n rs.send k, v\n end\n end\n end", "def add_to_stories_lists\n non_friend_stories_list = NonFriendStoriesList.new(id: user.id)\n friend_stories_list = FriendStoriesList.new(id: user.id)\n my_stories_list = MyStoriesList.new(id: user.id)\n\n redis.pipelined do\n non_friend_stories_list.add_message(self) if public?\n friend_stories_list.add_message(self) if public? || friends?\n my_stories_list.add_message(self)\n end\n end", "def set_rule\n @rule = params[:rule].to_i\n\n if @rule == 0 or @rule == 1 or @rule == 2\n else\n @rule = 0\n end\n end", "def mg_port_forwarding_rules\r\n MGPortForwardingRulesController.instance\r\n end", "def subsequent_rules(*args); end", "def subsequent_rules(*args); end", "def checkbrainmailbox\n #Check if token is present\n logger.info params[\"token\"]\n if APP_CONFIG['token_action'].to_s == params[\"token\"]\n #Start the actual work\n imap = Net::IMAP.new(APP_CONFIG['imap_host'], APP_CONFIG['imap_port'] , APP_CONFIG['imap_ssl'], nil, false)\n imap.authenticate('LOGIN', APP_CONFIG['imap_user'], APP_CONFIG['imap_password'])\n imap.select('INBOX')\n @output = \"Connected to IMAP server\\n\"\n \n @n=0\n #Select unseen messages only\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n \n #Get the full content\n raw = imap.fetch(message_id, \"BODY[]\")[0].attr[\"BODY[]\"]\n imap.store(message_id, '+FLAGS', [:Seen])\n #Parse it with mail library\n mail = Mail.read_from_string(raw)\n token = mail.to.to_s\n #If multipart or auth token not included, then discard the mail and send a warning\n if mail.multipart? or (not token.include?(APP_CONFIG['token_email'].to_s))\n imap.copy(message_id, 'Untreated')\n @output=@output+Time.now.getutc.to_s+\" - 1 untreated mail\\n\"\n send_warning_mail(mail.from, raw) \n else\n content = mail.body.decoded\n name = mail.subject\n date = mail.date\n #Detect if labels are specified in first line\n if content.lines.first.to_s[0]==\"@\"\n labels = content.lines.first.chomp\n content = content.lines.to_a[1..-1].join\n end\n #Here, create the neuron\n @output=@output+Time.now.getutc.to_s+\" - 1 neuron created from a mail\\n\"\n puts \"One neuron created with name '#{name}', labels '#{labels}' and content '#{content}'\"\n neuron = Neuron.new\n neuron.name = name\n neuron.content = content\n neuron.labels = labels\n neuron.date = date\n neuron.save\n imap.copy(message_id, 'Treated')\n end\n imap.store(message_id, '+FLAGS', [:Deleted])\n @n+=1\n end\n imap.expunge #Delete all mails with deleted flags\n imap.close\n end\n render :layout => false\n end", "def build_inbox\n folders.build(:name => \"Inbox\")\n end", "def build_inbox\n folders.build(:name => \"Inbox\")\n end", "def trigger_rules\n self.class.trigger_rules(self)\n end" ]
[ "0.61950773", "0.5751447", "0.5678452", "0.5643247", "0.54154164", "0.53206235", "0.52772284", "0.52740157", "0.52516335", "0.525135", "0.5231989", "0.5219381", "0.5214958", "0.51981", "0.51866287", "0.514604", "0.5103869", "0.50939095", "0.50881296", "0.50880677", "0.5080491", "0.50705767", "0.5059062", "0.5058283", "0.5027189", "0.502632", "0.50169057", "0.50017023", "0.4977712", "0.49360177", "0.49338683", "0.49324635", "0.4931943", "0.4929331", "0.49234736", "0.48980537", "0.48974454", "0.48689875", "0.4864424", "0.4859101", "0.48537692", "0.48536906", "0.48462367", "0.4836991", "0.48368853", "0.48351586", "0.4832362", "0.4831602", "0.48135847", "0.47904512", "0.47844204", "0.47828394", "0.47828394", "0.47828394", "0.47811076", "0.4765729", "0.476176", "0.47560272", "0.4753904", "0.47480145", "0.474002", "0.47384042", "0.47367278", "0.47202903", "0.4716662", "0.47074714", "0.47037855", "0.4702347", "0.46975505", "0.4696086", "0.4696086", "0.4696086", "0.4694409", "0.4694409", "0.46924567", "0.46882534", "0.46855363", "0.4680555", "0.46771145", "0.46767172", "0.46767172", "0.46767172", "0.46767172", "0.46679494", "0.46532375", "0.4651747", "0.46478593", "0.4647733", "0.46367204", "0.46284005", "0.46184137", "0.46128795", "0.46018893", "0.45927912", "0.45915097", "0.45915097", "0.4583048", "0.4580604", "0.4580604", "0.45802537" ]
0.6304485
0
Create an inbox ruleset Create a new inbox rule for forwarding, blocking, and allowing emails when sending and receiving
def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...' end # verify the required parameter 'create_inbox_ruleset_options' is set if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil? fail ArgumentError, "Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset" end # resource path local_var_path = '/rulesets' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) # return_type return_type = opts[:return_type] || 'InboxRulesetDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboxRulesetControllerApi#create_new_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def add_to_rules(msg)\n # TODO use configatron config parameter for conf dir\n line = \"ACCEPT net:#{msg[2]} fw #{msg[1]}\"\n line << \" \" << msg[3] if msg[3]\n line << \"\\n\"\n lines = []\n\n File.open(rules_file) do |f|\n lines = f.readlines\n end\n\n i = lines.size - 1\n\n while i >= 0 && lines[i] !~ /\\s*#LAST LINE -- ADD YOUR ENTRIES/\n i -= 1\n end\n\n if i >= 0\n a = [line, lines[i]]\n lines[i,i] = a\n\n # TODO ask agent to backup original file\n\n File.open(rules_file, \"w\") do |f|\n f.write lines.join\n end\n\n message = \"#{rules_file} updated, run shorewall restart to reload the rules.\"\n else\n message = \"Can not find last mark line\"\n end\n\n send_response(message)\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def add_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n add_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end", "def setRules(rules, add_to_self: false, ingress: true, egress: false)\n return if rules.nil? or rules.size == 0\n\n if add_to_self\n rules.each { |rule|\n if rule['sgs'].nil?\n new_rule = rule.clone\n new_rule.delete('hosts')\n rule['sgs'] = Array.new if rule['sgs'].nil?\n rule['sgs'] << { \"Ref\" => @cfm_name }\n end\n }\n end\n\n ec2_rules = convertToEc2(rules)\n\n # Creating an empty security group is ok, so don't freak out if we get\n # a null rule list.\n if !ec2_rules.nil?\n ec2_rules.each { |rule|\n next if rule.nil? or rule[:ip_ranges].nil? # XXX whaaat\n rule[:ip_ranges].each { |cidr|\n MU::Cloud::CloudFormation.setCloudFormationProp(\n @cfm_template[@cfm_name],\n \"SecurityGroupIngress\",\n {\n \"IpProtocol\" => rule[:ip_protocol],\n \"FromPort\" => rule[:from_port],\n \"ToPort\" => rule[:to_port],\n \"CidrIp\" => cidr[:cidr_ip]\n }\n )\n }\n }\n end\n\n end", "def add_rule(subject, clauses)\n options = { :body => {\n :Subject => subject,\n :Clauses => clauses }.to_json }\n response = @create_send.post \"/segments/#{segment_id}/rules.json\", options\n end", "def inbound_rules\n @inbound_rules ||= normalized_security_rules.one_direction_rules(\"inbound\")\n end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def create_firewall_rule(rule_hash, firewall_name)\n script_code = +'netsh advfirewall firewall add rule'\n rule_hash.each do |key, val|\n filter_or_append_rule_field(script_code, key, val)\n end\n @@creation_script_cache[firewall_name] = [] if @@creation_script_cache[firewall_name].nil?\n @@creation_script_cache[firewall_name].push(script_code)\n cmd = log_powershell_out('creation', script_code)\n validate_creation_output(cmd.stdout)\n end", "def add_rules(rules)\n rules.each do |rule|\n add_rule rule\n end\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def add_rules(rules)\n options = {request: []}\n rules.each do |rule|\n options[:request] << rule.attributes\n end\n response = nil\n if @parent.class == Profitbricks::LoadBalancer\n response = Profitbricks.request :add_firewall_rules_to_load_balancer, options.merge(load_balancer_id: @parent.id)\n self.reload\n else\n response = Profitbricks.request :add_firewall_rules_to_nic, options.merge(nic_id: self.nic_id)\n self.reload\n end\n \n end", "def batch_rules!(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n res = batch_rules(rules, forward_to_replicas, clear_existing_rules, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def receive_inbound_email_from_mail(**kwargs, &block)\n create_inbound_email_from_mail(**kwargs, &block).tap(&:route)\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def create\n @email_params = email_params\n @email_params[:body_plain] = @email_params['body-plain']\n @email_params[:stripped_html] = @email_params['stripped-html']\n @email_params[:body_html] = @email_params['body-html']\n ['body-plain', 'body-html', 'stripped-html'].collect{|p| @email_params.delete(p) }\n @email = Email.new(@email_params)\n @email.conversation_id = @email.find_conversation\n # We check if it's in the spam list. If that is the case, no conversation is created\n if Spam.search_pattern(@email.sender)\n @email.spam = true\n end\n if @email.save\n if @email.conversation\n @email.conversation.update_attribute(:read, false)\n @email.conversation.update_attribute(:answered, false)\n @email.conversation.update_attribute(:archived, false)\n end\n return render nothing: true, code: 200\n else\n return render nothing: true, code: 500\n end\n end", "def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end", "def add_rule(rule)\n @rulebook.add_rule rule\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def add_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})\n requires :network_acl_id\n\n service.create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options)\n true\n end", "def initialize(rules = [])\n @rules = rules\n end", "def << rule\n rules << rule\n nil\n end", "def migrate_rules\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n source_keys_matching('contact_notification_rules:?*').each do |rules_key|\n\n rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n contact_id = $1\n raise \"Bad regex for '#{rules_key}'\" if contact_id.nil?\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n rules = {\n Flapjack::Data::Acceptor => [],\n Flapjack::Data::Rejector => []\n }\n\n rule_ids = @source_redis.smembers(rules_key)\n rule_ids.each do |rule_id|\n rule_data = @source_redis.hgetall(\"notification_rule:#{rule_id}\")\n\n time_restrictions = Flapjack.load_json(rule_data['time_restrictions'])\n\n entities = Set.new( Flapjack.load_json(rule_data['entities']))\n regex_entities = Set.new( Flapjack.load_json(rule_data['regex_entities']))\n\n tags = Set.new( Flapjack.load_json(rule_data['tags']))\n regex_tags = Set.new( Flapjack.load_json(rule_data['regex_tags']))\n\n # collect specific matches together with regexes\n regex_entities = regex_entities.collect {|re| Regexp.new(re) } +\n entities.to_a.collect {|entity| /\\A#{Regexp.escape(entity)}\\z/}\n regex_tags = regex_tags.collect {|re| Regexp.new(re) } +\n tags.to_a.collect {|tag| /\\A#{Regexp.escape(tag)}\\z/}\n\n acceptor_conditions_by_media = {}\n rejector_conditions_by_media = {}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n media_types = Flapjack.load_json(rule_data[\"#{fail_state}_media\"])\n next if media_types.nil? || media_types.empty?\n\n media_types_str = media_types.sort.join(\"|\")\n blackhole = !!Flapjack.load_json(rule_data[\"#{fail_state}_blackhole\"])\n cond_by_media = blackhole ? rejector_conditions_by_media : acceptor_conditions_by_media\n cond_by_media[media_types_str] ||= []\n cond_by_media[media_types_str] << fail_state\n end\n\n checks_and_tags_for_rule = proc do |rule_klass, cond_by_media|\n\n rule_klass.lock(Flapjack::Data::Check, Flapjack::Data::Tag,\n Flapjack::Data::Contact, Flapjack::Data::Medium) do\n\n cond_by_media.each_pair do |media_types_str, fail_states|\n rule = rule_klass.new\n rule.conditions_list = fail_states.sort.join(\"|\")\n rule.all = regex_entities.empty? && regex_tags.empty?\n rule.time_restrictions = time_restrictions\n rule.save\n raise rule.errors.full_messages.join(\", \") unless rule.persisted?\n\n media_transports = media_types_str.split('|')\n media = contact.media.intersect(:transport => media_transports)\n rule.media.add_ids(*media.ids) unless media.empty?\n\n unless rule.all\n # apply the entities/tag regexes as a filter\n checks = Flapjack::Data::Check.intersect(:id => check_ids).select do |check|\n entity_name = check.name.split(':', 2).first\n if regex_entities.all? {|re| re === entity_name }\n # copying logic from https://github.com/flapjack/flapjack/blob/68a3fd1144a0aa516cf53e8ae5cb83916f78dd94/lib/flapjack/data/notification_rule.rb\n # not sure if this does what we want, but it's how it currently works\n matching_re = []\n check.tags.each do |tag|\n matching_re += regex_tags.select {|re| re === tag.name }\n end\n matching_re.size >= regex_tags.size\n else\n false\n end\n end\n\n tags = checks.collect do |check|\n check_num = check_counts_by_id[check.id]\n if check_num.nil?\n check_num = check_counts_by_id.size + 1\n check_counts_by_id[check.id] = check_num\n end\n\n tag = Flapjack::Data::Tag.new(:name => \"migrated-contact_#{contact_num}-check_#{check_num}\")\n tag.save\n check.tags << tag\n tag\n end\n\n rule.tags.add(*tags) unless tags.empty?\n end\n rules[rule_klass] << rule\n end\n end\n end\n\n checks_and_tags_for_rule.call(Flapjack::Data::Rejector, rejector_conditions_by_media)\n checks_and_tags_for_rule.call(Flapjack::Data::Acceptor, acceptor_conditions_by_media)\n end\n\n rejectors = rules[Flapjack::Data::Rejector]\n contact.rejectors.add(*rejectors) unless rejectors.empty?\n\n acceptors = rules[Flapjack::Data::Acceptor]\n contact.acceptors.add(*acceptors) unless acceptors.empty?\n end\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def rule(cmd, a, &block)\n # Evaluate a block expression and return early if it evaluates to false.\n # If no block is passed it is equivalent to the block: { true }.\n return self if block_given? && !instance_eval(&block)\n\n raise ArgumentError, 'chain is a required argument' unless a[:chain]\n assert_valid_ipaddr(a[:src]) if a[:src]\n assert_valid_ipaddr(a[:dst]) if a[:dst]\n\n # Map of commands for rules\n cmds = {\n add: '-A', delete: '-D', insert: '-I', replace: '-R',\n check: '-C'\n }\n\n a[:proto] ||= 'tcp'\n table = build_option('-t', @table)\n jump = build_option('-j', a[:jump])\n goto = build_option('-g', a[:goto])\n proto = build_option('-p', a[:proto])\n inface = build_option('-i', a[:in])\n outface = build_option('-o', a[:out])\n src = build_option('-s', a[:src])\n dst = build_option('-d', a[:dst])\n match = build_option('-m', a[:match] || @match)\n ports = build_option('--dport', @ports)\n to_port = build_option('--to-port', a[:to_port])\n @buffer << [\n 'iptables', table, cmds[cmd], a[:chain], src, dst, outface,\n inface, proto, match, ports, jump || goto, to_port\n ].compact.join(' ') << \"\\n\"\n self\n end", "def batch_rules(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n client.post(\"#{Protocol.batch_rules_uri(name)}?forwardToReplicas=#{forward_to_replicas}&clearExistingRules=#{clear_existing_rules}\", rules.to_json, :batch, request_options)\n end", "def process_rules *args, &block\n Shotshare::ProcessRuleContainer.instance.rules = \\\n Docile.dsl_eval(Shotshare::Dsl::ProcessRuleBuilder.new, &block).build\nend", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def initialize(rules)\n @rules = rules\n end", "def addRule(hosts, proto: \"tcp\", port: nil, egress: false, port_range: \"0-65535\")\n end", "def notification_rules(opts = {})\n rules = self.notification_rule_ids.inject([]) do |ret, rule_id|\n unless (rule_id.nil? || rule_id == '')\n ret << Flapjack::Data::NotificationRule.find_by_id(rule_id, :redis => @redis)\n end\n ret\n end\n if rules.all? {|r| r.is_specific? } # also true if empty\n rule = self.add_notification_rule({\n :entities => [],\n :regex_entities => [],\n :tags => Set.new([]),\n :regex_tags => Set.new([]),\n :time_restrictions => [],\n :warning_media => ALL_MEDIA,\n :critical_media => ALL_MEDIA,\n :warning_blackhole => false,\n :critical_blackhole => false,\n }, :logger => opts[:logger])\n rules.unshift(rule)\n end\n rules\n end", "def rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"STORING IN SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.add(@db_name, rules, @schema_graph, \"application/rdf+xml\")\n self\n end", "def create()\n\n ensure_prerequsites\n\n rule = {\n rule: {\n recipients: @receipt_rule.email_addresses,\n actions: [\n {\n s3_action: {\n bucket_name: @receipt_rule.s3_bucket,\n object_key_prefix: @receipt_rule.object_key_prefix,\n },\n },\n ],\n enabled: true,\n name: @receipt_rule.rule_name,\n scan_enabled: false,\n tls_policy: 'Optional',\n },\n rule_set_name: @receipt_rule.rule_set_name,\n }\n begin\n @ses.create_receipt_rule(rule)\n rescue Aws::SES::Errors::AlreadyExists\n @ses.update_receipt_rule(rule)\n end\n end", "def add_outbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n add_rule(rule_number, protocol, rule_action, cidr_block, true, options)\n end", "def add_item_routing_rule(rule)\n @item_routing_rules << rule\n end", "def add(rule); end", "def config_fwrules(filtertype, srcaddr, dstaddr, sport, dport, protocol, action, svc_negate, interface,\n int, sub, filter, term, dscp)\n\n\n # Initialize\n newaddobj = false\n\n # Currently an \"input filter\" (v4 or v6) is being translated to a FG interface policy\n # interface policies can only specifically allow traffic (aka no action can be specified)\n if filtertype == :ipv4_input_filter || filtertype == :ipv6_input_filter\n unless action == :accept\n p \"config_fwrules: action type must be accept for interface policy\" if $opts[:verbose]\n return ''\n end\n end\n\n # if action not specified then assume it is accept. *update* This should be verified.\n action = :accept if action == ''\n\n if filtertype == :ipv4_output_filter || filtertype == :ipv6_output_filter\n unless action == :accept || action == :discard\n p \"config_fwrules: action type must be accept or discard, was #{action} for outbound policy filter: #{filter},\\\\\n term: #{term}\" if $opts[:verbose]\n\n return ''\n end\n end\n\n # Initialize local vars, strings, hashes, sets, arrays\n fwconfig = String.new\n # fwconfig += \"### From Filter: #{filter}, Term: #{term}\\n\"\n fwconfig += \" edit 0\\n\"\n fwconfig += \" set comment \\\"From Filter: #{filter}, Term: #{term}\\\" \\n\"\n srcaddr_out = String.new\n dstaddr_out = String.new\n service_out = String.new\n dscp_out = String.new\n\n # Put the srcaddr and dstaddrs in a string format acceptable for applying\n # to a FG firewall policy as srcaddr or dstaddr setting. (aka no punctuation, spaces only)\n if srcaddr.count > 0\n srcaddr.each do |x|\n srcaddr_out += x.to_s + ' '\n end\n else\n srcaddr_out = 'all'\n end\n\n if dstaddr.count > 0\n dstaddr.each do |x|\n dstaddr_out += x.to_s + ' '\n end\n else\n if $opts[:map2sub]\n ### When map2sub enabled, any rules with dstaddr any will be changed from any to the subnet\n ### that the associated interfaces IP is in\n case filtertype\n when :ipv4_output_filter\n if $h_interfaces[int.to_sym][sub.to_sym][:'address_v4_primary'] == nil\n $h_interfaces[int.to_sym][sub.to_sym][:vrrp].each_key do |x|\n unless $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'] == nil\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n end\n else\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:address_v4_primary].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n when :ipv6_output_filter\n if $h_interfaces[int.to_sym][sub.to_sym][:'address_v6_primary'] == nil\n $h_interfaces[int.to_sym][sub.to_sym][:vrrp].each_key do |x|\n unless $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'] == nil\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:vrrp][x][:'intf-address'].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n end\n else\n intip = IPAddress $h_interfaces[int.to_sym][sub.to_sym][:address_v6_primary].to_s\n dstaddr_out = intip.network.to_s + '/' + intip.prefix.to_s\n newaddobj = true\n end\n else\n dstaddr_out = 'all'\n end\n else\n dstaddr_out = 'all'\n end\n end\n\n # For input filters we are creating an inbound interface policy\n if filtertype == :ipv4_input_filter || filtertype == :ipv6_input_filter\n fwconfig += \" set interface #{interface}\\n\"\n fwconfig += \" set srcaddr #{srcaddr_out}\\n\"\n fwconfig += \" set dstaddr #{dstaddr_out}\\n\"\n elsif filtertype == :ipv4_output_filter || filtertype == :ipv6_output_filter\n fwconfig += \" set srcintf any\\n\"\n fwconfig += \" set dstintf #{interface}\\n\"\n fwconfig += \" set srcaddr #{srcaddr_out}\\n\"\n fwconfig += \" set dstaddr #{dstaddr_out}\\n\"\n fwconfig += \" set action #{action}\\n\"\n fwconfig += \" set schedule always\\n\"\n else\n p \"config_fwrules: filtertype not supported, skipping #{filtertype}\"\n end\n\n ## Create the source and/or destination services fg config\n if protocol.include?(:tcp)\n dport.each do |x|\n service_out += \"#{x}-tcp \"\n end\n sport.each do |x|\n service_out += \"#{x}-tcp_source \"\n end\n end\n if protocol.include?(:udp)\n dport.each do |x|\n service_out += \"#{x}-udp \"\n end\n sport.each do |x|\n service_out += \"#{x}-udp_source \"\n end\n end\n\n # If no protocol is specified in the term, then we will add tcp and udp.\n if !(protocol.include?(:tcp) || protocol.include?(:udp) || protocol.include?(:icmp))\n dport.each do |x|\n service_out += \"#{x}-tcp \"\n end\n sport.each do |x|\n service_out += \"#{x}-tcp_source \"\n end\n dport.each do |x|\n service_out += \"#{x}-udp \"\n end\n sport.each do |x|\n service_out += \"#{x}-udp_source \"\n end\n elsif (protocol.include?(:tcp) || protocol.include?(:udp) || protocol.include?(:icmp)) &&\\\n (dport.count == 0 && sport.count == 0)\n protocol.each do |x|\n service_out += \"#{x.to_s.upcase} \"\n end\n elsif protocol.include?(:icmp) && !(protocol.include?(:tcp) || protocol.include?(:udp))\n dport.each do |x|\n service_out += \"ICMP-#{x} \"\n end\n end\n\n service_out = 'ALL' if service_out == ''\n fwconfig += \" set service #{service_out} \\n\"\n\n if svc_negate == 'true'\n fwconfig += \" set service-negate enable \\n\"\n end\n\n # if dscp acls in configured create the dscp fg value\n if dscp.count > 0\n dscp.each do |x|\n\n if $h_dscp_map[x.to_s]\n dscpval = $h_dscp_map[x.to_s]\n dscp_out += dscpval + ' '\n else\n p \"config_fw_fules: No DSCP mapping found for dscp: #{x.to_s}\"\n next\n end\n\n fwconfig += \" set dscp-match enable \\n\"\n fwconfig += \" set dscp-value #{dscp_out} \\n\"\n fwconfig += \" set diffserv-forward enable \\n\"\n fwconfig += \" set diffserv-reverse enable \\n\"\n end\n end\n\n fwconfig += \" next\\n\"\n\n return fwconfig, dstaddr_out if newaddobj == true\n return fwconfig, nil\nend", "def add *rules\n self.set(self, *rules)\n end", "def initialize(rule)\n @rule = rule\n @protocol = @rule[:protocol].downcase.to_sym\n @protocol = :esp if @protocol == :ipsec\n\n @rule_type = @rule[:rule_type].downcase.to_sym\n @icmp_type = @rule[:icmp_type]\n @icmpv6_type = @rule[:icmpv6_type]\n\n @range = @rule[:range]\n @ip = @rule[:ip]\n @ip6 = @rule[:ip6]\n @ip6_global = @rule[:ip6_global]\n @ip6_ula = @rule[:ip6_ula]\n @size = @rule[:size]\n @type = set_type\n end", "def initialize(rules)\n @rules = rules\n end", "def add_rule(rule_object)\n\n # store the rule\n @rules[rule_object.name] = rule_object\n\n case\n\n # rule which asserts facts without conditions or questions\n when rule_object.matcher.nil? && rule_object.questions.empty?\n\n # add the rule to the fact rules array, contains rules with only facts\n @fact_rules << rule_object\n\n when rule_object.matcher.nil? && rule_object.questions.count > 0\n\n # rules can be triggered directly\n @start_rules << rule_object\n\n else\n\n # get the matcher\n matcher = rule_object.matcher\n\n # get the matcher type (any / all)\n matcher_type = matcher.type\n\n # generate the ruleby conditions based on the matcher conditions\n conditions = create_conditions matcher.conditions\n\n # switch statement for the matcher type\n case matcher_type\n\n # all the conditions must match\n when :all\n\n # star to convert array to arguments\n rule AND *conditions do |v|\n\n # when rule is applicable, add to possible rules\n rule_handler rule_object\n\n end\n\n # one of the conditions must match\n when :any\n\n # star to convert array to arguments\n rule OR *conditions do |v|\n\n # when rule is applicable, add to possible rules\n rule_handler rule_object\n\n end\n\n else\n raise \"Unknown matcher type #{matcher.type}\"\n\n end\n\n end\n\n end", "def make_mailbox mailbox\n Dir.mkdir(mailbox)\n %w{cur tmp new}.each do |dir|\n Dir.mkdir(File.join(mailbox,dir))\n end\n end", "def initialize(&block)\n @rules = Sawtooth::Rules::Set.new\n self.instance_eval(&block) if block_given?\n end", "def migrate_rules\n notification_rules_keys = @source_redis.keys('contact_notification_rules:*')\n\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n notification_rules_keys.each do |notification_rules_key|\n\n raise \"Bad regex for '#{notification_rules_key}'\" unless\n notification_rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n\n contact_id = $1\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n rules = []\n\n notification_rule_ids = @source_redis.smembers(notification_rules_key)\n\n notification_rule_ids.each do |notification_rule_id|\n\n notification_rule_data = @source_redis.hgetall(\"notification_rule:#{notification_rule_id}\")\n\n time_restrictions = Flapjack.load_json(notification_rule_data['time_restrictions'])\n\n entities = Set.new( Flapjack.load_json(notification_rule_data['entities']))\n regex_entities = Set.new( Flapjack.load_json(notification_rule_data['regex_entities']))\n\n tags = Set.new( Flapjack.load_json(notification_rule_data['tags']))\n regex_tags = Set.new( Flapjack.load_json(notification_rule_data['regex_tags']))\n\n # collect specific matches together with regexes\n regex_entities = regex_entities.collect {|re| Regexp.new(re) } +\n entities.to_a.collect {|entity| /\\A#{Regexp.escape(entity)}\\z/}\n regex_tags = regex_tags.collect {|re| Regexp.new(re) } +\n tags.to_a.collect {|tag| /\\A#{Regexp.escape(tag)}\\z/}\n\n media_states = {}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n next if !!Flapjack.load_json(notification_rule_data[\"#{fail_state}_blackhole\"])\n media_types = Flapjack.load_json(notification_rule_data[\"#{fail_state}_media\"])\n unless media_types.nil? || media_types.empty?\n media_types_str = media_types.sort.join(\"|\")\n media_states[media_types_str] ||= []\n media_states[media_types_str] << fail_state\n end\n end\n\n media_states.each_pair do |media_types_str, fail_states|\n\n rule = Flapjack::Data::Rule.new\n rule.time_restrictions = time_restrictions\n rule.conditions_list = fail_states.sort.join(\"|\")\n rule.save\n\n media = media_types_str.split('|').each_with_object([]) do |media_type, memo|\n medium = contact.media.intersect(:transport => media_type).all.first\n memo << medium unless medium.nil?\n end\n\n rule.media.add(*media) unless media.empty?\n\n checks_for_rule = Flapjack::Data::Check.intersect(:id => check_ids)\n\n checks = if regex_entities.empty? && regex_tags.empty?\n checks_for_rule.all\n else\n # apply the entities/tag regexes as a filter\n checks_for_rule.select do |check|\n entity_name = check.name.split(':', 2).first\n if regex_entities.all? {|re| re === entity_name }\n # copying logic from https://github.com/flapjack/flapjack/blob/68a3fd1144a0aa516cf53e8ae5cb83916f78dd94/lib/flapjack/data/notification_rule.rb\n # not sure if this does what we want, but it's how it currently works\n matching_re = []\n check_tags.each do |check_tags|\n matching_re += regex_tags.select {|re| re === check_tag }\n end\n matching_re.size >= regex_tags.size\n else\n false\n end\n end\n end\n\n tags = checks.collect do |check|\n\n check_num = check_counts_by_id[check.id]\n if check_num.nil?\n check_num = check_counts_by_id.size + 1\n check_counts_by_id[check.id] = check_num\n end\n\n tag = Flapjack::Data::Tag.new(:name => \"migrated-contact_#{contact_num}-check_#{check_num}|\")\n tag.save\n check.tags << tag\n tag\n end\n\n rule.tags.add(*tags) unless tags.empty?\n rules << rule\n end\n end\n\n contact.rules.add(*rules)\n end\n end", "def set_attend_rule\n @attend_rule = AttendRule.find(params[:id])\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def receive_inbound_email_from_mail(**kwargs, &block); end", "def create_new_rule_set\n ActiveRecord::Base.transaction do\n new_rule_set = StateMachineRuleSet.default_rule_set.create_duplicate_rule_set!(rule_set_name, rule_set_descr)\n new_rule_set.state_transition_guards.where(:type => %w[TpsGuard TpsRhnqaGuard]).update_all(:guard_type => 'info')\n end\n end", "def migrate_rules\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n source_keys_matching('contact_notification_rules:?*').each do |rules_key|\n\n rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n contact_id = Regexp.last_match(1)\n raise \"Bad regex for '#{rules_key}'\" if contact_id.nil?\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n Flapjack::Data::Rule.lock(\n Flapjack::Data::Check,\n Flapjack::Data::Tag,\n Flapjack::Data::Contact,\n Flapjack::Data::Medium\n ) do\n\n new_rule_ids = []\n\n rule_ids = @source_redis.smembers(rules_key)\n rule_ids.each do |rule_id|\n rule_data = @source_redis.hgetall(\"notification_rule:#{rule_id}\")\n\n old_time_restrictions_json = rule_data['time_restrictions']\n\n time_restrictions = if old_time_restrictions_json.nil? || old_time_restrictions_json.empty?\n nil\n else\n old_time_restrictions = Flapjack.load_json(old_time_restrictions_json)\n if old_time_restrictions.nil? || old_time_restrictions.empty?\n []\n elsif old_time_restrictions.is_a?(Hash)\n [rule_time_restriction_to_icecube_schedule(old_time_restrictions, contact.time_zone)]\n elsif old_time_restrictions.is_a?(Array)\n old_time_restrictions.map {|t| rule_time_restriction_to_icecube_schedule(t, contact.time_zone)}\n end\n end\n\n filter_tag_ids = Set.new\n\n old_entities = field_from_rule_json(rule_data, 'entities')\n entity_names = case old_entities\n when String\n Set.new([old_entities])\n when Array\n Set.new(old_entities)\n else\n nil\n end\n\n old_regex_entities = field_from_rule_json(rule_data, 'regex_entities')\n entity_regexes = case old_regex_entities\n when String\n Set.new([Regexp.new(old_regex_entities)])\n when Array\n Set.new(old_regex_entities.map {|re| Regexp.new(re) })\n else\n nil\n end\n\n Flapjack::Data::Tag.intersect(:name => '/^manage_service_\\d+_.+$/').each do |tag|\n next if tag.name.nil? ||\n (tag.name !~ /^manage_service_(\\d+)_(.+)$/)\n # eldest_service_id = Regexp.last_match(1)\n service_name = Regexp.last_match(2)\n\n next unless entity_names.include?(service_name) ||\n entity_regexes.all? {|re| !re.match(service_name).nil? }\n filter_tag_ids << tag.id\n end\n\n\n old_tags = field_from_rule_json(rule_data, 'tags')\n tags = case old_tags\n when String\n Set.new([old_tags])\n when Array\n Set.new(old_tags)\n else\n nil\n end\n\n old_regex_tags = field_from_rule_json(rule_data, 'regex_tags')\n tag_regexes = case old_regex_tags\n when String\n Set.new([Regexp.new(old_regex_tags)])\n when Array\n Set.new(old_regex_tags.map {|re| Regexp.new(re) })\n else\n nil\n end\n\n # start with the initial limited visibility range (overall scope)\n old_tags_checks = Flapjack::Data::Check.intersect(:id => check_ids)\n\n # then limit further by checks with names containing tag words\n unless tags.nil? || tags.empty?\n old_tags_checks = tags.inject(old_tags_checks) do |memo, tag|\n memo.intersect(:name => /(?: |^)#{Regexp.escape(tag)}(?: |$)/)\n end\n end\n\n # and by checks with names matching regexes\n unless tag_regexes.nil? || tag_regexes.empty?\n old_tags_checks = tag_regexes.inject(old_tags_checks) do |memo, tag_regex|\n memo.intersect(:name => /#{tag_regex}/)\n end\n end\n\n unless old_tags_checks.empty?\n tag = Flapjack::Data::Tag.new(:name => \"migrated_rule_#{rule_id}\")\n tag.save!\n tag.checks.add_ids(*old_tags_checks.ids)\n filter_tag_ids << tag.id\n end\n\n normal_rules_to_create = []\n filter_rules_to_create = []\n\n conditions_by_blackhole_and_media = {false => {},\n true => {}}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n media_types = Flapjack.load_json(rule_data[\"#{fail_state}_media\"])\n next if media_types.nil? || media_types.empty?\n\n media_types_str = media_types.sort.join(\"|\")\n blackhole = !!Flapjack.load_json(rule_data[\"#{fail_state}_blackhole\"])\n conditions_by_blackhole_and_media[blackhole][media_types_str] ||= []\n conditions_by_blackhole_and_media[blackhole][media_types_str] << fail_state\n end\n\n # multiplier -- conditions_by_blackhole_and_media[false].size +\n # conditions_by_blackhole_and_media[true].size\n\n [false, true].each do |blackhole|\n normal_rules_to_create += conditions_by_blackhole_and_media[blackhole].each_with_object([]) do |(media_types_str, fail_states), memo|\n media_types = media_types_str.split('|')\n\n rule_media_ids = contact.media.intersect(:transport => media_types).ids\n # if no media to communicate by, don't save the rule\n next if rule_media_ids.empty?\n\n memo << {\n :enabled => true,\n :blackhole => blackhole,\n :strategy => 'global', # filter rule also applies\n :conditions_list => fail_states.sort.join(','),\n :medium_ids => rule_media_ids\n }\n end\n end\n\n # multiply by number of applied time restrictions, if any\n unless time_restrictions.empty?\n replace_rules = time_restrictions.each_with_object([]) do |tr, memo|\n memo += normal_rules_to_create.collect do |r|\n r.merge(:time_restriction => tr)\n end\n end\n\n normal_rules_to_create = replace_rules\n end\n\n unless filter_tag_ids.empty?\n filter_data = {\n :blackhole => true,\n :strategy => 'no_tag'\n }\n\n filter_rules = normal_rules_to_create.each_with_object([]) do |r, memo|\n memo << r.merge(filter_data) unless r[:blackhole]\n end\n\n filter_rules_to_create += filter_rules\n end\n\n new_rule_ids += normal_rules_to_create.collect do |r|\n new_rule_id = SecureRandom.uuid\n r[:id] = new_rule_id\n medium_ids = r.delete(:medium_ids)\n rule = Flapjack::Data::Rule.new(r)\n rule.save!\n rule.media.add_ids(*medium_ids)\n new_rule_id\n end\n\n new_rule_ids += filter_rules_to_create.collect do |r|\n new_rule_id = SecureRandom.uuid\n r[:id] = new_rule_id\n medium_ids = r.delete(:medium_ids)\n rule = Flapjack::Data::Rule.new(r)\n rule.save!\n rule.media.add_ids(*medium_ids)\n rule.tags.add_ids(*filter_tag_ids) unless filter_tag_ids.empty?\n new_rule_id\n end\n end\n\n contact.rules.add_ids(*new_rule_ids) unless new_rule_ids.empty?\n end\n end\n end", "def new_rule(rule)\n Rule.new(rule)\n end", "def rules\n @rules ||= {}\n end", "def rule(expression, &block)\n case expression\n when Hash\n expression.each do |fact, task|\n fact = define_fact(fact)\n task = define_task(task)\n @rules << Rule.new(fact, &task)\n end\n else\n fact = define_fact(expression)\n @rules << Rule.new(fact, &block)\n end\n\n #rule = Rule.new(@_facts, get_rule_options, &procedure)\n #@rules << rule\n #clear_rule_options\n\n return @rules\n end", "def mx_port_forwarding_rules\r\n MXPortForwardingRulesController.instance\r\n end", "def migrate_notification_rules\n notification_rules_keys = @source_redis.keys('contact_notification_rules:*')\n\n notification_rules_keys.each do |notification_rules_key|\n\n raise \"Bad regex for '#{notification_rules_key}'\" unless\n notification_rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n\n contact_id = $1\n\n contact = find_contact(contact_id)\n\n notification_rule_ids = @source_redis.smembers(notification_rules_key)\n\n notification_rule_ids.each do |notification_rule_id|\n\n notification_rule_data = @source_redis.hgetall(\"notification_rule:#{notification_rule_id}\")\n\n nr_fail_states = Flapjack::Data::CheckState.failing_states.collect do |fail_state|\n state = Flapjack::Data::NotificationRuleState.new(:state => fail_state,\n :blackhole => !!Flapjack.load_json(notification_rule_data[\"#{fail_state}_blackhole\"]))\n state.save\n\n media_types = Flapjack.load_json(notification_rule_data[\"#{fail_state}_media\"])\n unless media_types.nil? || media_types.empty?\n state_media = contact.media.intersect(:type => media_types).all\n state.media.add(*state_media) unless state_media.empty?\n end\n state\n end\n\n # TODO Fix\n\n # rule = Flapjack::Data::NotificationRule.new(\n # :id => notification_rule_id,\n # :entities => Set.new( Flapjack.load_json(notification_rule_data['entities'])),\n # :tags => Set.new( Flapjack.load_json(notification_rule_data['tags'])),\n # :time_restrictions => Flapjack.load_json(notification_rule_data['time_restrictions'])\n # )\n # rule.save\n # rule.states.add(*nr_fail_states)\n\n # contact.rules << rule\n end\n end\nend", "def rules\n @rules=get_endpoint('rule').keys\n end", "def addTeamRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def enable_inbox_replies\n client.post('/api/sendreplies', id: read_attribute(:name), state: true)\n end", "def create_forwarding_rule(body, opts = {})\n data, _status_code, _headers = create_forwarding_rule_with_http_info(body, opts)\n return data\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_reminder_rule\n @reminder_rule = ReminderRule.find(params[:id])\n end", "def rule name, &body\n self.active_policy[name] = body\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_policy(filtertype)\n\n # Initialize vars, sets, string, hashes, etc\n filter = String.new\n fwconfig = String.new\n result = String.new\n service_negate = String.new\n newaddresses = Set.new\n\n case filtertype\n when :ipv4_input_filter\n fwconfig += \"#### Firewall Interface Policy ####\\n\"\n fwconfig += \"config firewall interface-policy\\n\"\n h_filters = $h_filters\n when :ipv6_input_filter\n fwconfig += \"#### Firewall IPv6 Interface Policy ####\\n\"\n fwconfig += \"config firewall interface-policy6\\n\"\n h_filters = $h_filters6\n when :ipv4_output_filter\n fwconfig += \"#### Firewall Policy ####\\n\"\n fwconfig += \"config firewall policy\\n\"\n h_filters = $h_filters\n when :ipv6_output_filter\n fwconfig += \"#### Firewall IPv6 Policy ####\\n\"\n fwconfig += \"config firewall policy6\\n\"\n h_filters = $h_filters6\n else\n p \"create_fg_intf_policy_rules: filtertype not supported - #{filtertype}\" if $opts[:verbose]\n return\n end\n\n # For each interface/sub-interface, process each unique filter matching the passed filtertype option\n # We are iterating through each used filter and checking the terms for compatibility. If compatible\n # then we will go ahead and process/convert to FG config.\n $h_interfaces.each_key do |int|\n $h_interfaces[int].each_key do |sub|\n if ($opts[:interfacemapout] && $h_ints_map_out.has_key?(\"#{int}-#{sub}\")) || !$opts[:interfacemapout]\n filter = $h_interfaces[int][sub][filtertype]\n\n ruletype = '' # for supportability checks\n filterref = '' # for referenced filters (aka linked filters)\n\n ### if interfacemapout option specified then we will change the dst interace to zone name supplied by file\n if $opts[:interfacemapout]\n interface = $h_ints_map_out[\"#{int}-#{sub}\"]\n else\n interface = \"#{int}-#{sub}\"\n end\n\n unless filter == 'nil' || filter == nil\n if h_filters.has_key?(filter)\n h_filters[filter].each_key do |term|\n\n # check to see if this policy is derived from dscp, forwarding-class, etc. if so, we will skip\n ruletype, filterref = check_rule_support_type(filter, term, h_filters)\n\n # Call action_rule_support_type which will call the right methods to build the fg config\n # based on the juniper filter/term detail, including handling nested filters/terms\n # will return the completed FG config for that filter/term. Also, if int2sub option is enabled\n # may return a list of subnets that need to be additionally created as address objects.\n newconfig, newaddobj = action_rule_support_type(ruletype,\\\n filterref,\\\n h_filters,\\\n filtertype,\\\n filter,\\\n term,\\\n interface,\\\n int,\\\n sub)\n\n fwconfig += newconfig\n\n # Add any new address objects that need to be configured to a set (due to any dst int map)\n newaddresses << newaddobj if newaddobj\n end\n\n else\n p \"create_fg_policy_rules: filter \\\"#{filter} referenced by interface does not exist for #{int}-#{sub}\"\\\n if $opts[:debug] || $opts[:verbose]\n end\n\n end\n else\n p \"Skipping interface #{int}-#{sub} due to, is not included in --interfacemapout file\"\\\n if $opts[:debug] || $opts[:verbose]\n end\n end\n end\n fwconfig += \"end \\n\"\n\n # If new address objects need to be created due that here, and insert them in the config ahead of creating\n # rules that will need to use these objects.\n if newaddresses.count > 0\n newconfig = \"### Additional FW Addresses from derived subnets ###\"\n newconfig += \"config firewall address\\n\"\n\n newaddresses.each do |x|\n newconfig += <<-EOS\n edit #{x}\n set type subnet\n set subnet #{x}\n set comment \"Derived subnet from interface IP due to rule with dst of any\"\n next\n EOS\n end\n\n newconfig += \"end\\n\"\n\n fwconfig = newconfig + fwconfig\n end\n\n return fwconfig\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def create_mailbox name\n log \"LIST #{name}\"\n list = imap.list '', name\n return if list\n log \"CREATE #{name}\"\n imap.create name\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def addRule(hosts,\n proto: \"tcp\",\n port: nil,\n egress: false,\n port_range: \"0-65535\"\n )\n rule = Hash.new\n rule[\"proto\"] = proto\n if hosts.is_a?(String)\n rule[\"hosts\"] = [hosts]\n else\n rule[\"hosts\"] = hosts\n end\n if port != nil\n port = port.to_s if !port.is_a?(String)\n rule[\"port\"] = port\n else\n rule[\"port_range\"] = port_range\n end\n ec2_rule = convertToEc2([rule])\n\n begin\n if egress\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_egress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n else\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).authorize_security_group_ingress(\n group_id: @cloud_id,\n ip_permissions: ec2_rule\n )\n end\n rescue Aws::EC2::Errors::InvalidPermissionDuplicate => e\n MU.log \"Attempt to add duplicate rule to #{@cloud_id}\", MU::DEBUG, details: ec2_rule\n end\n end", "def create rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_post_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def update_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})\n update_rule(rule_number, protocol, rule_action, cidr_block, false, options)\n end", "def add_to_allowed_list(email)\n send_contact_command email, 'ADL', '2'\n end", "def create_mailings!\n caffeinate_campaign.to_dripper.drips.each do |drip|\n mailing = Caffeinate::Mailing.new(caffeinate_campaign_subscription: self).from_drip(drip)\n mailing.save!\n end\n caffeinate_campaign.to_dripper.run_callbacks(:on_subscribe, self)\n end", "def <<(rule); end", "def method_missing(rule_set_name, args = {})\n template = Asbestos::RuleSet[rule_set_name]\n raise %{Unknown host DSL call : \"#{rule_set_name}\" for host \"#{name}\"} unless template\n\n @rulesets << \\\n Asbestos::RuleSet.new(rule_set_name, self, template).tap do |rs|\n # override template defaults with provided options\n args.each do |k, v|\n rs.send k, v\n end\n end\n end", "def add_to_stories_lists\n non_friend_stories_list = NonFriendStoriesList.new(id: user.id)\n friend_stories_list = FriendStoriesList.new(id: user.id)\n my_stories_list = MyStoriesList.new(id: user.id)\n\n redis.pipelined do\n non_friend_stories_list.add_message(self) if public?\n friend_stories_list.add_message(self) if public? || friends?\n my_stories_list.add_message(self)\n end\n end", "def set_rule\n @rule = params[:rule].to_i\n\n if @rule == 0 or @rule == 1 or @rule == 2\n else\n @rule = 0\n end\n end", "def mg_port_forwarding_rules\r\n MGPortForwardingRulesController.instance\r\n end", "def subsequent_rules(*args); end", "def subsequent_rules(*args); end", "def checkbrainmailbox\n #Check if token is present\n logger.info params[\"token\"]\n if APP_CONFIG['token_action'].to_s == params[\"token\"]\n #Start the actual work\n imap = Net::IMAP.new(APP_CONFIG['imap_host'], APP_CONFIG['imap_port'] , APP_CONFIG['imap_ssl'], nil, false)\n imap.authenticate('LOGIN', APP_CONFIG['imap_user'], APP_CONFIG['imap_password'])\n imap.select('INBOX')\n @output = \"Connected to IMAP server\\n\"\n \n @n=0\n #Select unseen messages only\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n \n #Get the full content\n raw = imap.fetch(message_id, \"BODY[]\")[0].attr[\"BODY[]\"]\n imap.store(message_id, '+FLAGS', [:Seen])\n #Parse it with mail library\n mail = Mail.read_from_string(raw)\n token = mail.to.to_s\n #If multipart or auth token not included, then discard the mail and send a warning\n if mail.multipart? or (not token.include?(APP_CONFIG['token_email'].to_s))\n imap.copy(message_id, 'Untreated')\n @output=@output+Time.now.getutc.to_s+\" - 1 untreated mail\\n\"\n send_warning_mail(mail.from, raw) \n else\n content = mail.body.decoded\n name = mail.subject\n date = mail.date\n #Detect if labels are specified in first line\n if content.lines.first.to_s[0]==\"@\"\n labels = content.lines.first.chomp\n content = content.lines.to_a[1..-1].join\n end\n #Here, create the neuron\n @output=@output+Time.now.getutc.to_s+\" - 1 neuron created from a mail\\n\"\n puts \"One neuron created with name '#{name}', labels '#{labels}' and content '#{content}'\"\n neuron = Neuron.new\n neuron.name = name\n neuron.content = content\n neuron.labels = labels\n neuron.date = date\n neuron.save\n imap.copy(message_id, 'Treated')\n end\n imap.store(message_id, '+FLAGS', [:Deleted])\n @n+=1\n end\n imap.expunge #Delete all mails with deleted flags\n imap.close\n end\n render :layout => false\n end", "def trigger_rules\n self.class.trigger_rules(self)\n end", "def get_inbox_ruleset(id, opts = {})\n data, _status_code, _headers = get_inbox_ruleset_with_http_info(id, opts)\n data\n end", "def build_inbox\n folders.build(:name => \"Inbox\")\n end" ]
[ "0.63034475", "0.61941344", "0.5750968", "0.56765753", "0.5641073", "0.5414884", "0.5320021", "0.52764016", "0.5271975", "0.5251907", "0.5250316", "0.5232335", "0.52176464", "0.5196002", "0.51865673", "0.5144872", "0.51033604", "0.5094446", "0.5088191", "0.5085173", "0.5080333", "0.5068181", "0.5058452", "0.5058441", "0.50254434", "0.50244796", "0.5015044", "0.5000344", "0.49768096", "0.493671", "0.49330693", "0.49311104", "0.49299204", "0.49291405", "0.4921051", "0.48968813", "0.48965997", "0.48662183", "0.48624712", "0.4858642", "0.48531452", "0.4851538", "0.48458457", "0.48358974", "0.48356804", "0.48328346", "0.4831185", "0.48291466", "0.48136464", "0.47894454", "0.4782669", "0.47811076", "0.47811076", "0.47811076", "0.47808388", "0.4764182", "0.4760008", "0.47537133", "0.47522065", "0.47479066", "0.47391737", "0.47386214", "0.47353226", "0.47185114", "0.47150043", "0.47081897", "0.47029442", "0.47025067", "0.4697075", "0.46951282", "0.46951282", "0.46951282", "0.46931165", "0.46931165", "0.4691905", "0.4688683", "0.4685086", "0.46799487", "0.4675624", "0.4675624", "0.4675624", "0.4675624", "0.46741766", "0.46666887", "0.46512163", "0.46496788", "0.4647872", "0.46452418", "0.46334726", "0.46256623", "0.46196333", "0.46117565", "0.46021512", "0.45930913", "0.45908052", "0.45908052", "0.4581148", "0.45790106", "0.45781767", "0.45775136" ]
0.5213975
13
Delete an inbox ruleset Delete inbox ruleset
def delete_inbox_ruleset(id, opts = {}) delete_inbox_ruleset_with_http_info(id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def destroy\n @rule_set = RuleSet.find(params[:id])\n @rule_set.destroy\n\n respond_to do |format|\n format.html { redirect_to rule_sets_url }\n format.json { head :ok }\n end\n end", "def delete_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_rulesets ...'\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#delete_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def clear_rules\n response = @create_send.delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def delete_all_rules(rules)\n return if rules.nil?\n\n @ids = rules['data'].map { |rule| rule['id'] }\n @payload = { delete: { ids: @ids } }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while deleting your rules: #{@response.status_message}\" unless @response.success?\nend", "def clear_rules\n cs_delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def retract_rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, rules, @schema_graph, \"text/turtle\")\n self\n end", "def clear_rules!(forward_to_replicas = false, request_options = {})\n res = clear_rules(forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def del_from_rules(msg)\n if file_util(rules_file).remove_line(msg[2])\n reply = \"Removed lines from #{rules_file} mathing #{msg[2].inspect}.\"\n else\n reply = \"Lines mathing #{msg[2].inspect} were not found.\"\n end\n\n send_response(reply)\n end", "def delete rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_delete_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def delete_inbox_ruleset_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.delete_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#delete_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_nsset(nsset)\n builder = build_epp_request do |xml|\n xml.command {\n xml.delete {\n xml.delete('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {\n xml.parent.namespace = xml.parent.namespace_definitions.first\n xml['nsset'].id_ nsset\n }\n }\n xml.clTRID UUIDTools::UUID.timestamp_create.to_s\n }\n end\n \n NssetDeleteResponse.new(send_request(builder.to_xml))\n end", "def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end", "def destroy\n #@rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end", "def delete_rule!(objectID, forward_to_replicas = false, request_options = {})\n res = delete_rule(objectID, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def delete_rule(scope, kind, id)\n make_request(:delete, \"/pushrules/#{scope}/#{kind}/#{id}\").code == 200\n end", "def clear_rules!\n @rules = []\n end", "def delete!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n type = DELETE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 166:10: 'delete'\n match( \"delete\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n end", "def remove( *ruleses )\n self.dup.remove!( *ruleses )\n end", "def destroy\n @route_rule = RouteRule.find(params[:id])\n @route_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_rules_url) }\n format.xml { head :ok }\n end\n end", "def clear\n @rule = Rule.find(params[:id])\n @rule.hits.destroy_all\n\n respond_to do |format|\n format.html { redirect_to params[:referrer] || @rule }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @inbox.destroy\n end", "def destroy\n @team_roleset = TeamRoleset.find(params[:id])\n rolesets_in_map = TeamRolesetsMap.find_all_by_team_rolesets_id(params[:id])\n\n rolesets_in_map.each do |x|\n x.destroy\n end\n\n @team_roleset.destroy\n\n respond_to do |format|\n format.html { redirect_to(team_rolesets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end", "def destroy\n @rule = Rule.find(params[:id])\n \n\t@account = Account.find(params[:account_id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rule.destroy\n render json: {}\n\n end", "def destroy\n @rule.destroy\n\n respond_with(rule, location: rules_url, notice: 'RUle was successfully destroyed.')\n end", "def delete_from_all_lists(email)\n full_path = full_resource_path('/delete_all')\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.delete_result(full_path, query_params)\n end", "def delete_sync_rule(audience_id, sync_rule_id)\n delete(\"audiences/#{audience_id}/sync_rules/#{sync_rule_id}\")\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attend_rule.destroy\n respond_to do |format|\n format.html { redirect_to attend_rules_url, notice: 'Attend rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_group_rule = StudentGroupRule.find(params[:id])\n @student_group_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_group_rules_url) }\n format.xml { head :ok }\n end\n end", "def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{rule_id}\")\n end", "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @rule_type = RuleType.find(params[:id])\n @rule_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(rule_types_url) }\n format.xml { head :ok }\n end\n end", "def delete_merge_request_level_rule(project, merge_request, appr_rule_id)\n delete(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}\")\n end", "def delete(fw_rule)\n Dnet.fw_delete @handle, fw_rule\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def remove_firewall_rule server_uuid, position\n response = delete \"server/#{server_uuid}/firewall_rule/#{position}\"\n\n response\n end", "def destroy\n @http_domain_rule = collection.find(params[:id])\n @http_domain_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end", "def delete(service=Azure::ServiceBus::Rules)\n service.delete(self)\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end", "def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end", "def destroy\n @transaction_rule = @business.transaction_rules.find(params[:id])\n @transaction_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to business_transaction_rules_url(@business), notice: _(\"Regla eliminada\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @context = Context.find(params[:context_id])\n @context_rule = @context.context_rules.find(params[:id])\n @context_rule.destroy\n redirect_to context_path(@context)\n end", "def delMail(imap, folder)\n pp \"Emptying #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Deleted])\n imap.expunge\nend", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def purge_associations\n EspRulesList.where(list_type: type, list_id: id).delete_all\n ExportedLead.where(list_type: type, list_id: id).delete_all\n MessageAutoResponse.where(esp_list_type: type, esp_list_id: id).delete_all\n end", "def destroy\n @seta = Seta.find(params[:id])\n @seta.destroy\n\n respond_to do |format|\n format.html { redirect_to(setas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @code_rule = CodeRule.find(params[:id])\n @code_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(code_rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lar_rule.destroy\n respond_to do |format|\n format.html { redirect_to lar_rules_url }\n format.json { head :no_content }\n end\n end", "def delete_rcpt( email )\n RESPONSE[\"DELRCPT\"] + email + \"\\0\"\n end", "def rm(msgid)\n req(\"rm\", \"\", \"\", msgid, \"\")\n end", "def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n imap.select(mailbox)\n imap.uid_search(['ALL']).each do |uid|\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n imap.expunge\n end\n end", "def delete\n super do\n @members.each do |member|\n Strand.redis.hdel LOOKUP, member.typed_id\n end\n Strand.redis.hdel TOPICS, @id\n end\n end", "def destroy\n @target_rule = TargetRule.find(params[:id])\n @target_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to target_rules_url }\n format.json { head :no_content }\n end\n end", "def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n info \"delete_all block\"\n info \"imap.uid_search #{batch} #{\"ALL\"}\"\n imap.uid_search(['ALL']).each do |uid|\n info \"imap.uid_store #{uid} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\"\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n info \"imap.expunge\"\n imap.expunge\n end\n end", "def delete\n self.class.call('domain.mailbox.delete', @domain.fqdn, @login)\n end", "def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def remove_rule(rule_number, egress)\n requires :network_acl_id\n\n service.delete_network_acl_entry(network_acl_id, rule_number, egress)\n true\n end", "def cmd_db_set_del_from(*args)\n\t\t\tset_id = args[0]\n\t\t\tif is_valid_set?(set_id)\n\t\t\t\t@sets[set_id].each do |item|\n\t\t\t\t\t@working_set.each do |working_item|\n\t\t\t\t\t\tif @working_item == item\n\t\t\t\t\t\t\t@sets[set_id].remove!(item)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint_error \"#{set_id} is not a valid set id\"\n\t\t\tend\n\t\tend", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(collection)\n return 0 unless collection.query.valid?\n adapter.delete(collection)\n end", "def delete_related_groups\n \n end", "def destroy\r\n @contact_rule = ContactRule.find(params[:id])\r\n @contact_rule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to contact_rules_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete_fileset( user, fileset )\n\n print \"deleting file set #{fileset.id} (#{fileset.label})... \"\n\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, user )\n file_actor.destroy\n\n puts \"done\"\n\n end", "def destroy\n @rulemaking.destroy\n respond_to do |format|\n format.html { redirect_to rulemakings_url, notice: 'Rulemaking was successfully destroyed.' }\n end\n end", "def remove_rule(rule)\n new_rules = rules.dup\n new_rules.delete(rule)\n @rules = new_rules.uniq.freeze\n self\n end", "def destroy\n @payin_rule = PayinRule.find_by(guid: params[:guid])\n\n if @payin_rule.destroy!\n head :ok\n else\n head :bad_request\n end\n end", "def destroy\n reminder = @reminder_rule.reminder\n @reminder_rule.destroy\n CountAllocator.new(reminder).allocate!\n\n respond_to do |format|\n format.html { redirect_to reminder, notice: 'Reminder rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_all_rules\n super\n end", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end", "def delete\n DB.exec(\"DELETE FROM stylists WHERE id = #{self.id};\")\n end", "def clear\n @tasks.clear\n @rules.clear\n end", "def remove_inbound_rule(rule_number)\n remove_rule(rule_number, false)\n end", "def destroy\n @taxon_rule = TaxonRule.find(params[:id])\n @taxon_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_rules_url }\n format.json { head :no_content }\n end\n end", "def test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/testsource\"\n \n @test_acl.create_principal(user)\n @test_acl.create_resource_object(res_ob_type, res_ob_adr, user)\n id = @test_acl.create_ace(user, \"allow\", priv, res_ob_type, res_ob_adr)\n \n @test_acl.delete_res_object(res_ob_type, res_ob_adr)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def deleteAllEmail\n queryParams = Hash.new\n queryParams['key'] = @API_KEY\n queryParams['mailbox'] = @MAILBOX\n RestClient.post(\"#{@BASE_URI}/emails/deleteall\", nil, {:params => queryParams})\n end", "def delete(actor)\n @links.delete actor.mailbox.address\n end", "def delete(contact_ids, monitor_id, monitor_type)\n contact_ids = contact_ids.join(',') if contact_ids.class == Array\n args = {contactIds: contact_ids, \n monitorId: monitor_id,\n monitorType: monitor_type}\n post('deleteNotificationRule', args)\n end", "def destroy\n @reachmailgroup = Reachmailgroup.find(params[:id])\n @reachmailgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to reachmailgroups_url }\n format.json { head :no_content }\n end\n end", "def remove_outbound_rule(rule_number)\n remove_rule(rule_number, true)\n end", "def remove_all\n @batch = Batch.shod(params[:id])\n @exam_groups = @batch.exam_groups.all\n end", "def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def delete()\n\n Email.destroy(self.id)\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def remove(mailbox)\n delete(\"#{domain}/mailboxes/#{mailbox}\")\n end", "def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end", "def delete(model)\n\n # LREM key 0 <id> means remove all elements matching <id>\n # @see http://redis.io/commands/lrem\n key.call(\"LREM\", 0, model.id)\n end", "def delete(pathset)\n raise ActionNotSupportedError.new(:delete, self)\n end", "def destroy\n @lookup_set = LookupSet.find(params[:id])\n @lookup_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sets_url) }\n format.xml { head :ok }\n end\n end", "def delete_rcpt( email )\n RESPONSE[:delrcpt] + email + \"\\0\"\n end", "def destroy\n @exam_group = ExamGroup.shod(params[:id])\n authorize! :delete, @exam_group\n batch = @exam_group.batch\n @exam_group.destroy\n flash[:notice] = 'Exam Group deleted successfully!'\n redirect_to exam_group_path(batch)\n end", "def destroy\n @test_rule.destroy\n respond_to do |format|\n format.html { redirect_to test_rules_url, notice: 'Test rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_remove_rule_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end" ]
[ "0.7691972", "0.66032934", "0.65967035", "0.63888776", "0.6176017", "0.61702317", "0.59798986", "0.59178627", "0.5816386", "0.57613325", "0.57417184", "0.5738284", "0.5737985", "0.57039267", "0.56656593", "0.56450397", "0.5606443", "0.5570346", "0.55576843", "0.55542505", "0.55534816", "0.55053896", "0.5493998", "0.5485735", "0.5456545", "0.5452485", "0.5452458", "0.54422534", "0.54406893", "0.5419986", "0.5392921", "0.5386412", "0.53803694", "0.53779334", "0.5372703", "0.5366879", "0.53548443", "0.5344825", "0.53060323", "0.53037775", "0.52788454", "0.5256375", "0.525438", "0.5246351", "0.5245189", "0.5236306", "0.52060205", "0.52060115", "0.5187617", "0.51589495", "0.51456964", "0.5145286", "0.51343995", "0.51240116", "0.51214886", "0.5118318", "0.5105855", "0.5090482", "0.5085912", "0.50855106", "0.5082711", "0.5071853", "0.507061", "0.507061", "0.5066278", "0.5059445", "0.5056519", "0.5055556", "0.50530744", "0.50524426", "0.5048135", "0.5046684", "0.50224376", "0.50190747", "0.5018293", "0.5017881", "0.50129426", "0.49908018", "0.4986385", "0.4952793", "0.49510455", "0.4947227", "0.4945692", "0.49293348", "0.49129316", "0.49126932", "0.49098822", "0.4905314", "0.49038064", "0.49023354", "0.48982403", "0.48962465", "0.48930138", "0.48902926", "0.4883859", "0.48836726", "0.488105", "0.48797476", "0.48781344", "0.4875787" ]
0.6839362
1
Delete an inbox ruleset Delete inbox ruleset
def delete_inbox_ruleset_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_ruleset ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling InboxRulesetControllerApi.delete_inbox_ruleset" end # resource path local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboxRulesetControllerApi#delete_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def delete_inbox_ruleset(id, opts = {})\n delete_inbox_ruleset_with_http_info(id, opts)\n nil\n end", "def destroy\n @rule_set = RuleSet.find(params[:id])\n @rule_set.destroy\n\n respond_to do |format|\n format.html { redirect_to rule_sets_url }\n format.json { head :ok }\n end\n end", "def delete_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_rulesets ...'\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#delete_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def clear_rules\n response = @create_send.delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def delete_all_rules(rules)\n return if rules.nil?\n\n @ids = rules['data'].map { |rule| rule['id'] }\n @payload = { delete: { ids: @ids } }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while deleting your rules: #{@response.status_message}\" unless @response.success?\nend", "def clear_rules\n cs_delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def retract_rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, rules, @schema_graph, \"text/turtle\")\n self\n end", "def clear_rules!(forward_to_replicas = false, request_options = {})\n res = clear_rules(forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def del_from_rules(msg)\n if file_util(rules_file).remove_line(msg[2])\n reply = \"Removed lines from #{rules_file} mathing #{msg[2].inspect}.\"\n else\n reply = \"Lines mathing #{msg[2].inspect} were not found.\"\n end\n\n send_response(reply)\n end", "def delete rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_delete_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def delete_nsset(nsset)\n builder = build_epp_request do |xml|\n xml.command {\n xml.delete {\n xml.delete('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {\n xml.parent.namespace = xml.parent.namespace_definitions.first\n xml['nsset'].id_ nsset\n }\n }\n xml.clTRID UUIDTools::UUID.timestamp_create.to_s\n }\n end\n \n NssetDeleteResponse.new(send_request(builder.to_xml))\n end", "def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end", "def destroy\n #@rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end", "def delete_rule!(objectID, forward_to_replicas = false, request_options = {})\n res = delete_rule(objectID, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def delete_rule(scope, kind, id)\n make_request(:delete, \"/pushrules/#{scope}/#{kind}/#{id}\").code == 200\n end", "def clear_rules!\n @rules = []\n end", "def delete!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 45 )\n\n type = DELETE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 166:10: 'delete'\n match( \"delete\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 45 )\n\n end", "def remove( *ruleses )\n self.dup.remove!( *ruleses )\n end", "def destroy\n @route_rule = RouteRule.find(params[:id])\n @route_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_rules_url) }\n format.xml { head :ok }\n end\n end", "def clear\n @rule = Rule.find(params[:id])\n @rule.hits.destroy_all\n\n respond_to do |format|\n format.html { redirect_to params[:referrer] || @rule }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @inbox.destroy\n end", "def destroy\n @team_roleset = TeamRoleset.find(params[:id])\n rolesets_in_map = TeamRolesetsMap.find_all_by_team_rolesets_id(params[:id])\n\n rolesets_in_map.each do |x|\n x.destroy\n end\n\n @team_roleset.destroy\n\n respond_to do |format|\n format.html { redirect_to(team_rolesets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end", "def destroy\n @rule = Rule.find(params[:id])\n \n\t@account = Account.find(params[:account_id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rule.destroy\n render json: {}\n\n end", "def destroy\n @rule.destroy\n\n respond_with(rule, location: rules_url, notice: 'RUle was successfully destroyed.')\n end", "def delete_from_all_lists(email)\n full_path = full_resource_path('/delete_all')\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.delete_result(full_path, query_params)\n end", "def delete_sync_rule(audience_id, sync_rule_id)\n delete(\"audiences/#{audience_id}/sync_rules/#{sync_rule_id}\")\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attend_rule.destroy\n respond_to do |format|\n format.html { redirect_to attend_rules_url, notice: 'Attend rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_group_rule = StudentGroupRule.find(params[:id])\n @student_group_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_group_rules_url) }\n format.xml { head :ok }\n end\n end", "def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{rule_id}\")\n end", "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @rule_type = RuleType.find(params[:id])\n @rule_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(rule_types_url) }\n format.xml { head :ok }\n end\n end", "def delete_merge_request_level_rule(project, merge_request, appr_rule_id)\n delete(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}\")\n end", "def delete(fw_rule)\n Dnet.fw_delete @handle, fw_rule\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def remove_firewall_rule server_uuid, position\n response = delete \"server/#{server_uuid}/firewall_rule/#{position}\"\n\n response\n end", "def destroy\n @http_domain_rule = collection.find(params[:id])\n @http_domain_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end", "def delete(service=Azure::ServiceBus::Rules)\n service.delete(self)\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end", "def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end", "def destroy\n @transaction_rule = @business.transaction_rules.find(params[:id])\n @transaction_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to business_transaction_rules_url(@business), notice: _(\"Regla eliminada\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @context = Context.find(params[:context_id])\n @context_rule = @context.context_rules.find(params[:id])\n @context_rule.destroy\n redirect_to context_path(@context)\n end", "def delMail(imap, folder)\n pp \"Emptying #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Deleted])\n imap.expunge\nend", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def purge_associations\n EspRulesList.where(list_type: type, list_id: id).delete_all\n ExportedLead.where(list_type: type, list_id: id).delete_all\n MessageAutoResponse.where(esp_list_type: type, esp_list_id: id).delete_all\n end", "def destroy\n @seta = Seta.find(params[:id])\n @seta.destroy\n\n respond_to do |format|\n format.html { redirect_to(setas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @code_rule = CodeRule.find(params[:id])\n @code_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(code_rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lar_rule.destroy\n respond_to do |format|\n format.html { redirect_to lar_rules_url }\n format.json { head :no_content }\n end\n end", "def delete_rcpt( email )\n RESPONSE[\"DELRCPT\"] + email + \"\\0\"\n end", "def rm(msgid)\n req(\"rm\", \"\", \"\", msgid, \"\")\n end", "def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n imap.select(mailbox)\n imap.uid_search(['ALL']).each do |uid|\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n imap.expunge\n end\n end", "def delete\n super do\n @members.each do |member|\n Strand.redis.hdel LOOKUP, member.typed_id\n end\n Strand.redis.hdel TOPICS, @id\n end\n end", "def destroy\n @target_rule = TargetRule.find(params[:id])\n @target_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to target_rules_url }\n format.json { head :no_content }\n end\n end", "def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n info \"delete_all block\"\n info \"imap.uid_search #{batch} #{\"ALL\"}\"\n imap.uid_search(['ALL']).each do |uid|\n info \"imap.uid_store #{uid} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\"\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n info \"imap.expunge\"\n imap.expunge\n end\n end", "def delete\n self.class.call('domain.mailbox.delete', @domain.fqdn, @login)\n end", "def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def remove_rule(rule_number, egress)\n requires :network_acl_id\n\n service.delete_network_acl_entry(network_acl_id, rule_number, egress)\n true\n end", "def cmd_db_set_del_from(*args)\n\t\t\tset_id = args[0]\n\t\t\tif is_valid_set?(set_id)\n\t\t\t\t@sets[set_id].each do |item|\n\t\t\t\t\t@working_set.each do |working_item|\n\t\t\t\t\t\tif @working_item == item\n\t\t\t\t\t\t\t@sets[set_id].remove!(item)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint_error \"#{set_id} is not a valid set id\"\n\t\t\tend\n\t\tend", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url, notice: 'Rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(collection)\n return 0 unless collection.query.valid?\n adapter.delete(collection)\n end", "def delete_related_groups\n \n end", "def destroy\r\n @contact_rule = ContactRule.find(params[:id])\r\n @contact_rule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to contact_rules_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete_fileset( user, fileset )\n\n print \"deleting file set #{fileset.id} (#{fileset.label})... \"\n\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, user )\n file_actor.destroy\n\n puts \"done\"\n\n end", "def destroy\n @rulemaking.destroy\n respond_to do |format|\n format.html { redirect_to rulemakings_url, notice: 'Rulemaking was successfully destroyed.' }\n end\n end", "def remove_rule(rule)\n new_rules = rules.dup\n new_rules.delete(rule)\n @rules = new_rules.uniq.freeze\n self\n end", "def destroy\n @payin_rule = PayinRule.find_by(guid: params[:guid])\n\n if @payin_rule.destroy!\n head :ok\n else\n head :bad_request\n end\n end", "def destroy\n reminder = @reminder_rule.reminder\n @reminder_rule.destroy\n CountAllocator.new(reminder).allocate!\n\n respond_to do |format|\n format.html { redirect_to reminder, notice: 'Reminder rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_all_rules\n super\n end", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end", "def delete\n DB.exec(\"DELETE FROM stylists WHERE id = #{self.id};\")\n end", "def clear\n @tasks.clear\n @rules.clear\n end", "def remove_inbound_rule(rule_number)\n remove_rule(rule_number, false)\n end", "def destroy\n @taxon_rule = TaxonRule.find(params[:id])\n @taxon_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to taxon_rules_url }\n format.json { head :no_content }\n end\n end", "def test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/testsource\"\n \n @test_acl.create_principal(user)\n @test_acl.create_resource_object(res_ob_type, res_ob_adr, user)\n id = @test_acl.create_ace(user, \"allow\", priv, res_ob_type, res_ob_adr)\n \n @test_acl.delete_res_object(res_ob_type, res_ob_adr)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def deleteAllEmail\n queryParams = Hash.new\n queryParams['key'] = @API_KEY\n queryParams['mailbox'] = @MAILBOX\n RestClient.post(\"#{@BASE_URI}/emails/deleteall\", nil, {:params => queryParams})\n end", "def delete(actor)\n @links.delete actor.mailbox.address\n end", "def delete(contact_ids, monitor_id, monitor_type)\n contact_ids = contact_ids.join(',') if contact_ids.class == Array\n args = {contactIds: contact_ids, \n monitorId: monitor_id,\n monitorType: monitor_type}\n post('deleteNotificationRule', args)\n end", "def destroy\n @reachmailgroup = Reachmailgroup.find(params[:id])\n @reachmailgroup.destroy\n\n respond_to do |format|\n format.html { redirect_to reachmailgroups_url }\n format.json { head :no_content }\n end\n end", "def remove_outbound_rule(rule_number)\n remove_rule(rule_number, true)\n end", "def remove_all\n @batch = Batch.shod(params[:id])\n @exam_groups = @batch.exam_groups.all\n end", "def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def delete()\n\n Email.destroy(self.id)\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def remove(mailbox)\n delete(\"#{domain}/mailboxes/#{mailbox}\")\n end", "def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end", "def delete(model)\n\n # LREM key 0 <id> means remove all elements matching <id>\n # @see http://redis.io/commands/lrem\n key.call(\"LREM\", 0, model.id)\n end", "def delete(pathset)\n raise ActionNotSupportedError.new(:delete, self)\n end", "def destroy\n @lookup_set = LookupSet.find(params[:id])\n @lookup_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sets_url) }\n format.xml { head :ok }\n end\n end", "def delete_rcpt( email )\n RESPONSE[:delrcpt] + email + \"\\0\"\n end", "def destroy\n @exam_group = ExamGroup.shod(params[:id])\n authorize! :delete, @exam_group\n batch = @exam_group.batch\n @exam_group.destroy\n flash[:notice] = 'Exam Group deleted successfully!'\n redirect_to exam_group_path(batch)\n end", "def destroy\n @test_rule.destroy\n respond_to do |format|\n format.html { redirect_to test_rules_url, notice: 'Test rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_remove_rule_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end" ]
[ "0.7691972", "0.6839362", "0.66032934", "0.65967035", "0.63888776", "0.6176017", "0.61702317", "0.59798986", "0.59178627", "0.5816386", "0.57613325", "0.5738284", "0.5737985", "0.57039267", "0.56656593", "0.56450397", "0.5606443", "0.5570346", "0.55576843", "0.55542505", "0.55534816", "0.55053896", "0.5493998", "0.5485735", "0.5456545", "0.5452485", "0.5452458", "0.54422534", "0.54406893", "0.5419986", "0.5392921", "0.5386412", "0.53803694", "0.53779334", "0.5372703", "0.5366879", "0.53548443", "0.5344825", "0.53060323", "0.53037775", "0.52788454", "0.5256375", "0.525438", "0.5246351", "0.5245189", "0.5236306", "0.52060205", "0.52060115", "0.5187617", "0.51589495", "0.51456964", "0.5145286", "0.51343995", "0.51240116", "0.51214886", "0.5118318", "0.5105855", "0.5090482", "0.5085912", "0.50855106", "0.5082711", "0.5071853", "0.507061", "0.507061", "0.5066278", "0.5059445", "0.5056519", "0.5055556", "0.50530744", "0.50524426", "0.5048135", "0.5046684", "0.50224376", "0.50190747", "0.5018293", "0.5017881", "0.50129426", "0.49908018", "0.4986385", "0.4952793", "0.49510455", "0.4947227", "0.4945692", "0.49293348", "0.49129316", "0.49126932", "0.49098822", "0.4905314", "0.49038064", "0.49023354", "0.48982403", "0.48962465", "0.48930138", "0.48902926", "0.4883859", "0.48836726", "0.488105", "0.48797476", "0.48781344", "0.4875787" ]
0.57417184
11
Delete inbox rulesets Delete inbox rulesets. Accepts optional inboxId filter.
def delete_inbox_rulesets(opts = {}) delete_inbox_rulesets_with_http_info(opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_inbox_ruleset(id, opts = {})\n delete_inbox_ruleset_with_http_info(id, opts)\n nil\n end", "def delete_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_rulesets ...'\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#delete_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def delete_all_rules(rules)\n return if rules.nil?\n\n @ids = rules['data'].map { |rule| rule['id'] }\n @payload = { delete: { ids: @ids } }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while deleting your rules: #{@response.status_message}\" unless @response.success?\nend", "def delete_inbox_ruleset_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.delete_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#delete_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def clear_rules\n response = @create_send.delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def clear_rules\n cs_delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def delete_inbox(inbox_id, opts = {})\n delete_inbox_with_http_info(inbox_id, opts)\n nil\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def delete_all_inbox_emails(inbox_id, opts = {})\n delete_all_inbox_emails_with_http_info(inbox_id, opts)\n nil\n end", "def destroy\n @inbox.destroy\n end", "def destroy\n @rule_set = RuleSet.find(params[:id])\n @rule_set.destroy\n\n respond_to do |format|\n format.html { redirect_to rule_sets_url }\n format.json { head :ok }\n end\n end", "def retract_rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, rules, @schema_graph, \"text/turtle\")\n self\n end", "def delete rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_delete_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def del_from_rules(msg)\n if file_util(rules_file).remove_line(msg[2])\n reply = \"Removed lines from #{rules_file} mathing #{msg[2].inspect}.\"\n else\n reply = \"Lines mathing #{msg[2].inspect} were not found.\"\n end\n\n send_response(reply)\n end", "def delete_from_all_lists(email)\n full_path = full_resource_path('/delete_all')\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.delete_result(full_path, query_params)\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def clear_rules!(forward_to_replicas = false, request_options = {})\n res = clear_rules(forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def destroy\n @inbox = Inbox.find(params[:id])\n @inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice:'Inbox Destroyed' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_roleset = TeamRoleset.find(params[:id])\n rolesets_in_map = TeamRolesetsMap.find_all_by_team_rolesets_id(params[:id])\n\n rolesets_in_map.each do |x|\n x.destroy\n end\n\n @team_roleset.destroy\n\n respond_to do |format|\n format.html { redirect_to(team_rolesets_url) }\n format.xml { head :ok }\n end\n end", "def delete_filters(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'filters', params)\n end", "def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n imap.select(mailbox)\n imap.uid_search(['ALL']).each do |uid|\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n imap.expunge\n end\n end", "def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n info \"delete_all block\"\n info \"imap.uid_search #{batch} #{\"ALL\"}\"\n imap.uid_search(['ALL']).each do |uid|\n info \"imap.uid_store #{uid} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\"\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n info \"imap.expunge\"\n imap.expunge\n end\n end", "def destroy\n @messaging_inbox = Messaging::Inbox.find(params[:id])\n @messaging_inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to messaging_inboxes_url }\n format.json { head :ok }\n end\n end", "def clear_rules!\n @rules = []\n end", "def delete_merge_request_level_rule(project, merge_request, appr_rule_id)\n delete(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}\")\n end", "def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end", "def delete_rule(scope, kind, id)\n make_request(:delete, \"/pushrules/#{scope}/#{kind}/#{id}\").code == 200\n end", "def destroy\n @context = Context.find(params[:context_id])\n @context_rule = @context.context_rules.find(params[:id])\n @context_rule.destroy\n redirect_to context_path(@context)\n end", "def destroy\n @inbox = Inbox.find(params[:id])\n @inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to inboxes_url }\n format.json { head :no_content }\n end\n end", "def delete_all_inbox_emails_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.delete_all_inbox_emails ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.delete_all_inbox_emails\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/deleteAllInboxEmails'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#delete_all_inbox_emails\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def deleteAllEmail\n queryParams = Hash.new\n queryParams['key'] = @API_KEY\n queryParams['mailbox'] = @MAILBOX\n RestClient.post(\"#{@BASE_URI}/emails/deleteall\", nil, {:params => queryParams})\n end", "def clear\n @rule = Rule.find(params[:id])\n @rule.hits.destroy_all\n\n respond_to do |format|\n format.html { redirect_to params[:referrer] || @rule }\n end\n end", "def delete_inbox_repliers(opts = {})\n delete_inbox_repliers_with_http_info(opts)\n nil\n end", "def delete_from_lists(contact_id, lists_to_delete_from)\n full_path = full_resource_path(\"/#{contact_id}\")\n query_params = MaropostApi.set_query_params({'list_ids' => lists_to_delete_from.join(',')})\n \n MaropostApi.delete_result(full_path, query_params)\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @inbox.destroy\n respond_to do |format|\n format.html { redirect_to inboxes_url, notice: 'Inbox was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(contact_ids, monitor_id, monitor_type)\n contact_ids = contact_ids.join(',') if contact_ids.class == Array\n args = {contactIds: contact_ids, \n monitorId: monitor_id,\n monitorType: monitor_type}\n post('deleteNotificationRule', args)\n end", "def delete_from_friend_feeds(friend_ids)\n redis.pipelined do\n friend_ids.each do |friend_id|\n feed = FriendFeed.new(id: friend_id)\n feed.message_ids.delete(id)\n end\n end\n end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def delete_playlists(ids = [])\n url = 'playlistbatch'\n\n deletes = ids.map do |pd|\n {\n delete: pd\n }\n end\n\n options = {\n body: {mutations: deletes}.to_json\n }\n\n make_post_request(url, options).fetch('mutate_response')\n end", "def delete\n self.class.call('domain.mailbox.delete', @domain.fqdn, @login)\n end", "def delMail(imap, folder)\n pp \"Emptying #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Deleted])\n imap.expunge\nend", "def clear_queues\n RosettaQueue::Destinations.queue_names.each do |name| \n queue = name.gsub('/queue/','')\n open(\"http://127.0.0.1:8161/admin/deleteDestination.action?JMSDestination=#{queue}&JMSDestinationType=queue\")\n end\n end", "def destroy\n @rule = Rule.find(params[:id])\n \n\t@account = Account.find(params[:account_id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n end\n end", "def delete_project_merge_request_approval_rule(project, approval_rule_id)\n delete(\"/projects/#{url_encode project}/approval_rules/#{approval_rule_id}\")\n end", "def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end", "def delete_sync_rule(audience_id, sync_rule_id)\n delete(\"audiences/#{audience_id}/sync_rules/#{sync_rule_id}\")\n end", "def batch_rules(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n client.post(\"#{Protocol.batch_rules_uri(name)}?forwardToReplicas=#{forward_to_replicas}&clearExistingRules=#{clear_existing_rules}\", rules.to_json, :batch, request_options)\n end", "def delete_inbox_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.delete_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.delete_inbox\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#delete_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{rule_id}\")\n end", "def remove( *ruleses )\n self.dup.remove!( *ruleses )\n end", "def destroy\n #@rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @qmask = Qmask.find(params[:id])\n @qmask.destroy\n\n respond_to do |format|\n format.html { redirect_to(qmasks_url) }\n format.xml { head :ok }\n end\n end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def purge_associations\n EspRulesList.where(list_type: type, list_id: id).delete_all\n ExportedLead.where(list_type: type, list_id: id).delete_all\n MessageAutoResponse.where(esp_list_type: type, esp_list_id: id).delete_all\n end", "def remove(mailbox)\n delete(\"#{domain}/mailboxes/#{mailbox}\")\n end", "def delete_rule!(objectID, forward_to_replicas = false, request_options = {})\n res = delete_rule(objectID, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def destroy\n @payin_rule = PayinRule.find_by(guid: params[:guid])\n\n if @payin_rule.destroy!\n head :ok\n else\n head :bad_request\n end\n end", "def destroy\n @route_rule = RouteRule.find(params[:id])\n @route_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_rules_url) }\n format.xml { head :ok }\n end\n end", "def delete(*ids)\n collection.remove(to_criteria(:_id => ids.flatten))\n end", "def remove_all\n @batch = Batch.shod(params[:id])\n @exam_groups = @batch.exam_groups.all\n end", "def delete_ana\n @project = Project.find(params[:id])\n @an= @project.analyses.find(params[:ana_id])\n if @an\n @project.analyses.delete(@an)\n end\n redirect_to :action => 'analyses'\n end", "def delete_many(filter = nil, options = nil)\n native.delete_many(filter, options || {}).deleted_count\n end", "def remove_firewall_rule server_uuid, position\n response = delete \"server/#{server_uuid}/firewall_rule/#{position}\"\n\n response\n end", "def delete_inbox_replier(id, opts = {})\n delete_inbox_replier_with_http_info(id, opts)\n nil\n end", "def empty\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @folder_id = params[:id]\n mail_account_id = params[:mail_account_id]\n SqlHelper.validate_token([@folder_id, mail_account_id])\n\n trash_folder = MailFolder.get_for(@login_user, mail_account_id, MailFolder::XTYPE_TRASH)\n\n mail_folder = MailFolder.find(@folder_id)\n emails = (MailFolder.get_mails(mail_folder.id, @login_user) || [])\n\n if mail_folder.id == trash_folder.id \\\n or mail_folder.get_parents(false).include?(trash_folder.id.to_s)\n emails.each do |email|\n email.destroy\n end\n flash[:notice] = t('msg.delete_success')\n else\n emails.each do |email|\n email.update_attribute(:mail_folder_id, trash_folder.id)\n end\n flash[:notice] = t('msg.moved_to_trash')\n end\n\n get_mails\n end", "def destroy\n @code_rule = CodeRule.find(params[:id])\n @code_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(code_rules_url) }\n format.xml { head :ok }\n end\n end", "def remove_all_rules\n super\n end", "def delete_address_list(id)\n delete(\"addressGroups/#{id}\")\n end", "def clear\n @tasks.clear\n @rules.clear\n end", "def remove_from_inbox\r\n @content = Content.active.find(params[:id])\r\n @inbox = Inbox.active.find(params[:inbox_id])\r\n \r\n # Can only remove from active (not archived) inboxes, and then only if you own the content or the inbox\r\n raise Kroogi::NotPermitted unless !@inbox.archived? && current_actor.is_self_or_owner?(@content.user, @inbox.user)\r\n @content.remove_from_inbox(@inbox)\r\n flash[:success] = \"Removed '%s' from '%s'\" / [@content.title_long, @inbox.title_long]\r\n redirect_to content_url(current_actor.is_self_or_owner?(@inbox.user) ? @inbox : @content)\r\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @outline = Outline.find(params[:id])\n @outline.destroy\n\n respond_to do |format|\n format.html { redirect_to(outlines_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url }\n format.json { head :no_content }\n end\n end", "def remove_inbound_rule(rule_number)\n remove_rule(rule_number, false)\n end", "def delete_all_workflows\n wfs = workflows\n wfs.each { |wf| delete_workflow(workflow_id: wf.id) }\n end", "def destroy\n prepare_collection_query\n\n @query.where(\"#{@grid.model.arel_table.name}.id in (?)\", params[:ids]).each(&:destroy)\n render :json => { status: \"OK\" }\n end", "def cmd_db_set_del_from(*args)\n\t\t\tset_id = args[0]\n\t\t\tif is_valid_set?(set_id)\n\t\t\t\t@sets[set_id].each do |item|\n\t\t\t\t\t@working_set.each do |working_item|\n\t\t\t\t\t\tif @working_item == item\n\t\t\t\t\t\t\t@sets[set_id].remove!(item)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint_error \"#{set_id} is not a valid set id\"\n\t\t\tend\n\t\tend", "def bulk_delete_groups(ids)\n delete('groups/bulk_delete', ids: ids)\n end", "def remove_contacts\n selected_contact_ids = params[:selected_contact_ids]\n\n Contact.where(:id => selected_contact_ids).destroy_all\n contacts_list\n end", "def delete_related_groups\n \n end", "def destroy\n @student_group_rule = StudentGroupRule.find(params[:id])\n @student_group_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_group_rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction_rule = @business.transaction_rules.find(params[:id])\n @transaction_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to business_transaction_rules_url(@business), notice: _(\"Regla eliminada\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @mailbox = Mailbox.find(params[:id])\n @mailbox.destroy\n\n respond_to do |format|\n format.html { redirect_to mailboxes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule.destroy\n render json: {}\n\n end", "def delete_flow(table_id: nil, flow_id: nil)\n raise ArgumentError, \"Table ID (table_id) required\" unless table_id\n raise ArgumentError, \"Flow ID (flow_id) required\" unless flow_id\n delete_uri = \"#{@controller.get_node_config_uri(self)}/table/#{table_id}/\"\\\n \"flow/#{flow_id}\"\n response = @controller.rest_agent.delete_request(delete_uri)\n if response.code.to_i == 200\n NetconfResponse.new(NetconfResponseStatus::OK)\n else\n handle_error_response(response)\n end\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def destroy\n @rule_type = RuleType.find(params[:id])\n @rule_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(rule_types_url) }\n format.xml { head :ok }\n end\n end", "def update_multiple\n params[:group_ids].each do |group_name|\n group = Admin::Group.new\n group.name = group_name \n group.resources.each do |resource|\n resource_obj = MediaObject.find(resource)\n read_groups = resource_obj.read_groups\n read_groups.delete(group_name) \n resource_obj.read_groups = read_groups\n resource_obj.save\n end\n \n RoleControls.remove_role(group_name)\n end\n RoleControls.save_changes\n \n flash[:notice] = \"Successfully deleted groups: #{params[:group_ids].join(\", \")}\"\n redirect_to admin_groups_path\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def remove_records(messages)\n clause = deleted_query(messages)\n\n clause.delete_all\n end", "def delete(client_id)\n id = client_id.to_s\n Client.collection.filter(:id => id).delete\n AuthRequest.collection.filter(:client_id => id).delete\n AccessGrant.collection.filter(:client_id => id).delete\n AccessToken.collection.filter(:client_id => id).delete\n end", "def remove_all_requests\n return if params[:request_ids].blank?\n requests = params[:request_ids].split(',')\n requests.each do |request|\n current_user.delete_request(request)\n end\n end", "def destroy(ids)\n end", "def destroy(ids)\n end", "def deleteSelection \n\n chk_ids = params[:ids]\n chks = chk_ids.split(\",\")\n\n chks.each do |chk|\n @mbook = Mbook.get(chk.to_i)\n mbook_id = @mbook.id\n mbook = @mbook\n \n if @mbook != nil\n if File.exists?(@mbook.zipfile)\n FileUtils.rm_rf @mbook.zipfile\n end\n \n if File.exists?(@mbook.zip_path)\n FileUtils.rm_rf @mbook.zip_path\n end\n \n if File.exists?(MBOOK_PATH + @mbook.id.to_s + \".zip\")\n FileUtils.rm_rf MBOOK_PATH + @mbook.id.to_s + \".zip\"\n end\n \n if @mbook.destroy \n puts_message \"mBook (\"+mbook_id.to_s+\") 삭제 성공\"\n else\n puts_message \"mBook (\"+mbook_id.to_s+\") 삭제 실패\"\n end\n end \n end\n\n render :text => \"success\"\n end" ]
[ "0.7091587", "0.68988985", "0.6226191", "0.59654415", "0.5943421", "0.5937195", "0.56038946", "0.54905397", "0.54545236", "0.54135305", "0.5299187", "0.5285349", "0.5271623", "0.5268008", "0.5263276", "0.52274543", "0.51354396", "0.51113975", "0.51058125", "0.50943893", "0.509251", "0.5080724", "0.50797635", "0.49704581", "0.4947077", "0.48629197", "0.48595315", "0.4857817", "0.48301145", "0.4811568", "0.48095953", "0.48091957", "0.47676796", "0.47542027", "0.47368017", "0.4731758", "0.47182748", "0.4696208", "0.4690155", "0.4675449", "0.4662861", "0.46573105", "0.46031302", "0.46026182", "0.45966604", "0.45937294", "0.45795226", "0.45764473", "0.45733792", "0.45718324", "0.45603353", "0.45556062", "0.4553612", "0.45419887", "0.4510747", "0.45106447", "0.45022246", "0.45009008", "0.45003673", "0.44567537", "0.44507796", "0.44487906", "0.44434398", "0.44236317", "0.44220713", "0.44203368", "0.44191426", "0.44115072", "0.44078323", "0.4406021", "0.4399609", "0.43686825", "0.43661687", "0.43637016", "0.43603402", "0.43553734", "0.4349232", "0.43473214", "0.43446806", "0.43412846", "0.4339404", "0.4330209", "0.4328786", "0.43267342", "0.4322659", "0.43169752", "0.43152615", "0.43127564", "0.4305963", "0.4303317", "0.4296346", "0.4293623", "0.42913732", "0.42899948", "0.42891368", "0.42881602", "0.42853314", "0.4281904", "0.4281904", "0.42735645" ]
0.8147999
0
Delete inbox rulesets Delete inbox rulesets. Accepts optional inboxId filter.
def delete_inbox_rulesets_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_rulesets ...' end # resource path local_var_path = '/rulesets' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboxRulesetControllerApi#delete_inbox_rulesets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def delete_inbox_ruleset(id, opts = {})\n delete_inbox_ruleset_with_http_info(id, opts)\n nil\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def delete_all_rules(rules)\n return if rules.nil?\n\n @ids = rules['data'].map { |rule| rule['id'] }\n @payload = { delete: { ids: @ids } }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while deleting your rules: #{@response.status_message}\" unless @response.success?\nend", "def delete_inbox_ruleset_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.delete_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#delete_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def clear_rules\n response = @create_send.delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def clear_rules\n cs_delete \"/segments/#{segment_id}/rules.json\", {}\n end", "def delete_inbox(inbox_id, opts = {})\n delete_inbox_with_http_info(inbox_id, opts)\n nil\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def delete_all_inbox_emails(inbox_id, opts = {})\n delete_all_inbox_emails_with_http_info(inbox_id, opts)\n nil\n end", "def destroy\n @inbox.destroy\n end", "def destroy\n @rule_set = RuleSet.find(params[:id])\n @rule_set.destroy\n\n respond_to do |format|\n format.html { redirect_to rule_sets_url }\n format.json { head :ok }\n end\n end", "def retract_rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"REMOVING FROM SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.remove(@db_name, rules, @schema_graph, \"text/turtle\")\n self\n end", "def delete rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_delete_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def del_from_rules(msg)\n if file_util(rules_file).remove_line(msg[2])\n reply = \"Removed lines from #{rules_file} mathing #{msg[2].inspect}.\"\n else\n reply = \"Lines mathing #{msg[2].inspect} were not found.\"\n end\n\n send_response(reply)\n end", "def delete_from_all_lists(email)\n full_path = full_resource_path('/delete_all')\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.delete_result(full_path, query_params)\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def clear_rules!(forward_to_replicas = false, request_options = {})\n res = clear_rules(forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def destroy\n @inbox = Inbox.find(params[:id])\n @inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice:'Inbox Destroyed' }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_roleset = TeamRoleset.find(params[:id])\n rolesets_in_map = TeamRolesetsMap.find_all_by_team_rolesets_id(params[:id])\n\n rolesets_in_map.each do |x|\n x.destroy\n end\n\n @team_roleset.destroy\n\n respond_to do |format|\n format.html { redirect_to(team_rolesets_url) }\n format.xml { head :ok }\n end\n end", "def delete_filters(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'filters', params)\n end", "def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n imap.select(mailbox)\n imap.uid_search(['ALL']).each do |uid|\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n imap.expunge\n end\n end", "def delete_all(mailbox='INBOX')\n mailbox ||= 'INBOX'\n mailbox = Net::IMAP.encode_utf7(mailbox)\n\n start do |imap|\n info \"delete_all block\"\n info \"imap.uid_search #{batch} #{\"ALL\"}\"\n imap.uid_search(['ALL']).each do |uid|\n info \"imap.uid_store #{uid} #{\"+FLAGS\"} #{[Net::IMAP::DELETED]}\"\n imap.uid_store(uid, \"+FLAGS\", [Net::IMAP::DELETED])\n end\n info \"imap.expunge\"\n imap.expunge\n end\n end", "def destroy\n @messaging_inbox = Messaging::Inbox.find(params[:id])\n @messaging_inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to messaging_inboxes_url }\n format.json { head :ok }\n end\n end", "def clear_rules!\n @rules = []\n end", "def delete_merge_request_level_rule(project, merge_request, appr_rule_id)\n delete(\"/projects/#{url_encode project}/merge_requests/#{merge_request}/approval_rules/#{appr_rule_id}\")\n end", "def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end", "def delete_rule(scope, kind, id)\n make_request(:delete, \"/pushrules/#{scope}/#{kind}/#{id}\").code == 200\n end", "def destroy\n @context = Context.find(params[:context_id])\n @context_rule = @context.context_rules.find(params[:id])\n @context_rule.destroy\n redirect_to context_path(@context)\n end", "def destroy\n @inbox = Inbox.find(params[:id])\n @inbox.destroy\n\n respond_to do |format|\n format.html { redirect_to inboxes_url }\n format.json { head :no_content }\n end\n end", "def delete_all_inbox_emails_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.delete_all_inbox_emails ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.delete_all_inbox_emails\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/deleteAllInboxEmails'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#delete_all_inbox_emails\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def deleteAllEmail\n queryParams = Hash.new\n queryParams['key'] = @API_KEY\n queryParams['mailbox'] = @MAILBOX\n RestClient.post(\"#{@BASE_URI}/emails/deleteall\", nil, {:params => queryParams})\n end", "def clear\n @rule = Rule.find(params[:id])\n @rule.hits.destroy_all\n\n respond_to do |format|\n format.html { redirect_to params[:referrer] || @rule }\n end\n end", "def delete_inbox_repliers(opts = {})\n delete_inbox_repliers_with_http_info(opts)\n nil\n end", "def delete_from_lists(contact_id, lists_to_delete_from)\n full_path = full_resource_path(\"/#{contact_id}\")\n query_params = MaropostApi.set_query_params({'list_ids' => lists_to_delete_from.join(',')})\n \n MaropostApi.delete_result(full_path, query_params)\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @inbox.destroy\n respond_to do |format|\n format.html { redirect_to inboxes_url, notice: 'Inbox was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(contact_ids, monitor_id, monitor_type)\n contact_ids = contact_ids.join(',') if contact_ids.class == Array\n args = {contactIds: contact_ids, \n monitorId: monitor_id,\n monitorType: monitor_type}\n post('deleteNotificationRule', args)\n end", "def delete_from_friend_feeds(friend_ids)\n redis.pipelined do\n friend_ids.each do |friend_id|\n feed = FriendFeed.new(id: friend_id)\n feed.message_ids.delete(id)\n end\n end\n end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def delete_playlists(ids = [])\n url = 'playlistbatch'\n\n deletes = ids.map do |pd|\n {\n delete: pd\n }\n end\n\n options = {\n body: {mutations: deletes}.to_json\n }\n\n make_post_request(url, options).fetch('mutate_response')\n end", "def delete\n self.class.call('domain.mailbox.delete', @domain.fqdn, @login)\n end", "def delMail(imap, folder)\n pp \"Emptying #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Deleted])\n imap.expunge\nend", "def clear_queues\n RosettaQueue::Destinations.queue_names.each do |name| \n queue = name.gsub('/queue/','')\n open(\"http://127.0.0.1:8161/admin/deleteDestination.action?JMSDestination=#{queue}&JMSDestinationType=queue\")\n end\n end", "def destroy\n @rule = Rule.find(params[:id])\n \n\t@account = Account.find(params[:account_id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_rules_url(@account)) }\n format.xml { head :ok }\n end\n end", "def delete_project_merge_request_approval_rule(project, approval_rule_id)\n delete(\"/projects/#{url_encode project}/approval_rules/#{approval_rule_id}\")\n end", "def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end", "def delete_sync_rule(audience_id, sync_rule_id)\n delete(\"audiences/#{audience_id}/sync_rules/#{sync_rule_id}\")\n end", "def batch_rules(rules, forward_to_replicas = false, clear_existing_rules = false, request_options = {})\n client.post(\"#{Protocol.batch_rules_uri(name)}?forwardToReplicas=#{forward_to_replicas}&clearExistingRules=#{clear_existing_rules}\", rules.to_json, :batch, request_options)\n end", "def delete_inbox_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.delete_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.delete_inbox\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#delete_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{rule_id}\")\n end", "def remove( *ruleses )\n self.dup.remove!( *ruleses )\n end", "def destroy\n #@rule = Rule.find(params[:id])\n @rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @qmask = Qmask.find(params[:id])\n @qmask.destroy\n\n respond_to do |format|\n format.html { redirect_to(qmasks_url) }\n format.xml { head :ok }\n end\n end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def purge_associations\n EspRulesList.where(list_type: type, list_id: id).delete_all\n ExportedLead.where(list_type: type, list_id: id).delete_all\n MessageAutoResponse.where(esp_list_type: type, esp_list_id: id).delete_all\n end", "def remove(mailbox)\n delete(\"#{domain}/mailboxes/#{mailbox}\")\n end", "def delete_rule!(objectID, forward_to_replicas = false, request_options = {})\n res = delete_rule(objectID, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def destroy\n @payin_rule = PayinRule.find_by(guid: params[:guid])\n\n if @payin_rule.destroy!\n head :ok\n else\n head :bad_request\n end\n end", "def destroy\n @route_rule = RouteRule.find(params[:id])\n @route_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_rules_url) }\n format.xml { head :ok }\n end\n end", "def delete(*ids)\n collection.remove(to_criteria(:_id => ids.flatten))\n end", "def remove_all\n @batch = Batch.shod(params[:id])\n @exam_groups = @batch.exam_groups.all\n end", "def delete_ana\n @project = Project.find(params[:id])\n @an= @project.analyses.find(params[:ana_id])\n if @an\n @project.analyses.delete(@an)\n end\n redirect_to :action => 'analyses'\n end", "def delete_many(filter = nil, options = nil)\n native.delete_many(filter, options || {}).deleted_count\n end", "def remove_firewall_rule server_uuid, position\n response = delete \"server/#{server_uuid}/firewall_rule/#{position}\"\n\n response\n end", "def delete_inbox_replier(id, opts = {})\n delete_inbox_replier_with_http_info(id, opts)\n nil\n end", "def empty\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @folder_id = params[:id]\n mail_account_id = params[:mail_account_id]\n SqlHelper.validate_token([@folder_id, mail_account_id])\n\n trash_folder = MailFolder.get_for(@login_user, mail_account_id, MailFolder::XTYPE_TRASH)\n\n mail_folder = MailFolder.find(@folder_id)\n emails = (MailFolder.get_mails(mail_folder.id, @login_user) || [])\n\n if mail_folder.id == trash_folder.id \\\n or mail_folder.get_parents(false).include?(trash_folder.id.to_s)\n emails.each do |email|\n email.destroy\n end\n flash[:notice] = t('msg.delete_success')\n else\n emails.each do |email|\n email.update_attribute(:mail_folder_id, trash_folder.id)\n end\n flash[:notice] = t('msg.moved_to_trash')\n end\n\n get_mails\n end", "def destroy\n @code_rule = CodeRule.find(params[:id])\n @code_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(code_rules_url) }\n format.xml { head :ok }\n end\n end", "def remove_all_rules\n super\n end", "def delete_address_list(id)\n delete(\"addressGroups/#{id}\")\n end", "def clear\n @tasks.clear\n @rules.clear\n end", "def remove_from_inbox\r\n @content = Content.active.find(params[:id])\r\n @inbox = Inbox.active.find(params[:inbox_id])\r\n \r\n # Can only remove from active (not archived) inboxes, and then only if you own the content or the inbox\r\n raise Kroogi::NotPermitted unless !@inbox.archived? && current_actor.is_self_or_owner?(@content.user, @inbox.user)\r\n @content.remove_from_inbox(@inbox)\r\n flash[:success] = \"Removed '%s' from '%s'\" / [@content.title_long, @inbox.title_long]\r\n redirect_to content_url(current_actor.is_self_or_owner?(@inbox.user) ? @inbox : @content)\r\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @outline = Outline.find(params[:id])\n @outline.destroy\n\n respond_to do |format|\n format.html { redirect_to(outlines_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.html { redirect_to rules_url }\n format.json { head :no_content }\n end\n end", "def remove_inbound_rule(rule_number)\n remove_rule(rule_number, false)\n end", "def delete_all_workflows\n wfs = workflows\n wfs.each { |wf| delete_workflow(workflow_id: wf.id) }\n end", "def destroy\n prepare_collection_query\n\n @query.where(\"#{@grid.model.arel_table.name}.id in (?)\", params[:ids]).each(&:destroy)\n render :json => { status: \"OK\" }\n end", "def cmd_db_set_del_from(*args)\n\t\t\tset_id = args[0]\n\t\t\tif is_valid_set?(set_id)\n\t\t\t\t@sets[set_id].each do |item|\n\t\t\t\t\t@working_set.each do |working_item|\n\t\t\t\t\t\tif @working_item == item\n\t\t\t\t\t\t\t@sets[set_id].remove!(item)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint_error \"#{set_id} is not a valid set id\"\n\t\t\tend\n\t\tend", "def bulk_delete_groups(ids)\n delete('groups/bulk_delete', ids: ids)\n end", "def remove_contacts\n selected_contact_ids = params[:selected_contact_ids]\n\n Contact.where(:id => selected_contact_ids).destroy_all\n contacts_list\n end", "def delete_related_groups\n \n end", "def destroy\n @student_group_rule = StudentGroupRule.find(params[:id])\n @student_group_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_group_rules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction_rule = @business.transaction_rules.find(params[:id])\n @transaction_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to business_transaction_rules_url(@business), notice: _(\"Regla eliminada\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @mailbox = Mailbox.find(params[:id])\n @mailbox.destroy\n\n respond_to do |format|\n format.html { redirect_to mailboxes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rule.destroy\n render json: {}\n\n end", "def delete_flow(table_id: nil, flow_id: nil)\n raise ArgumentError, \"Table ID (table_id) required\" unless table_id\n raise ArgumentError, \"Flow ID (flow_id) required\" unless flow_id\n delete_uri = \"#{@controller.get_node_config_uri(self)}/table/#{table_id}/\"\\\n \"flow/#{flow_id}\"\n response = @controller.rest_agent.delete_request(delete_uri)\n if response.code.to_i == 200\n NetconfResponse.new(NetconfResponseStatus::OK)\n else\n handle_error_response(response)\n end\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def destroy\n @rule_type = RuleType.find(params[:id])\n @rule_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(rule_types_url) }\n format.xml { head :ok }\n end\n end", "def update_multiple\n params[:group_ids].each do |group_name|\n group = Admin::Group.new\n group.name = group_name \n group.resources.each do |resource|\n resource_obj = MediaObject.find(resource)\n read_groups = resource_obj.read_groups\n read_groups.delete(group_name) \n resource_obj.read_groups = read_groups\n resource_obj.save\n end\n \n RoleControls.remove_role(group_name)\n end\n RoleControls.save_changes\n \n flash[:notice] = \"Successfully deleted groups: #{params[:group_ids].join(\", \")}\"\n redirect_to admin_groups_path\n end", "def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def remove_records(messages)\n clause = deleted_query(messages)\n\n clause.delete_all\n end", "def delete(client_id)\n id = client_id.to_s\n Client.collection.filter(:id => id).delete\n AuthRequest.collection.filter(:client_id => id).delete\n AccessGrant.collection.filter(:client_id => id).delete\n AccessToken.collection.filter(:client_id => id).delete\n end", "def remove_all_requests\n return if params[:request_ids].blank?\n requests = params[:request_ids].split(',')\n requests.each do |request|\n current_user.delete_request(request)\n end\n end", "def destroy(ids)\n end", "def destroy(ids)\n end", "def deleteSelection \n\n chk_ids = params[:ids]\n chks = chk_ids.split(\",\")\n\n chks.each do |chk|\n @mbook = Mbook.get(chk.to_i)\n mbook_id = @mbook.id\n mbook = @mbook\n \n if @mbook != nil\n if File.exists?(@mbook.zipfile)\n FileUtils.rm_rf @mbook.zipfile\n end\n \n if File.exists?(@mbook.zip_path)\n FileUtils.rm_rf @mbook.zip_path\n end\n \n if File.exists?(MBOOK_PATH + @mbook.id.to_s + \".zip\")\n FileUtils.rm_rf MBOOK_PATH + @mbook.id.to_s + \".zip\"\n end\n \n if @mbook.destroy \n puts_message \"mBook (\"+mbook_id.to_s+\") 삭제 성공\"\n else\n puts_message \"mBook (\"+mbook_id.to_s+\") 삭제 실패\"\n end\n end \n end\n\n render :text => \"success\"\n end" ]
[ "0.8147999", "0.7091587", "0.6226191", "0.59654415", "0.5943421", "0.5937195", "0.56038946", "0.54905397", "0.54545236", "0.54135305", "0.5299187", "0.5285349", "0.5271623", "0.5268008", "0.5263276", "0.52274543", "0.51354396", "0.51113975", "0.51058125", "0.50943893", "0.509251", "0.5080724", "0.50797635", "0.49704581", "0.4947077", "0.48629197", "0.48595315", "0.4857817", "0.48301145", "0.4811568", "0.48095953", "0.48091957", "0.47676796", "0.47542027", "0.47368017", "0.4731758", "0.47182748", "0.4696208", "0.4690155", "0.4675449", "0.4662861", "0.46573105", "0.46031302", "0.46026182", "0.45966604", "0.45937294", "0.45795226", "0.45764473", "0.45733792", "0.45718324", "0.45603353", "0.45556062", "0.4553612", "0.45419887", "0.4510747", "0.45106447", "0.45022246", "0.45009008", "0.45003673", "0.44567537", "0.44507796", "0.44487906", "0.44434398", "0.44236317", "0.44220713", "0.44203368", "0.44191426", "0.44115072", "0.44078323", "0.4406021", "0.4399609", "0.43686825", "0.43661687", "0.43637016", "0.43603402", "0.43553734", "0.4349232", "0.43473214", "0.43446806", "0.43412846", "0.4339404", "0.4330209", "0.4328786", "0.43267342", "0.4322659", "0.43169752", "0.43152615", "0.43127564", "0.4305963", "0.4303317", "0.4296346", "0.4293623", "0.42913732", "0.42899948", "0.42891368", "0.42881602", "0.42853314", "0.4281904", "0.4281904", "0.42735645" ]
0.68988985
2
Get an inbox ruleset Get inbox ruleset
def get_inbox_ruleset(id, opts = {}) data, _status_code, _headers = get_inbox_ruleset_with_http_info(id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def get_rules\r\n @rules\r\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_rules(service=Azure::ServiceBus::Rules)\n service.all(self)\n end", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def ruleset(ruleset, ctx)\r\n rulelist = rulelist(ruleset, ctx)\r\n\r\n cmtSuffix = \"\"\r\n ruleParams = \"#{ruleset.execType}\" # Build the ruleset parameter list.\r\n\r\n if (ruleset.type == \"PL\")\r\n ruleParams += \", PL\"\r\n cmtSuffix += \"(PowerLookup)\"\r\n end # if ruleset.type\r\n\r\n aliasStmt = \"\" # Don't create an alias statement if it is not needed.\r\n\r\n if (ruleset.name != ruleset.alias)\r\n aliasStmt = <<EOF\r\nalias(ruleset, #{ruleset.name}, \"#{ruleset.alias}\");\r\nEOF\r\n end # if ruleset.name...\r\n\r\n\r\n out = <<EOF\r\n#{aliasStmt}\r\n/* ==========================================================================\r\n * #{ruleset.name} #{cmtSuffix}\r\n *\r\n *\r\n */\r\nruleset #{ruleset.name}(#{ruleParams})\r\n#{rulelist}\r\nend // ruleset #{ruleset.name}(#{ruleParams})\r\n\r\n\r\n\r\n\r\nEOF\r\n\r\n return out\r\n\r\n end", "def get_inbox_ruleset_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.get_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\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] || 'InboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_rules(scope = nil)\n path = scope ? \"/pushrules/#{scope}\" : '/pushrules'\n make_request(:get, path).parsed_response\n end", "def inbox\n folders.find_by_name(\"Inbox\")\n end", "def inbox\n folders.find_by_name(\"Inbox\")\n end", "def all\n @rules\n end", "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def rules\n return @rules\n end", "def get_rule(name, service=Azure::ServiceBus::Rules)\n service.get(self, name)\n end", "def rule_by_id; end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def get_ruleset(application_id, campaign_id, ruleset_id, opts = {})\n data, _status_code, _headers = get_ruleset_with_http_info(application_id, campaign_id, ruleset_id, opts)\n data\n end", "def rules(options={})\n get('getNotificationRules', options)\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def get_rule(rule_id)\n get(\"rules/#{rule_id}\")\n end", "def get_staging_rule_sets\n get(\"#{url_base}/staging/rule_sets?#{dc}\")[\"data\"]\n end", "def inbox\n return @defaults.objectForKey(:inbox)\n end", "def rules\n @rules ||= {}\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def rule_get(ref)\n rule_table.get(self, setup_package_id(ref))\n end", "def get_mailboxes\n get(\"mailboxes\")\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def inbound_rules\n @inbound_rules ||= normalized_security_rules.one_direction_rules(\"inbound\")\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def get_rule(scope, kind, id)\n make_request(:get, \"/pushrules/#{scope}/#{kind}/#{id}\").parsed_response\n end", "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def rule_by_id(rule_id)\n url = @base_url + '/rules/' + rule_id\n valid_codes = [NSXConstants::CODE_CREATED,\n NSXConstants::CODE_OK,\n NSXConstants::CODE_BAD_REQUEST,\n NSXConstants::CODE_NOT_FOUND]\n additional_headers = []\n @nsx_client.get(url, additional_headers, valid_codes)\n end", "def rules\n self.class.rules\n end", "def find_rule(id)\n @sec_grp_objs.select { |security_group| security_group.rules.select{ |rule| rule.id == id }}\n end", "def get_rulesets(application_id, campaign_id, opts = {})\n data, _status_code, _headers = get_rulesets_with_http_info(application_id, campaign_id, opts)\n data\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rules_ids\n @rules_registry.rules.map(&:id)\n end", "def get_all_config_rules\n config_rules = []\n\n # Fetch all rules with pagination\n response = @client.describe_config_rules\n config_rules += response.config_rules\n while response.next_token\n response = @client.describe_config_rules(next_token: response.next_token)\n config_rules += response.config_rules\n end\n config_rules = config_rules.map(&:to_h)\n\n # Add necessary data to rules using helpers\n add_compliance_to_config_rules(config_rules)\n add_results_to_config_rules(config_rules)\n end", "def by_id(id)\n @rules.select { |rule| rule.id == id }\n end", "def GetRules\n Builtins.y2milestone(\"Getting Rules: %1\", @tomerge)\n\n scheme = AutoinstConfig.scheme\n host = AutoinstConfig.host\n filepath = AutoinstConfig.filepath\n directory = AutoinstConfig.directory\n\n valid = []\n stop = false\n Builtins.foreach(@tomerge) do |file|\n if !stop\n dir = dirname(file)\n if dir != \"\"\n SCR.Execute(\n path(\".target.mkdir\"),\n Ops.add(Ops.add(AutoinstConfig.local_rules_location, \"/\"), dir)\n )\n end\n\n localfile = Ops.add(\n Ops.add(AutoinstConfig.local_rules_location, \"/\"),\n file\n )\n if !Get(\n scheme,\n host,\n Ops.add(Ops.add(directory, \"/\"), file),\n localfile\n )\n Builtins.y2error(\n \"Error while fetching file: %1\",\n Ops.add(Ops.add(directory, \"/\"), file)\n )\n else\n stop = true if @Behaviour == :one\n valid = Builtins.add(valid, file)\n end\n end\n end\n @tomerge = deep_copy(valid)\n if Builtins.size(@tomerge) == 0\n Builtins.y2milestone(\"No files from rules found\")\n return false\n else\n return true\n end\n end", "def rules\n rule_applier.rules\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def get_all(provider = :aws)\n @@_rule_set_registry.fetch(provider, {}).values\n end", "def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end", "def get_rule(rule)\n @rules[rule]\n end", "def rules(section_id = @one_section_id)\n url = @url_sections + '/' + section_id + '/rules'\n @nsx_client.get(url)\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def imap_select_inbox\n imap.select('INBOX')\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def for_rule(rule_name)\n @rules.fetch(rule_name.to_sym, {})\n end", "def parse_firewall_rules\n script_code = 'netsh advfirewall firewall show rule name=all verbose'\n cmd = powershell_out(script_code) # Not logged because it makes too much noise\n\n retval = parse_firewall_paragraphs(cmd)\n\n raise 'Could not parse firewall rules' if retval.empty?\n return retval\n end", "def [](ruleset)\n for_ruleset(ruleset)\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def rules_by_name; end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def content_rules_get(authorization, web_application_name, opts = {})\n data, status_code, headers = content_rules_get_with_http_info(authorization, web_application_name, opts)\n [data, status_code, headers]\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def get_approval_rules()\n build_header_auth('/approval_rules', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n #puts \"Request headers\\n\"\n @header.each do |name, value|\n request[name] = value\n\n #puts name+\": \"+value\n end\n\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n\n end", "def ruleset(name_and_chain, &block)\n name, chain = parse_ruleset_name(name_and_chain)\n if @rulesets.key?(name)\n ruleset = @rulesets[name]\n ruleset.update(chain, &block)\n else\n ruleset = Ruleset.new(self, name_and_chain, &block)\n @rulesets[name] = ruleset\n end\n ruleset\n end", "def get_rule(method)\n return Rules::Rule.enabled if rule_engine.nil?\n control_id = rule_control_id(method).to_sym\n rule_engine.evaluate(control_id)\n end", "def all_defined_rules\n if @group\n @defined_rules.merge(@group.all_defined_rules)\n else\n @defined_rules\n end\n end", "def index\n if !params[:ids].nil?\n ids = params[:ids].split \",\"\n @rules = Rule.find(ids)\n else\n if params[:query].nil? or params[:query].length < 2\n @rules = []\n else\n @rules = Rule.with_query(params[:query])\n end\n end\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def delete_inbox_ruleset(id, opts = {})\n delete_inbox_ruleset_with_http_info(id, opts)\n nil\n end", "def rules1\n @rules1\nend", "def set_reminder_rule\n @reminder_rule = ReminderRule.find(params[:id])\n end", "def external_rules\n @external_rules ||= rules.dup.external\n end", "def rules\n @rules.dup.freeze\n end", "def show\n @rule_set = RuleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def get_messages where = \"inbox\", opts = {}\n query = {\n mark: false\n }\n query.merge! opts\n get(\"/message/#{where}.json\", query: query)\n end", "def to_a\n @rules.keys\n end", "def rule_set_artifacts\n @rule_set_artifacts ||= []\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def all\n get(\"#{domain}/mailboxes\")\n end", "def reference\n :rules\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end" ]
[ "0.7306557", "0.66872704", "0.6485104", "0.6325704", "0.61333424", "0.60435486", "0.58460385", "0.57955986", "0.57066685", "0.5694549", "0.55562836", "0.55260766", "0.54777145", "0.54563564", "0.54500496", "0.5356801", "0.5356801", "0.5356363", "0.52597237", "0.5253154", "0.5239964", "0.5228296", "0.52274543", "0.52222836", "0.5172485", "0.5160136", "0.5160136", "0.51560795", "0.5144185", "0.5127537", "0.50579995", "0.50459564", "0.5037017", "0.5032277", "0.50256246", "0.49974492", "0.4994522", "0.4994522", "0.4994522", "0.49872756", "0.498508", "0.498508", "0.4956241", "0.4951795", "0.49449256", "0.49344605", "0.49098098", "0.49073794", "0.48983097", "0.48875403", "0.48846743", "0.48824587", "0.48717943", "0.4848074", "0.48269323", "0.48220447", "0.48220447", "0.48220447", "0.48220447", "0.48220447", "0.48097238", "0.4801323", "0.47799206", "0.47692245", "0.47451118", "0.47436312", "0.47246954", "0.47204262", "0.4705099", "0.46833298", "0.46750125", "0.46732673", "0.46669954", "0.46638533", "0.4660659", "0.4660659", "0.4660659", "0.4660659", "0.46591556", "0.46453583", "0.46428838", "0.46171954", "0.4605123", "0.46025756", "0.46025756", "0.46025756", "0.4597564", "0.4577893", "0.4556537", "0.45480892", "0.45419693", "0.4533586", "0.45296237", "0.45249364", "0.45223883", "0.45174214", "0.4511113", "0.45034075", "0.45031026", "0.45031026" ]
0.660201
2
Get an inbox ruleset Get inbox ruleset
def get_inbox_ruleset_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_ruleset ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling InboxRulesetControllerApi.get_inbox_ruleset" end # resource path local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'InboxRulesetDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboxRulesetControllerApi#get_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def get_inbox_ruleset(id, opts = {})\n data, _status_code, _headers = get_inbox_ruleset_with_http_info(id, opts)\n data\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def get_rules\r\n @rules\r\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_rules(service=Azure::ServiceBus::Rules)\n service.all(self)\n end", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def ruleset(ruleset, ctx)\r\n rulelist = rulelist(ruleset, ctx)\r\n\r\n cmtSuffix = \"\"\r\n ruleParams = \"#{ruleset.execType}\" # Build the ruleset parameter list.\r\n\r\n if (ruleset.type == \"PL\")\r\n ruleParams += \", PL\"\r\n cmtSuffix += \"(PowerLookup)\"\r\n end # if ruleset.type\r\n\r\n aliasStmt = \"\" # Don't create an alias statement if it is not needed.\r\n\r\n if (ruleset.name != ruleset.alias)\r\n aliasStmt = <<EOF\r\nalias(ruleset, #{ruleset.name}, \"#{ruleset.alias}\");\r\nEOF\r\n end # if ruleset.name...\r\n\r\n\r\n out = <<EOF\r\n#{aliasStmt}\r\n/* ==========================================================================\r\n * #{ruleset.name} #{cmtSuffix}\r\n *\r\n *\r\n */\r\nruleset #{ruleset.name}(#{ruleParams})\r\n#{rulelist}\r\nend // ruleset #{ruleset.name}(#{ruleParams})\r\n\r\n\r\n\r\n\r\nEOF\r\n\r\n return out\r\n\r\n end", "def get_rules(scope = nil)\n path = scope ? \"/pushrules/#{scope}\" : '/pushrules'\n make_request(:get, path).parsed_response\n end", "def inbox\n folders.find_by_name(\"Inbox\")\n end", "def inbox\n folders.find_by_name(\"Inbox\")\n end", "def all\n @rules\n end", "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def rules\n return @rules\n end", "def get_rule(name, service=Azure::ServiceBus::Rules)\n service.get(self, name)\n end", "def rule_by_id; end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def get_ruleset(application_id, campaign_id, ruleset_id, opts = {})\n data, _status_code, _headers = get_ruleset_with_http_info(application_id, campaign_id, ruleset_id, opts)\n data\n end", "def rules(options={})\n get('getNotificationRules', options)\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def get_rule(rule_id)\n get(\"rules/#{rule_id}\")\n end", "def get_staging_rule_sets\n get(\"#{url_base}/staging/rule_sets?#{dc}\")[\"data\"]\n end", "def inbox\n return @defaults.objectForKey(:inbox)\n end", "def rules\n @rules ||= {}\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def rule_get(ref)\n rule_table.get(self, setup_package_id(ref))\n end", "def get_mailboxes\n get(\"mailboxes\")\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def inbound_rules\n @inbound_rules ||= normalized_security_rules.one_direction_rules(\"inbound\")\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def get_rule(scope, kind, id)\n make_request(:get, \"/pushrules/#{scope}/#{kind}/#{id}\").parsed_response\n end", "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def rule_by_id(rule_id)\n url = @base_url + '/rules/' + rule_id\n valid_codes = [NSXConstants::CODE_CREATED,\n NSXConstants::CODE_OK,\n NSXConstants::CODE_BAD_REQUEST,\n NSXConstants::CODE_NOT_FOUND]\n additional_headers = []\n @nsx_client.get(url, additional_headers, valid_codes)\n end", "def rules\n self.class.rules\n end", "def find_rule(id)\n @sec_grp_objs.select { |security_group| security_group.rules.select{ |rule| rule.id == id }}\n end", "def get_rulesets(application_id, campaign_id, opts = {})\n data, _status_code, _headers = get_rulesets_with_http_info(application_id, campaign_id, opts)\n data\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rules_ids\n @rules_registry.rules.map(&:id)\n end", "def get_all_config_rules\n config_rules = []\n\n # Fetch all rules with pagination\n response = @client.describe_config_rules\n config_rules += response.config_rules\n while response.next_token\n response = @client.describe_config_rules(next_token: response.next_token)\n config_rules += response.config_rules\n end\n config_rules = config_rules.map(&:to_h)\n\n # Add necessary data to rules using helpers\n add_compliance_to_config_rules(config_rules)\n add_results_to_config_rules(config_rules)\n end", "def by_id(id)\n @rules.select { |rule| rule.id == id }\n end", "def GetRules\n Builtins.y2milestone(\"Getting Rules: %1\", @tomerge)\n\n scheme = AutoinstConfig.scheme\n host = AutoinstConfig.host\n filepath = AutoinstConfig.filepath\n directory = AutoinstConfig.directory\n\n valid = []\n stop = false\n Builtins.foreach(@tomerge) do |file|\n if !stop\n dir = dirname(file)\n if dir != \"\"\n SCR.Execute(\n path(\".target.mkdir\"),\n Ops.add(Ops.add(AutoinstConfig.local_rules_location, \"/\"), dir)\n )\n end\n\n localfile = Ops.add(\n Ops.add(AutoinstConfig.local_rules_location, \"/\"),\n file\n )\n if !Get(\n scheme,\n host,\n Ops.add(Ops.add(directory, \"/\"), file),\n localfile\n )\n Builtins.y2error(\n \"Error while fetching file: %1\",\n Ops.add(Ops.add(directory, \"/\"), file)\n )\n else\n stop = true if @Behaviour == :one\n valid = Builtins.add(valid, file)\n end\n end\n end\n @tomerge = deep_copy(valid)\n if Builtins.size(@tomerge) == 0\n Builtins.y2milestone(\"No files from rules found\")\n return false\n else\n return true\n end\n end", "def rules\n rule_applier.rules\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def get_all(provider = :aws)\n @@_rule_set_registry.fetch(provider, {}).values\n end", "def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end", "def get_rule(rule)\n @rules[rule]\n end", "def rules(section_id = @one_section_id)\n url = @url_sections + '/' + section_id + '/rules'\n @nsx_client.get(url)\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def imap_select_inbox\n imap.select('INBOX')\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def for_rule(rule_name)\n @rules.fetch(rule_name.to_sym, {})\n end", "def parse_firewall_rules\n script_code = 'netsh advfirewall firewall show rule name=all verbose'\n cmd = powershell_out(script_code) # Not logged because it makes too much noise\n\n retval = parse_firewall_paragraphs(cmd)\n\n raise 'Could not parse firewall rules' if retval.empty?\n return retval\n end", "def [](ruleset)\n for_ruleset(ruleset)\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def rules_by_name; end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def content_rules_get(authorization, web_application_name, opts = {})\n data, status_code, headers = content_rules_get_with_http_info(authorization, web_application_name, opts)\n [data, status_code, headers]\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def get_approval_rules()\n build_header_auth('/approval_rules', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n #puts \"Request headers\\n\"\n @header.each do |name, value|\n request[name] = value\n\n #puts name+\": \"+value\n end\n\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n\n end", "def ruleset(name_and_chain, &block)\n name, chain = parse_ruleset_name(name_and_chain)\n if @rulesets.key?(name)\n ruleset = @rulesets[name]\n ruleset.update(chain, &block)\n else\n ruleset = Ruleset.new(self, name_and_chain, &block)\n @rulesets[name] = ruleset\n end\n ruleset\n end", "def get_rule(method)\n return Rules::Rule.enabled if rule_engine.nil?\n control_id = rule_control_id(method).to_sym\n rule_engine.evaluate(control_id)\n end", "def all_defined_rules\n if @group\n @defined_rules.merge(@group.all_defined_rules)\n else\n @defined_rules\n end\n end", "def index\n if !params[:ids].nil?\n ids = params[:ids].split \",\"\n @rules = Rule.find(ids)\n else\n if params[:query].nil? or params[:query].length < 2\n @rules = []\n else\n @rules = Rule.with_query(params[:query])\n end\n end\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def delete_inbox_ruleset(id, opts = {})\n delete_inbox_ruleset_with_http_info(id, opts)\n nil\n end", "def rules1\n @rules1\nend", "def set_reminder_rule\n @reminder_rule = ReminderRule.find(params[:id])\n end", "def external_rules\n @external_rules ||= rules.dup.external\n end", "def rules\n @rules.dup.freeze\n end", "def show\n @rule_set = RuleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def get_messages where = \"inbox\", opts = {}\n query = {\n mark: false\n }\n query.merge! opts\n get(\"/message/#{where}.json\", query: query)\n end", "def to_a\n @rules.keys\n end", "def rule_set_artifacts\n @rule_set_artifacts ||= []\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def all\n get(\"#{domain}/mailboxes\")\n end", "def reference\n :rules\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end" ]
[ "0.7306557", "0.66872704", "0.660201", "0.6485104", "0.6325704", "0.61333424", "0.60435486", "0.58460385", "0.57955986", "0.57066685", "0.5694549", "0.55562836", "0.55260766", "0.54777145", "0.54500496", "0.5356801", "0.5356801", "0.5356363", "0.52597237", "0.5253154", "0.5239964", "0.5228296", "0.52274543", "0.52222836", "0.5172485", "0.5160136", "0.5160136", "0.51560795", "0.5144185", "0.5127537", "0.50579995", "0.50459564", "0.5037017", "0.5032277", "0.50256246", "0.49974492", "0.4994522", "0.4994522", "0.4994522", "0.49872756", "0.498508", "0.498508", "0.4956241", "0.4951795", "0.49449256", "0.49344605", "0.49098098", "0.49073794", "0.48983097", "0.48875403", "0.48846743", "0.48824587", "0.48717943", "0.4848074", "0.48269323", "0.48220447", "0.48220447", "0.48220447", "0.48220447", "0.48220447", "0.48097238", "0.4801323", "0.47799206", "0.47692245", "0.47451118", "0.47436312", "0.47246954", "0.47204262", "0.4705099", "0.46833298", "0.46750125", "0.46732673", "0.46669954", "0.46638533", "0.4660659", "0.4660659", "0.4660659", "0.4660659", "0.46591556", "0.46453583", "0.46428838", "0.46171954", "0.4605123", "0.46025756", "0.46025756", "0.46025756", "0.4597564", "0.4577893", "0.4556537", "0.45480892", "0.45419693", "0.4533586", "0.45296237", "0.45249364", "0.45223883", "0.45174214", "0.4511113", "0.45034075", "0.45031026", "0.45031026" ]
0.54563564
14
List inbox rulesets List all rulesets attached to an inbox
def get_inbox_rulesets(opts = {}) data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def all\n @rules\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_rulesets(application_id, campaign_id, opts = {})\n data, _status_code, _headers = get_rulesets_with_http_info(application_id, campaign_id, opts)\n data\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def dumpRulesets()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"RULESET DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@rulesets.length > 0)\r\n rulesets = @rulesets.sort\r\n rulesets.each do |key, ruleset|\r\n\r\n 40.times {print \"-\"}\r\n puts\r\n puts \"#{ruleset.name}\\t(#{ruleset.alias}) : #{ruleset.type} : #{ruleset.execType}\"\r\n ruleset.rules.each do |ruleAlias|\r\n puts \"\\t#{ruleAlias}\"\r\n end # rules.each\r\n puts \"\"\r\n\r\n end # rulesets.each\r\n\r\n else\r\n puts \"No rulesets to dump.\"\r\n end\r\n\r\n puts \"\"\r\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_all_config_rules\n config_rules = []\n\n # Fetch all rules with pagination\n response = @client.describe_config_rules\n config_rules += response.config_rules\n while response.next_token\n response = @client.describe_config_rules(next_token: response.next_token)\n config_rules += response.config_rules\n end\n config_rules = config_rules.map(&:to_h)\n\n # Add necessary data to rules using helpers\n add_compliance_to_config_rules(config_rules)\n add_results_to_config_rules(config_rules)\n end", "def get_rules\r\n @rules\r\n end", "def get_staging_rule_sets\n get(\"#{url_base}/staging/rule_sets?#{dc}\")[\"data\"]\n end", "def ruleset(ruleset, ctx)\r\n rulelist = rulelist(ruleset, ctx)\r\n\r\n cmtSuffix = \"\"\r\n ruleParams = \"#{ruleset.execType}\" # Build the ruleset parameter list.\r\n\r\n if (ruleset.type == \"PL\")\r\n ruleParams += \", PL\"\r\n cmtSuffix += \"(PowerLookup)\"\r\n end # if ruleset.type\r\n\r\n aliasStmt = \"\" # Don't create an alias statement if it is not needed.\r\n\r\n if (ruleset.name != ruleset.alias)\r\n aliasStmt = <<EOF\r\nalias(ruleset, #{ruleset.name}, \"#{ruleset.alias}\");\r\nEOF\r\n end # if ruleset.name...\r\n\r\n\r\n out = <<EOF\r\n#{aliasStmt}\r\n/* ==========================================================================\r\n * #{ruleset.name} #{cmtSuffix}\r\n *\r\n *\r\n */\r\nruleset #{ruleset.name}(#{ruleParams})\r\n#{rulelist}\r\nend // ruleset #{ruleset.name}(#{ruleParams})\r\n\r\n\r\n\r\n\r\nEOF\r\n\r\n return out\r\n\r\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def extended_grammar(sets)\n rules = []\n sets.each do |set|\n set.items.each do |item|\n if item.dot == 0\n rule = [item]\n next_item = item.next_item\n while next_item != nil\n rule << next_item\n next_item = next_item.next_item\n end\n rules << rule\n end\n end\n end\n rules\n end", "def get_inbox_ruleset(id, opts = {})\n data, _status_code, _headers = get_inbox_ruleset_with_http_info(id, opts)\n data\n end", "def get_rules(service=Azure::ServiceBus::Rules)\n service.all(self)\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def all_permission_sets(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'permissionSets', params)\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def rules_ids\n @rules_registry.rules.map(&:id)\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def get_rules(scope = nil)\n path = scope ? \"/pushrules/#{scope}\" : '/pushrules'\n make_request(:get, path).parsed_response\n end", "def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n return @rules\n end", "def print_rules(*names)\n names = nil if names.empty?\n puts \"(#{runner.root})\"\n runner.rulesets.each do |name, set|\n next unless names.member?(name.to_s) if names\n print \"#{name}\"\n print \" (#{set.chain.join(' ')})\" unless set.chain.empty?\n puts\n set.docs.each_with_index do |d, i|\n puts \" * #{d}\"\n end\n end\n\n #exit\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def rules\n @rules ||= {}\n end", "def index\n @rule_types = RuleType.all\n end", "def rules(section_id = @one_section_id)\n url = @url_sections + '/' + section_id + '/rules'\n @nsx_client.get(url)\n end", "def parse_firewall_rules\n script_code = 'netsh advfirewall firewall show rule name=all verbose'\n cmd = powershell_out(script_code) # Not logged because it makes too much noise\n\n retval = parse_firewall_paragraphs(cmd)\n\n raise 'Could not parse firewall rules' if retval.empty?\n return retval\n end", "def get_all(provider = :aws)\n @@_rule_set_registry.fetch(provider, {}).values\n end", "def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end", "def rules=(value)\n @rules = value\n end", "def rules\n self.class.rules\n end", "def rules(options={})\n get('getNotificationRules', options)\n end", "def rules(rule_name:, kind:)\n Rules::RuleSet.build_for(calendar: calendar, kind: kind).rules_with_name(rule_name)\n end", "def to_list\n rules.map do |rule|\n object = { actions: rule.actions, subject: rule.subjects.map{ |s| s.is_a?(Symbol) ? s : s.name } }\n object[:conditions] = rule.conditions unless rule.conditions.blank?\n object[:inverted] = true unless rule.base_behavior\n object\n end\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rules_by_name; end", "def dumpRules()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"RULE DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@rules.length > 0)\r\n rules = @rules.sort\r\n rules.each do |key, rule|\r\n puts \"#{rule.name}\\t(#{rule.alias})\"\r\n puts \"#{rule.xml}\"\r\n 40.times {print \"-\"}\r\n puts\r\n end\r\n\r\n else\r\n puts \"No rules to dump.\"\r\n end\r\n\r\n puts \"\"\r\n end", "def rule_names\n @rule_names ||= []\n end", "def rule_names\n @rule_names ||= []\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules\n rule_applier.rules\n end", "def all_defined_rules\n if @group\n @defined_rules.merge(@group.all_defined_rules)\n else\n @defined_rules\n end\n end", "def rules\n @rules.dup.freeze\n end", "def dump\n Wrapper.msc_rules_dump rules_ptr\n self\n end", "def all\n get(\"#{domain}/mailboxes\")\n end", "def export_rules(hits_per_page = 100, request_options = {}, &_block)\n res = []\n page = 0\n loop do\n curr = search_rules('', { :hitsPerPage => hits_per_page, :page => page }, request_options)['hits']\n curr.each do |rule|\n res << rule\n yield rule if block_given?\n end\n break if curr.size < hits_per_page\n page += 1\n end\n res\n end", "def rule_set_artifacts\n @rule_set_artifacts ||= []\n end", "def list\n @driver.getRuleNames\n end", "def index\n if !params[:ids].nil?\n ids = params[:ids].split \",\"\n @rules = Rule.find(ids)\n else\n if params[:query].nil? or params[:query].length < 2\n @rules = []\n else\n @rules = Rule.with_query(params[:query])\n end\n end\n end", "def available_rules\n\t\tif @rules.nil?\n\t\t\t@rules = []\n\t\t\tDir.glob(File.join(@rule_directory,\"**\",\"*.yar*\")).each do |yara_rule_file|\n\t\t\t\trule = YaraRule.new\n\t\t\t\trule.file_path = yara_rule_file.gsub(\"/\",\"\\\\\\\\\")\n\t\t\t\t@rules << rule\n\t\t\tend\n\t\tend\n\t\treturn @rules\n\tend", "def get_all_notification_rules(opts = {})\n data, _status_code, _headers = get_all_notification_rules_with_http_info(opts)\n data\n end", "def clear_rules!\n @rules = []\n end", "def rules\n return [] if @rules.empty?\n @rules.sort_by { |k| k['priority'] }.map { |h| h['rule_name'] }\n end", "def show\n @rule_set = RuleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def rules\n return @rules unless @rules.nil?\n\n # this initialization code runs only once\n @rules = {}\n 7.downto(0).each do |rule_key|\n key = rule_key.to_s(2).rjust(3, '0') # convert to binary, pad left with 0\n @rules[key.to_sym] = RULE_NAME >> rule_key & 1 # just the one bit\n end\n\n @rules\n end", "def index\n\t@account = Account.find(params[:account_id])\n @rules = @account.rules\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def get_ruleset(application_id, campaign_id, ruleset_id, opts = {})\n data, _status_code, _headers = get_ruleset_with_http_info(application_id, campaign_id, ruleset_id, opts)\n data\n end", "def index\n @query = SiteRule.ransack(params[:q])\n @site_rules = @query.result.page(params[:page]).per(10)\n end", "def mailboxes_list\n get \"mailboxes\"\n end", "def rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"STORING IN SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.add(@db_name, rules, @schema_graph, \"application/rdf+xml\")\n self\n end", "def index\n @rulemakings = Rulemaking.order(:rulemaking_name)\n end", "def LIST_RULES\n return @legacy.LIST_RULES if @legacy\n raise 'Using legacy auditd_rules LIST_RULES interface with non-legacy audit package. Please use the new syntax.'\n end", "def to_rules\n Array.new.tap do |rules|\n new_rule = Rule.new(rule.chain)\n new_rule.description = \"#{rule.description} (#{self.description})\"\n new_rule.rule = rule.rule.gsub(/\\{\\{(\\w+)\\}\\}/) do\n if value = self.options[$1.to_sym]\n value\n else\n \"{{#{$1}}}\"\n end\n end\n new_rule.action = rule.action\n new_rule.conditions = rule.conditions | self.conditions\n if self.version\n new_rule.versions = [self.version]\n end\n\n if has_host_group?\n host_group = @rule.chain.table.base.host_groups[self.options[:ip]]\n host_group.hosts.each do |key, host|\n host.ips.each do |v, ip|\n hg_rule = new_rule.dup\n hg_rule.description += \" (#{host.name} via #{host_group.name})\"\n hg_rule.rule.gsub!(host_group.name.to_s, ip)\n hg_rule.versions = [v]\n rules << hg_rule\n end\n end\n else\n rules << new_rule\n end\n end\n end", "def get_rulesets_with_http_info(application_id, campaign_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_rulesets ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_rulesets\"\n end\n # verify the required parameter 'campaign_id' is set\n if @api_client.config.client_side_validation && campaign_id.nil?\n fail ArgumentError, \"Missing the required parameter 'campaign_id' when calling ManagementApi.get_rulesets\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_rulesets, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_rulesets, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/rulesets'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2006' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\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: ManagementApi#get_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ruleset(name_and_chain, &block)\n name, chain = parse_ruleset_name(name_and_chain)\n if @rulesets.key?(name)\n ruleset = @rulesets[name]\n ruleset.update(chain, &block)\n else\n ruleset = Ruleset.new(self, name_and_chain, &block)\n @rulesets[name] = ruleset\n end\n ruleset\n end", "def index\n @rules = Rule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def delete_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_rulesets ...'\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#delete_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def printRules\n\t\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\tputs \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\tif @i == 1\n\t\tputs \"No rules to print!\"\n\telse\n\t\tputs \"Rules Loaded!\"\n\tend\nend", "def all\n rules = []\n\n raw.each do |type, details|\n # Add general rules\n Array(details['prefix']).each do |prefix|\n rules.push({\n prefix: prefix.to_s,\n length: details['length'],\n type: type\n })\n end\n\n # Process each country\n Array(details['countries']).each do |country, prefixes|\n # Add a rule for each prefix\n Array(prefixes).each do |prefix|\n rules.push({\n prefix: prefix.to_s,\n length: details['length'],\n type: type,\n country: country,\n })\n end\n end\n\n end\n\n # Sort by prefix length\n rules.sort { |x, y| y[:prefix].length <=> x[:prefix].length }\n end", "def rules\n @rules ||= Rules.new(path, logger)\n end", "def next_sets(cache)\n result = {}\n @items.each do |item|\n rule = item.rule\n dot = item.dot\n dotted = rule.productions[dot]\n \n if dot < rule.productions.length\n result[dotted] = [] if result[dotted] == nil\n result[dotted] << item\n end\n end\n \n res = []\n result.each do |symbol, items|\n new_items = []\n items.each{|item| new_items << Item.new(item.rule, item.dot + 1)}\n cached = cache[new_items]\n if cached\n set = cached\n else\n set = ItemSet.new(@rules, new_items).closure\n end\n \n items.each do |item|\n item.link = set\n set.reverse_ref item\n end\n \n res << set\n end\n res\n end", "def route_sets; end", "def list(options = {})\n @raw = send_get_request(@conn_no_err, ['/v1/acl/list'], options)\n parse_body\n end", "def index\n @lar_rules = LarRule.all\n end", "def consume_rules(flags = {})\n rules = []\n\n while token = @tokens.consume\n case token[:node]\n when :comment, :whitespace\n rules << token\n\n when :cdc, :cdo\n unless flags[:top_level]\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n\n when :at_keyword\n @tokens.reconsume\n rule = consume_at_rule\n rules << rule if rule\n\n else\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n end\n\n rules\n end" ]
[ "0.76426435", "0.7247974", "0.6769916", "0.64807636", "0.61858845", "0.6144545", "0.612242", "0.60838485", "0.60390484", "0.60120493", "0.59073216", "0.58550584", "0.57910347", "0.57639754", "0.5679666", "0.5676389", "0.5623009", "0.55354303", "0.55354303", "0.5493309", "0.5485691", "0.54374737", "0.5386582", "0.53776395", "0.53567487", "0.53567487", "0.53567487", "0.53567487", "0.53184617", "0.53179955", "0.53177494", "0.53143424", "0.5313607", "0.53048265", "0.5303846", "0.5303846", "0.52746403", "0.5265386", "0.5247787", "0.5247787", "0.5247787", "0.5243663", "0.5206752", "0.5194718", "0.5081588", "0.504173", "0.5034336", "0.5028186", "0.5011298", "0.4998837", "0.49686426", "0.49622202", "0.4953534", "0.4931852", "0.49261484", "0.49228707", "0.49164173", "0.49164173", "0.49146858", "0.49146858", "0.49146858", "0.49146858", "0.49146858", "0.49146858", "0.49146858", "0.4907873", "0.48975486", "0.48879007", "0.4887866", "0.4885161", "0.4877237", "0.48734814", "0.48720694", "0.48711854", "0.48666432", "0.4863884", "0.48606098", "0.4843388", "0.48191077", "0.48083785", "0.47934434", "0.47695765", "0.47629654", "0.47605145", "0.47572944", "0.4756505", "0.47353366", "0.47345984", "0.47300348", "0.47260007", "0.4713688", "0.47134084", "0.47015515", "0.46936378", "0.46934658", "0.4682827", "0.46821317", "0.46736085", "0.46732876", "0.4665703" ]
0.7625467
1
List inbox rulesets List all rulesets attached to an inbox
def get_inbox_rulesets_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...' end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/rulesets' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageInboxRulesetDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboxRulesetControllerApi#get_inbox_rulesets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def all\n @rules\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_rulesets(application_id, campaign_id, opts = {})\n data, _status_code, _headers = get_rulesets_with_http_info(application_id, campaign_id, opts)\n data\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def dumpRulesets()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"RULESET DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@rulesets.length > 0)\r\n rulesets = @rulesets.sort\r\n rulesets.each do |key, ruleset|\r\n\r\n 40.times {print \"-\"}\r\n puts\r\n puts \"#{ruleset.name}\\t(#{ruleset.alias}) : #{ruleset.type} : #{ruleset.execType}\"\r\n ruleset.rules.each do |ruleAlias|\r\n puts \"\\t#{ruleAlias}\"\r\n end # rules.each\r\n puts \"\"\r\n\r\n end # rulesets.each\r\n\r\n else\r\n puts \"No rulesets to dump.\"\r\n end\r\n\r\n puts \"\"\r\n end", "def get_all_config_rules\n config_rules = []\n\n # Fetch all rules with pagination\n response = @client.describe_config_rules\n config_rules += response.config_rules\n while response.next_token\n response = @client.describe_config_rules(next_token: response.next_token)\n config_rules += response.config_rules\n end\n config_rules = config_rules.map(&:to_h)\n\n # Add necessary data to rules using helpers\n add_compliance_to_config_rules(config_rules)\n add_results_to_config_rules(config_rules)\n end", "def get_rules\r\n @rules\r\n end", "def get_staging_rule_sets\n get(\"#{url_base}/staging/rule_sets?#{dc}\")[\"data\"]\n end", "def ruleset(ruleset, ctx)\r\n rulelist = rulelist(ruleset, ctx)\r\n\r\n cmtSuffix = \"\"\r\n ruleParams = \"#{ruleset.execType}\" # Build the ruleset parameter list.\r\n\r\n if (ruleset.type == \"PL\")\r\n ruleParams += \", PL\"\r\n cmtSuffix += \"(PowerLookup)\"\r\n end # if ruleset.type\r\n\r\n aliasStmt = \"\" # Don't create an alias statement if it is not needed.\r\n\r\n if (ruleset.name != ruleset.alias)\r\n aliasStmt = <<EOF\r\nalias(ruleset, #{ruleset.name}, \"#{ruleset.alias}\");\r\nEOF\r\n end # if ruleset.name...\r\n\r\n\r\n out = <<EOF\r\n#{aliasStmt}\r\n/* ==========================================================================\r\n * #{ruleset.name} #{cmtSuffix}\r\n *\r\n *\r\n */\r\nruleset #{ruleset.name}(#{ruleParams})\r\n#{rulelist}\r\nend // ruleset #{ruleset.name}(#{ruleParams})\r\n\r\n\r\n\r\n\r\nEOF\r\n\r\n return out\r\n\r\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def extended_grammar(sets)\n rules = []\n sets.each do |set|\n set.items.each do |item|\n if item.dot == 0\n rule = [item]\n next_item = item.next_item\n while next_item != nil\n rule << next_item\n next_item = next_item.next_item\n end\n rules << rule\n end\n end\n end\n rules\n end", "def get_inbox_ruleset(id, opts = {})\n data, _status_code, _headers = get_inbox_ruleset_with_http_info(id, opts)\n data\n end", "def get_rules(service=Azure::ServiceBus::Rules)\n service.all(self)\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def all_permission_sets(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'permissionSets', params)\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def rules_ids\n @rules_registry.rules.map(&:id)\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def get_rules(scope = nil)\n path = scope ? \"/pushrules/#{scope}\" : '/pushrules'\n make_request(:get, path).parsed_response\n end", "def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n return @rules\n end", "def print_rules(*names)\n names = nil if names.empty?\n puts \"(#{runner.root})\"\n runner.rulesets.each do |name, set|\n next unless names.member?(name.to_s) if names\n print \"#{name}\"\n print \" (#{set.chain.join(' ')})\" unless set.chain.empty?\n puts\n set.docs.each_with_index do |d, i|\n puts \" * #{d}\"\n end\n end\n\n #exit\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def rules\n @rules ||= {}\n end", "def index\n @rule_types = RuleType.all\n end", "def rules(section_id = @one_section_id)\n url = @url_sections + '/' + section_id + '/rules'\n @nsx_client.get(url)\n end", "def parse_firewall_rules\n script_code = 'netsh advfirewall firewall show rule name=all verbose'\n cmd = powershell_out(script_code) # Not logged because it makes too much noise\n\n retval = parse_firewall_paragraphs(cmd)\n\n raise 'Could not parse firewall rules' if retval.empty?\n return retval\n end", "def get_all(provider = :aws)\n @@_rule_set_registry.fetch(provider, {}).values\n end", "def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end", "def rules=(value)\n @rules = value\n end", "def rules\n self.class.rules\n end", "def rules(options={})\n get('getNotificationRules', options)\n end", "def rules(rule_name:, kind:)\n Rules::RuleSet.build_for(calendar: calendar, kind: kind).rules_with_name(rule_name)\n end", "def to_list\n rules.map do |rule|\n object = { actions: rule.actions, subject: rule.subjects.map{ |s| s.is_a?(Symbol) ? s : s.name } }\n object[:conditions] = rule.conditions unless rule.conditions.blank?\n object[:inverted] = true unless rule.base_behavior\n object\n end\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rules_by_name; end", "def dumpRules()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"RULE DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@rules.length > 0)\r\n rules = @rules.sort\r\n rules.each do |key, rule|\r\n puts \"#{rule.name}\\t(#{rule.alias})\"\r\n puts \"#{rule.xml}\"\r\n 40.times {print \"-\"}\r\n puts\r\n end\r\n\r\n else\r\n puts \"No rules to dump.\"\r\n end\r\n\r\n puts \"\"\r\n end", "def rule_names\n @rule_names ||= []\n end", "def rule_names\n @rule_names ||= []\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules\n rule_applier.rules\n end", "def all_defined_rules\n if @group\n @defined_rules.merge(@group.all_defined_rules)\n else\n @defined_rules\n end\n end", "def rules\n @rules.dup.freeze\n end", "def dump\n Wrapper.msc_rules_dump rules_ptr\n self\n end", "def all\n get(\"#{domain}/mailboxes\")\n end", "def export_rules(hits_per_page = 100, request_options = {}, &_block)\n res = []\n page = 0\n loop do\n curr = search_rules('', { :hitsPerPage => hits_per_page, :page => page }, request_options)['hits']\n curr.each do |rule|\n res << rule\n yield rule if block_given?\n end\n break if curr.size < hits_per_page\n page += 1\n end\n res\n end", "def rule_set_artifacts\n @rule_set_artifacts ||= []\n end", "def list\n @driver.getRuleNames\n end", "def index\n if !params[:ids].nil?\n ids = params[:ids].split \",\"\n @rules = Rule.find(ids)\n else\n if params[:query].nil? or params[:query].length < 2\n @rules = []\n else\n @rules = Rule.with_query(params[:query])\n end\n end\n end", "def available_rules\n\t\tif @rules.nil?\n\t\t\t@rules = []\n\t\t\tDir.glob(File.join(@rule_directory,\"**\",\"*.yar*\")).each do |yara_rule_file|\n\t\t\t\trule = YaraRule.new\n\t\t\t\trule.file_path = yara_rule_file.gsub(\"/\",\"\\\\\\\\\")\n\t\t\t\t@rules << rule\n\t\t\tend\n\t\tend\n\t\treturn @rules\n\tend", "def get_all_notification_rules(opts = {})\n data, _status_code, _headers = get_all_notification_rules_with_http_info(opts)\n data\n end", "def clear_rules!\n @rules = []\n end", "def rules\n return [] if @rules.empty?\n @rules.sort_by { |k| k['priority'] }.map { |h| h['rule_name'] }\n end", "def show\n @rule_set = RuleSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @rule_set }\n end\n end", "def rules\n return @rules unless @rules.nil?\n\n # this initialization code runs only once\n @rules = {}\n 7.downto(0).each do |rule_key|\n key = rule_key.to_s(2).rjust(3, '0') # convert to binary, pad left with 0\n @rules[key.to_sym] = RULE_NAME >> rule_key & 1 # just the one bit\n end\n\n @rules\n end", "def index\n\t@account = Account.find(params[:account_id])\n @rules = @account.rules\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def get_ruleset(application_id, campaign_id, ruleset_id, opts = {})\n data, _status_code, _headers = get_ruleset_with_http_info(application_id, campaign_id, ruleset_id, opts)\n data\n end", "def index\n @query = SiteRule.ransack(params[:q])\n @site_rules = @query.result.page(params[:page]).per(10)\n end", "def mailboxes_list\n get \"mailboxes\"\n end", "def rules(rules)\n rules = QL.to_rules(rules)\n GRel::Debugger.debug \"STORING IN SCHEMA #{@schema_graph}\"\n GRel::Debugger.debug rules\n GRel::Debugger.debug \"IN\"\n GRel::Debugger.debug @db_name\n @connection.add(@db_name, rules, @schema_graph, \"application/rdf+xml\")\n self\n end", "def index\n @rulemakings = Rulemaking.order(:rulemaking_name)\n end", "def LIST_RULES\n return @legacy.LIST_RULES if @legacy\n raise 'Using legacy auditd_rules LIST_RULES interface with non-legacy audit package. Please use the new syntax.'\n end", "def to_rules\n Array.new.tap do |rules|\n new_rule = Rule.new(rule.chain)\n new_rule.description = \"#{rule.description} (#{self.description})\"\n new_rule.rule = rule.rule.gsub(/\\{\\{(\\w+)\\}\\}/) do\n if value = self.options[$1.to_sym]\n value\n else\n \"{{#{$1}}}\"\n end\n end\n new_rule.action = rule.action\n new_rule.conditions = rule.conditions | self.conditions\n if self.version\n new_rule.versions = [self.version]\n end\n\n if has_host_group?\n host_group = @rule.chain.table.base.host_groups[self.options[:ip]]\n host_group.hosts.each do |key, host|\n host.ips.each do |v, ip|\n hg_rule = new_rule.dup\n hg_rule.description += \" (#{host.name} via #{host_group.name})\"\n hg_rule.rule.gsub!(host_group.name.to_s, ip)\n hg_rule.versions = [v]\n rules << hg_rule\n end\n end\n else\n rules << new_rule\n end\n end\n end", "def get_rulesets_with_http_info(application_id, campaign_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_rulesets ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_rulesets\"\n end\n # verify the required parameter 'campaign_id' is set\n if @api_client.config.client_side_validation && campaign_id.nil?\n fail ArgumentError, \"Missing the required parameter 'campaign_id' when calling ManagementApi.get_rulesets\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_rulesets, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_rulesets, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/applications/{applicationId}/campaigns/{campaignId}/rulesets'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2006' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\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: ManagementApi#get_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ruleset(name_and_chain, &block)\n name, chain = parse_ruleset_name(name_and_chain)\n if @rulesets.key?(name)\n ruleset = @rulesets[name]\n ruleset.update(chain, &block)\n else\n ruleset = Ruleset.new(self, name_and_chain, &block)\n @rulesets[name] = ruleset\n end\n ruleset\n end", "def index\n @rules = Rule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rules }\n end\n end", "def delete_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.delete_inbox_rulesets ...'\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\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] \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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#delete_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def printRules\n\t\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\tputs \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\tif @i == 1\n\t\tputs \"No rules to print!\"\n\telse\n\t\tputs \"Rules Loaded!\"\n\tend\nend", "def all\n rules = []\n\n raw.each do |type, details|\n # Add general rules\n Array(details['prefix']).each do |prefix|\n rules.push({\n prefix: prefix.to_s,\n length: details['length'],\n type: type\n })\n end\n\n # Process each country\n Array(details['countries']).each do |country, prefixes|\n # Add a rule for each prefix\n Array(prefixes).each do |prefix|\n rules.push({\n prefix: prefix.to_s,\n length: details['length'],\n type: type,\n country: country,\n })\n end\n end\n\n end\n\n # Sort by prefix length\n rules.sort { |x, y| y[:prefix].length <=> x[:prefix].length }\n end", "def rules\n @rules ||= Rules.new(path, logger)\n end", "def next_sets(cache)\n result = {}\n @items.each do |item|\n rule = item.rule\n dot = item.dot\n dotted = rule.productions[dot]\n \n if dot < rule.productions.length\n result[dotted] = [] if result[dotted] == nil\n result[dotted] << item\n end\n end\n \n res = []\n result.each do |symbol, items|\n new_items = []\n items.each{|item| new_items << Item.new(item.rule, item.dot + 1)}\n cached = cache[new_items]\n if cached\n set = cached\n else\n set = ItemSet.new(@rules, new_items).closure\n end\n \n items.each do |item|\n item.link = set\n set.reverse_ref item\n end\n \n res << set\n end\n res\n end", "def route_sets; end", "def list(options = {})\n @raw = send_get_request(@conn_no_err, ['/v1/acl/list'], options)\n parse_body\n end", "def index\n @lar_rules = LarRule.all\n end", "def consume_rules(flags = {})\n rules = []\n\n while token = @tokens.consume\n case token[:node]\n when :comment, :whitespace\n rules << token\n\n when :cdc, :cdo\n unless flags[:top_level]\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n\n when :at_keyword\n @tokens.reconsume\n rule = consume_at_rule\n rules << rule if rule\n\n else\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n end\n\n rules\n end" ]
[ "0.76426435", "0.7625467", "0.7247974", "0.6769916", "0.64807636", "0.61858845", "0.6144545", "0.612242", "0.60838485", "0.60390484", "0.60120493", "0.59073216", "0.57910347", "0.57639754", "0.5679666", "0.5676389", "0.5623009", "0.55354303", "0.55354303", "0.5493309", "0.5485691", "0.54374737", "0.5386582", "0.53776395", "0.53567487", "0.53567487", "0.53567487", "0.53567487", "0.53184617", "0.53179955", "0.53177494", "0.53143424", "0.5313607", "0.53048265", "0.5303846", "0.5303846", "0.52746403", "0.5265386", "0.5247787", "0.5247787", "0.5247787", "0.5243663", "0.5206752", "0.5194718", "0.5081588", "0.504173", "0.5034336", "0.5028186", "0.5011298", "0.4998837", "0.49686426", "0.49622202", "0.4953534", "0.4931852", "0.49261484", "0.49228707", "0.49164173", "0.49164173", "0.49146858", "0.49146858", "0.49146858", "0.49146858", "0.49146858", "0.49146858", "0.49146858", "0.4907873", "0.48975486", "0.48879007", "0.4887866", "0.4885161", "0.4877237", "0.48734814", "0.48720694", "0.48711854", "0.48666432", "0.4863884", "0.48606098", "0.4843388", "0.48191077", "0.48083785", "0.47934434", "0.47695765", "0.47629654", "0.47605145", "0.47572944", "0.4756505", "0.47353366", "0.47345984", "0.47300348", "0.47260007", "0.4713688", "0.47134084", "0.47015515", "0.46936378", "0.46934658", "0.4682827", "0.46821317", "0.46736085", "0.46732876", "0.4665703" ]
0.58550584
12
Test an inbox ruleset Test an inbox ruleset
def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {}) data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def boolean_rule_test_sets\n {\n 'not set': 'fail',\n 'set': 'pass'\n }\nend", "def test_authorize_according_to_one_rule\n rule_or = rules(:active_or_rule) # friends or members of group tkk can view name of person 1\n rule_and = rules(:active_and_rule) # friends who are members of group tkk can view email of person 1\n\n action_view_name = actions(:view_name)\n action_view_email = actions(:view_email)\n object_person = people(:valid_person) # person id 1\n subject_person_test = people(:test) # not friend, not member of group tkk\n subject_person_4 = people(:friend) # person 4 is a friend, but not a member of group tkk\n subject_person_1aa = people(:person1) # person 1aa is a friend, and also a member of group tkk\n\n assert subject_person_1aa.contacts.include? object_person\n assert subject_person_1aa.is_member_of? groups(:tkk)\n\n assert !rule_or.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert rule_and.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_email.action_type, action_view_email.action_value)\n end", "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}/test'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_new_inbox_ruleset ...'\n end\n # verify the required parameter 'test_new_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && test_new_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'test_new_inbox_ruleset_options' when calling InboxRulesetControllerApi.test_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(test_new_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_authorize\n object_person = people(:valid_person) # person_id 1\n subject_person_1aa = people(:person1) # person_id 1aa\n subject_person_2aa = people(:person3) # person_id 2aa\n \n assert Rule.authorize?(subject_person_1aa, object_person.id, \"view\", \"email\")\n assert !Rule.authorize?(subject_person_2aa, object_person.id, \"view\",\"email\")\n\n end", "def test(rule)\n rule.exec(self)[-1]\n end", "def test(rule)\n position = pos\n events = apply_rule(rule, position, [])\n self.pos = position\n events[-1]\n end", "def set_test_rule\n @test_rule = TestRule.find(params[:id])\n end", "def test_active?\n active_rule = rules(:active_or_rule)\n assert active_rule.active?, \"The rule should be active\"\n inactive_rule = rules(:inactive_rule)\n assert !inactive_rule.active?, \"The rule should be inactive\"\n end", "def rule_assert( obj )\r\n # add object as a new fact\r\n f = fact(obj)\r\n # get_relevant_rules\r\n logger.debug( \"Check if we need to add more rules\") if logger\r\n add_relevant_rules_for_fact(f)\r\n sort_relevant_rules\r\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def test_create_timebase_acl_rule\n user = createUser(\"1\")\n node = createNode(\"1\")\n res = @s.set_node_acl_rule_entries(node, user, {\"jcr:read\" => \"granted\"}, {\"rule\" => \"TestingThatRuleWorks\"})\n\tassert_equal(\"200\",res.code,\"Failed to add Rule ACL \"+res.body)\t\n\t\n\tacl = @s.get_node_ruleacl(node)\n\t@s.log.info(acl)\n\tassert_equal(1,acl.size)\n\t\n\truleace = findRuleAce(acl, user.name)\n\tassert_not_nil(ruleace)\n\tassert_equal(0,ruleace[\"order\"])\n\tgranted = ruleace[\"granted\"]\n\tassert_equal(1,granted.size)\n\tassert_equal(\"jcr:read\",granted[0])\n\tdenied = ruleace[\"denied\"]\n\tassert_nil(denied)\n\tassert_equal(\"TestingThatRuleWorks\",ruleace[\"sakai:rule-processor\"])\n\t\n\t\n\t\n\t\n end", "def test_emails\n end", "def test_check_condition_logged_in\n rule = rules(:test_rule)\n # expose private methods of the test object rule\n class << rule\n public :check_condition_logged_in\n end\n\n subject_person1 = nil\n subject_person2 = people(:valid_person)\n assert !rule.check_condition_logged_in(subject_person1, true)\n assert rule.check_condition_logged_in(subject_person2, true)\n assert rule.check_condition_logged_in(subject_person1, false)\n assert !rule.check_condition_logged_in(subject_person2, false)\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def test_startchangeset_invalid_wrong_user\n user = create(:user)\n user2 = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user2.email}:test\", {}, cs_id, \"delete\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -2, result[0]\n assert_equal \"The user doesn't own that changeset\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n end", "def run(rule)\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def tests\n config.tests(subject)\n end", "def test_multiple_recipients\r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n initial_bob_plan_count = bob.planner.plans.length\r\n initial_existingbob_plan_count = existingbob.planner.plans.length\r\n initial_longbob_plan_count = longbob.planner.plans.length\r\n \r\n Mailman.receive(@multiple_recipients_string)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n assert_equal initial_bob_plan_count + 1, bob.planner.plans.length\r\n assert_equal initial_existingbob_plan_count + 1, existingbob.planner.plans.length\r\n assert_equal initial_longbob_plan_count, longbob.planner.plans.length\r\n end", "def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_ut_t2_ars_arc_012\n current_user = User.find_by_id(TCANA_MEMBER_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert !ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def test_ut_t2_ars_arc_011\n current_user = User.find_by_id(TCANA_ADMIN_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @test_rules = TestRule.all\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def evaluate\r\n @status = PASS\r\n @assert = true\r\n @num_executed = 0;\r\n @num_evaluated = 0;\r\n \r\n get_relevant_rules()\r\n logger.debug(\"no relevant rules\") if logger && @relevant_rules.size==0\r\n \r\n #begin #rescue\r\n \r\n # loop through the available_rules, evaluating each one,\r\n # until there are no more matching rules available\r\n begin # loop\r\n \r\n # the loop condition is reset to break by default after every iteration\r\n matches = false\r\n obj = nil #deprecated\r\n \r\n #logger.debug(\"available rules: #{available_rules.size.to_s}\") if logger\r\n @relevant_rules.each do |rule|\r\n # RuleCheckErrors are caught and swallowed and the rule that\r\n # raised the error is removed from the working-set.\r\n logger.debug(\"evaluating: #{rule}\") if logger\r\n begin\r\n @num_evaluated += 1\r\n if rule.conditions_match?(obj)\r\n logger.debug(\"rule #{rule} matched\") if logger\r\n matches = true\r\n \r\n # remove the rule from the working-set so it's not re-evaluated\r\n @relevant_rules.delete(rule)\r\n \r\n # find all parameter-matching dependencies of this rule and\r\n # add them to the working-set.\r\n if @dependencies.has_key?(rule.name)\r\n logger.debug( \"found dependant rules to #{rule}\") if logger\r\n @relevant_rules += @dependencies[rule.name].select do |dependency|\r\n dependency.parameters_match?(obj)\r\n end\r\n end\r\n \r\n # execute this rule\r\n logger.debug(\"executing rule #{rule}\") if logger\r\n rule.call(obj)\r\n @num_executed += 1\r\n \r\n # break the current iteration and start back from the first rule defined.\r\n break\r\n end # if rule.conditions_match?(obj)\r\n \r\n rescue RuleConsequenceError\r\n fail\r\n rescue RuleCheckError => e\r\n fail\r\n end # begin/rescue\r\n \r\n end # available_rules.each\r\n \r\n end while(matches && @assert)\r\n \r\n #rescue RuleConsequenceError => rce\r\n # RuleConsequenceErrors are allowed to break out of the current assertion,\r\n # then the inner error is bubbled-up to the asserting code.\r\n # @status = FAIL\r\n # raise rce.inner_error\r\n #end\r\n \r\n @assert = false\r\n \r\n return @status\r\n end", "def test_is_applicable_to_test_models\n\t[\"LargeHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"LargeOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"MediumOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"PrimarySchool-90.1-2007-ASHRAE 169-2006-2A.osm\", \"SecondarySchool-90.1-2010-ASHRAE 169-2006-4A.osm\", \"SmallHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"SmallOffice-90.1-2010-ASHRAE 169-2006-2A.osm\"].each do |m|\n\t\tresult,_ = applytotestmodel(m)\n\t\tassert_equal(\"Success\", result.value.valueName)\n end\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def testExactMatchWithAll\n initTestCase do\n $Context[:SlaveActions] = [\n [ Tools::All, 'DummyAction', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n Tools::All => {\n 'DummyAction' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def rule; end", "def rule; end", "def rule; end", "def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def test_ensure_mail_wasnt_sent_when_grader_takes_on_report\n login_as :donna\n post :auto_assign\n assert_equal(0, @emails.size)\n\n=begin\n\n email = @emails.first\n assert_match(/A grader has picked up your report on/ , email.subject)\n assert_match(/Once the grader has completed grading your report, you will get another email notification/, email.body)\n\n=end\n\n end", "def test_ut_t5_sef_con_010\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:waiting_but_no_analyzing]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:waiting_but_no_analyzing])\n assert email_title.include?(\"There is at least 1 waiting task but no analyzing task\")\n end", "def assert_reviewables_on_team(team_set)\n team_set.thinkspace_team_teams.each do |team|\n members = team.thinkspace_common_users\n ts = get_team_set_for_team(team)\n if ts.present?\n members.each do |member|\n rs = get_review_set_for_ownerable(ts, member)\n if rs.present?\n rs.thinkspace_peer_assessment_reviews.each do |review|\n assert_reviewable_on_team(review, members)\n end\n end\n end\n end\n end\nend", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def test_ut_t5_sef_con_013\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:create])\n assert email_title.include?(\"Subtask is created\")\n end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rule_by_id; end", "def test(_action, _action_feats, _user_feats)\n return false unless @rules.has_key? _action\n\n # if any of the test groups passes, then test is passed.\n @rules[_action].each do |tests|\n return true if self.test_aux(tests, _action_feats, _user_feats)\n end\n\n return false\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def ruleset(ruleset, ctx)\r\n rulelist = rulelist(ruleset, ctx)\r\n\r\n cmtSuffix = \"\"\r\n ruleParams = \"#{ruleset.execType}\" # Build the ruleset parameter list.\r\n\r\n if (ruleset.type == \"PL\")\r\n ruleParams += \", PL\"\r\n cmtSuffix += \"(PowerLookup)\"\r\n end # if ruleset.type\r\n\r\n aliasStmt = \"\" # Don't create an alias statement if it is not needed.\r\n\r\n if (ruleset.name != ruleset.alias)\r\n aliasStmt = <<EOF\r\nalias(ruleset, #{ruleset.name}, \"#{ruleset.alias}\");\r\nEOF\r\n end # if ruleset.name...\r\n\r\n\r\n out = <<EOF\r\n#{aliasStmt}\r\n/* ==========================================================================\r\n * #{ruleset.name} #{cmtSuffix}\r\n *\r\n *\r\n */\r\nruleset #{ruleset.name}(#{ruleParams})\r\n#{rulelist}\r\nend // ruleset #{ruleset.name}(#{ruleParams})\r\n\r\n\r\n\r\n\r\nEOF\r\n\r\n return out\r\n\r\n end", "def assert_team_ids_reassigned(team_set)\n team_ids = team_set.thinkspace_team_teams.pluck(:id)\n get_assessment.thinkspace_peer_assessment_team_sets.each do |ts|\n assert_include team_ids, ts.team_id\n end\nend", "def run_test\n rdfa_string = input\n \n # Run\n @rdfa_parser = RdfaParser::RdfaParser.new\n yield(rdfa_string, rdfa_parser)\n\n query_string = results\n\n triples = self.triples rescue nil\n \n if (query_string.match(/UNION|OPTIONAL/) || title.match(/XML/)) && triples\n # Check triples, as Rasql doesn't implement UNION\n parser = NTriplesParser.new(triples, tcpath)\n @rdfa_parser.graph.should be_equivalent_graph(parser.graph, self)\n else\n # Run SPARQL query\n @rdfa_parser.graph.should pass_query(query_string, self)\n end\n\n @rdfa_parser.graph.to_rdfxml.should be_valid_xml\n end", "def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n end", "def test_ut_t5_sef_con_008\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:change])\n assert email_title.include?(\"Subtask state is changed\")\n end", "def assert(obj)\r\n @rule_set.rule_assert(obj)\r\n end", "def set_rule\n @rule = params[:rule].to_i\n\n if @rule == 0 or @rule == 1 or @rule == 2\n else\n @rule = 0\n end\n end", "def test_ut_t5_sef_con_011\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:delete]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:delete])\n assert email_title.include?(\"Subtask is deleted\")\n end", "def submatchers; end", "def test_ut_t2_ars_arc_013\n # pu admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n # pu ars\n pu_id = PrivilegesUsers.find_all_by_user_id(current_user.id)[0].pu_id\n ars = Pu.find_by_id(pu_id).analyze_rule_configs[0]\n #\n assert ars.editable?(current_user,pu_id,nil)\n end", "def test_rule1_more_can_attend_one_even_if_fewer_can_attend_both\n student_a = Student.new(\"a\", [MONDAY_8, MONDAY_12], [WEDNESDAY_13, WEDNESDAY_18])\n student_b = Student.new(\"b\", [MONDAY_12, MONDAY_14], [WEDNESDAY_18, WEDNESDAY_19])\n student_c = Student.new(\"c\", [MONDAY_8, MONDAY_15], [WEDNESDAY_7, WEDNESDAY_20])\n student_d = Student.new(\"d\", [MONDAY_8, MONDAY_16], [WEDNESDAY_9, WEDNESDAY_21])\n group = StudentGroup.new([student_a, student_b, student_c, student_d])\n\n assert_equal \"8:00 AM EDT (12:00 UTC)\\n\\na\\nc\\nd\", group.monday_roster.to_s\n assert_equal \"6:00 PM EDT (22:00 UTC)\\n\\na\\nb\", group.wednesday_roster.to_s\n end", "def subsequent_rules(*args); end", "def subsequent_rules(*args); end", "def password_rule_test_sets\n {\n 'not set': 'pass',\n 'parameter with NoEcho': 'pass',\n 'parameter with NoEcho and Default value': 'fail',\n 'parameter as a literal in plaintext': 'fail',\n 'as a literal in plaintext': 'fail',\n 'from Secrets Manager': 'pass',\n 'from Secure Systems Manager': 'pass',\n 'from Systems Manager': 'fail'\n }\nend", "def test_boolean_sets\n Sets.rcreate(@alice, :name => 'and')\n Sets.rcreate(@alice, :name => 'or')\n @alice.items[0].add_tag '|'\n @alice.items[1].add_tag '&'\n @alice.items(\n \"sets.name\" => 'and',\n \"rating\" => ['>=', 4],\n :order_by => [[:rating, :desc]]\n )\n end", "def tests\n parser.flow_items\n end", "def fail(message = nil)\r\n @rule_set.fail(message)\r\n end", "def test_feetToMeters\n\t\temail = EmailLogMain.new\n\t\temailHash = email.makeHash\n\t\temailString = emailHash[\"B6C161B2004\"]\n\n# START OF TESTING!\n\t\tassert(true,File.exist?(email.getFileName))\n#Checks if our regular expressions find the correct items needed for our report\n\t\tassert_equal(\"20131211132505.999FB1B2003@toilers.Mines.EDU\",email.RegexExist(\"messageid\",emailString))#Messageid\n\t\tassert_equal(\"echopper@mines.edu\", email.RegexExist(\"to\",emailString)) #to email\n\t\tassert_equal(\"root@toilers.Mines.EDU\",email.RegexExist(\"from\",emailString)) #from email\n\t\tassert_equal(\"6072\",email.RegexExist(\"size\",emailString))#size\n\t\tassert_equal(\"B6C161B2004\",email.RegexExist(\"uniqueid\",emailString)) #uniqueID\n\n#This test will show how many reg expression this program finds for each item\n\t\tassert_equal(3, emailString.scan(@@TO_REGEX).size) #to email\n\t\tassert_equal(1, emailString.scan(@@MESSAGE_ID_REGEX).size) #messageid\n\t\tassert_equal(1, emailString.scan(@@SIZE_REGEX).size) #size\n\t\tassert_equal(6, emailString.scan(@@TIMESTAMP_REGEX).size) #Time\n\t\tassert_equal(1, emailString.scan(@@FROM_REGEX).size) #from email\n\t\tassert_equal(6, emailString.scan(@@UNIQUE_ID).size) #uniqueID\n\n\t\t#This test will check for the correct ammount of emails since every email has a unique message ID \n\t\t#Messageid == total number of email i.e. the size of our hash\t\t\n\t\tholdEntireString = IO.read(email.getFileName)\n\t\tassert_equal(emailHash.length, holdEntireString.scan(@@MESSAGE_ID_REGEX).size)\n\tend", "def test_q11_b_all\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n end", "def test_ut_t5_sef_pj_010\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n email_settings = EmailSetting.find_all_by_pj_id(new_pj.id)\n email_settings.each do |setting|\n assert_equal TCANA_ADMIN_ID.to_s, setting.user_ids\n end\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def rules_by_name; end", "def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...'\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#create_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def testExactMatch2Actions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ],\n 'DummyAction2' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def process_rules *args, &block\n Shotshare::ProcessRuleContainer.instance.rules = \\\n Docile.dsl_eval(Shotshare::Dsl::ProcessRuleBuilder.new, &block).build\nend", "def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end", "def test_loadproducts\n rules = PaymentRules.instance\n Products.load_business_rules('simpleRules.txt')\n checker = rules.processPayment('book')\n assert_equal(checker, true)\n checker = rules.processPayment('membership')\n assert_equal(checker, true)\n checker = rules.processPayment('dog')\n assert_equal(checker, false)\n end", "def test_ut_t2_ars_ard_006\n ars_detail = AnalyzeRuleConfigDetail.find(:first)\n ars_detail.rule_numbers = \"1,2,3,4,5\"\n ars_detail.save\n assert_equal ars_detail.rule_number_list, [\"1\",\"2\",\"3\",\"4\",\"5\"]\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def testExactMatch1Of2\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test_truth\n assert groups(:teacher_group).has_user(users(:teacheruser))\n assert ! groups(:admin_group).has_user(users(:teacheruser))\n assert groups(:admin_group).has_user(users(:adminuser))\n end", "def test_lists\r\n nodelist = @mymodel.node_list\r\n linklist = @mymodel.link_list\r\n \r\n assert(nodelist.size == 0)\r\n assert(linklist.size == 0)\r\n end", "def test_ut_t5_sef_con_007\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n WRONG_ID,OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.blank?\n end", "def test_ut_t5_sef_pj_004\n current_user = User.find(TCANA_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 4,users.size\n end\n end", "def test_ut_t5_sef_con_001\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:change],OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.include?(\"has changed from\")\n end", "def test_workflow\n\n #create a random agent\n randomagent = UUIDTools::UUID.timestamp_create.to_s\n @zendeskclient.createuser(randomagent+='@gmail.com', 'Harish', \"4\", \"0\", [134692])\n assert_equal(201, @zendeskclient.responsecode)\n #lets make sure the /user/#{id}.xml exists\n\n usercreationresponse = @zendeskclient.response\n begin\n resource = RestClient::Resource.new usercreationresponse, @username, @pswd\n rescue\n assert(false) # if we hit this assertion for any reason means, we cannot access the user file\n # which means we have failed\n end\n\n # create ticket with the same user as created above as requester\n # this is implemented by using the same email id as before\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', randomagent)\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match(@host))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n\n end" ]
[ "0.68785197", "0.6313421", "0.59523785", "0.58934397", "0.5879393", "0.56199455", "0.55669504", "0.5560386", "0.5536923", "0.55095834", "0.5430169", "0.5301235", "0.5293016", "0.52534896", "0.52376497", "0.5207789", "0.51600164", "0.51548076", "0.51447135", "0.5132889", "0.5127631", "0.5126079", "0.51205033", "0.5106832", "0.50789434", "0.5052373", "0.50516313", "0.5028137", "0.5010731", "0.50008637", "0.49862736", "0.4983894", "0.4980148", "0.49777436", "0.4966249", "0.49450973", "0.4934255", "0.49246964", "0.49212942", "0.49212942", "0.49212942", "0.4916735", "0.49029675", "0.48961926", "0.48859063", "0.48786438", "0.48786438", "0.48786438", "0.48786438", "0.48786438", "0.48786438", "0.48786438", "0.4871201", "0.48699257", "0.48669654", "0.4855154", "0.48507085", "0.4843807", "0.4838486", "0.483282", "0.48174495", "0.47970793", "0.47914782", "0.4785811", "0.47700906", "0.47617593", "0.47611666", "0.47587276", "0.4755129", "0.4746858", "0.47434548", "0.47293404", "0.47293404", "0.47214425", "0.4720323", "0.47197065", "0.47155976", "0.4707541", "0.4706284", "0.47044638", "0.470313", "0.46902665", "0.46841767", "0.4679115", "0.46654302", "0.46521366", "0.4648796", "0.46487916", "0.46459904", "0.46459904", "0.46459904", "0.46459904", "0.46414518", "0.46401", "0.46353605", "0.4631428", "0.46283448", "0.46180147", "0.46126935", "0.46116385" ]
0.6450755
1
Test an inbox ruleset Test an inbox ruleset
def test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_ruleset ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling InboxRulesetControllerApi.test_inbox_ruleset" end # verify the required parameter 'inbox_ruleset_test_options' is set if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil? fail ArgumentError, "Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_ruleset" end # resource path local_var_path = '/rulesets/{id}/test'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) # return_type return_type = opts[:return_type] || 'InboxRulesetTestResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboxRulesetControllerApi#test_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def boolean_rule_test_sets\n {\n 'not set': 'fail',\n 'set': 'pass'\n }\nend", "def test_authorize_according_to_one_rule\n rule_or = rules(:active_or_rule) # friends or members of group tkk can view name of person 1\n rule_and = rules(:active_and_rule) # friends who are members of group tkk can view email of person 1\n\n action_view_name = actions(:view_name)\n action_view_email = actions(:view_email)\n object_person = people(:valid_person) # person id 1\n subject_person_test = people(:test) # not friend, not member of group tkk\n subject_person_4 = people(:friend) # person 4 is a friend, but not a member of group tkk\n subject_person_1aa = people(:person1) # person 1aa is a friend, and also a member of group tkk\n\n assert subject_person_1aa.contacts.include? object_person\n assert subject_person_1aa.is_member_of? groups(:tkk)\n\n assert !rule_or.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert rule_and.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_email.action_type, action_view_email.action_value)\n end", "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_new_inbox_ruleset ...'\n end\n # verify the required parameter 'test_new_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && test_new_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'test_new_inbox_ruleset_options' when calling InboxRulesetControllerApi.test_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(test_new_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_authorize\n object_person = people(:valid_person) # person_id 1\n subject_person_1aa = people(:person1) # person_id 1aa\n subject_person_2aa = people(:person3) # person_id 2aa\n \n assert Rule.authorize?(subject_person_1aa, object_person.id, \"view\", \"email\")\n assert !Rule.authorize?(subject_person_2aa, object_person.id, \"view\",\"email\")\n\n end", "def test(rule)\n rule.exec(self)[-1]\n end", "def test(rule)\n position = pos\n events = apply_rule(rule, position, [])\n self.pos = position\n events[-1]\n end", "def set_test_rule\n @test_rule = TestRule.find(params[:id])\n end", "def test_active?\n active_rule = rules(:active_or_rule)\n assert active_rule.active?, \"The rule should be active\"\n inactive_rule = rules(:inactive_rule)\n assert !inactive_rule.active?, \"The rule should be inactive\"\n end", "def rule_assert( obj )\r\n # add object as a new fact\r\n f = fact(obj)\r\n # get_relevant_rules\r\n logger.debug( \"Check if we need to add more rules\") if logger\r\n add_relevant_rules_for_fact(f)\r\n sort_relevant_rules\r\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def test_create_timebase_acl_rule\n user = createUser(\"1\")\n node = createNode(\"1\")\n res = @s.set_node_acl_rule_entries(node, user, {\"jcr:read\" => \"granted\"}, {\"rule\" => \"TestingThatRuleWorks\"})\n\tassert_equal(\"200\",res.code,\"Failed to add Rule ACL \"+res.body)\t\n\t\n\tacl = @s.get_node_ruleacl(node)\n\t@s.log.info(acl)\n\tassert_equal(1,acl.size)\n\t\n\truleace = findRuleAce(acl, user.name)\n\tassert_not_nil(ruleace)\n\tassert_equal(0,ruleace[\"order\"])\n\tgranted = ruleace[\"granted\"]\n\tassert_equal(1,granted.size)\n\tassert_equal(\"jcr:read\",granted[0])\n\tdenied = ruleace[\"denied\"]\n\tassert_nil(denied)\n\tassert_equal(\"TestingThatRuleWorks\",ruleace[\"sakai:rule-processor\"])\n\t\n\t\n\t\n\t\n end", "def test_emails\n end", "def test_check_condition_logged_in\n rule = rules(:test_rule)\n # expose private methods of the test object rule\n class << rule\n public :check_condition_logged_in\n end\n\n subject_person1 = nil\n subject_person2 = people(:valid_person)\n assert !rule.check_condition_logged_in(subject_person1, true)\n assert rule.check_condition_logged_in(subject_person2, true)\n assert rule.check_condition_logged_in(subject_person1, false)\n assert !rule.check_condition_logged_in(subject_person2, false)\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def test_startchangeset_invalid_wrong_user\n user = create(:user)\n user2 = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user2.email}:test\", {}, cs_id, \"delete\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -2, result[0]\n assert_equal \"The user doesn't own that changeset\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n end", "def run(rule)\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def tests\n config.tests(subject)\n end", "def test_multiple_recipients\r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n initial_bob_plan_count = bob.planner.plans.length\r\n initial_existingbob_plan_count = existingbob.planner.plans.length\r\n initial_longbob_plan_count = longbob.planner.plans.length\r\n \r\n Mailman.receive(@multiple_recipients_string)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n assert_equal initial_bob_plan_count + 1, bob.planner.plans.length\r\n assert_equal initial_existingbob_plan_count + 1, existingbob.planner.plans.length\r\n assert_equal initial_longbob_plan_count, longbob.planner.plans.length\r\n end", "def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_ut_t2_ars_arc_012\n current_user = User.find_by_id(TCANA_MEMBER_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert !ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def test_ut_t2_ars_arc_011\n current_user = User.find_by_id(TCANA_ADMIN_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @test_rules = TestRule.all\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def evaluate\r\n @status = PASS\r\n @assert = true\r\n @num_executed = 0;\r\n @num_evaluated = 0;\r\n \r\n get_relevant_rules()\r\n logger.debug(\"no relevant rules\") if logger && @relevant_rules.size==0\r\n \r\n #begin #rescue\r\n \r\n # loop through the available_rules, evaluating each one,\r\n # until there are no more matching rules available\r\n begin # loop\r\n \r\n # the loop condition is reset to break by default after every iteration\r\n matches = false\r\n obj = nil #deprecated\r\n \r\n #logger.debug(\"available rules: #{available_rules.size.to_s}\") if logger\r\n @relevant_rules.each do |rule|\r\n # RuleCheckErrors are caught and swallowed and the rule that\r\n # raised the error is removed from the working-set.\r\n logger.debug(\"evaluating: #{rule}\") if logger\r\n begin\r\n @num_evaluated += 1\r\n if rule.conditions_match?(obj)\r\n logger.debug(\"rule #{rule} matched\") if logger\r\n matches = true\r\n \r\n # remove the rule from the working-set so it's not re-evaluated\r\n @relevant_rules.delete(rule)\r\n \r\n # find all parameter-matching dependencies of this rule and\r\n # add them to the working-set.\r\n if @dependencies.has_key?(rule.name)\r\n logger.debug( \"found dependant rules to #{rule}\") if logger\r\n @relevant_rules += @dependencies[rule.name].select do |dependency|\r\n dependency.parameters_match?(obj)\r\n end\r\n end\r\n \r\n # execute this rule\r\n logger.debug(\"executing rule #{rule}\") if logger\r\n rule.call(obj)\r\n @num_executed += 1\r\n \r\n # break the current iteration and start back from the first rule defined.\r\n break\r\n end # if rule.conditions_match?(obj)\r\n \r\n rescue RuleConsequenceError\r\n fail\r\n rescue RuleCheckError => e\r\n fail\r\n end # begin/rescue\r\n \r\n end # available_rules.each\r\n \r\n end while(matches && @assert)\r\n \r\n #rescue RuleConsequenceError => rce\r\n # RuleConsequenceErrors are allowed to break out of the current assertion,\r\n # then the inner error is bubbled-up to the asserting code.\r\n # @status = FAIL\r\n # raise rce.inner_error\r\n #end\r\n \r\n @assert = false\r\n \r\n return @status\r\n end", "def test_is_applicable_to_test_models\n\t[\"LargeHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"LargeOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"MediumOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"PrimarySchool-90.1-2007-ASHRAE 169-2006-2A.osm\", \"SecondarySchool-90.1-2010-ASHRAE 169-2006-4A.osm\", \"SmallHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"SmallOffice-90.1-2010-ASHRAE 169-2006-2A.osm\"].each do |m|\n\t\tresult,_ = applytotestmodel(m)\n\t\tassert_equal(\"Success\", result.value.valueName)\n end\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def testExactMatchWithAll\n initTestCase do\n $Context[:SlaveActions] = [\n [ Tools::All, 'DummyAction', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n Tools::All => {\n 'DummyAction' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def rule; end", "def rule; end", "def rule; end", "def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def test_ensure_mail_wasnt_sent_when_grader_takes_on_report\n login_as :donna\n post :auto_assign\n assert_equal(0, @emails.size)\n\n=begin\n\n email = @emails.first\n assert_match(/A grader has picked up your report on/ , email.subject)\n assert_match(/Once the grader has completed grading your report, you will get another email notification/, email.body)\n\n=end\n\n end", "def test_ut_t5_sef_con_010\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:waiting_but_no_analyzing]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:waiting_but_no_analyzing])\n assert email_title.include?(\"There is at least 1 waiting task but no analyzing task\")\n end", "def assert_reviewables_on_team(team_set)\n team_set.thinkspace_team_teams.each do |team|\n members = team.thinkspace_common_users\n ts = get_team_set_for_team(team)\n if ts.present?\n members.each do |member|\n rs = get_review_set_for_ownerable(ts, member)\n if rs.present?\n rs.thinkspace_peer_assessment_reviews.each do |review|\n assert_reviewable_on_team(review, members)\n end\n end\n end\n end\n end\nend", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def test_ut_t5_sef_con_013\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:create])\n assert email_title.include?(\"Subtask is created\")\n end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rule_by_id; end", "def test(_action, _action_feats, _user_feats)\n return false unless @rules.has_key? _action\n\n # if any of the test groups passes, then test is passed.\n @rules[_action].each do |tests|\n return true if self.test_aux(tests, _action_feats, _user_feats)\n end\n\n return false\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def ruleset(ruleset, ctx)\r\n rulelist = rulelist(ruleset, ctx)\r\n\r\n cmtSuffix = \"\"\r\n ruleParams = \"#{ruleset.execType}\" # Build the ruleset parameter list.\r\n\r\n if (ruleset.type == \"PL\")\r\n ruleParams += \", PL\"\r\n cmtSuffix += \"(PowerLookup)\"\r\n end # if ruleset.type\r\n\r\n aliasStmt = \"\" # Don't create an alias statement if it is not needed.\r\n\r\n if (ruleset.name != ruleset.alias)\r\n aliasStmt = <<EOF\r\nalias(ruleset, #{ruleset.name}, \"#{ruleset.alias}\");\r\nEOF\r\n end # if ruleset.name...\r\n\r\n\r\n out = <<EOF\r\n#{aliasStmt}\r\n/* ==========================================================================\r\n * #{ruleset.name} #{cmtSuffix}\r\n *\r\n *\r\n */\r\nruleset #{ruleset.name}(#{ruleParams})\r\n#{rulelist}\r\nend // ruleset #{ruleset.name}(#{ruleParams})\r\n\r\n\r\n\r\n\r\nEOF\r\n\r\n return out\r\n\r\n end", "def assert_team_ids_reassigned(team_set)\n team_ids = team_set.thinkspace_team_teams.pluck(:id)\n get_assessment.thinkspace_peer_assessment_team_sets.each do |ts|\n assert_include team_ids, ts.team_id\n end\nend", "def run_test\n rdfa_string = input\n \n # Run\n @rdfa_parser = RdfaParser::RdfaParser.new\n yield(rdfa_string, rdfa_parser)\n\n query_string = results\n\n triples = self.triples rescue nil\n \n if (query_string.match(/UNION|OPTIONAL/) || title.match(/XML/)) && triples\n # Check triples, as Rasql doesn't implement UNION\n parser = NTriplesParser.new(triples, tcpath)\n @rdfa_parser.graph.should be_equivalent_graph(parser.graph, self)\n else\n # Run SPARQL query\n @rdfa_parser.graph.should pass_query(query_string, self)\n end\n\n @rdfa_parser.graph.to_rdfxml.should be_valid_xml\n end", "def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n end", "def test_ut_t5_sef_con_008\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:change])\n assert email_title.include?(\"Subtask state is changed\")\n end", "def assert(obj)\r\n @rule_set.rule_assert(obj)\r\n end", "def set_rule\n @rule = params[:rule].to_i\n\n if @rule == 0 or @rule == 1 or @rule == 2\n else\n @rule = 0\n end\n end", "def test_ut_t5_sef_con_011\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:delete]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:delete])\n assert email_title.include?(\"Subtask is deleted\")\n end", "def submatchers; end", "def test_ut_t2_ars_arc_013\n # pu admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n # pu ars\n pu_id = PrivilegesUsers.find_all_by_user_id(current_user.id)[0].pu_id\n ars = Pu.find_by_id(pu_id).analyze_rule_configs[0]\n #\n assert ars.editable?(current_user,pu_id,nil)\n end", "def test_rule1_more_can_attend_one_even_if_fewer_can_attend_both\n student_a = Student.new(\"a\", [MONDAY_8, MONDAY_12], [WEDNESDAY_13, WEDNESDAY_18])\n student_b = Student.new(\"b\", [MONDAY_12, MONDAY_14], [WEDNESDAY_18, WEDNESDAY_19])\n student_c = Student.new(\"c\", [MONDAY_8, MONDAY_15], [WEDNESDAY_7, WEDNESDAY_20])\n student_d = Student.new(\"d\", [MONDAY_8, MONDAY_16], [WEDNESDAY_9, WEDNESDAY_21])\n group = StudentGroup.new([student_a, student_b, student_c, student_d])\n\n assert_equal \"8:00 AM EDT (12:00 UTC)\\n\\na\\nc\\nd\", group.monday_roster.to_s\n assert_equal \"6:00 PM EDT (22:00 UTC)\\n\\na\\nb\", group.wednesday_roster.to_s\n end", "def subsequent_rules(*args); end", "def subsequent_rules(*args); end", "def password_rule_test_sets\n {\n 'not set': 'pass',\n 'parameter with NoEcho': 'pass',\n 'parameter with NoEcho and Default value': 'fail',\n 'parameter as a literal in plaintext': 'fail',\n 'as a literal in plaintext': 'fail',\n 'from Secrets Manager': 'pass',\n 'from Secure Systems Manager': 'pass',\n 'from Systems Manager': 'fail'\n }\nend", "def test_boolean_sets\n Sets.rcreate(@alice, :name => 'and')\n Sets.rcreate(@alice, :name => 'or')\n @alice.items[0].add_tag '|'\n @alice.items[1].add_tag '&'\n @alice.items(\n \"sets.name\" => 'and',\n \"rating\" => ['>=', 4],\n :order_by => [[:rating, :desc]]\n )\n end", "def tests\n parser.flow_items\n end", "def fail(message = nil)\r\n @rule_set.fail(message)\r\n end", "def test_feetToMeters\n\t\temail = EmailLogMain.new\n\t\temailHash = email.makeHash\n\t\temailString = emailHash[\"B6C161B2004\"]\n\n# START OF TESTING!\n\t\tassert(true,File.exist?(email.getFileName))\n#Checks if our regular expressions find the correct items needed for our report\n\t\tassert_equal(\"20131211132505.999FB1B2003@toilers.Mines.EDU\",email.RegexExist(\"messageid\",emailString))#Messageid\n\t\tassert_equal(\"echopper@mines.edu\", email.RegexExist(\"to\",emailString)) #to email\n\t\tassert_equal(\"root@toilers.Mines.EDU\",email.RegexExist(\"from\",emailString)) #from email\n\t\tassert_equal(\"6072\",email.RegexExist(\"size\",emailString))#size\n\t\tassert_equal(\"B6C161B2004\",email.RegexExist(\"uniqueid\",emailString)) #uniqueID\n\n#This test will show how many reg expression this program finds for each item\n\t\tassert_equal(3, emailString.scan(@@TO_REGEX).size) #to email\n\t\tassert_equal(1, emailString.scan(@@MESSAGE_ID_REGEX).size) #messageid\n\t\tassert_equal(1, emailString.scan(@@SIZE_REGEX).size) #size\n\t\tassert_equal(6, emailString.scan(@@TIMESTAMP_REGEX).size) #Time\n\t\tassert_equal(1, emailString.scan(@@FROM_REGEX).size) #from email\n\t\tassert_equal(6, emailString.scan(@@UNIQUE_ID).size) #uniqueID\n\n\t\t#This test will check for the correct ammount of emails since every email has a unique message ID \n\t\t#Messageid == total number of email i.e. the size of our hash\t\t\n\t\tholdEntireString = IO.read(email.getFileName)\n\t\tassert_equal(emailHash.length, holdEntireString.scan(@@MESSAGE_ID_REGEX).size)\n\tend", "def test_q11_b_all\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n end", "def test_ut_t5_sef_pj_010\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n email_settings = EmailSetting.find_all_by_pj_id(new_pj.id)\n email_settings.each do |setting|\n assert_equal TCANA_ADMIN_ID.to_s, setting.user_ids\n end\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def rules_by_name; end", "def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...'\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#create_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def testExactMatch2Actions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ],\n 'DummyAction2' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def process_rules *args, &block\n Shotshare::ProcessRuleContainer.instance.rules = \\\n Docile.dsl_eval(Shotshare::Dsl::ProcessRuleBuilder.new, &block).build\nend", "def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end", "def test_loadproducts\n rules = PaymentRules.instance\n Products.load_business_rules('simpleRules.txt')\n checker = rules.processPayment('book')\n assert_equal(checker, true)\n checker = rules.processPayment('membership')\n assert_equal(checker, true)\n checker = rules.processPayment('dog')\n assert_equal(checker, false)\n end", "def test_ut_t2_ars_ard_006\n ars_detail = AnalyzeRuleConfigDetail.find(:first)\n ars_detail.rule_numbers = \"1,2,3,4,5\"\n ars_detail.save\n assert_equal ars_detail.rule_number_list, [\"1\",\"2\",\"3\",\"4\",\"5\"]\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def testExactMatch1Of2\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test_truth\n assert groups(:teacher_group).has_user(users(:teacheruser))\n assert ! groups(:admin_group).has_user(users(:teacheruser))\n assert groups(:admin_group).has_user(users(:adminuser))\n end", "def test_lists\r\n nodelist = @mymodel.node_list\r\n linklist = @mymodel.link_list\r\n \r\n assert(nodelist.size == 0)\r\n assert(linklist.size == 0)\r\n end", "def test_ut_t5_sef_con_007\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n WRONG_ID,OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.blank?\n end", "def test_ut_t5_sef_pj_004\n current_user = User.find(TCANA_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 4,users.size\n end\n end", "def test_ut_t5_sef_con_001\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:change],OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.include?(\"has changed from\")\n end", "def test_workflow\n\n #create a random agent\n randomagent = UUIDTools::UUID.timestamp_create.to_s\n @zendeskclient.createuser(randomagent+='@gmail.com', 'Harish', \"4\", \"0\", [134692])\n assert_equal(201, @zendeskclient.responsecode)\n #lets make sure the /user/#{id}.xml exists\n\n usercreationresponse = @zendeskclient.response\n begin\n resource = RestClient::Resource.new usercreationresponse, @username, @pswd\n rescue\n assert(false) # if we hit this assertion for any reason means, we cannot access the user file\n # which means we have failed\n end\n\n # create ticket with the same user as created above as requester\n # this is implemented by using the same email id as before\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', randomagent)\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match(@host))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n\n end" ]
[ "0.68785197", "0.6450755", "0.6313421", "0.59523785", "0.58934397", "0.5879393", "0.55669504", "0.5560386", "0.5536923", "0.55095834", "0.5430169", "0.5301235", "0.5293016", "0.52534896", "0.52376497", "0.5207789", "0.51600164", "0.51548076", "0.51447135", "0.5132889", "0.5127631", "0.5126079", "0.51205033", "0.5106832", "0.50789434", "0.5052373", "0.50516313", "0.5028137", "0.5010731", "0.50008637", "0.49862736", "0.4983894", "0.4980148", "0.49777436", "0.4966249", "0.49450973", "0.4934255", "0.49246964", "0.49212942", "0.49212942", "0.49212942", "0.4916735", "0.49029675", "0.48961926", "0.48859063", "0.48786438", "0.48786438", "0.48786438", "0.48786438", "0.48786438", "0.48786438", "0.48786438", "0.4871201", "0.48699257", "0.48669654", "0.4855154", "0.48507085", "0.4843807", "0.4838486", "0.483282", "0.48174495", "0.47970793", "0.47914782", "0.4785811", "0.47700906", "0.47617593", "0.47611666", "0.47587276", "0.4755129", "0.4746858", "0.47434548", "0.47293404", "0.47293404", "0.47214425", "0.4720323", "0.47197065", "0.47155976", "0.4707541", "0.4706284", "0.47044638", "0.470313", "0.46902665", "0.46841767", "0.4679115", "0.46654302", "0.46521366", "0.4648796", "0.46487916", "0.46459904", "0.46459904", "0.46459904", "0.46459904", "0.46414518", "0.46401", "0.46353605", "0.4631428", "0.46283448", "0.46180147", "0.46126935", "0.46116385" ]
0.56199455
6
Test inbox rulesets for inbox Test inbox rulesets for inbox
def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {}) data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def boolean_rule_test_sets\n {\n 'not set': 'fail',\n 'set': 'pass'\n }\nend", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_new_inbox_ruleset ...'\n end\n # verify the required parameter 'test_new_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && test_new_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'test_new_inbox_ruleset_options' when calling InboxRulesetControllerApi.test_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(test_new_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_authorize_according_to_one_rule\n rule_or = rules(:active_or_rule) # friends or members of group tkk can view name of person 1\n rule_and = rules(:active_and_rule) # friends who are members of group tkk can view email of person 1\n\n action_view_name = actions(:view_name)\n action_view_email = actions(:view_email)\n object_person = people(:valid_person) # person id 1\n subject_person_test = people(:test) # not friend, not member of group tkk\n subject_person_4 = people(:friend) # person 4 is a friend, but not a member of group tkk\n subject_person_1aa = people(:person1) # person 1aa is a friend, and also a member of group tkk\n\n assert subject_person_1aa.contacts.include? object_person\n assert subject_person_1aa.is_member_of? groups(:tkk)\n\n assert !rule_or.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert rule_and.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_email.action_type, action_view_email.action_value)\n end", "def test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}/test'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_emails\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def test_create_timebase_acl_rule\n user = createUser(\"1\")\n node = createNode(\"1\")\n res = @s.set_node_acl_rule_entries(node, user, {\"jcr:read\" => \"granted\"}, {\"rule\" => \"TestingThatRuleWorks\"})\n\tassert_equal(\"200\",res.code,\"Failed to add Rule ACL \"+res.body)\t\n\t\n\tacl = @s.get_node_ruleacl(node)\n\t@s.log.info(acl)\n\tassert_equal(1,acl.size)\n\t\n\truleace = findRuleAce(acl, user.name)\n\tassert_not_nil(ruleace)\n\tassert_equal(0,ruleace[\"order\"])\n\tgranted = ruleace[\"granted\"]\n\tassert_equal(1,granted.size)\n\tassert_equal(\"jcr:read\",granted[0])\n\tdenied = ruleace[\"denied\"]\n\tassert_nil(denied)\n\tassert_equal(\"TestingThatRuleWorks\",ruleace[\"sakai:rule-processor\"])\n\t\n\t\n\t\n\t\n end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def tests\n config.tests(subject)\n end", "def test_multiple_recipients\r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n initial_bob_plan_count = bob.planner.plans.length\r\n initial_existingbob_plan_count = existingbob.planner.plans.length\r\n initial_longbob_plan_count = longbob.planner.plans.length\r\n \r\n Mailman.receive(@multiple_recipients_string)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n assert_equal initial_bob_plan_count + 1, bob.planner.plans.length\r\n assert_equal initial_existingbob_plan_count + 1, existingbob.planner.plans.length\r\n assert_equal initial_longbob_plan_count, longbob.planner.plans.length\r\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def _test_testNamespaces ; process_test_case(\"testNamespaces\") ; end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def index\n @test_rules = TestRule.all\n end", "def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end", "def check_rank_rules\n defined_rules.each do |scoped_model, level_and_rules|\n level_and_rules.sort.each do |level, rule|\n grant_when_applies(scoped_model, rule, level)\n end\n end\n end", "def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...'\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#create_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_inbox_ruleset(id, opts = {})\n data, _status_code, _headers = get_inbox_ruleset_with_http_info(id, opts)\n data\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def assert_reviewables_on_team(team_set)\n team_set.thinkspace_team_teams.each do |team|\n members = team.thinkspace_common_users\n ts = get_team_set_for_team(team)\n if ts.present?\n members.each do |member|\n rs = get_review_set_for_ownerable(ts, member)\n if rs.present?\n rs.thinkspace_peer_assessment_reviews.each do |review|\n assert_reviewable_on_team(review, members)\n end\n end\n end\n end\n end\nend", "def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def test_authorize\n object_person = people(:valid_person) # person_id 1\n subject_person_1aa = people(:person1) # person_id 1aa\n subject_person_2aa = people(:person3) # person_id 2aa\n \n assert Rule.authorize?(subject_person_1aa, object_person.id, \"view\", \"email\")\n assert !Rule.authorize?(subject_person_2aa, object_person.id, \"view\",\"email\")\n\n end", "def get_rules\r\n @rules\r\n end", "def test_lists\r\n nodelist = @mymodel.node_list\r\n linklist = @mymodel.link_list\r\n \r\n assert(nodelist.size == 0)\r\n assert(linklist.size == 0)\r\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def test_is_applicable_to_test_models\n\t[\"LargeHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"LargeOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"MediumOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"PrimarySchool-90.1-2007-ASHRAE 169-2006-2A.osm\", \"SecondarySchool-90.1-2010-ASHRAE 169-2006-4A.osm\", \"SmallHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"SmallOffice-90.1-2010-ASHRAE 169-2006-2A.osm\"].each do |m|\n\t\tresult,_ = applytotestmodel(m)\n\t\tassert_equal(\"Success\", result.value.valueName)\n end\n end", "def migrate_rules\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n source_keys_matching('contact_notification_rules:?*').each do |rules_key|\n\n rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n contact_id = $1\n raise \"Bad regex for '#{rules_key}'\" if contact_id.nil?\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n rules = {\n Flapjack::Data::Acceptor => [],\n Flapjack::Data::Rejector => []\n }\n\n rule_ids = @source_redis.smembers(rules_key)\n rule_ids.each do |rule_id|\n rule_data = @source_redis.hgetall(\"notification_rule:#{rule_id}\")\n\n time_restrictions = Flapjack.load_json(rule_data['time_restrictions'])\n\n entities = Set.new( Flapjack.load_json(rule_data['entities']))\n regex_entities = Set.new( Flapjack.load_json(rule_data['regex_entities']))\n\n tags = Set.new( Flapjack.load_json(rule_data['tags']))\n regex_tags = Set.new( Flapjack.load_json(rule_data['regex_tags']))\n\n # collect specific matches together with regexes\n regex_entities = regex_entities.collect {|re| Regexp.new(re) } +\n entities.to_a.collect {|entity| /\\A#{Regexp.escape(entity)}\\z/}\n regex_tags = regex_tags.collect {|re| Regexp.new(re) } +\n tags.to_a.collect {|tag| /\\A#{Regexp.escape(tag)}\\z/}\n\n acceptor_conditions_by_media = {}\n rejector_conditions_by_media = {}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n media_types = Flapjack.load_json(rule_data[\"#{fail_state}_media\"])\n next if media_types.nil? || media_types.empty?\n\n media_types_str = media_types.sort.join(\"|\")\n blackhole = !!Flapjack.load_json(rule_data[\"#{fail_state}_blackhole\"])\n cond_by_media = blackhole ? rejector_conditions_by_media : acceptor_conditions_by_media\n cond_by_media[media_types_str] ||= []\n cond_by_media[media_types_str] << fail_state\n end\n\n checks_and_tags_for_rule = proc do |rule_klass, cond_by_media|\n\n rule_klass.lock(Flapjack::Data::Check, Flapjack::Data::Tag,\n Flapjack::Data::Contact, Flapjack::Data::Medium) do\n\n cond_by_media.each_pair do |media_types_str, fail_states|\n rule = rule_klass.new\n rule.conditions_list = fail_states.sort.join(\"|\")\n rule.all = regex_entities.empty? && regex_tags.empty?\n rule.time_restrictions = time_restrictions\n rule.save\n raise rule.errors.full_messages.join(\", \") unless rule.persisted?\n\n media_transports = media_types_str.split('|')\n media = contact.media.intersect(:transport => media_transports)\n rule.media.add_ids(*media.ids) unless media.empty?\n\n unless rule.all\n # apply the entities/tag regexes as a filter\n checks = Flapjack::Data::Check.intersect(:id => check_ids).select do |check|\n entity_name = check.name.split(':', 2).first\n if regex_entities.all? {|re| re === entity_name }\n # copying logic from https://github.com/flapjack/flapjack/blob/68a3fd1144a0aa516cf53e8ae5cb83916f78dd94/lib/flapjack/data/notification_rule.rb\n # not sure if this does what we want, but it's how it currently works\n matching_re = []\n check.tags.each do |tag|\n matching_re += regex_tags.select {|re| re === tag.name }\n end\n matching_re.size >= regex_tags.size\n else\n false\n end\n end\n\n tags = checks.collect do |check|\n check_num = check_counts_by_id[check.id]\n if check_num.nil?\n check_num = check_counts_by_id.size + 1\n check_counts_by_id[check.id] = check_num\n end\n\n tag = Flapjack::Data::Tag.new(:name => \"migrated-contact_#{contact_num}-check_#{check_num}\")\n tag.save\n check.tags << tag\n tag\n end\n\n rule.tags.add(*tags) unless tags.empty?\n end\n rules[rule_klass] << rule\n end\n end\n end\n\n checks_and_tags_for_rule.call(Flapjack::Data::Rejector, rejector_conditions_by_media)\n checks_and_tags_for_rule.call(Flapjack::Data::Acceptor, acceptor_conditions_by_media)\n end\n\n rejectors = rules[Flapjack::Data::Rejector]\n contact.rejectors.add(*rejectors) unless rejectors.empty?\n\n acceptors = rules[Flapjack::Data::Acceptor]\n contact.acceptors.add(*acceptors) unless acceptors.empty?\n end\n end", "def run\n log \"Flagging tasty messages\"\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n message_count += process_unlearned_flagged\n message_count += process_tasty_unflagged\n message_count += process_bland_flagged\n message_count += process_unlearned\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end", "def validate_emails emails\n invitation_models = []\n emails.each do |email|\n invit = Invitation.new(email: email, opinion_poll: @opinion_poll)\n bad_request invit.errors.messages and return unless invit.valid? #opinion_poll_id: @opinion_poll)\n invitation_models.append invit\n end\n invitation_models\n end", "def testExactMatchWithAll\n initTestCase do\n $Context[:SlaveActions] = [\n [ Tools::All, 'DummyAction', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n Tools::All => {\n 'DummyAction' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def rule_assert( obj )\r\n # add object as a new fact\r\n f = fact(obj)\r\n # get_relevant_rules\r\n logger.debug( \"Check if we need to add more rules\") if logger\r\n add_relevant_rules_for_fact(f)\r\n sort_relevant_rules\r\n end", "def test_ensure_mail_wasnt_sent_when_grader_takes_on_report\n login_as :donna\n post :auto_assign\n assert_equal(0, @emails.size)\n\n=begin\n\n email = @emails.first\n assert_match(/A grader has picked up your report on/ , email.subject)\n assert_match(/Once the grader has completed grading your report, you will get another email notification/, email.body)\n\n=end\n\n end", "def test_q11_b_all\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n end", "def test_active?\n active_rule = rules(:active_or_rule)\n assert active_rule.active?, \"The rule should be active\"\n inactive_rule = rules(:inactive_rule)\n assert !inactive_rule.active?, \"The rule should be inactive\"\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def add_to_rules(msg)\n # TODO use configatron config parameter for conf dir\n line = \"ACCEPT net:#{msg[2]} fw #{msg[1]}\"\n line << \" \" << msg[3] if msg[3]\n line << \"\\n\"\n lines = []\n\n File.open(rules_file) do |f|\n lines = f.readlines\n end\n\n i = lines.size - 1\n\n while i >= 0 && lines[i] !~ /\\s*#LAST LINE -- ADD YOUR ENTRIES/\n i -= 1\n end\n\n if i >= 0\n a = [line, lines[i]]\n lines[i,i] = a\n\n # TODO ask agent to backup original file\n\n File.open(rules_file, \"w\") do |f|\n f.write lines.join\n end\n\n message = \"#{rules_file} updated, run shorewall restart to reload the rules.\"\n else\n message = \"Can not find last mark line\"\n end\n\n send_response(message)\n end", "def test_ut_t5_sef_pj_004\n current_user = User.find(TCANA_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 4,users.size\n end\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def test_startchangeset_invalid_wrong_user\n user = create(:user)\n user2 = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user2.email}:test\", {}, cs_id, \"delete\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -2, result[0]\n assert_equal \"The user doesn't own that changeset\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n end", "def load_rules; end", "def test_03_storyadmin_clickall_links()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 02 ----------------------\"\n\t\tlogin(\"orgadmin@aol.com\", \"123456\")\n\t\tverifyHeaderLinks()\n\t\tverifyFooterLinks()\n\t\tverifyMyAccountLinks()\n\t\tverifyNPOAdminLinks(\"Minnesota Community Foundation\")\n\t\t#~ searchProject(\"RazooTrunkFirefoxPRO20 of Minnesota Community Foundation\")\n\t\t#~ verifyStoryAdminLinks()\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 02 --------------------------\"\n\tend", "def process_rules *args, &block\n Shotshare::ProcessRuleContainer.instance.rules = \\\n Docile.dsl_eval(Shotshare::Dsl::ProcessRuleBuilder.new, &block).build\nend", "def rules_by_name; end", "def test_enumerators\n connection = Connection.new()\n (3.times.collect { connection.open_session }).each { |s|\n s.open_sender; s.open_receiver\n }\n\n assert_equal 3, connection.each_session.to_a.size\n assert_equal 6, connection.each_link.to_a.size\n\n # Build Session => Set<Links> map using connection link enumerator\n map1 = {}\n connection.each_link { |l| map1[l.session] ||= Set.new; map1[l.session] << l }\n assert_equal 3, map1.size\n map1.each do |session,links|\n assert_equal 2, links.size\n links.each { |l| assert_equal session, l.session }\n end\n\n # Build Session => Set<Links> map using connection and session blocks\n map2 = {}\n connection.each_session do |session|\n map2[session] = Set.new\n session.each_link { |l| map2[session] << l }\n end\n assert_equal map1, map2\n\n # Build Session => Set<Links> map using connection session and session enumerators\n map3 = Hash[connection.each_session.collect { |s| [s, Set.new(s.each_link)] }]\n assert_equal map1, map3\n\n assert_equal [true, true, true], connection.each_sender.collect { |l| l.is_a? Sender }\n assert_equal [true, true, true], connection.each_receiver.collect { |l| l.is_a? Receiver }\n connection.each_session { |session|\n assert_equal [true], session.each_sender.collect { |l| l.is_a? Sender }\n assert_equal [true], session.each_receiver.collect { |l| l.is_a? Receiver }\n }\n\n\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def assert_team_ids_reassigned(team_set)\n team_ids = team_set.thinkspace_team_teams.pluck(:id)\n get_assessment.thinkspace_peer_assessment_team_sets.each do |ts|\n assert_include team_ids, ts.team_id\n end\nend", "def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end", "def test_04_razooglobaladmin_clickall_links()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 03 ----------------------\"\n\t\tlogin(\"srajkumar.here@gmail.com\", \"razoo1\")\n\t\tverifyNPOAdminLinks(\"FRIENDS OF NEVADA ORGANICS ORG\")\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 03 --------------------------\"\n\tend", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def test_scenario2\n data = [[File.dirname(__FILE__)+'/data/tiny_mushrooms.csv', [\"Edible\"], {'p_value'=> 5.26971e-31, 'confidence'=> 1, 'rhs_cover'=> [0.488, 122], 'leverage'=> 0.24986, 'rhs'=> [19], 'rule_id'=> '000002', 'lift' => 2.04918, 'lhs'=> [0, 21, 16, 7], 'lhs_cover'=> [0.488, 122], 'support' => [0.488, 122]}]]\n\n puts\n puts \"Scenario: Successfully creating local association object:\" \n\n data.each do |filename, item_list, json_rule|\n puts\n puts \"Given I create a data source uploading a \" + filename+ \" file\"\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create an association from a dataset\"\n association = @api.create_association(dataset, {'name'=> 'new association'})\n puts \"And I wait until the association is ready\"\n assert_equal(BigML::HTTP_CREATED, association[\"code\"])\n assert_equal(1, association[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(association), true)\n\n puts \"And I create a local association\"\n local_association = BigML::Association.new(association)\n \n puts \"When I get the rules for %s\" % JSON.generate(item_list)\n\n association_rules = local_association.get_rules(nil, nil, nil, nil, item_list)\n\n puts \"Then the first rule is <%s>\" % json_rule\n assert_equal(association_rules[0].to_json(), json_rule)\n \n end\n\n end", "def get_inbox_ruleset_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.get_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\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] || 'InboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_workflow\n\n #create a random agent\n randomagent = UUIDTools::UUID.timestamp_create.to_s\n @zendeskclient.createuser(randomagent+='@gmail.com', 'Harish', \"4\", \"0\", [134692])\n assert_equal(201, @zendeskclient.responsecode)\n #lets make sure the /user/#{id}.xml exists\n\n usercreationresponse = @zendeskclient.response\n begin\n resource = RestClient::Resource.new usercreationresponse, @username, @pswd\n rescue\n assert(false) # if we hit this assertion for any reason means, we cannot access the user file\n # which means we have failed\n end\n\n # create ticket with the same user as created above as requester\n # this is implemented by using the same email id as before\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', randomagent)\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match(@host))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n\n end", "def tests\n parser.flow_items\n end", "def test_ut_t5_sef_pj_006\n current_user = User.find(PJ_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n # Create PJ admin right\n PrivilegesUsers.create(:user_id => PJ_ADMIN_ID,\n :privilege_id => 3,\n :pu_id => PU_ID,\n :pj_id => new_pj.id)\n # Create PJ member right\n PjsUsers.create(:pj_id => new_pj.id,\n :user_id => PJ_MEMBER_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 2,users.size\n end\n end", "def set_test_rule\n @test_rule = TestRule.find(params[:id])\n end", "def test_subject_templates\n @subject_templates.each { |template| \n puts render_subject(template) \n }\n end", "def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end", "def all\n @rules\n end", "def test_should_init_mail_settings\n assert Preference.init_mail_settings\n end", "def printRules\n\t\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\tputs \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\tif @i == 1\n\t\tputs \"No rules to print!\"\n\telse\n\t\tputs \"Rules Loaded!\"\n\tend\nend", "def password_rule_test_sets\n {\n 'not set': 'pass',\n 'parameter with NoEcho': 'pass',\n 'parameter with NoEcho and Default value': 'fail',\n 'parameter as a literal in plaintext': 'fail',\n 'as a literal in plaintext': 'fail',\n 'from Secrets Manager': 'pass',\n 'from Secure Systems Manager': 'pass',\n 'from Systems Manager': 'fail'\n }\nend", "def test_source_lists\n config=<<EOF\nsource_list \"test\", %w(test-1.example.com)\n\nsource_list \"has_ipv4\", \"0.0.0.0/0\"\n\nsource_list \"has_ipv6\", \"2000::/3\"\nEOF\n\n Configuration.current = ConfigurationBuilder.parse(config)\n\n a = Alert.new\n a.subject = \"www.example.com\"\n\n assert( a.in_source_list?(\"test\") )\n assert_equal( %w(test has_ipv4).sort, a.source_lists.sort )\n\n a.subject = \"www2.example.com\"\n assert( a.in_source_list?(\"has_ipv6\") )\n assert_equal( %w(has_ipv6 has_ipv4).sort, a.source_lists.sort )\n end", "def testSeveralSlaveClients2ActionsDifferentFilters\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool1', 'DummyAction1', [] ],\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWith2SlaveClientsFilters',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal(\n {\n 'SlaveClient1' => [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ] ]\n ],\n 'SlaveClient2' => [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n } ] ]\n ]\n },\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test_ut_t5_sef_pj_010\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n email_settings = EmailSetting.find_all_by_pj_id(new_pj.id)\n email_settings.each do |setting|\n assert_equal TCANA_ADMIN_ID.to_s, setting.user_ids\n end\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def check_subject_and_body(email)\n winning_category = nil\n temp_points = 0 #The score for the current category\n points = 0 # The highest score achived\n\n subject_words = SeperateWords.new.seperate(email.subject)\n body_words = SeperateWords.new.seperate(email.body)\n\n @all_categories.each do |cat|\n #Checks each word in subject and body against keywords in categories\n temp_points += check_words(cat.key_words, subject_words, true)\n\n #BODY\n temp_points += check_words(cat.key_words, body_words)\n\n if temp_points > points\n\n points = temp_points\n winning_category = cat\n end\n\n temp_points = 0\n end\n #This way removes unesseccary transactions\n unless winning_category.blank?\n attach_category_to_email(email,winning_category)\n else\n #This asumes there's a category called \"Uncategorized\"\n #uncategorized = Category.find_by_name(\"Uncategorized\")\n #using scopes: not working for some reason\n #uncategorized = Category.uncategorized\n\n #attach_category_to_email(email,uncategorized)\n end\n\n end", "def should_update_inbox_unread_count!\n i = mailbox.inbox.unread(self).pluck(\"distinct conversations.id\").size\n update_attributes(inbox_unread_count: i) if i != inbox_unread_count\n end", "def checkbrainmailbox\n #Check if token is present\n logger.info params[\"token\"]\n if APP_CONFIG['token_action'].to_s == params[\"token\"]\n #Start the actual work\n imap = Net::IMAP.new(APP_CONFIG['imap_host'], APP_CONFIG['imap_port'] , APP_CONFIG['imap_ssl'], nil, false)\n imap.authenticate('LOGIN', APP_CONFIG['imap_user'], APP_CONFIG['imap_password'])\n imap.select('INBOX')\n @output = \"Connected to IMAP server\\n\"\n \n @n=0\n #Select unseen messages only\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n \n #Get the full content\n raw = imap.fetch(message_id, \"BODY[]\")[0].attr[\"BODY[]\"]\n imap.store(message_id, '+FLAGS', [:Seen])\n #Parse it with mail library\n mail = Mail.read_from_string(raw)\n token = mail.to.to_s\n #If multipart or auth token not included, then discard the mail and send a warning\n if mail.multipart? or (not token.include?(APP_CONFIG['token_email'].to_s))\n imap.copy(message_id, 'Untreated')\n @output=@output+Time.now.getutc.to_s+\" - 1 untreated mail\\n\"\n send_warning_mail(mail.from, raw) \n else\n content = mail.body.decoded\n name = mail.subject\n date = mail.date\n #Detect if labels are specified in first line\n if content.lines.first.to_s[0]==\"@\"\n labels = content.lines.first.chomp\n content = content.lines.to_a[1..-1].join\n end\n #Here, create the neuron\n @output=@output+Time.now.getutc.to_s+\" - 1 neuron created from a mail\\n\"\n puts \"One neuron created with name '#{name}', labels '#{labels}' and content '#{content}'\"\n neuron = Neuron.new\n neuron.name = name\n neuron.content = content\n neuron.labels = labels\n neuron.date = date\n neuron.save\n imap.copy(message_id, 'Treated')\n end\n imap.store(message_id, '+FLAGS', [:Deleted])\n @n+=1\n end\n imap.expunge #Delete all mails with deleted flags\n imap.close\n end\n render :layout => false\n end", "def test_check_condition_logged_in\n rule = rules(:test_rule)\n # expose private methods of the test object rule\n class << rule\n public :check_condition_logged_in\n end\n\n subject_person1 = nil\n subject_person2 = people(:valid_person)\n assert !rule.check_condition_logged_in(subject_person1, true)\n assert rule.check_condition_logged_in(subject_person2, true)\n assert rule.check_condition_logged_in(subject_person1, false)\n assert !rule.check_condition_logged_in(subject_person2, false)\n end", "def est03_groups_email_settings_TC_24415 #8/1/13 - JIRA TripleX 4588 , internal environment issue. disabling for now\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch)\n\t\t$search_text_field.when_present.set(\"the fighting mongooses\")\n\t\t$search_button.when_present.click\n\t\t\n\t\tsleep 2\n\t\tassert $search_result_fighting_mongooses.exists?\n\t\t\n\t\tassert $search_result_fighting_mongooses.exists?\n\t\t$search_result_fighting_mongooses.when_present.click\n\t\t$group_email_settings.click\n\t\tsleep 2\n\t\t\n\t\tassert $browser.text.include? \"Email Settings\"\n\tend", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def execute\n @imap = Net::IMAP.new(@imap_setting[:server], @imap_setting[:port])\n @imap.login(@imap_setting[:user], @imap_setting[:password])\n @imap.select(@imap_setting[:folder])\n \n #process all mail read email with test in subject for testing purpose. In reality it will process all emails\n query = imap_setting[:mode] == \"prod\" ? ['NOT', 'SEEN'] : ['SUBJECT', 'test']\n @imap.uid_search(query).each do |uid|\n catch(:continue) do\n mail = TMail::Mail.parse( imap.uid_fetch(uid, 'RFC822').first.attr['RFC822'] )\n from = mail.from\n to = mail.to\n bcc = mail.bcc\n cc = mail.cc\n subject = mail.subject\n msgid = mail.message_id \n date = mail.date\n ref_msgid = [mail.in_reply_to, mail.references].flatten.compact.join(\" \") \n \n #normalize all email addresses\n from.map! {|address| normalize_address(address) }\n to.map! {|address| normalize_address(address) }\n cc.map! {|address| normalize_address(address) } unless cc.is_nil?\n bcc.map! {|address| normalize_address(address) } unless bcc.is_nil?\n\n #find matching user\n user = nil\n user_email = from.find do |f|\n user = User.find_by_email(f.downcase)\n end\n \n if user\n logger.info \"processing email for #{user.username}\"\n if bcc.include?(@imap_setting[:email])\n #if from as user or asignee to as contact and we are in bcc it's outbound\n contacts = to.map do |t|\n #find contact by user or assigned to\n contact = Contact.find_by_email_and_user(t, user)\n if contact.nil?\n contact = Contact.find_by_email_and_assignee(t, user)\n end\n \n if contact.nil?\n #create contact, user is emailing a contact that's not in FFC\n logger.info \"new contact #{t}\"\n contact = Contact.new\n contact.user = user\n contact.email = t\n unless contact.save \n logger.warn \"could not save contact #{t}\"\n contact = nil\n end\n end\n contact\n end\n contacts.compact!\n \n #save mail\n from_list = from.join(\" \")\n to_list = to.join(\" \")\n cc_list = cc.join(\" \")\n bcc_list = bcc.join(\" \")\n body = mail.quoted_body\n save_email(from_list, to_list, subject, cc_list, bcc_list, body, msgid, ref_msgid, date, user, contacts)\n else\n #TODO if fowarded msg has from as user and to as contact it's inbound\n \n end\n \n else\n #unknown sender,this email is not supposed to be in drop box\n logger.warn \"mail from unknown user from: #{from} to: #{to} subject: #{subject}\"\n handle_processed_mail(uid) if @imap_setting[:mode] == \"prod\"\n end\n \n end\n \n end\n @imap.logout\n @imap.disconnect\n \n rescue Net::IMAP::NoResponseError => e\n logger.error \"IMAP server error\"\n rescue Net::IMAP::ByeResponseError => e\n logger.error \"IMAP server error\"\n rescue => e\n logger.error \"IMAP server error\"\n \n end", "def test_ut_t5_sef_con_007\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n WRONG_ID,OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.blank?\n end", "def test_cases(email_id = nil, root_folder = nil)\n file_selector(root_folder).email_id(email_id)\n .map(&:test_cases).reject(&:empty?).flatten.unwrap\n end", "def print_rules(*names)\n names = nil if names.empty?\n puts \"(#{runner.root})\"\n runner.rulesets.each do |name, set|\n next unless names.member?(name.to_s) if names\n print \"#{name}\"\n print \" (#{set.chain.join(' ')})\" unless set.chain.empty?\n puts\n set.docs.each_with_index do |d, i|\n puts \" * #{d}\"\n end\n end\n\n #exit\n end", "def test_multiple_recipients\n expected1 = @expected.clone\n expected1.to = 'user1@trypticon.org'\n expected2 = @expected.clone\n expected2.to = 'user2@trypticon.org'\n\n # Creation\n assert_equal [ expected1, expected2 ],\n SimpleMessenger.create_wakeup_multi('user1@trypticon.org', 'user2@trypticon.org')\n\n # Delivery\n SimpleMessenger.send_wakeup_multi('user1@trypticon.org', 'user2@trypticon.org')\n assert_equal [ expected1, expected2],\n @messenger.deliveries\n end" ]
[ "0.6427489", "0.6315927", "0.60893935", "0.58721715", "0.5780896", "0.5497661", "0.5484492", "0.5480035", "0.5434681", "0.54239094", "0.53774464", "0.53744745", "0.5336081", "0.51936847", "0.51283765", "0.51251245", "0.5080757", "0.50705403", "0.5008124", "0.49881157", "0.49808228", "0.49577174", "0.49577174", "0.49577174", "0.49577174", "0.49577174", "0.49577174", "0.49577174", "0.49460727", "0.4933231", "0.49203077", "0.48642015", "0.48033407", "0.4800496", "0.4794113", "0.47936872", "0.47918612", "0.47845972", "0.47819462", "0.47753268", "0.4771592", "0.47321346", "0.4722708", "0.4722708", "0.4722708", "0.4717178", "0.47085813", "0.47080776", "0.47015575", "0.46914473", "0.46812567", "0.46763813", "0.46696776", "0.46601278", "0.46570045", "0.46557805", "0.4646869", "0.4646869", "0.46449605", "0.46384746", "0.46313757", "0.46240544", "0.46201268", "0.46092722", "0.46035433", "0.4585916", "0.45711675", "0.45648864", "0.45648745", "0.4564369", "0.45636213", "0.45555508", "0.4551533", "0.45477295", "0.45442206", "0.4541182", "0.45362908", "0.45296717", "0.4528211", "0.4522059", "0.4518547", "0.45139575", "0.4510452", "0.4508647", "0.45082247", "0.45068222", "0.45061857", "0.4504209", "0.45015854", "0.4495654", "0.44932932", "0.44915015", "0.44891846", "0.44875756", "0.44847125", "0.44778785", "0.44769937", "0.44753546", "0.4471169", "0.44674817" ]
0.72629654
0
Test inbox rulesets for inbox Test inbox rulesets for inbox
def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...' end # verify the required parameter 'inbox_id' is set if @api_client.config.client_side_validation && inbox_id.nil? fail ArgumentError, "Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox" end # verify the required parameter 'inbox_ruleset_test_options' is set if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil? fail ArgumentError, "Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox" end # resource path local_var_path = '/rulesets' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxId'] = inbox_id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) # return_type return_type = opts[:return_type] || 'InboxRulesetTestResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def boolean_rule_test_sets\n {\n 'not set': 'fail',\n 'set': 'pass'\n }\nend", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_new_inbox_ruleset ...'\n end\n # verify the required parameter 'test_new_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && test_new_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'test_new_inbox_ruleset_options' when calling InboxRulesetControllerApi.test_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(test_new_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_authorize_according_to_one_rule\n rule_or = rules(:active_or_rule) # friends or members of group tkk can view name of person 1\n rule_and = rules(:active_and_rule) # friends who are members of group tkk can view email of person 1\n\n action_view_name = actions(:view_name)\n action_view_email = actions(:view_email)\n object_person = people(:valid_person) # person id 1\n subject_person_test = people(:test) # not friend, not member of group tkk\n subject_person_4 = people(:friend) # person 4 is a friend, but not a member of group tkk\n subject_person_1aa = people(:person1) # person 1aa is a friend, and also a member of group tkk\n\n assert subject_person_1aa.contacts.include? object_person\n assert subject_person_1aa.is_member_of? groups(:tkk)\n\n assert !rule_or.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert rule_and.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_email.action_type, action_view_email.action_value)\n end", "def test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}/test'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_emails\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def delete_inbox_rulesets(opts = {})\n delete_inbox_rulesets_with_http_info(opts)\n nil\n end", "def test_create_timebase_acl_rule\n user = createUser(\"1\")\n node = createNode(\"1\")\n res = @s.set_node_acl_rule_entries(node, user, {\"jcr:read\" => \"granted\"}, {\"rule\" => \"TestingThatRuleWorks\"})\n\tassert_equal(\"200\",res.code,\"Failed to add Rule ACL \"+res.body)\t\n\t\n\tacl = @s.get_node_ruleacl(node)\n\t@s.log.info(acl)\n\tassert_equal(1,acl.size)\n\t\n\truleace = findRuleAce(acl, user.name)\n\tassert_not_nil(ruleace)\n\tassert_equal(0,ruleace[\"order\"])\n\tgranted = ruleace[\"granted\"]\n\tassert_equal(1,granted.size)\n\tassert_equal(\"jcr:read\",granted[0])\n\tdenied = ruleace[\"denied\"]\n\tassert_nil(denied)\n\tassert_equal(\"TestingThatRuleWorks\",ruleace[\"sakai:rule-processor\"])\n\t\n\t\n\t\n\t\n end", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def tests\n config.tests(subject)\n end", "def test_multiple_recipients\r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n initial_bob_plan_count = bob.planner.plans.length\r\n initial_existingbob_plan_count = existingbob.planner.plans.length\r\n initial_longbob_plan_count = longbob.planner.plans.length\r\n \r\n Mailman.receive(@multiple_recipients_string)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n assert_equal initial_bob_plan_count + 1, bob.planner.plans.length\r\n assert_equal initial_existingbob_plan_count + 1, existingbob.planner.plans.length\r\n assert_equal initial_longbob_plan_count, longbob.planner.plans.length\r\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def _test_testNamespaces ; process_test_case(\"testNamespaces\") ; end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def index\n @test_rules = TestRule.all\n end", "def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end", "def check_rank_rules\n defined_rules.each do |scoped_model, level_and_rules|\n level_and_rules.sort.each do |level, rule|\n grant_when_applies(scoped_model, rule, level)\n end\n end\n end", "def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...'\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#create_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_inbox_ruleset(id, opts = {})\n data, _status_code, _headers = get_inbox_ruleset_with_http_info(id, opts)\n data\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def assert_reviewables_on_team(team_set)\n team_set.thinkspace_team_teams.each do |team|\n members = team.thinkspace_common_users\n ts = get_team_set_for_team(team)\n if ts.present?\n members.each do |member|\n rs = get_review_set_for_ownerable(ts, member)\n if rs.present?\n rs.thinkspace_peer_assessment_reviews.each do |review|\n assert_reviewable_on_team(review, members)\n end\n end\n end\n end\n end\nend", "def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def test_authorize\n object_person = people(:valid_person) # person_id 1\n subject_person_1aa = people(:person1) # person_id 1aa\n subject_person_2aa = people(:person3) # person_id 2aa\n \n assert Rule.authorize?(subject_person_1aa, object_person.id, \"view\", \"email\")\n assert !Rule.authorize?(subject_person_2aa, object_person.id, \"view\",\"email\")\n\n end", "def get_rules\r\n @rules\r\n end", "def test_lists\r\n nodelist = @mymodel.node_list\r\n linklist = @mymodel.link_list\r\n \r\n assert(nodelist.size == 0)\r\n assert(linklist.size == 0)\r\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def test_is_applicable_to_test_models\n\t[\"LargeHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"LargeOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"MediumOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"PrimarySchool-90.1-2007-ASHRAE 169-2006-2A.osm\", \"SecondarySchool-90.1-2010-ASHRAE 169-2006-4A.osm\", \"SmallHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"SmallOffice-90.1-2010-ASHRAE 169-2006-2A.osm\"].each do |m|\n\t\tresult,_ = applytotestmodel(m)\n\t\tassert_equal(\"Success\", result.value.valueName)\n end\n end", "def migrate_rules\n contact_counts_by_id = {}\n check_counts_by_id = {}\n\n source_keys_matching('contact_notification_rules:?*').each do |rules_key|\n\n rules_key =~ /\\Acontact_notification_rules:(#{ID_PATTERN_FRAGMENT})\\z/\n contact_id = $1\n raise \"Bad regex for '#{rules_key}'\" if contact_id.nil?\n\n contact = find_contact(contact_id)\n\n contact_num = contact_counts_by_id[contact.id]\n if contact_num.nil?\n contact_num = contact_counts_by_id.size + 1\n contact_counts_by_id[contact.id] = contact_num\n end\n\n check_ids = @check_ids_by_contact_id_cache[contact.id]\n\n rules = {\n Flapjack::Data::Acceptor => [],\n Flapjack::Data::Rejector => []\n }\n\n rule_ids = @source_redis.smembers(rules_key)\n rule_ids.each do |rule_id|\n rule_data = @source_redis.hgetall(\"notification_rule:#{rule_id}\")\n\n time_restrictions = Flapjack.load_json(rule_data['time_restrictions'])\n\n entities = Set.new( Flapjack.load_json(rule_data['entities']))\n regex_entities = Set.new( Flapjack.load_json(rule_data['regex_entities']))\n\n tags = Set.new( Flapjack.load_json(rule_data['tags']))\n regex_tags = Set.new( Flapjack.load_json(rule_data['regex_tags']))\n\n # collect specific matches together with regexes\n regex_entities = regex_entities.collect {|re| Regexp.new(re) } +\n entities.to_a.collect {|entity| /\\A#{Regexp.escape(entity)}\\z/}\n regex_tags = regex_tags.collect {|re| Regexp.new(re) } +\n tags.to_a.collect {|tag| /\\A#{Regexp.escape(tag)}\\z/}\n\n acceptor_conditions_by_media = {}\n rejector_conditions_by_media = {}\n\n Flapjack::Data::Condition.unhealthy.keys.each do |fail_state|\n media_types = Flapjack.load_json(rule_data[\"#{fail_state}_media\"])\n next if media_types.nil? || media_types.empty?\n\n media_types_str = media_types.sort.join(\"|\")\n blackhole = !!Flapjack.load_json(rule_data[\"#{fail_state}_blackhole\"])\n cond_by_media = blackhole ? rejector_conditions_by_media : acceptor_conditions_by_media\n cond_by_media[media_types_str] ||= []\n cond_by_media[media_types_str] << fail_state\n end\n\n checks_and_tags_for_rule = proc do |rule_klass, cond_by_media|\n\n rule_klass.lock(Flapjack::Data::Check, Flapjack::Data::Tag,\n Flapjack::Data::Contact, Flapjack::Data::Medium) do\n\n cond_by_media.each_pair do |media_types_str, fail_states|\n rule = rule_klass.new\n rule.conditions_list = fail_states.sort.join(\"|\")\n rule.all = regex_entities.empty? && regex_tags.empty?\n rule.time_restrictions = time_restrictions\n rule.save\n raise rule.errors.full_messages.join(\", \") unless rule.persisted?\n\n media_transports = media_types_str.split('|')\n media = contact.media.intersect(:transport => media_transports)\n rule.media.add_ids(*media.ids) unless media.empty?\n\n unless rule.all\n # apply the entities/tag regexes as a filter\n checks = Flapjack::Data::Check.intersect(:id => check_ids).select do |check|\n entity_name = check.name.split(':', 2).first\n if regex_entities.all? {|re| re === entity_name }\n # copying logic from https://github.com/flapjack/flapjack/blob/68a3fd1144a0aa516cf53e8ae5cb83916f78dd94/lib/flapjack/data/notification_rule.rb\n # not sure if this does what we want, but it's how it currently works\n matching_re = []\n check.tags.each do |tag|\n matching_re += regex_tags.select {|re| re === tag.name }\n end\n matching_re.size >= regex_tags.size\n else\n false\n end\n end\n\n tags = checks.collect do |check|\n check_num = check_counts_by_id[check.id]\n if check_num.nil?\n check_num = check_counts_by_id.size + 1\n check_counts_by_id[check.id] = check_num\n end\n\n tag = Flapjack::Data::Tag.new(:name => \"migrated-contact_#{contact_num}-check_#{check_num}\")\n tag.save\n check.tags << tag\n tag\n end\n\n rule.tags.add(*tags) unless tags.empty?\n end\n rules[rule_klass] << rule\n end\n end\n end\n\n checks_and_tags_for_rule.call(Flapjack::Data::Rejector, rejector_conditions_by_media)\n checks_and_tags_for_rule.call(Flapjack::Data::Acceptor, acceptor_conditions_by_media)\n end\n\n rejectors = rules[Flapjack::Data::Rejector]\n contact.rejectors.add(*rejectors) unless rejectors.empty?\n\n acceptors = rules[Flapjack::Data::Acceptor]\n contact.acceptors.add(*acceptors) unless acceptors.empty?\n end\n end", "def run\n log \"Flagging tasty messages\"\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n message_count += process_unlearned_flagged\n message_count += process_tasty_unflagged\n message_count += process_bland_flagged\n message_count += process_unlearned\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end", "def validate_emails emails\n invitation_models = []\n emails.each do |email|\n invit = Invitation.new(email: email, opinion_poll: @opinion_poll)\n bad_request invit.errors.messages and return unless invit.valid? #opinion_poll_id: @opinion_poll)\n invitation_models.append invit\n end\n invitation_models\n end", "def testExactMatchWithAll\n initTestCase do\n $Context[:SlaveActions] = [\n [ Tools::All, 'DummyAction', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n Tools::All => {\n 'DummyAction' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def rule_assert( obj )\r\n # add object as a new fact\r\n f = fact(obj)\r\n # get_relevant_rules\r\n logger.debug( \"Check if we need to add more rules\") if logger\r\n add_relevant_rules_for_fact(f)\r\n sort_relevant_rules\r\n end", "def test_ensure_mail_wasnt_sent_when_grader_takes_on_report\n login_as :donna\n post :auto_assign\n assert_equal(0, @emails.size)\n\n=begin\n\n email = @emails.first\n assert_match(/A grader has picked up your report on/ , email.subject)\n assert_match(/Once the grader has completed grading your report, you will get another email notification/, email.body)\n\n=end\n\n end", "def test_q11_b_all\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n end", "def test_active?\n active_rule = rules(:active_or_rule)\n assert active_rule.active?, \"The rule should be active\"\n inactive_rule = rules(:inactive_rule)\n assert !inactive_rule.active?, \"The rule should be inactive\"\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def add_to_rules(msg)\n # TODO use configatron config parameter for conf dir\n line = \"ACCEPT net:#{msg[2]} fw #{msg[1]}\"\n line << \" \" << msg[3] if msg[3]\n line << \"\\n\"\n lines = []\n\n File.open(rules_file) do |f|\n lines = f.readlines\n end\n\n i = lines.size - 1\n\n while i >= 0 && lines[i] !~ /\\s*#LAST LINE -- ADD YOUR ENTRIES/\n i -= 1\n end\n\n if i >= 0\n a = [line, lines[i]]\n lines[i,i] = a\n\n # TODO ask agent to backup original file\n\n File.open(rules_file, \"w\") do |f|\n f.write lines.join\n end\n\n message = \"#{rules_file} updated, run shorewall restart to reload the rules.\"\n else\n message = \"Can not find last mark line\"\n end\n\n send_response(message)\n end", "def test_ut_t5_sef_pj_004\n current_user = User.find(TCANA_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 4,users.size\n end\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def test_startchangeset_invalid_wrong_user\n user = create(:user)\n user2 = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user2.email}:test\", {}, cs_id, \"delete\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -2, result[0]\n assert_equal \"The user doesn't own that changeset\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n end", "def load_rules; end", "def test_03_storyadmin_clickall_links()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 02 ----------------------\"\n\t\tlogin(\"orgadmin@aol.com\", \"123456\")\n\t\tverifyHeaderLinks()\n\t\tverifyFooterLinks()\n\t\tverifyMyAccountLinks()\n\t\tverifyNPOAdminLinks(\"Minnesota Community Foundation\")\n\t\t#~ searchProject(\"RazooTrunkFirefoxPRO20 of Minnesota Community Foundation\")\n\t\t#~ verifyStoryAdminLinks()\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 02 --------------------------\"\n\tend", "def process_rules *args, &block\n Shotshare::ProcessRuleContainer.instance.rules = \\\n Docile.dsl_eval(Shotshare::Dsl::ProcessRuleBuilder.new, &block).build\nend", "def rules_by_name; end", "def test_enumerators\n connection = Connection.new()\n (3.times.collect { connection.open_session }).each { |s|\n s.open_sender; s.open_receiver\n }\n\n assert_equal 3, connection.each_session.to_a.size\n assert_equal 6, connection.each_link.to_a.size\n\n # Build Session => Set<Links> map using connection link enumerator\n map1 = {}\n connection.each_link { |l| map1[l.session] ||= Set.new; map1[l.session] << l }\n assert_equal 3, map1.size\n map1.each do |session,links|\n assert_equal 2, links.size\n links.each { |l| assert_equal session, l.session }\n end\n\n # Build Session => Set<Links> map using connection and session blocks\n map2 = {}\n connection.each_session do |session|\n map2[session] = Set.new\n session.each_link { |l| map2[session] << l }\n end\n assert_equal map1, map2\n\n # Build Session => Set<Links> map using connection session and session enumerators\n map3 = Hash[connection.each_session.collect { |s| [s, Set.new(s.each_link)] }]\n assert_equal map1, map3\n\n assert_equal [true, true, true], connection.each_sender.collect { |l| l.is_a? Sender }\n assert_equal [true, true, true], connection.each_receiver.collect { |l| l.is_a? Receiver }\n connection.each_session { |session|\n assert_equal [true], session.each_sender.collect { |l| l.is_a? Sender }\n assert_equal [true], session.each_receiver.collect { |l| l.is_a? Receiver }\n }\n\n\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def assert_team_ids_reassigned(team_set)\n team_ids = team_set.thinkspace_team_teams.pluck(:id)\n get_assessment.thinkspace_peer_assessment_team_sets.each do |ts|\n assert_include team_ids, ts.team_id\n end\nend", "def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end", "def test_04_razooglobaladmin_clickall_links()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 03 ----------------------\"\n\t\tlogin(\"srajkumar.here@gmail.com\", \"razoo1\")\n\t\tverifyNPOAdminLinks(\"FRIENDS OF NEVADA ORGANICS ORG\")\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 03 --------------------------\"\n\tend", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def test_scenario2\n data = [[File.dirname(__FILE__)+'/data/tiny_mushrooms.csv', [\"Edible\"], {'p_value'=> 5.26971e-31, 'confidence'=> 1, 'rhs_cover'=> [0.488, 122], 'leverage'=> 0.24986, 'rhs'=> [19], 'rule_id'=> '000002', 'lift' => 2.04918, 'lhs'=> [0, 21, 16, 7], 'lhs_cover'=> [0.488, 122], 'support' => [0.488, 122]}]]\n\n puts\n puts \"Scenario: Successfully creating local association object:\" \n\n data.each do |filename, item_list, json_rule|\n puts\n puts \"Given I create a data source uploading a \" + filename+ \" file\"\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create an association from a dataset\"\n association = @api.create_association(dataset, {'name'=> 'new association'})\n puts \"And I wait until the association is ready\"\n assert_equal(BigML::HTTP_CREATED, association[\"code\"])\n assert_equal(1, association[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(association), true)\n\n puts \"And I create a local association\"\n local_association = BigML::Association.new(association)\n \n puts \"When I get the rules for %s\" % JSON.generate(item_list)\n\n association_rules = local_association.get_rules(nil, nil, nil, nil, item_list)\n\n puts \"Then the first rule is <%s>\" % json_rule\n assert_equal(association_rules[0].to_json(), json_rule)\n \n end\n\n end", "def get_inbox_ruleset_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.get_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\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] || 'InboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_workflow\n\n #create a random agent\n randomagent = UUIDTools::UUID.timestamp_create.to_s\n @zendeskclient.createuser(randomagent+='@gmail.com', 'Harish', \"4\", \"0\", [134692])\n assert_equal(201, @zendeskclient.responsecode)\n #lets make sure the /user/#{id}.xml exists\n\n usercreationresponse = @zendeskclient.response\n begin\n resource = RestClient::Resource.new usercreationresponse, @username, @pswd\n rescue\n assert(false) # if we hit this assertion for any reason means, we cannot access the user file\n # which means we have failed\n end\n\n # create ticket with the same user as created above as requester\n # this is implemented by using the same email id as before\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', randomagent)\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match(@host))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n\n end", "def tests\n parser.flow_items\n end", "def test_ut_t5_sef_pj_006\n current_user = User.find(PJ_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n # Create PJ admin right\n PrivilegesUsers.create(:user_id => PJ_ADMIN_ID,\n :privilege_id => 3,\n :pu_id => PU_ID,\n :pj_id => new_pj.id)\n # Create PJ member right\n PjsUsers.create(:pj_id => new_pj.id,\n :user_id => PJ_MEMBER_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 2,users.size\n end\n end", "def set_test_rule\n @test_rule = TestRule.find(params[:id])\n end", "def test_subject_templates\n @subject_templates.each { |template| \n puts render_subject(template) \n }\n end", "def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end", "def all\n @rules\n end", "def test_should_init_mail_settings\n assert Preference.init_mail_settings\n end", "def printRules\n\t\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\tputs \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\tif @i == 1\n\t\tputs \"No rules to print!\"\n\telse\n\t\tputs \"Rules Loaded!\"\n\tend\nend", "def password_rule_test_sets\n {\n 'not set': 'pass',\n 'parameter with NoEcho': 'pass',\n 'parameter with NoEcho and Default value': 'fail',\n 'parameter as a literal in plaintext': 'fail',\n 'as a literal in plaintext': 'fail',\n 'from Secrets Manager': 'pass',\n 'from Secure Systems Manager': 'pass',\n 'from Systems Manager': 'fail'\n }\nend", "def test_source_lists\n config=<<EOF\nsource_list \"test\", %w(test-1.example.com)\n\nsource_list \"has_ipv4\", \"0.0.0.0/0\"\n\nsource_list \"has_ipv6\", \"2000::/3\"\nEOF\n\n Configuration.current = ConfigurationBuilder.parse(config)\n\n a = Alert.new\n a.subject = \"www.example.com\"\n\n assert( a.in_source_list?(\"test\") )\n assert_equal( %w(test has_ipv4).sort, a.source_lists.sort )\n\n a.subject = \"www2.example.com\"\n assert( a.in_source_list?(\"has_ipv6\") )\n assert_equal( %w(has_ipv6 has_ipv4).sort, a.source_lists.sort )\n end", "def testSeveralSlaveClients2ActionsDifferentFilters\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool1', 'DummyAction1', [] ],\n [ 'DummyTool2', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWith2SlaveClientsFilters',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal(\n {\n 'SlaveClient1' => [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool1' => {\n 'DummyAction1' => [\n []\n ]\n }\n } ] ]\n ],\n 'SlaveClient2' => [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool2' => {\n 'DummyAction2' => [\n []\n ]\n }\n } ] ]\n ]\n },\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def test_ut_t5_sef_pj_010\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n email_settings = EmailSetting.find_all_by_pj_id(new_pj.id)\n email_settings.each do |setting|\n assert_equal TCANA_ADMIN_ID.to_s, setting.user_ids\n end\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def check_subject_and_body(email)\n winning_category = nil\n temp_points = 0 #The score for the current category\n points = 0 # The highest score achived\n\n subject_words = SeperateWords.new.seperate(email.subject)\n body_words = SeperateWords.new.seperate(email.body)\n\n @all_categories.each do |cat|\n #Checks each word in subject and body against keywords in categories\n temp_points += check_words(cat.key_words, subject_words, true)\n\n #BODY\n temp_points += check_words(cat.key_words, body_words)\n\n if temp_points > points\n\n points = temp_points\n winning_category = cat\n end\n\n temp_points = 0\n end\n #This way removes unesseccary transactions\n unless winning_category.blank?\n attach_category_to_email(email,winning_category)\n else\n #This asumes there's a category called \"Uncategorized\"\n #uncategorized = Category.find_by_name(\"Uncategorized\")\n #using scopes: not working for some reason\n #uncategorized = Category.uncategorized\n\n #attach_category_to_email(email,uncategorized)\n end\n\n end", "def should_update_inbox_unread_count!\n i = mailbox.inbox.unread(self).pluck(\"distinct conversations.id\").size\n update_attributes(inbox_unread_count: i) if i != inbox_unread_count\n end", "def checkbrainmailbox\n #Check if token is present\n logger.info params[\"token\"]\n if APP_CONFIG['token_action'].to_s == params[\"token\"]\n #Start the actual work\n imap = Net::IMAP.new(APP_CONFIG['imap_host'], APP_CONFIG['imap_port'] , APP_CONFIG['imap_ssl'], nil, false)\n imap.authenticate('LOGIN', APP_CONFIG['imap_user'], APP_CONFIG['imap_password'])\n imap.select('INBOX')\n @output = \"Connected to IMAP server\\n\"\n \n @n=0\n #Select unseen messages only\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n \n #Get the full content\n raw = imap.fetch(message_id, \"BODY[]\")[0].attr[\"BODY[]\"]\n imap.store(message_id, '+FLAGS', [:Seen])\n #Parse it with mail library\n mail = Mail.read_from_string(raw)\n token = mail.to.to_s\n #If multipart or auth token not included, then discard the mail and send a warning\n if mail.multipart? or (not token.include?(APP_CONFIG['token_email'].to_s))\n imap.copy(message_id, 'Untreated')\n @output=@output+Time.now.getutc.to_s+\" - 1 untreated mail\\n\"\n send_warning_mail(mail.from, raw) \n else\n content = mail.body.decoded\n name = mail.subject\n date = mail.date\n #Detect if labels are specified in first line\n if content.lines.first.to_s[0]==\"@\"\n labels = content.lines.first.chomp\n content = content.lines.to_a[1..-1].join\n end\n #Here, create the neuron\n @output=@output+Time.now.getutc.to_s+\" - 1 neuron created from a mail\\n\"\n puts \"One neuron created with name '#{name}', labels '#{labels}' and content '#{content}'\"\n neuron = Neuron.new\n neuron.name = name\n neuron.content = content\n neuron.labels = labels\n neuron.date = date\n neuron.save\n imap.copy(message_id, 'Treated')\n end\n imap.store(message_id, '+FLAGS', [:Deleted])\n @n+=1\n end\n imap.expunge #Delete all mails with deleted flags\n imap.close\n end\n render :layout => false\n end", "def test_check_condition_logged_in\n rule = rules(:test_rule)\n # expose private methods of the test object rule\n class << rule\n public :check_condition_logged_in\n end\n\n subject_person1 = nil\n subject_person2 = people(:valid_person)\n assert !rule.check_condition_logged_in(subject_person1, true)\n assert rule.check_condition_logged_in(subject_person2, true)\n assert rule.check_condition_logged_in(subject_person1, false)\n assert !rule.check_condition_logged_in(subject_person2, false)\n end", "def est03_groups_email_settings_TC_24415 #8/1/13 - JIRA TripleX 4588 , internal environment issue. disabling for now\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch)\n\t\t$search_text_field.when_present.set(\"the fighting mongooses\")\n\t\t$search_button.when_present.click\n\t\t\n\t\tsleep 2\n\t\tassert $search_result_fighting_mongooses.exists?\n\t\t\n\t\tassert $search_result_fighting_mongooses.exists?\n\t\t$search_result_fighting_mongooses.when_present.click\n\t\t$group_email_settings.click\n\t\tsleep 2\n\t\t\n\t\tassert $browser.text.include? \"Email Settings\"\n\tend", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def execute\n @imap = Net::IMAP.new(@imap_setting[:server], @imap_setting[:port])\n @imap.login(@imap_setting[:user], @imap_setting[:password])\n @imap.select(@imap_setting[:folder])\n \n #process all mail read email with test in subject for testing purpose. In reality it will process all emails\n query = imap_setting[:mode] == \"prod\" ? ['NOT', 'SEEN'] : ['SUBJECT', 'test']\n @imap.uid_search(query).each do |uid|\n catch(:continue) do\n mail = TMail::Mail.parse( imap.uid_fetch(uid, 'RFC822').first.attr['RFC822'] )\n from = mail.from\n to = mail.to\n bcc = mail.bcc\n cc = mail.cc\n subject = mail.subject\n msgid = mail.message_id \n date = mail.date\n ref_msgid = [mail.in_reply_to, mail.references].flatten.compact.join(\" \") \n \n #normalize all email addresses\n from.map! {|address| normalize_address(address) }\n to.map! {|address| normalize_address(address) }\n cc.map! {|address| normalize_address(address) } unless cc.is_nil?\n bcc.map! {|address| normalize_address(address) } unless bcc.is_nil?\n\n #find matching user\n user = nil\n user_email = from.find do |f|\n user = User.find_by_email(f.downcase)\n end\n \n if user\n logger.info \"processing email for #{user.username}\"\n if bcc.include?(@imap_setting[:email])\n #if from as user or asignee to as contact and we are in bcc it's outbound\n contacts = to.map do |t|\n #find contact by user or assigned to\n contact = Contact.find_by_email_and_user(t, user)\n if contact.nil?\n contact = Contact.find_by_email_and_assignee(t, user)\n end\n \n if contact.nil?\n #create contact, user is emailing a contact that's not in FFC\n logger.info \"new contact #{t}\"\n contact = Contact.new\n contact.user = user\n contact.email = t\n unless contact.save \n logger.warn \"could not save contact #{t}\"\n contact = nil\n end\n end\n contact\n end\n contacts.compact!\n \n #save mail\n from_list = from.join(\" \")\n to_list = to.join(\" \")\n cc_list = cc.join(\" \")\n bcc_list = bcc.join(\" \")\n body = mail.quoted_body\n save_email(from_list, to_list, subject, cc_list, bcc_list, body, msgid, ref_msgid, date, user, contacts)\n else\n #TODO if fowarded msg has from as user and to as contact it's inbound\n \n end\n \n else\n #unknown sender,this email is not supposed to be in drop box\n logger.warn \"mail from unknown user from: #{from} to: #{to} subject: #{subject}\"\n handle_processed_mail(uid) if @imap_setting[:mode] == \"prod\"\n end\n \n end\n \n end\n @imap.logout\n @imap.disconnect\n \n rescue Net::IMAP::NoResponseError => e\n logger.error \"IMAP server error\"\n rescue Net::IMAP::ByeResponseError => e\n logger.error \"IMAP server error\"\n rescue => e\n logger.error \"IMAP server error\"\n \n end", "def test_ut_t5_sef_con_007\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n WRONG_ID,OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.blank?\n end", "def test_cases(email_id = nil, root_folder = nil)\n file_selector(root_folder).email_id(email_id)\n .map(&:test_cases).reject(&:empty?).flatten.unwrap\n end", "def print_rules(*names)\n names = nil if names.empty?\n puts \"(#{runner.root})\"\n runner.rulesets.each do |name, set|\n next unless names.member?(name.to_s) if names\n print \"#{name}\"\n print \" (#{set.chain.join(' ')})\" unless set.chain.empty?\n puts\n set.docs.each_with_index do |d, i|\n puts \" * #{d}\"\n end\n end\n\n #exit\n end", "def test_multiple_recipients\n expected1 = @expected.clone\n expected1.to = 'user1@trypticon.org'\n expected2 = @expected.clone\n expected2.to = 'user2@trypticon.org'\n\n # Creation\n assert_equal [ expected1, expected2 ],\n SimpleMessenger.create_wakeup_multi('user1@trypticon.org', 'user2@trypticon.org')\n\n # Delivery\n SimpleMessenger.send_wakeup_multi('user1@trypticon.org', 'user2@trypticon.org')\n assert_equal [ expected1, expected2],\n @messenger.deliveries\n end" ]
[ "0.72629654", "0.6315927", "0.60893935", "0.58721715", "0.5780896", "0.5497661", "0.5484492", "0.5480035", "0.5434681", "0.54239094", "0.53774464", "0.53744745", "0.5336081", "0.51936847", "0.51283765", "0.51251245", "0.5080757", "0.50705403", "0.5008124", "0.49881157", "0.49808228", "0.49577174", "0.49577174", "0.49577174", "0.49577174", "0.49577174", "0.49577174", "0.49577174", "0.49460727", "0.4933231", "0.49203077", "0.48642015", "0.48033407", "0.4800496", "0.4794113", "0.47936872", "0.47918612", "0.47845972", "0.47819462", "0.47753268", "0.4771592", "0.47321346", "0.4722708", "0.4722708", "0.4722708", "0.4717178", "0.47085813", "0.47080776", "0.47015575", "0.46914473", "0.46812567", "0.46763813", "0.46696776", "0.46601278", "0.46570045", "0.46557805", "0.4646869", "0.4646869", "0.46449605", "0.46384746", "0.46313757", "0.46240544", "0.46201268", "0.46092722", "0.46035433", "0.4585916", "0.45711675", "0.45648864", "0.45648745", "0.4564369", "0.45636213", "0.45555508", "0.4551533", "0.45477295", "0.45442206", "0.4541182", "0.45362908", "0.45296717", "0.4528211", "0.4522059", "0.4518547", "0.45139575", "0.4510452", "0.4508647", "0.45082247", "0.45068222", "0.45061857", "0.4504209", "0.45015854", "0.4495654", "0.44932932", "0.44915015", "0.44891846", "0.44875756", "0.44847125", "0.44778785", "0.44769937", "0.44753546", "0.4471169", "0.44674817" ]
0.6427489
1
Test new inbox ruleset Test new inbox ruleset
def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {}) data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_new_inbox_ruleset ...'\n end\n # verify the required parameter 'test_new_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && test_new_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'test_new_inbox_ruleset_options' when calling InboxRulesetControllerApi.test_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(test_new_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def test_create_timebase_acl_rule\n user = createUser(\"1\")\n node = createNode(\"1\")\n res = @s.set_node_acl_rule_entries(node, user, {\"jcr:read\" => \"granted\"}, {\"rule\" => \"TestingThatRuleWorks\"})\n\tassert_equal(\"200\",res.code,\"Failed to add Rule ACL \"+res.body)\t\n\t\n\tacl = @s.get_node_ruleacl(node)\n\t@s.log.info(acl)\n\tassert_equal(1,acl.size)\n\t\n\truleace = findRuleAce(acl, user.name)\n\tassert_not_nil(ruleace)\n\tassert_equal(0,ruleace[\"order\"])\n\tgranted = ruleace[\"granted\"]\n\tassert_equal(1,granted.size)\n\tassert_equal(\"jcr:read\",granted[0])\n\tdenied = ruleace[\"denied\"]\n\tassert_nil(denied)\n\tassert_equal(\"TestingThatRuleWorks\",ruleace[\"sakai:rule-processor\"])\n\t\n\t\n\t\n\t\n end", "def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end", "def set_test_rule\n @test_rule = TestRule.find(params[:id])\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}/test'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...'\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#create_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def test_authorize_according_to_one_rule\n rule_or = rules(:active_or_rule) # friends or members of group tkk can view name of person 1\n rule_and = rules(:active_and_rule) # friends who are members of group tkk can view email of person 1\n\n action_view_name = actions(:view_name)\n action_view_email = actions(:view_email)\n object_person = people(:valid_person) # person id 1\n subject_person_test = people(:test) # not friend, not member of group tkk\n subject_person_4 = people(:friend) # person 4 is a friend, but not a member of group tkk\n subject_person_1aa = people(:person1) # person 1aa is a friend, and also a member of group tkk\n\n assert subject_person_1aa.contacts.include? object_person\n assert subject_person_1aa.is_member_of? groups(:tkk)\n\n assert !rule_or.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert rule_and.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_email.action_type, action_view_email.action_value)\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def test_startchangeset_invalid_wrong_user\n user = create(:user)\n user2 = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user2.email}:test\", {}, cs_id, \"delete\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -2, result[0]\n assert_equal \"The user doesn't own that changeset\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n end", "def boolean_rule_test_sets\n {\n 'not set': 'fail',\n 'set': 'pass'\n }\nend", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_new_rule_set\n ActiveRecord::Base.transaction do\n new_rule_set = StateMachineRuleSet.default_rule_set.create_duplicate_rule_set!(rule_set_name, rule_set_descr)\n new_rule_set.state_transition_guards.where(:type => %w[TpsGuard TpsRhnqaGuard]).update_all(:guard_type => 'info')\n end\n end", "def test_emails\n end", "def test_putrelation_create_valid\n changeset = create(:changeset)\n user = changeset.user\n cs_id = changeset.id\n\n node = create(:node)\n way = create(:way_with_nodes, :nodes_count => 2)\n relation = create(:relation)\n\n amf_content \"putrelation\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, { \"test\" => \"new\" }, [[\"Node\", node.id, \"node\"], [\"Way\", way.id, \"way\"], [\"Relation\", relation.id, \"relation\"]], true]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_relation_id = result[3].to_i\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal 1, result[4]\n\n new_relation = Relation.find(new_relation_id)\n assert_equal 1, new_relation.version\n assert_equal [[\"Node\", node.id, \"node\"], [\"Way\", way.id, \"way\"], [\"Relation\", relation.id, \"relation\"]], new_relation.members\n assert_equal({ \"test\" => \"new\" }, new_relation.tags)\n assert_equal true, new_relation.visible\n end", "def test_multiple_recipients\r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n initial_bob_plan_count = bob.planner.plans.length\r\n initial_existingbob_plan_count = existingbob.planner.plans.length\r\n initial_longbob_plan_count = longbob.planner.plans.length\r\n \r\n Mailman.receive(@multiple_recipients_string)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n assert_equal initial_bob_plan_count + 1, bob.planner.plans.length\r\n assert_equal initial_existingbob_plan_count + 1, existingbob.planner.plans.length\r\n assert_equal initial_longbob_plan_count, longbob.planner.plans.length\r\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def test_quiz_keyword_adds_subscriber_to_active_quiz\n q = @t.quizzes.new(:name => 'quiz with participants', :response_message => 'blah')\n assert q.save\n @t.activate_quiz(q)\n assert_equal 0, q.subscribers.count\n t = @t.text_messages.new(\"body\" => \"quiz\", \"from_number\" => \"111\", :to_number => \"222\")\n t.save\n assert_equal 1, q.subscribers.count\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def test_putway_create_valid\n changeset = create(:changeset)\n cs_id = changeset.id\n user = changeset.user\n\n a = create(:node).id\n b = create(:node).id\n c = create(:node).id\n d = create(:node).id\n e = create(:node).id\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [a, b, c], { \"test\" => \"new\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({}, result[4])\n assert_equal 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [a, b, c], new_way.nds\n assert_equal({ \"test\" => \"new\" }, new_way.tags)\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [b, d, e, a], { \"test\" => \"newer\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({}, result[4])\n assert_equal 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [b, d, e, a], new_way.nds\n assert_equal({ \"test\" => \"newer\" }, new_way.tags)\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [b, -1, d, e], { \"test\" => \"newest\" }, [[4.56, 12.34, -1, 0, { \"test\" => \"new\" }], [12.34, 4.56, d, 1, { \"test\" => \"ok\" }]], { a => 1 }]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n new_node_id = result[4][\"-1\"].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({ \"-1\" => new_node_id }, result[4])\n assert_equal 1, result[5]\n assert_equal({ new_node_id.to_s => 1, d.to_s => 2 }, result[6])\n assert_equal({ a.to_s => 1 }, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [b, new_node_id, d, e], new_way.nds\n assert_equal({ \"test\" => \"newest\" }, new_way.tags)\n\n new_node = Node.find(new_node_id)\n assert_equal 1, new_node.version\n assert_equal true, new_node.visible\n assert_equal 4.56, new_node.lon\n assert_equal 12.34, new_node.lat\n assert_equal({ \"test\" => \"new\" }, new_node.tags)\n\n changed_node = Node.find(d)\n assert_equal 2, changed_node.version\n assert_equal true, changed_node.visible\n assert_equal 12.34, changed_node.lon\n assert_equal 4.56, changed_node.lat\n assert_equal({ \"test\" => \"ok\" }, changed_node.tags)\n\n # node is not deleted because our other ways are using it\n deleted_node = Node.find(a)\n assert_equal 1, deleted_node.version\n assert_equal true, deleted_node.visible\n end", "def rule_assert( obj )\r\n # add object as a new fact\r\n f = fact(obj)\r\n # get_relevant_rules\r\n logger.debug( \"Check if we need to add more rules\") if logger\r\n add_relevant_rules_for_fact(f)\r\n sort_relevant_rules\r\n end", "def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end", "def test_ut_t2_ars_arc_012\n current_user = User.find_by_id(TCANA_MEMBER_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert !ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def test(rule)\n position = pos\n events = apply_rule(rule, position, [])\n self.pos = position\n events[-1]\n end", "def test_ensure_mail_wasnt_sent_when_grader_takes_on_report\n login_as :donna\n post :auto_assign\n assert_equal(0, @emails.size)\n\n=begin\n\n email = @emails.first\n assert_match(/A grader has picked up your report on/ , email.subject)\n assert_match(/Once the grader has completed grading your report, you will get another email notification/, email.body)\n\n=end\n\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def test_authorize\n object_person = people(:valid_person) # person_id 1\n subject_person_1aa = people(:person1) # person_id 1aa\n subject_person_2aa = people(:person3) # person_id 2aa\n \n assert Rule.authorize?(subject_person_1aa, object_person.id, \"view\", \"email\")\n assert !Rule.authorize?(subject_person_2aa, object_person.id, \"view\",\"email\")\n\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_ut_t2_ars_ard_006\n ars_detail = AnalyzeRuleConfigDetail.find(:first)\n ars_detail.rule_numbers = \"1,2,3,4,5\"\n ars_detail.save\n assert_equal ars_detail.rule_number_list, [\"1\",\"2\",\"3\",\"4\",\"5\"]\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def test_known_rule_creation_by_shortened_name\n rule_type = :RequestCount\n rule = RSlow::Rule.generate(rule_type)\n assert_instance_of(RSlow::Rules::RequestCountRule, rule)\n end", "def test(rule)\n rule.exec(self)[-1]\n end", "def test_ut_t5_sef_con_013\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:create])\n assert email_title.include?(\"Subtask is created\")\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def test_workflow\n\n #create a random agent\n randomagent = UUIDTools::UUID.timestamp_create.to_s\n @zendeskclient.createuser(randomagent+='@gmail.com', 'Harish', \"4\", \"0\", [134692])\n assert_equal(201, @zendeskclient.responsecode)\n #lets make sure the /user/#{id}.xml exists\n\n usercreationresponse = @zendeskclient.response\n begin\n resource = RestClient::Resource.new usercreationresponse, @username, @pswd\n rescue\n assert(false) # if we hit this assertion for any reason means, we cannot access the user file\n # which means we have failed\n end\n\n # create ticket with the same user as created above as requester\n # this is implemented by using the same email id as before\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', randomagent)\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match(@host))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n\n end", "def test_should_init_mail_settings\n assert Preference.init_mail_settings\n end", "def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def run(rule)\n end", "def test_ut_t2_ars_arc_011\n current_user = User.find_by_id(TCANA_ADMIN_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def new_rule(rule)\n Rule.new(rule)\n end", "def add_to_rules(msg)\n # TODO use configatron config parameter for conf dir\n line = \"ACCEPT net:#{msg[2]} fw #{msg[1]}\"\n line << \" \" << msg[3] if msg[3]\n line << \"\\n\"\n lines = []\n\n File.open(rules_file) do |f|\n lines = f.readlines\n end\n\n i = lines.size - 1\n\n while i >= 0 && lines[i] !~ /\\s*#LAST LINE -- ADD YOUR ENTRIES/\n i -= 1\n end\n\n if i >= 0\n a = [line, lines[i]]\n lines[i,i] = a\n\n # TODO ask agent to backup original file\n\n File.open(rules_file, \"w\") do |f|\n f.write lines.join\n end\n\n message = \"#{rules_file} updated, run shorewall restart to reload the rules.\"\n else\n message = \"Can not find last mark line\"\n end\n\n send_response(message)\n end", "def test_ut_t5_sef_pj_010\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n email_settings = EmailSetting.find_all_by_pj_id(new_pj.id)\n email_settings.each do |setting|\n assert_equal TCANA_ADMIN_ID.to_s, setting.user_ids\n end\n end", "def test_10a\r\n db = build\r\n assert_equal [],db.groups\r\n end", "def test_ut_t5_sef_con_007\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n WRONG_ID,OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.blank?\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def create\n @rule_set = RuleSet.new(params[:rule_set])\n\n respond_to do |format|\n if @rule_set.save\n format.html { redirect_to @rule_set, :notice => 'Rule set was successfully created.' }\n format.json { render :json => @rule_set, :status => :created, :location => @rule_set }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rule_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_ut_t5_sef_con_006\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:create],OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.include?(\"Task ID (#{TASK_ID}) that was register at\")\n end", "def add(rule); end", "def index\n @test_rules = TestRule.all\n end", "def test_ut_t5_sef_con_001\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:change],OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.include?(\"has changed from\")\n end", "def test_it_can_create_payload_entry\n payload = Payload.new(user_id: @user, url_id: @url, requestedAt: \"2013-02-16 21:38:28 -0700\", respondedIn: 37, referral_id: @referral, request_id: @request, parameters: \"fill\",user_agent_id: @user_agent, resolution_id: @resolution, ip: \"63.29.38.211\")\n assert payload.valid?\n end", "def test_issue_add\n issue = Issue.find(1)\n GLoc.valid_languages.each do |lang|\n Setting.default_language = lang.to_s\n assert Mailer.deliver_issue_add(issue)\n end\n end", "def set_reminder_rule\n @reminder_rule = ReminderRule.find(params[:id])\n end", "def test_startchangeset_valid\n user = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(new_cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n old_cs_id = new_cs_id\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"newer\" }, old_cs_id, \"newer\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_cs_id = result[2].to_i\n\n assert_not_equal old_cs_id, new_cs_id\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(old_cs_id)\n assert_equal false, cs.is_open?\n assert_equal({ \"comment\" => \"newer\", \"source\" => \"new\" }, cs.tags)\n\n cs = Changeset.find(new_cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"newer\", \"source\" => \"newer\" }, cs.tags)\n\n old_cs_id = new_cs_id\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", {}, old_cs_id, \"\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_nil result[2]\n\n cs = Changeset.find(old_cs_id)\n assert_equal false, cs.is_open?\n assert_equal({ \"comment\" => \"newer\", \"source\" => \"newer\" }, cs.tags)\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def add_rule(rule)\n @rulebook.add_rule rule\n end", "def test_initializing_new_privilege_set\n assert_difference(\"PrivilegeSet.sets.length\", 1, \"Adding test PrivilegeSet\") do\n assert_difference(\"Cbac::PrivilegeSetRecord.find(:all).length\", 1, \"Record should not be added to table - record already exists\") do\n PrivilegeSet.add :test_initializing_new_privilege_set, \"Something\"\n end\n end\n end", "def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def test_2_add_rule_bad\n pattern = ''\n resource = 'A'\n dns_response = ['1.1.1.1']\n\n hash = {:pattern => pattern, :resource => resource, :response => dns_response}\n\n # Test that an empty \"pattern\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['pattern'] = 'foo.bar.baz'\n hash['resource'] = ''\n\n # Test that an empty \"resource\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['resource'] = 'A'\n hash['response'] = []\n\n # Test that an empty \"response\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['response'] = 42\n\n # Test that a non-array \"response\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n end", "def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n end", "def test_ut_t5_sef_pj_004\n current_user = User.find(TCANA_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 4,users.size\n end\n end", "def test_only_one_invitation_per_team\n duplicate_invitation = ImFreeAgentInvitation.new(:im_free_agent_id => im_free_agent_invitations(:invitation_from_division_team).im_free_agent_id,\n :im_team_id => im_free_agent_invitations(:invitation_from_division_team).im_team_id)\n assert !duplicate_invitation.save\n assert_equal \"has already been taken\" , duplicate_invitation.errors.on(:im_free_agent_id)\n #change team number and should save\n duplicate_invitation.im_team_id = 10\n assert duplicate_invitation.save\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def test_create\n #create a new resourceset\n post :create, :exp=> 'SemanticExpression.new.union(:s,Namespace.lookup(:rdf,:type),Namespace.lookup(:rdfs,:Class))'\n assert @controller.resourceset.resources.size > 0 #assert that set was remove\n assert_response :success #assert that the request was executed successful\n \n end", "def test_creation_and_delivery\n @expected.to = 'trejkaz@trypticon.org/tests'\n\n # Test creation of the message.\n assert_equal [ @expected ], SimpleMessenger.create_wakeup('trejkaz@trypticon.org/tests')\n \n # Test delivery.\n SimpleMessenger.send_wakeup('trejkaz@trypticon.org/tests')\n assert_equal [ @expected ], @messenger.deliveries\n end", "def test_add_a_discussion_topic_to_general_theme\n $ie.link(:text, /Add a Discussion Topic/).click\n $ie.text_field(:id, \"discussion_title\").set(\"a new discussion\")\n $ie.text_field(:id, \"discussion_body\").set(\"the new discussion body\")\n $ie.form(:id, \"new_discussion\").submit\n assert $ie.h1(:text, \"a new discussion\").exist?\n assert $ie.p(:text, \"the new discussion body\").exist?\n assert $ie.link(:text, \"General\").exist?\n $ie.link(:text, /Return to Discussions/).click\n assert $ie.link(:text, \"a new discussion\").exist?\n $ie.link(:text, \"General\").click\n assert $ie.link(:text, \"a new discussion\").exist? \n end", "def test_home_message_1\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.real_rubies_found(0)\n\t\ttest_main.home_message\n\t\tassert mocked_Graph\n\tend", "def test_active?\n active_rule = rules(:active_or_rule)\n assert active_rule.active?, \"The rule should be active\"\n inactive_rule = rules(:inactive_rule)\n assert !inactive_rule.active?, \"The rule should be inactive\"\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def set_rulemaking\n @rulemaking = Rulemaking.find(params[:id])\n end", "def test_ut_t2_ars_arc_014\n # pu admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n # ars created by pu\n pu_id = PrivilegesUsers.find_all_by_user_id(current_user.id)[0].pu_id\n ars = Pu.find_by_id(pu_id).analyze_rule_configs[0]\n ars.created_by = current_user.id\n ars.save\n #\n assert ars.editable?(current_user,pu_id,nil)\n end", "def test_is_error_mail?\n\t\temail = TMail::Mail.new\n\t\temail.to = [\"mogya@mogya.com\",\"mogya2@mogya.com\"]\n\t\temail.from = \"MAILER-DAEMON@mogya.com\"\n\n\t\tassert SchduleMailReceiver.is_error_mail?(email)\n\n\t\temail.from = \"mogya@mogya.com\"\n\t\tassert !SchduleMailReceiver.is_error_mail?(email)\n\n end", "def test_ut_t5_sef_pj_006\n current_user = User.find(PJ_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n # Create PJ admin right\n PrivilegesUsers.create(:user_id => PJ_ADMIN_ID,\n :privilege_id => 3,\n :pu_id => PU_ID,\n :pj_id => new_pj.id)\n # Create PJ member right\n PjsUsers.create(:pj_id => new_pj.id,\n :user_id => PJ_MEMBER_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 2,users.size\n end\n end", "def test_confirm_that_creating_a_text_message_with_keyword_adds_subscriber_to_keyword\n kw = @t.keywords.new(:word => 'word', :response => 'to your mom')\n assert_equal 0, kw.subscribers.count\n assert kw.save\n tm = @t.text_messages.new(:body => \"word\", :to_number => \"1\", :from_number => \"999\")\n assert tm.save\n kw.reload\n assert_equal 1, kw.subscribers.count\n end", "def set_rule\n @rule = params[:rule].to_i\n\n if @rule == 0 or @rule == 1 or @rule == 2\n else\n @rule = 0\n end\n end", "def rule; end", "def rule; end", "def rule; end", "def test_rule_name_uniquess_for_a_person\n owner = people(:valid_person)\n rule_1 = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"and\")\n assert rule_1.save, \"Rule 1 cannot be saved.\"\n\n rule_2 = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"or\")\n assert !rule_2.save, \"Allows duplicate rule names for a person.\"\n end", "def test_group_rule(group_rule, setup_match, remove_match, expected_member_count = 1)\n # Ensure a group has a rule\n group = entities(:groupWithNothing)\n\n assert group.roles.empty?, 'looks like groupWithNothing has a role'\n assert group.rules.empty?, 'looks like groupWithNothing has a rule'\n assert group.owners.empty?, 'looks like groupWithNothing has an owner'\n assert group.operators.empty?, 'looks like groupWithNothing has an operator'\n\n Rails.logger.tagged 'test_group_rule' do\n Rails.logger.debug 'Calling setup ...'\n\n setup_match.call()\n\n # Test basic rule creation matches existing people\n assert group.members.empty?, 'group should have no members'\n\n Rails.logger.debug 'Adding group rule ...'\n group.rules << group_rule\n\n group.reload\n # Subtract a second from the 'updated_at' flag to ensure it is a reliable\n # indicator of a group being touched\n group.updated_at -= 1\n group.save!\n group_last_updated_at = group.updated_at\n\n assert group.members.length == expected_member_count, \"group should have #{expected_member_count} member(s) but has #{group.members.length} member(s)\"\n\n Rails.logger.debug 'Calling remove ...'\n remove_match.call()\n\n Rails.logger.debug 'Checking that group has no members ...'\n group.reload\n assert group.updated_at > group_last_updated_at, 'group should have been touched'\n\n # Subtract a second from the 'updated_at' flag to ensure it is a reliable\n # indicator of a group being touched\n group.updated_at -= 1\n group.save!\n group_last_updated_at = group.updated_at\n assert group.members.empty?, \"group should have no members but has #{group.members.count}\"\n\n Rails.logger.debug 'Calling setup again ...'\n setup_match.call()\n\n group.reload\n assert group.updated_at > group_last_updated_at, 'group should have been touched'\n group_last_updated_at = group.updated_at\n\n assert group.members.length == expected_member_count, \"group should have #{expected_member_count} member(s)\"\n end\n end", "def test_putrelation_delete_inuse\n relation = create(:relation)\n super_relation = create(:relation)\n create(:relation_member, :relation => super_relation, :member => relation)\n cs_id = relation.changeset.id\n user = relation.changeset.user\n\n amf_content \"putrelation\", \"/1\", [\"#{user.email}:test\", cs_id, relation.version, relation.id, relation.tags, relation.members, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -1, result[0]\n assert_match /relation #{relation.id} is used in/, result[1]\n\n new_relation = Relation.find(relation.id)\n assert_equal relation.version, new_relation.version\n assert_equal relation.members, new_relation.members\n assert_equal relation.tags, new_relation.tags\n assert_equal true, new_relation.visible\n end", "def test_create\n before = CaseViewSetting.count\n assert_nil CaseViewSetting.find_by_sfcontact_setting_id(@derek.settings.id)\n case_view = @derek.settings.case_view('New')\n assert_equal before +1, CaseViewSetting.count\n assert case_view.is_a?(CaseViewSetting)\n end", "def tests\n config.tests(subject)\n end", "def create\n @test_rule = TestRule.new(test_rule_params)\n\n respond_to do |format|\n if @test_rule.save\n format.html { redirect_to @test_rule, notice: 'Test rule was successfully created.' }\n format.json { render :show, status: :created, location: @test_rule }\n else\n format.html { render :new }\n format.json { render json: @test_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_ut_t2_ars_arc_022\n # tcana admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n ars = AnalyzeRuleConfig.create() # ars is not being used.\n ars.created_by = current_user.id\n ars.save\n assert ars.deletable?(current_user, PU_ID, nil)\n end", "def test_create\n\n assert_equal(5, DocumentType.count)\n\n admin_session = cathy_admin_session\n new_document_type = { 'active' => '1',\n 'name' => 'Yankee' }\n\n post(:create, { :new_document_type => new_document_type }, admin_session)\n assert_equal(6, DocumentType.count)\n assert_equal(\"Yankee added\", flash['notice'])\n assert_redirected_to :action => 'list'\n\n post(:create, { :new_document_type => new_document_type }, admin_session)\n assert_equal(6, DocumentType.count)\n #assert_equal(\"Name already exists in the database\", flash['notice'])\n assert_redirected_to :action => 'add'\n\n end", "def test_ut_t5_sef_con_018\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n assert ContextNotifier.send_email(email_setting,TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:create],OLD_STATE_ID,NEW_STATE_ID)\n # manually test by checking the mail.\n end", "def test_feetToMeters\n\t\temail = EmailLogMain.new\n\t\temailHash = email.makeHash\n\t\temailString = emailHash[\"B6C161B2004\"]\n\n# START OF TESTING!\n\t\tassert(true,File.exist?(email.getFileName))\n#Checks if our regular expressions find the correct items needed for our report\n\t\tassert_equal(\"20131211132505.999FB1B2003@toilers.Mines.EDU\",email.RegexExist(\"messageid\",emailString))#Messageid\n\t\tassert_equal(\"echopper@mines.edu\", email.RegexExist(\"to\",emailString)) #to email\n\t\tassert_equal(\"root@toilers.Mines.EDU\",email.RegexExist(\"from\",emailString)) #from email\n\t\tassert_equal(\"6072\",email.RegexExist(\"size\",emailString))#size\n\t\tassert_equal(\"B6C161B2004\",email.RegexExist(\"uniqueid\",emailString)) #uniqueID\n\n#This test will show how many reg expression this program finds for each item\n\t\tassert_equal(3, emailString.scan(@@TO_REGEX).size) #to email\n\t\tassert_equal(1, emailString.scan(@@MESSAGE_ID_REGEX).size) #messageid\n\t\tassert_equal(1, emailString.scan(@@SIZE_REGEX).size) #size\n\t\tassert_equal(6, emailString.scan(@@TIMESTAMP_REGEX).size) #Time\n\t\tassert_equal(1, emailString.scan(@@FROM_REGEX).size) #from email\n\t\tassert_equal(6, emailString.scan(@@UNIQUE_ID).size) #uniqueID\n\n\t\t#This test will check for the correct ammount of emails since every email has a unique message ID \n\t\t#Messageid == total number of email i.e. the size of our hash\t\t\n\t\tholdEntireString = IO.read(email.getFileName)\n\t\tassert_equal(emailHash.length, holdEntireString.scan(@@MESSAGE_ID_REGEX).size)\n\tend" ]
[ "0.64125824", "0.60827935", "0.5998476", "0.5913734", "0.56242436", "0.5592575", "0.55215394", "0.5515756", "0.5394641", "0.53827137", "0.5276402", "0.5274095", "0.5244903", "0.52198315", "0.52137554", "0.51923436", "0.5175251", "0.5127945", "0.5124497", "0.5117424", "0.5099006", "0.5097722", "0.50872904", "0.49976572", "0.49845108", "0.49714366", "0.4963714", "0.49183655", "0.49158606", "0.49158308", "0.49139705", "0.49008793", "0.48914227", "0.48644873", "0.4858162", "0.48486406", "0.48398823", "0.48342547", "0.48303813", "0.48245865", "0.4821318", "0.48132828", "0.48090944", "0.48079097", "0.48025736", "0.48002037", "0.4797734", "0.47894758", "0.478221", "0.47773486", "0.47741973", "0.47741973", "0.47741973", "0.47741973", "0.47691268", "0.47562072", "0.47552648", "0.47503364", "0.4747831", "0.47475386", "0.4738263", "0.47308528", "0.47297344", "0.47249818", "0.47243825", "0.47242826", "0.47239968", "0.47219625", "0.47219625", "0.47219625", "0.47197393", "0.46878207", "0.46861467", "0.46833825", "0.4682501", "0.46722874", "0.46719074", "0.46699828", "0.4665923", "0.4663056", "0.4659264", "0.46588135", "0.4657981", "0.46508923", "0.46502578", "0.46375015", "0.4635979", "0.4635339", "0.4635339", "0.4635339", "0.4633816", "0.4621275", "0.46148232", "0.46138933", "0.46078545", "0.46037263", "0.46030888", "0.4599363", "0.45973486", "0.45948347" ]
0.6669657
0
Test new inbox ruleset Test new inbox ruleset
def test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_new_inbox_ruleset ...' end # verify the required parameter 'test_new_inbox_ruleset_options' is set if @api_client.config.client_side_validation && test_new_inbox_ruleset_options.nil? fail ArgumentError, "Missing the required parameter 'test_new_inbox_ruleset_options' when calling InboxRulesetControllerApi.test_new_inbox_ruleset" end # resource path local_var_path = '/rulesets' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(test_new_inbox_ruleset_options) # return_type return_type = opts[:return_type] || 'InboxRulesetTestResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: InboxRulesetControllerApi#test_new_inbox_ruleset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_inbox_ruleset(test_new_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = test_new_inbox_ruleset_with_http_info(test_new_inbox_ruleset_options, opts)\n data\n end", "def test_inbox_rulesets_for_inbox(inbox_id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts)\n data\n end", "def test_inbox_rulesets_for_inbox_with_http_info(inbox_id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_rulesets_for_inbox ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_rulesets_for_inbox\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = inbox_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_rulesets_for_inbox\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_inbox_ruleset(id, inbox_ruleset_test_options, opts = {})\n data, _status_code, _headers = test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts)\n data\n end", "def test_create_timebase_acl_rule\n user = createUser(\"1\")\n node = createNode(\"1\")\n res = @s.set_node_acl_rule_entries(node, user, {\"jcr:read\" => \"granted\"}, {\"rule\" => \"TestingThatRuleWorks\"})\n\tassert_equal(\"200\",res.code,\"Failed to add Rule ACL \"+res.body)\t\n\t\n\tacl = @s.get_node_ruleacl(node)\n\t@s.log.info(acl)\n\tassert_equal(1,acl.size)\n\t\n\truleace = findRuleAce(acl, user.name)\n\tassert_not_nil(ruleace)\n\tassert_equal(0,ruleace[\"order\"])\n\tgranted = ruleace[\"granted\"]\n\tassert_equal(1,granted.size)\n\tassert_equal(\"jcr:read\",granted[0])\n\tdenied = ruleace[\"denied\"]\n\tassert_nil(denied)\n\tassert_equal(\"TestingThatRuleWorks\",ruleace[\"sakai:rule-processor\"])\n\t\n\t\n\t\n\t\n end", "def ensure_rule_set()\n resp = @ses.list_receipt_rule_sets()\n add_new_rule_set = true\n resp.to_h[:rule_sets].each { |rule_set|\n add_new_rule_set = false if (rule_set[:name] =~ /^#{Regexp.escape(@receipt_rule.rule_set_name)}$/)\n }\n @ses.create_receipt_rule_set({rule_set_name: @receipt_rule.rule_set_name}) if add_new_rule_set\n end", "def set_test_rule\n @test_rule = TestRule.find(params[:id])\n end", "def create_new_inbox_ruleset(create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts)\n data\n end", "def test_1_add_rule_good\n pattern = 'foo.bar'\n resource = 'A'\n dns_response = ['1.2.3.4']\n\n json = {:pattern => pattern, :resource => resource, :response => dns_response}.to_json\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n first_id = result['id']\n\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n json,\n @@headers)\n\n # Verify that adding an existing rule returns its id\n check_rest_response(rest_response)\n\n result = JSON.parse(rest_response.body)\n second_id = result['id']\n\n assert_equal(first_id, second_id)\n end", "def test_inbox_ruleset_with_http_info(id, inbox_ruleset_test_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.test_inbox_ruleset ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # verify the required parameter 'inbox_ruleset_test_options' is set\n if @api_client.config.client_side_validation && inbox_ruleset_test_options.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_ruleset_test_options' when calling InboxRulesetControllerApi.test_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets/{id}/test'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(inbox_ruleset_test_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetTestResult' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#test_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_new_inbox_ruleset_with_http_info(create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.create_new_inbox_ruleset ...'\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxRulesetControllerApi.create_new_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxRulesetControllerApi#create_new_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_inbox_ruleset(inbox_id, create_inbox_ruleset_options, opts = {})\n data, _status_code, _headers = create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts)\n data\n end", "def test_authorize_according_to_one_rule\n rule_or = rules(:active_or_rule) # friends or members of group tkk can view name of person 1\n rule_and = rules(:active_and_rule) # friends who are members of group tkk can view email of person 1\n\n action_view_name = actions(:view_name)\n action_view_email = actions(:view_email)\n object_person = people(:valid_person) # person id 1\n subject_person_test = people(:test) # not friend, not member of group tkk\n subject_person_4 = people(:friend) # person 4 is a friend, but not a member of group tkk\n subject_person_1aa = people(:person1) # person 1aa is a friend, and also a member of group tkk\n\n assert subject_person_1aa.contacts.include? object_person\n assert subject_person_1aa.is_member_of? groups(:tkk)\n\n assert !rule_or.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_test, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert !rule_and.authorize_according_to_one_rule(subject_person_4, object_person.id, action_view_email.action_type, action_view_email.action_value)\n assert rule_or.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_name.action_type, action_view_name.action_value)\n assert rule_and.authorize_according_to_one_rule(subject_person_1aa, object_person.id, action_view_email.action_type, action_view_email.action_value)\n end", "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "def test_startchangeset_invalid_wrong_user\n user = create(:user)\n user2 = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user2.email}:test\", {}, cs_id, \"delete\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -2, result[0]\n assert_equal \"The user doesn't own that changeset\", result[1]\n\n cs = Changeset.find(cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n end", "def boolean_rule_test_sets\n {\n 'not set': 'fail',\n 'set': 'pass'\n }\nend", "def create_inbox_ruleset_with_http_info(inbox_id, create_inbox_ruleset_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.create_inbox_ruleset ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # verify the required parameter 'create_inbox_ruleset_options' is set\n if @api_client.config.client_side_validation && create_inbox_ruleset_options.nil?\n fail ArgumentError, \"Missing the required parameter 'create_inbox_ruleset_options' when calling InboxControllerApi.create_inbox_ruleset\"\n end\n # resource path\n local_var_path = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(create_inbox_ruleset_options) \n\n # return_type\n return_type = opts[:return_type] || 'InboxRulesetDto' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InboxControllerApi#create_inbox_ruleset\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_new_rule_set\n ActiveRecord::Base.transaction do\n new_rule_set = StateMachineRuleSet.default_rule_set.create_duplicate_rule_set!(rule_set_name, rule_set_descr)\n new_rule_set.state_transition_guards.where(:type => %w[TpsGuard TpsRhnqaGuard]).update_all(:guard_type => 'info')\n end\n end", "def test_emails\n end", "def test_putrelation_create_valid\n changeset = create(:changeset)\n user = changeset.user\n cs_id = changeset.id\n\n node = create(:node)\n way = create(:way_with_nodes, :nodes_count => 2)\n relation = create(:relation)\n\n amf_content \"putrelation\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, { \"test\" => \"new\" }, [[\"Node\", node.id, \"node\"], [\"Way\", way.id, \"way\"], [\"Relation\", relation.id, \"relation\"]], true]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_relation_id = result[3].to_i\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal 1, result[4]\n\n new_relation = Relation.find(new_relation_id)\n assert_equal 1, new_relation.version\n assert_equal [[\"Node\", node.id, \"node\"], [\"Way\", way.id, \"way\"], [\"Relation\", relation.id, \"relation\"]], new_relation.members\n assert_equal({ \"test\" => \"new\" }, new_relation.tags)\n assert_equal true, new_relation.visible\n end", "def test_multiple_recipients\r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n initial_bob_plan_count = bob.planner.plans.length\r\n initial_existingbob_plan_count = existingbob.planner.plans.length\r\n initial_longbob_plan_count = longbob.planner.plans.length\r\n \r\n Mailman.receive(@multiple_recipients_string)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n assert_equal initial_bob_plan_count + 1, bob.planner.plans.length\r\n assert_equal initial_existingbob_plan_count + 1, existingbob.planner.plans.length\r\n assert_equal initial_longbob_plan_count, longbob.planner.plans.length\r\n end", "def set_rules(rules)\n return if rules.nil?\n\n @payload = { add: rules }\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\",\n \"Content-type\": 'application/json'\n },\n body: JSON.dump(@payload)\n }\n @response = Typhoeus.post(@rules_url, @options)\n raise \"An error occurred while adding rules: #{@response.status_message}\" unless @response.success?\nend", "def test_quiz_keyword_adds_subscriber_to_active_quiz\n q = @t.quizzes.new(:name => 'quiz with participants', :response_message => 'blah')\n assert q.save\n @t.activate_quiz(q)\n assert_equal 0, q.subscribers.count\n t = @t.text_messages.new(\"body\" => \"quiz\", \"from_number\" => \"111\", :to_number => \"222\")\n t.save\n assert_equal 1, q.subscribers.count\n end", "def get_inbox_rulesets(opts = {})\n data, _status_code, _headers = get_inbox_rulesets_with_http_info(opts)\n data\n end", "def test_putway_create_valid\n changeset = create(:changeset)\n cs_id = changeset.id\n user = changeset.user\n\n a = create(:node).id\n b = create(:node).id\n c = create(:node).id\n d = create(:node).id\n e = create(:node).id\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [a, b, c], { \"test\" => \"new\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({}, result[4])\n assert_equal 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [a, b, c], new_way.nds\n assert_equal({ \"test\" => \"new\" }, new_way.tags)\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [b, d, e, a], { \"test\" => \"newer\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({}, result[4])\n assert_equal 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [b, d, e, a], new_way.nds\n assert_equal({ \"test\" => \"newer\" }, new_way.tags)\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, 0, -1, [b, -1, d, e], { \"test\" => \"newest\" }, [[4.56, 12.34, -1, 0, { \"test\" => \"new\" }], [12.34, 4.56, d, 1, { \"test\" => \"ok\" }]], { a => 1 }]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_way_id = result[3].to_i\n new_node_id = result[4][\"-1\"].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal -1, result[2]\n assert_not_equal -1, result[3]\n assert_equal({ \"-1\" => new_node_id }, result[4])\n assert_equal 1, result[5]\n assert_equal({ new_node_id.to_s => 1, d.to_s => 2 }, result[6])\n assert_equal({ a.to_s => 1 }, result[7])\n\n new_way = Way.find(new_way_id)\n assert_equal 1, new_way.version\n assert_equal [b, new_node_id, d, e], new_way.nds\n assert_equal({ \"test\" => \"newest\" }, new_way.tags)\n\n new_node = Node.find(new_node_id)\n assert_equal 1, new_node.version\n assert_equal true, new_node.visible\n assert_equal 4.56, new_node.lon\n assert_equal 12.34, new_node.lat\n assert_equal({ \"test\" => \"new\" }, new_node.tags)\n\n changed_node = Node.find(d)\n assert_equal 2, changed_node.version\n assert_equal true, changed_node.visible\n assert_equal 12.34, changed_node.lon\n assert_equal 4.56, changed_node.lat\n assert_equal({ \"test\" => \"ok\" }, changed_node.tags)\n\n # node is not deleted because our other ways are using it\n deleted_node = Node.find(a)\n assert_equal 1, deleted_node.version\n assert_equal true, deleted_node.visible\n end", "def rule_assert( obj )\r\n # add object as a new fact\r\n f = fact(obj)\r\n # get_relevant_rules\r\n logger.debug( \"Check if we need to add more rules\") if logger\r\n add_relevant_rules_for_fact(f)\r\n sort_relevant_rules\r\n end", "def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end", "def test_ut_t2_ars_arc_012\n current_user = User.find_by_id(TCANA_MEMBER_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert !ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def test(rule)\n position = pos\n events = apply_rule(rule, position, [])\n self.pos = position\n events[-1]\n end", "def test_ensure_mail_wasnt_sent_when_grader_takes_on_report\n login_as :donna\n post :auto_assign\n assert_equal(0, @emails.size)\n\n=begin\n\n email = @emails.first\n assert_match(/A grader has picked up your report on/ , email.subject)\n assert_match(/Once the grader has completed grading your report, you will get another email notification/, email.body)\n\n=end\n\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def test_authorize\n object_person = people(:valid_person) # person_id 1\n subject_person_1aa = people(:person1) # person_id 1aa\n subject_person_2aa = people(:person3) # person_id 2aa\n \n assert Rule.authorize?(subject_person_1aa, object_person.id, \"view\", \"email\")\n assert !Rule.authorize?(subject_person_2aa, object_person.id, \"view\",\"email\")\n\n end", "def get_inbox_rulesets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxRulesetControllerApi.get_inbox_rulesets ...'\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 = '/rulesets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?\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] || 'PageInboxRulesetDto' \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: InboxRulesetControllerApi#get_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_ut_t2_ars_ard_006\n ars_detail = AnalyzeRuleConfigDetail.find(:first)\n ars_detail.rule_numbers = \"1,2,3,4,5\"\n ars_detail.save\n assert_equal ars_detail.rule_number_list, [\"1\",\"2\",\"3\",\"4\",\"5\"]\n end", "def test_set3_14_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny'\n res_ob_adrs='/db/temp/test'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs) \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def test_known_rule_creation_by_shortened_name\n rule_type = :RequestCount\n rule = RSlow::Rule.generate(rule_type)\n assert_instance_of(RSlow::Rules::RequestCountRule, rule)\n end", "def test(rule)\n rule.exec(self)[-1]\n end", "def test_ut_t5_sef_con_013\n# email_setting = EmailSetting.find(:first,\n# :conditions => { :pj_id => PJ_ID,\n# :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_title = ContextNotifier.email_title(AnalyzeProcessEvent::EVENT_IDS[:create])\n assert email_title.include?(\"Subtask is created\")\n end", "def list_inbox_rulesets(inbox_id, opts = {})\n data, _status_code, _headers = list_inbox_rulesets_with_http_info(inbox_id, opts)\n data\n end", "def test_workflow\n\n #create a random agent\n randomagent = UUIDTools::UUID.timestamp_create.to_s\n @zendeskclient.createuser(randomagent+='@gmail.com', 'Harish', \"4\", \"0\", [134692])\n assert_equal(201, @zendeskclient.responsecode)\n #lets make sure the /user/#{id}.xml exists\n\n usercreationresponse = @zendeskclient.response\n begin\n resource = RestClient::Resource.new usercreationresponse, @username, @pswd\n rescue\n assert(false) # if we hit this assertion for any reason means, we cannot access the user file\n # which means we have failed\n end\n\n # create ticket with the same user as created above as requester\n # this is implemented by using the same email id as before\n @zendeskclient.createticket(\"test ticket\", \"4\", 'Captain Cool', randomagent)\n assert_equal(201, @zendeskclient.responsecode)\n assert(@zendeskclient.response.to_s.match(@host))\n tktcreationresponse = @zendeskclient.response\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # a new ticket; assert on the status of the ticket\n assert_equal(\"0\", doc.root.elements[\"status-id\"].text)\n\n\n ticketid = ZenDeskAPI.extractid(tktcreationresponse)\n\n\n # solve the ticket and test for the http error code\n @zendeskclient.solveticket(\"31198262\", ticketid)\n assert_equal(200, @zendeskclient.responsecode)\n\n resource = RestClient::Resource.new tktcreationresponse, 'harishkrishna@yahoo.com', 'aashiana'\n doc = Document.new(resource.get)\n # after solving the ticket; assert on the status of the ticket\n assert_equal(\"3\", doc.root.elements[\"status-id\"].text)\n\n\n end", "def test_should_init_mail_settings\n assert Preference.init_mail_settings\n end", "def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def list_inbox_rulesets_with_http_info(inbox_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InboxControllerApi.list_inbox_rulesets ...'\n end\n # verify the required parameter 'inbox_id' is set\n if @api_client.config.client_side_validation && inbox_id.nil?\n fail ArgumentError, \"Missing the required parameter 'inbox_id' when calling InboxControllerApi.list_inbox_rulesets\"\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 = '/inboxes/{inboxId}/rulesets'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))\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] || 'PageInboxRulesetDto' \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: InboxControllerApi#list_inbox_rulesets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def run(rule)\n end", "def test_ut_t2_ars_arc_011\n current_user = User.find_by_id(TCANA_ADMIN_ID)\n ars = AnalyzeRuleConfig.find_by_id(1)\n assert ars.editable?(current_user,PU_ID,PJ_ID)\n end", "def new_rule(rule)\n Rule.new(rule)\n end", "def add_to_rules(msg)\n # TODO use configatron config parameter for conf dir\n line = \"ACCEPT net:#{msg[2]} fw #{msg[1]}\"\n line << \" \" << msg[3] if msg[3]\n line << \"\\n\"\n lines = []\n\n File.open(rules_file) do |f|\n lines = f.readlines\n end\n\n i = lines.size - 1\n\n while i >= 0 && lines[i] !~ /\\s*#LAST LINE -- ADD YOUR ENTRIES/\n i -= 1\n end\n\n if i >= 0\n a = [line, lines[i]]\n lines[i,i] = a\n\n # TODO ask agent to backup original file\n\n File.open(rules_file, \"w\") do |f|\n f.write lines.join\n end\n\n message = \"#{rules_file} updated, run shorewall restart to reload the rules.\"\n else\n message = \"Can not find last mark line\"\n end\n\n send_response(message)\n end", "def test_ut_t5_sef_pj_010\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n email_settings = EmailSetting.find_all_by_pj_id(new_pj.id)\n email_settings.each do |setting|\n assert_equal TCANA_ADMIN_ID.to_s, setting.user_ids\n end\n end", "def test_10a\r\n db = build\r\n assert_equal [],db.groups\r\n end", "def test_ut_t5_sef_con_007\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n WRONG_ID,OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.blank?\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def create\n @rule_set = RuleSet.new(params[:rule_set])\n\n respond_to do |format|\n if @rule_set.save\n format.html { redirect_to @rule_set, :notice => 'Rule set was successfully created.' }\n format.json { render :json => @rule_set, :status => :created, :location => @rule_set }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rule_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_ut_t5_sef_con_006\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:create],OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.include?(\"Task ID (#{TASK_ID}) that was register at\")\n end", "def add(rule); end", "def index\n @test_rules = TestRule.all\n end", "def test_ut_t5_sef_con_001\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n email_message = ContextNotifier.email_message(TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:change],OLD_STATE_ID,NEW_STATE_ID)\n assert email_message.include?(\"has changed from\")\n end", "def test_it_can_create_payload_entry\n payload = Payload.new(user_id: @user, url_id: @url, requestedAt: \"2013-02-16 21:38:28 -0700\", respondedIn: 37, referral_id: @referral, request_id: @request, parameters: \"fill\",user_agent_id: @user_agent, resolution_id: @resolution, ip: \"63.29.38.211\")\n assert payload.valid?\n end", "def test_issue_add\n issue = Issue.find(1)\n GLoc.valid_languages.each do |lang|\n Setting.default_language = lang.to_s\n assert Mailer.deliver_issue_add(issue)\n end\n end", "def set_reminder_rule\n @reminder_rule = ReminderRule.find(params[:id])\n end", "def test_startchangeset_valid\n user = create(:user)\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"new\" }, nil, \"new\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_cs_id = result[2].to_i\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(new_cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"new\", \"source\" => \"new\" }, cs.tags)\n\n old_cs_id = new_cs_id\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", { \"source\" => \"newer\" }, old_cs_id, \"newer\", 1]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_cs_id = result[2].to_i\n\n assert_not_equal old_cs_id, new_cs_id\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n\n cs = Changeset.find(old_cs_id)\n assert_equal false, cs.is_open?\n assert_equal({ \"comment\" => \"newer\", \"source\" => \"new\" }, cs.tags)\n\n cs = Changeset.find(new_cs_id)\n assert_equal true, cs.is_open?\n assert_equal({ \"comment\" => \"newer\", \"source\" => \"newer\" }, cs.tags)\n\n old_cs_id = new_cs_id\n\n amf_content \"startchangeset\", \"/1\", [\"#{user.email}:test\", {}, old_cs_id, \"\", 0]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_nil result[2]\n\n cs = Changeset.find(old_cs_id)\n assert_equal false, cs.is_open?\n assert_equal({ \"comment\" => \"newer\", \"source\" => \"newer\" }, cs.tags)\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def add_rule(rule)\n @rulebook.add_rule rule\n end", "def test_initializing_new_privilege_set\n assert_difference(\"PrivilegeSet.sets.length\", 1, \"Adding test PrivilegeSet\") do\n assert_difference(\"Cbac::PrivilegeSetRecord.find(:all).length\", 1, \"Record should not be added to table - record already exists\") do\n PrivilegeSet.add :test_initializing_new_privilege_set, \"Something\"\n end\n end\n end", "def test_set3_15_check() \n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test' \n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def test_2_add_rule_bad\n pattern = ''\n resource = 'A'\n dns_response = ['1.1.1.1']\n\n hash = {:pattern => pattern, :resource => resource, :response => dns_response}\n\n # Test that an empty \"pattern\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['pattern'] = 'foo.bar.baz'\n hash['resource'] = ''\n\n # Test that an empty \"resource\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['resource'] = 'A'\n hash['response'] = []\n\n # Test that an empty \"response\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n\n hash['response'] = 42\n\n # Test that a non-array \"response\" key returns 400\n assert_raise RestClient::BadRequest do\n rest_response = RestClient.post(\"#{RESTAPI_DNS}/rule?token=#{@@token}\",\n hash.to_json,\n @@headers)\n end\n end", "def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n end", "def test_ut_t5_sef_pj_004\n current_user = User.find(TCANA_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 4,users.size\n end\n end", "def test_only_one_invitation_per_team\n duplicate_invitation = ImFreeAgentInvitation.new(:im_free_agent_id => im_free_agent_invitations(:invitation_from_division_team).im_free_agent_id,\n :im_team_id => im_free_agent_invitations(:invitation_from_division_team).im_team_id)\n assert !duplicate_invitation.save\n assert_equal \"has already been taken\" , duplicate_invitation.errors.on(:im_free_agent_id)\n #change team number and should save\n duplicate_invitation.im_team_id = 10\n assert duplicate_invitation.save\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'deny'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n end", "def test_create\n #create a new resourceset\n post :create, :exp=> 'SemanticExpression.new.union(:s,Namespace.lookup(:rdf,:type),Namespace.lookup(:rdfs,:Class))'\n assert @controller.resourceset.resources.size > 0 #assert that set was remove\n assert_response :success #assert that the request was executed successful\n \n end", "def test_creation_and_delivery\n @expected.to = 'trejkaz@trypticon.org/tests'\n\n # Test creation of the message.\n assert_equal [ @expected ], SimpleMessenger.create_wakeup('trejkaz@trypticon.org/tests')\n \n # Test delivery.\n SimpleMessenger.send_wakeup('trejkaz@trypticon.org/tests')\n assert_equal [ @expected ], @messenger.deliveries\n end", "def test_add_a_discussion_topic_to_general_theme\n $ie.link(:text, /Add a Discussion Topic/).click\n $ie.text_field(:id, \"discussion_title\").set(\"a new discussion\")\n $ie.text_field(:id, \"discussion_body\").set(\"the new discussion body\")\n $ie.form(:id, \"new_discussion\").submit\n assert $ie.h1(:text, \"a new discussion\").exist?\n assert $ie.p(:text, \"the new discussion body\").exist?\n assert $ie.link(:text, \"General\").exist?\n $ie.link(:text, /Return to Discussions/).click\n assert $ie.link(:text, \"a new discussion\").exist?\n $ie.link(:text, \"General\").click\n assert $ie.link(:text, \"a new discussion\").exist? \n end", "def test_home_message_1\n\t\ttest_main = Main.new(3, 1, 6)\n\t\tmocked_Graph = MiniTest::Mock.new(\"mocked graph\")\n\t\tmocked_Graph.expect(:get_curr_loc, Node.new(\"Enumerable Canyon\", 4, 5, 10))\n\t\ttest_main.real_rubies_found(0)\n\t\ttest_main.home_message\n\t\tassert mocked_Graph\n\tend", "def test_active?\n active_rule = rules(:active_or_rule)\n assert active_rule.active?, \"The rule should be active\"\n inactive_rule = rules(:inactive_rule)\n assert !inactive_rule.active?, \"The rule should be inactive\"\n end", "def test_set3_17_check() \n prin_name = 'nikdo'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp/*'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n \n res_ob_adrs='/db/temp'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(false, access)\n \n res_ob_adrs='/db/temp/test'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n \n res_ob_adrs='/db/temp/test/hokus'\n access = @test_acl.check(prin_name, priv_name, res_ob_type, res_ob_adrs)\n assert_equal(true, access)\n end", "def set_rulemaking\n @rulemaking = Rulemaking.find(params[:id])\n end", "def test_ut_t2_ars_arc_014\n # pu admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n # ars created by pu\n pu_id = PrivilegesUsers.find_all_by_user_id(current_user.id)[0].pu_id\n ars = Pu.find_by_id(pu_id).analyze_rule_configs[0]\n ars.created_by = current_user.id\n ars.save\n #\n assert ars.editable?(current_user,pu_id,nil)\n end", "def test_is_error_mail?\n\t\temail = TMail::Mail.new\n\t\temail.to = [\"mogya@mogya.com\",\"mogya2@mogya.com\"]\n\t\temail.from = \"MAILER-DAEMON@mogya.com\"\n\n\t\tassert SchduleMailReceiver.is_error_mail?(email)\n\n\t\temail.from = \"mogya@mogya.com\"\n\t\tassert !SchduleMailReceiver.is_error_mail?(email)\n\n end", "def test_ut_t5_sef_pj_006\n current_user = User.find(PJ_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n # Create PJ admin right\n PrivilegesUsers.create(:user_id => PJ_ADMIN_ID,\n :privilege_id => 3,\n :pu_id => PU_ID,\n :pj_id => new_pj.id)\n # Create PJ member right\n PjsUsers.create(:pj_id => new_pj.id,\n :user_id => PJ_MEMBER_ID)\n #\n EVENT_IDS.each do |event_id|\n email_setting = EmailSetting.find(:first,\n :conditions => {\n :pj_id => new_pj.id,\n :analyze_process_event_id => event_id})\n email_setting.user_ids = \"#{TCANA_ADMIN_ID},#{PU_ADMIN_ID},#{PJ_ADMIN_ID},#{PJ_MEMBER_ID}\"\n email_setting.save\n\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert_equal 2,users.size\n end\n end", "def test_confirm_that_creating_a_text_message_with_keyword_adds_subscriber_to_keyword\n kw = @t.keywords.new(:word => 'word', :response => 'to your mom')\n assert_equal 0, kw.subscribers.count\n assert kw.save\n tm = @t.text_messages.new(:body => \"word\", :to_number => \"1\", :from_number => \"999\")\n assert tm.save\n kw.reload\n assert_equal 1, kw.subscribers.count\n end", "def set_rule\n @rule = params[:rule].to_i\n\n if @rule == 0 or @rule == 1 or @rule == 2\n else\n @rule = 0\n end\n end", "def rule; end", "def rule; end", "def rule; end", "def test_rule_name_uniquess_for_a_person\n owner = people(:valid_person)\n rule_1 = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"and\")\n assert rule_1.save, \"Rule 1 cannot be saved.\"\n\n rule_2 = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"active\",\n :logic=>\"or\")\n assert !rule_2.save, \"Allows duplicate rule names for a person.\"\n end", "def test_group_rule(group_rule, setup_match, remove_match, expected_member_count = 1)\n # Ensure a group has a rule\n group = entities(:groupWithNothing)\n\n assert group.roles.empty?, 'looks like groupWithNothing has a role'\n assert group.rules.empty?, 'looks like groupWithNothing has a rule'\n assert group.owners.empty?, 'looks like groupWithNothing has an owner'\n assert group.operators.empty?, 'looks like groupWithNothing has an operator'\n\n Rails.logger.tagged 'test_group_rule' do\n Rails.logger.debug 'Calling setup ...'\n\n setup_match.call()\n\n # Test basic rule creation matches existing people\n assert group.members.empty?, 'group should have no members'\n\n Rails.logger.debug 'Adding group rule ...'\n group.rules << group_rule\n\n group.reload\n # Subtract a second from the 'updated_at' flag to ensure it is a reliable\n # indicator of a group being touched\n group.updated_at -= 1\n group.save!\n group_last_updated_at = group.updated_at\n\n assert group.members.length == expected_member_count, \"group should have #{expected_member_count} member(s) but has #{group.members.length} member(s)\"\n\n Rails.logger.debug 'Calling remove ...'\n remove_match.call()\n\n Rails.logger.debug 'Checking that group has no members ...'\n group.reload\n assert group.updated_at > group_last_updated_at, 'group should have been touched'\n\n # Subtract a second from the 'updated_at' flag to ensure it is a reliable\n # indicator of a group being touched\n group.updated_at -= 1\n group.save!\n group_last_updated_at = group.updated_at\n assert group.members.empty?, \"group should have no members but has #{group.members.count}\"\n\n Rails.logger.debug 'Calling setup again ...'\n setup_match.call()\n\n group.reload\n assert group.updated_at > group_last_updated_at, 'group should have been touched'\n group_last_updated_at = group.updated_at\n\n assert group.members.length == expected_member_count, \"group should have #{expected_member_count} member(s)\"\n end\n end", "def test_putrelation_delete_inuse\n relation = create(:relation)\n super_relation = create(:relation)\n create(:relation_member, :relation => super_relation, :member => relation)\n cs_id = relation.changeset.id\n user = relation.changeset.user\n\n amf_content \"putrelation\", \"/1\", [\"#{user.email}:test\", cs_id, relation.version, relation.id, relation.tags, relation.members, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 2, result.size\n assert_equal -1, result[0]\n assert_match /relation #{relation.id} is used in/, result[1]\n\n new_relation = Relation.find(relation.id)\n assert_equal relation.version, new_relation.version\n assert_equal relation.members, new_relation.members\n assert_equal relation.tags, new_relation.tags\n assert_equal true, new_relation.visible\n end", "def test_create\n before = CaseViewSetting.count\n assert_nil CaseViewSetting.find_by_sfcontact_setting_id(@derek.settings.id)\n case_view = @derek.settings.case_view('New')\n assert_equal before +1, CaseViewSetting.count\n assert case_view.is_a?(CaseViewSetting)\n end", "def tests\n config.tests(subject)\n end", "def create\n @test_rule = TestRule.new(test_rule_params)\n\n respond_to do |format|\n if @test_rule.save\n format.html { redirect_to @test_rule, notice: 'Test rule was successfully created.' }\n format.json { render :show, status: :created, location: @test_rule }\n else\n format.html { render :new }\n format.json { render json: @test_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_ut_t2_ars_arc_022\n # tcana admin\n current_user = User.find_by_id(PU_ADMIN_ID)\n ars = AnalyzeRuleConfig.create() # ars is not being used.\n ars.created_by = current_user.id\n ars.save\n assert ars.deletable?(current_user, PU_ID, nil)\n end", "def test_create\n\n assert_equal(5, DocumentType.count)\n\n admin_session = cathy_admin_session\n new_document_type = { 'active' => '1',\n 'name' => 'Yankee' }\n\n post(:create, { :new_document_type => new_document_type }, admin_session)\n assert_equal(6, DocumentType.count)\n assert_equal(\"Yankee added\", flash['notice'])\n assert_redirected_to :action => 'list'\n\n post(:create, { :new_document_type => new_document_type }, admin_session)\n assert_equal(6, DocumentType.count)\n #assert_equal(\"Name already exists in the database\", flash['notice'])\n assert_redirected_to :action => 'add'\n\n end", "def test_ut_t5_sef_con_018\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID,\n :analyze_process_event_id => AnalyzeProcessEvent::EVENT_IDS[:change]})\n assert ContextNotifier.send_email(email_setting,TASK_ID,SUBTASK_ID,\n AnalyzeProcessEvent::EVENT_IDS[:create],OLD_STATE_ID,NEW_STATE_ID)\n # manually test by checking the mail.\n end", "def test_feetToMeters\n\t\temail = EmailLogMain.new\n\t\temailHash = email.makeHash\n\t\temailString = emailHash[\"B6C161B2004\"]\n\n# START OF TESTING!\n\t\tassert(true,File.exist?(email.getFileName))\n#Checks if our regular expressions find the correct items needed for our report\n\t\tassert_equal(\"20131211132505.999FB1B2003@toilers.Mines.EDU\",email.RegexExist(\"messageid\",emailString))#Messageid\n\t\tassert_equal(\"echopper@mines.edu\", email.RegexExist(\"to\",emailString)) #to email\n\t\tassert_equal(\"root@toilers.Mines.EDU\",email.RegexExist(\"from\",emailString)) #from email\n\t\tassert_equal(\"6072\",email.RegexExist(\"size\",emailString))#size\n\t\tassert_equal(\"B6C161B2004\",email.RegexExist(\"uniqueid\",emailString)) #uniqueID\n\n#This test will show how many reg expression this program finds for each item\n\t\tassert_equal(3, emailString.scan(@@TO_REGEX).size) #to email\n\t\tassert_equal(1, emailString.scan(@@MESSAGE_ID_REGEX).size) #messageid\n\t\tassert_equal(1, emailString.scan(@@SIZE_REGEX).size) #size\n\t\tassert_equal(6, emailString.scan(@@TIMESTAMP_REGEX).size) #Time\n\t\tassert_equal(1, emailString.scan(@@FROM_REGEX).size) #from email\n\t\tassert_equal(6, emailString.scan(@@UNIQUE_ID).size) #uniqueID\n\n\t\t#This test will check for the correct ammount of emails since every email has a unique message ID \n\t\t#Messageid == total number of email i.e. the size of our hash\t\t\n\t\tholdEntireString = IO.read(email.getFileName)\n\t\tassert_equal(emailHash.length, holdEntireString.scan(@@MESSAGE_ID_REGEX).size)\n\tend" ]
[ "0.6669657", "0.64125824", "0.60827935", "0.5913734", "0.56242436", "0.5592575", "0.55215394", "0.5515756", "0.5394641", "0.53827137", "0.5276402", "0.5274095", "0.5244903", "0.52198315", "0.52137554", "0.51923436", "0.5175251", "0.5127945", "0.5124497", "0.5117424", "0.5099006", "0.5097722", "0.50872904", "0.49976572", "0.49845108", "0.49714366", "0.4963714", "0.49183655", "0.49158606", "0.49158308", "0.49139705", "0.49008793", "0.48914227", "0.48644873", "0.4858162", "0.48486406", "0.48398823", "0.48342547", "0.48303813", "0.48245865", "0.4821318", "0.48132828", "0.48090944", "0.48079097", "0.48025736", "0.48002037", "0.4797734", "0.47894758", "0.478221", "0.47773486", "0.47741973", "0.47741973", "0.47741973", "0.47741973", "0.47691268", "0.47562072", "0.47552648", "0.47503364", "0.4747831", "0.47475386", "0.4738263", "0.47308528", "0.47297344", "0.47249818", "0.47243825", "0.47242826", "0.47239968", "0.47219625", "0.47219625", "0.47219625", "0.47197393", "0.46878207", "0.46861467", "0.46833825", "0.4682501", "0.46722874", "0.46719074", "0.46699828", "0.4665923", "0.4663056", "0.4659264", "0.46588135", "0.4657981", "0.46508923", "0.46502578", "0.46375015", "0.4635979", "0.4635339", "0.4635339", "0.4635339", "0.4633816", "0.4621275", "0.46148232", "0.46138933", "0.46078545", "0.46037263", "0.46030888", "0.4599363", "0.45973486", "0.45948347" ]
0.5998476
3
this function merge the pr branch into target branch, where the author of pr wanted to submit
def goto_prj_dir(repo) git_repo_dir = @git_dir + "/" + repo.split('/')[1] # chech that dir exist, otherwise clone it if File.directory?(@git_dir) == false FileUtils.mkdir_p(@git_dir) Dir.chdir @git_dir puts `git clone git@github.com:#{repo}.git` end begin # /tmp/gitbot, this is in case the dir already exists Dir.chdir git_repo_dir rescue # this is in case we clone the repo Dir.chdir repo.split('/')[1] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_pr_totarget(upstream, pr_branch)\n goto_prj_dir\n check_git_dir\n `git checkout #{upstream}`\n check_duplicata_pr_branch(\"#{pr_fix}#{pr_branch}\")\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b #{pr_fix}#{pr_branch} origin/#{pr_branch}`\n return if $CHILD_STATUS.exitstatus.zero?\n\n # if it fails the PR contain a forked external repo\n repo_external.checkout_into\n end", "def merge_pr_totarget(upstream, pr_branch, repo)\n goto_prj_dir(repo)\n # check that we are in a git dir\n check_git_dir\n `git checkout #{upstream}`\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b PR-#{pr_branch} origin/#{pr_branch}`\n puts `git branch`\n end", "def merge_pull_request\n git.merge pull_request.branch\n end", "def merge_branch( tag=@current_branch, actor=nil )\n raise \"Invalid branch '#{tag}'\" if not is_head?(tag)\n\n tag.gsub!(/['\\\\]/, '')\n\n # switch to master branch\n set_branch(DEFAULT_BRANCH, actor)\n\n # merge target branch to master branch\n\n rv = nil\n begin\n rv = exec_git_cmd(\"git merge -n --no-ff --no-log --no-squash '#{tag}'\", \n actor)\n rescue CommandError => e\n $stderr.puts e.message\n end\n rv\n end", "def process_pr(pr, cmd)\n head = pr[:head]\n repo = head[:repo]\n\n pending_status(pr, 'Merge in progress.')\n\n return true if skip_pr?(pr)\n\n begin\n cmd.run 'git fetch', repo[:ssh_url], head[:ref] if repo\n\n merge_status = cmd.run! 'git merge --no-ff --no-edit', head[:sha]\n\n if merge_status.success?\n success_status(pr, \"Merge with '#{@base_branch}' was successful.\")\n else\n cmd.run 'git merge --abort'\n\n message = \"Failed to merge '#{head[:ref]} with #{@base_branch}.\"\n failure_status(pr, message)\n end\n rescue => e\n failure_status(pr, \"Merge encountered an error: #{e.message}.\")\n\n return false\n end\n\n true\n end", "def branch_to_merge_into\n @branch_to_merge_into ||= git.latest_branch_for(branch_type)\n end", "def merger(pr)\n q = <<-QUERY\n select u.login as login\n from issues i, issue_events ie, users u\n where i.pull_request_id = ?\n and ie.issue_id = i.id\n and ie.action = 'merged'\n and u.id = ie.actor_id\n QUERY\n merger = db.fetch(q, pr[:id]).first\n\n if merger.nil?\n # If the PR was merged, then it is safe to assume that the\n # closer is also the merger\n if not @close_reason[pr[:github_id]].nil? and @close_reason[pr[:github_id]][1] != :unknown\n closer(pr)\n else\n ''\n end\n else\n merger[:login]\n end\n end", "def merge(branch_name)\n remote_commit = last_commit(remote_branch_from_local(branch_name))\n\n @rugged_repository.references.update(rugged_repository.head, remote_commit.oid)\n end", "def merge(join_request)\n work = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n work.checkout(join_request.target_stream)\n work.fetch\n work.pull\n work.merge(join_request.source_stream)\n work.branch(join_request.source_stream).delete\n work.push\n work.fetch\n work.pull\n end", "def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n if config.deployable_label\n with_labelling do\n merge\n end\n else\n merge\n end\n end\n end", "def merge_branch\n git.merge branch\n rescue Git::MergeFailed\n cli.say \"Merge failed. Please resolve these conflicts.\"\n end", "def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D #{pr_fix}#{pr}`\n end", "def target\n \"#{target_repo}/#{target_branch}\"\n end", "def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D PR-#{pr}`\n end", "def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n unless deployable? || @force\n CLI.say 'Pull request status checks have not passed. Cannot be marked deployable.'\n exit!\n end\n\n merge_result = merge\n add_deployable_label if config.deployable_label && merge_result\n end\n end", "def submit(*args)\n raise \"Submitting from a merged runner is currently not supported\"\n end", "def merge(merge_branch, options = {})\n merge_analysis = rugged.merge_analysis(merge_branch.name)\n if merge_analysis.include?(:fastforward)\n rugged.references.update(helper.head_ref, merge_branch.target_id)\n rugged.checkout_head(strategy: :force)\n elsif merge_analysis.include?(:normal)\n ours = helper.head_target\n theirs = merge_branch.target\n merge_base = rugged.merge_base(ours, theirs)\n raise(NoCommonCommit) unless merge_base\n\n base = rugged.rev_parse(merge_base)\n index = ours.tree.merge(theirs.tree, base.tree)\n\n commit_message =\n if index.conflicts?\n raise(MergeConflict) unless block_given?\n\n message = yield(index, rugged, helper.working_directory)\n raise(MergeConflict) unless message\n\n index.conflict_cleanup\n message\n else\n \"Merge branch '#{helper.head_branch.name}' of #{helper.head_remote.url}\"\n end\n\n helper.commit_create(\n commit_message,\n index.write_tree(rugged),\n [ours, theirs],\n options\n )\n rugged.checkout_head(strategy: :force)\n end\n\n self\n end", "def merge_branch_to_master(branch, tag, message, repo_path)\n\tDir.chdir(repo_path) do |path|\n\t\tcmds = [\n\t\t\t\t\"git checkout master\",\n\t\t\t\t\"git merge --no-ff -Xtheirs #{branch}\",\n\t\t\t\t\"git tag -a -f #{tag} -m '#{message}'\"\n\t\t\t\t]\n\t\tcmds.insert(0, \"git branch master origin/master\") unless branch_exists?(path, \"master\")\n\t\tapprove_and_execute(cmds, \"in #{path}\")\n\tend\nend", "def git_merge(branch = \"origin/#{current_default_branch}\")\n mysystem(\"git merge #{branch}\")\n end", "def check_duplicata_pr_branch(pr)\n puts `git branch --list #{pr}`\n `git branch -D #{pr} 2>/dev/null` if $CHILD_STATUS.exitstatus.zero?\n end", "def pullapprove_merge_hook\n context = params[:context]\n state = params[:state]\n target = params[:target_url]\n\n if context == 'code-review/pullapprove' && state == 'success'\n pr_num = %r{https?:\\/\\/pullapprove\\.com\\/Charcoal-SE\\/SmokeDetector\\/pull-request\\/(\\d+)\\/?}.match(target)[1].to_i\n pr = Octokit.client.pull_request('Charcoal-SE/SmokeDetector', pr_num)\n\n if pr[:user][:login] != 'SmokeDetector'\n render plain: \"Not a blacklist PR, not merging (##{pr_num})\"\n return\n end\n\n unless Dir.exist?('SmokeDetector')\n system 'git clone git@github.com:Charcoal-SE/SmokeDetector'\n\n Dir.chdir('SmokeDetector') do\n system 'git config user.name metasmoke'\n system 'git', 'config', 'user.email', AppConfig['github']['username']\n end\n end\n\n if !Octokit.client.pull_merged?('Charcoal-SE/SmokeDetector', pr_num)\n File.open('SmokeDetector/.git/info/attributes', File::RDWR) do |f|\n f.flock(File::LOCK_EX)\n\n Dir.chdir('SmokeDetector') do\n ref = pr[:head][:ref]\n\n system 'git fetch origin master; git checkout -B master origin/master'\n system 'git', 'fetch', 'origin', ref\n system 'git', 'merge', \"origin/#{ref}\", '--no-ff', '-m', \"Merge pull request ##{pr_num} from Charcoal-SE/#{ref} --autopull\"\n system 'git push origin master'\n system 'git', 'push', 'origin', '--delete', ref\n system 'git', 'branch', '-D', ref\n end\n end\n\n message = \"Merged SmokeDetector [##{pr_num}](https://github.com/Charcoal-SE/SmokeDetector/pull/#{pr_num}).\"\n ActionCable.server.broadcast('smokedetector_messages', message: message)\n render plain: \"Merged ##{pr_num}\"\n else\n render plain: \"##{pr_num} already merged\"\n end\n else\n render plain: 'Not PullApprove successful status, ignoring'\n end\n end", "def push(_branch)\n puts 'TODO: Implement Git.push'\n end", "def target_branch\n begin\n sha = @client.branch(repo, options[:target]).commit.sha\n rescue\n ref = @client.create_ref(repo, \"heads/#{options[:target]}\", source_branch)\n sha = ref.object.sha\n end\n sha\n end", "def updateRepo()\n $repo.checkout(BRANCH)\n\n # fetch\n remote = $repo.remotes['' << REMOTE]\n remote.fetch()\n\n # merge\n distant_commit = $repo.branches['' << REMOTE << '/' << BRANCH].target\n $repo.references.update($repo.head, distant_commit.oid)\nend", "def target_branch\n # TODO: Enable possibility to manually override this and set arbitrary branches.\n ENV['TARGET_BRANCH'] || 'master'\n end", "def merge(repo, base, head, options = {})\n params = {\n :base => base,\n :head => head\n }.merge(options)\n post \"#{Repository.path repo}/merges\", params\n end", "def propose_dependency_update(app, branch_key, dependencies, target_version, base_branch)\n am_suffix = current_default_branch == base_branch ? '' : \"-#{base_branch}\"\n branch_name = '' == branch_key ? \"AM#{am_suffix}_update_#{get_shortest_group_name(dependencies)}\" : \"AM#{am_suffix}_#{branch_key}\"\n merge_origin = git_local_branch_list.include?(branch_name)\n git_checkout(base_branch)\n git_checkout(branch_name, true)\n git_merge(\"origin/#{base_branch}\") if merge_origin\n\n if patch_versions(app, dependencies, target_version)\n git_push\n else\n git_checkout(base_branch)\n mysystem(\"git branch -D #{branch_name} 2> /dev/null 1> /dev/null\")\n end\n end", "def push_branch\n return puts \"Not pushing, isn't a branch: #{@name}\" unless valid?\n\n puts \"Checking if we can push something on #{@source.name}\"\n return puts \"...nothing to push for #{@source.name}\" unless dirty? && valid?\n\n puts \"...pushing #{@source.name}[#{shortsha(@source.name)}]\"\n @git.push('origin', @source.name)\n @pushed = true\n end", "def merge(branch, message = 'merge', opts = {})\n self.lib.merge(branch, message, opts)\n end", "def get_merged(br)\n __branches \"-l --merged #{br}\"\nend", "def update!(**args)\n @remote_branch = args[:remote_branch] if args.key?(:remote_branch)\n end", "def merge(options={})\n options.merge! :from => DEFAULT_REMOTE_BRANCH, :to => DEFAULT_LOCAL_REF\n theirs = repo.rev_parse options[:from]\n ours = repo.rev_parse options[:to]\n\n analysis = repo.merge_analysis(theirs)\n return analysis if analysis.include? :up_to_date\n\n base = repo.rev_parse(repo.merge_base(ours, theirs))\n index = ours.tree.merge(theirs.tree, base.tree)\n\n raise MergeConflict if index.conflicts?\n\n Rugged::Commit.create(repo, {\n parents: [ours, theirs],\n tree: index.write_tree(repo),\n message: \"Merged `#{options[:from]}` into `#{options[:to].sub(\"refs/heads/\", \"\")}`\",\n update_ref: options[:to]\n })\n end", "def update!(**args)\n @author = args[:author] if args.key?(:author)\n @remote_branch = args[:remote_branch] if args.key?(:remote_branch)\n end", "def copy_branch_commits(src_repo_path, src_branch, src_branch_point, dest_repo_path)\n `(cd \"#{src_repo_path}\" && git format-patch --stdout #{src_branch_point}..#{src_branch}) | (cd \"#{dest_repo_path}\" && git am)`\n end", "def merge(build)\n Rails.logger.info(\"Trying to merge branch: #{build.branch} to master after build id: #{build.id}\")\n\n checkout_log, status = Open3.capture2e(\"git checkout master && git pull\")\n raise_and_log(\"Was unable checkout and pull master:\\n\\n#{checkout_log}\") if status.exitstatus != 0\n\n commit_message = \"Kochiku merge of branch #{build.branch} for build id: #{build.id} ref: #{build.ref}\"\n merge_log, status = Open3.capture2e(merge_env, \"git merge --no-ff -m '#{commit_message}' #{build.ref}\")\n abort_merge_and_raise(\"git merge --abort\",\n \"Was unable to merge your branch:\\n\\n#{merge_log}\") unless status.success?\n\n push_log, status = Open3.capture2e(\"git push origin master\")\n rebase_log, second_push_log = recover_failed_push unless status.success?\n\n [checkout_log, merge_log, push_log, rebase_log, second_push_log].join(\"\\n\")\n end", "def merger_team(pr, months_back = nil)\n recently_merged = prs.find_all do |b|\n close_reason[b[:github_id]] != :unknown and\n (months_back.nil? ? true : b[:created_at].to_i > (pr[:created_at].to_i - months_back * 30 * 24 * 3600))\n end.map do |b|\n b[:github_id]\n end\n\n q = <<-QUERY\n select u1.login as merger\n from reduced_users u, reduced_projects p, reduced_pull_requests pr, reduced_pull_request_history prh, reduced_users u1\n where prh.action = 'closed'\n and prh.actor_id = u1.id\n and prh.pull_request_id = pr.id\n and pr.base_repo_id = p.id\n and p.owner_id = u.id\n and u.login = ?\n and p.name = ?\n and pr.pullreq_id = ?\n QUERY\n log q\n\n recently_merged.map do |pr_num|\n a = db.fetch(q, pr[:login], pr[:project_name], pr_num).first\n if not a.nil? then a[:merger] else nil end\n end.select {|x| not x.nil?}.uniq\n\n end", "def create_pull_request(token, branch, repo, body, assignee)\n payload = {:title => branch, :base => base_branch, :head => branch, :body => body}.to_json\n say \"Creating pull request for \"\n say \"#{branch} \", :green\n say \"against \"\n say \"#{base_branch} \", :green\n say \"in \"\n say repo, :green\n response = RestClient::Request.new(:url => \"https://api.github.com/repos/#{repo}/pulls\", :method => \"POST\", :payload => payload, :headers => {:accept => :json, :content_type => :json, 'Authorization' => \"token #{token}\"}).execute\n data = JSON.parse response.body\n\n assign_pull_request(token, branch, assignee, data) if assignee ## Unfortunately this needs to be done in a seperate request.\n\n url = data['html_url']\n url\n rescue RestClient::Exception => e\n process_error e\n throw e\n end", "def merge_pull_request(repo, number, commit_message='', options = {})\n put \"#{Repository.path repo}/pulls/#{number}/merge\", options.merge({:commit_message => commit_message})\n end", "def target_branch\n self.known_options.first || 'master'\n end", "def merged_with_git?(pr)\n\n #1. Commits from the pull request appear in the master branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n\t\t and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return [true, :commits_in_master]\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[pr[:github_id]].nil?\n sha = @closed_by_commit[pr[:github_id]]\n unless @all_commits.select { |x| sha.start_with? x }.empty?\n return [true, :fixes_in_commit]\n end\n end\n\n comments = issue_comments(pr[:login], pr[:project_name], pr[:github_id])\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :commit_sha_in_comments]\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return [true, :commit_sha_in_comments]\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :merged_in_comments]\n end\n end\n\n [false, :unknown]\n end", "def merged_with_git?(pr)\n\n #1. Commits from the pull request appear in the master branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n\t\t and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return [true, :commits_in_master]\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[pr[:github_id]].nil?\n sha = @closed_by_commit[pr[:github_id]]\n if not @all_commits.select { |x| sha.start_with? x }.empty?\n return [true, :fixes_in_commit]\n end\n end\n\n comments = issue_comments(pr[:login], pr[:project_name], pr[:github_id])\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :commit_sha_in_comments]\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return [true, :commit_sha_in_comments]\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :merged_in_comments]\n end\n end\n\n [false, :unknown]\n end", "def merge(number)\n request = get_request_by_number(number)\n if request.head.repo\n message = \"Accept request ##{request.number} \" +\n \"and merge changes into \\\"#{local.target}\\\"\"\n command = \"merge -m '#{message}' #{request.head.sha}\"\n puts\n puts \"Request title:\"\n puts \" #{request.title}\"\n puts\n puts \"Merge command:\"\n puts \" git #{command}\"\n puts\n puts git_call(command)\n else\n print_repo_deleted(request)\n end\n end", "def apply\n repo.push('origin', ['refs/heads/master'], credentials: credentials)\n end", "def apply(pr, pull_request_hash)\n if !previously_applied?(pr) && matches?(pull_request_hash)\n add_reviewer(pr)\n end\n end", "def branch; end", "def git_merge_base(target, source)\n status, out, err = exec!(\"git merge-base #{target} #{source}\")\n out.strip\n rescue Braid::Commands::ShellExecutionError\n nil\n end", "def include other_branch\n Dir.chdir @root do\n cmd = \"git merge --no-ff --no-commit \\\"#{other_branch}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n if /Not a git repository/.match stderr\n raise NotARepositoryError\n elsif /Automatic merge failed/.match stdout\n return false\n else\n raise Error, stderr\n end\n end\n end\n return true\n end", "def check_branch\n same_branch = `git branch -a` =~ /\\* #{@branch}/\n\n if current_remote = `git remote -v`.match(/\\s\\S+/)\n same_remote = current_remote[0].match(/#{@repo}/)\n end\n\n if same_remote && same_branch\n puts \"Deploy to #{@branch} canceled:\".red\n puts \"You cannot deploy to the same branch you are working in. This will overwrite the source for your site.\\n\"\n puts \"First, back up your site's source to a branch:\"\n puts \"\\n git checkout -b source\".yellow\n puts \" git push origin source\".yellow\n puts \"\\nWith that, you'll work in the #{\"source\".bold} branch and deploy to the #{@branch.bold} branch.\"\n abort\n end\n end", "def push!\n notify.write(\"Pushing to origin\")\n proj.push('origin', proj_branch)\n proj.push('origin', report_branch)\n end", "def fetch_and_pull_branch(branch_name)\n `cd #{project_repo_path} && git fetch && git checkout #{branch_name} && git pull origin #{branch_name} && git checkout #{self.trunk_branch}`\n end", "def merge?(owner, repo, number)\n\t\t\tPullRequests.get(\"/repos/#{owner}/#{repos}/pulls/#{number}/merge\", headers: @auth)\n\t\tend", "def handle_repo_push_request\n return unless @repository\n\n branch_name = payload[\"ref\"].sub(%r{\\Arefs/heads/}, '')\n branch = @repository.branches.where(name: branch_name).first\n if branch.present? && branch.convergence? && @repository.run_ci?\n sha = payload[\"after\"]\n branch.kickoff_new_build_unless_currently_busy(sha)\n end\n end", "def update\n @pullRequest = PullRequest.find(params[:id])\n\t\t@git = Git.init()\n\t\tDir.chdir(@pullRequest.source_repo.path)\n\t\trequestor_path = \"#{@pullRequest.repository.path}\"\n\t\t@git.pull(requestor_path, \"master\") # fetch and a merge\n\t\t@pullRequest.status = \"ACCEPTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while updating your pull request\"}\n end\n end", "def change_git!\n @jobs.each_value do |job|\n job[:value][:scm_branch] = \"origin/pr/#{@number}/head\"\n job[:value][:scm_params] = {} unless job[:value][:scm_params]\n job[:value][:scm_params][:refspec] = 'refs/pull/*:refs/remotes/origin/pr/*'\n end\n end", "def prepare(new=false, name=nil)\n # remember original branch the user was currently working on\n original_branch = local.source_branch\n if new || !local.on_feature_branch?\n local_branch = move_uncommitted_changes(local.target_branch, name)\n else\n local_branch = original_branch\n end\n [original_branch, local_branch]\n end", "def merge(other = {})\n branch default_options.merge(other)\n end", "def test_merge\n # Rule is non-admins can only merge herbaria in which they own all records\n # into their own personal herbarium. Nothing else. Mary owns all the\n # records at fundis, randomly enough, so if we create a personal\n # herbarium for her, she should be able to merge fundis into it.\n assert_true(fundis.owns_all_records?(mary))\n src = fundis\n dest = mary.create_personal_herbarium\n # dest_old_name = dest.name\n login(\"mary\")\n\n assert_no_changes(\n \"dest.name\", \"Destination Herbarium should retain its name\"\n ) do\n post(:create, params: { src: src.id, dest: dest.id })\n end\n assert_flash_success\n assert_redirected_to(herbarium_path(dest))\n assert_equal(\n dest.personal_user_id, mary.id,\n \"Destination Herbarium should remain Mary's personal Herbarium\"\n )\n end", "def propose_pull_request(github_account, params)\n params[:from] = \"#{github_account}:#{params[:from]}\"\n create_pull_request(params)\n end", "def add_merge(options={})\n if message = options[:message]\n message = \"-m '#{message}'\"\n end\n branch = options[:branch] || \"foobar\"\n base = options[:base] || \"master\"\n sh(\"git checkout -b #{branch} 2>&1 && echo asd >> xxx && git commit -am 'xxx' && git checkout #{base} 2>&1 && git merge #{branch} --no-ff #{message}\")\n commits = last_commits\n return commits[0], commits[1]\n end", "def build_branch(branch, params = {}, body = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).post(body)\n end", "def release_pr_check\n\n result = CheckResult.new(\"Release PR Check Result\")\n\n ## PR should be sent from `develop` branch\n result.message << \"Head Branch check |\"\n is_from_develop = github.branch_for_head == \"develop\"\n if is_from_develop\n result.message += \":o:\\n\"\n else\n fail \"Please send the PR from `develop` branch.\"\n result.message += \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should be sent to `master` branch\n result.message << \"Base Branch check |\"\n is_to_master = github.branch_for_base == \"master\"\n if is_to_master\n result.message += \":o:\\n\"\n else\n fail \"Please send the PR to `master` branch.\"\n result.message += \":x:\\n\"\n result.errors += 1\n end\n\n ## Release modification check\n release_modification_check_into_result(result)\n\n return result\n\nend", "def postEntityMerge( from, to, override_trust, uncontribute_masheryid, uncontribute_userid, uncontribute_supplierid, delete_mode)\n params = Hash.new\n params['from'] = from\n params['to'] = to\n params['override_trust'] = override_trust\n params['uncontribute_masheryid'] = uncontribute_masheryid\n params['uncontribute_userid'] = uncontribute_userid\n params['uncontribute_supplierid'] = uncontribute_supplierid\n params['delete_mode'] = delete_mode\n return doCurl(\"post\",\"/entity/merge\",params)\n end", "def pull(args, options)\n _closest_branch = closest_branch\n\n if _closest_branch\n branch_name = clean_branch_name_for( _closest_branch )\n link = @url_generator.pull_request_url( branch_name, options[:to] || \"master\" )\n\n launch link\n else\n fail \"Could not find closest remote branch for sha: #{@git_object.oid.inspect}\"\n end\n end", "def merge!; end", "def branch \n extra[\"branch\"] \n end", "def develop_pr_check\n\n result = CheckResult.new(\"Develop PR Check Result\")\n\n ## PR should be sent from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`\n result.message << \"Head Branch check |\"\n is_from_feature = github.branch_for_head.start_with?(\"feature/\")\n is_from_refactor = github.branch_for_head.start_with?(\"refactor/\")\n is_from_fix = github.branch_for_head.start_with?(\"fix/\")\n is_from_issue = github.branch_for_head.start_with?(\"issue/\")\n is_from_version = github.branch_for_head.start_with?(\"version/\")\n if is_from_feature || is_from_refactor || is_from_fix || is_from_issue || is_from_version\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR from a from a branch that begins with `feature/`, `refactor/`, `fix/`, `issue/` or `version/`.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should be sent to `develop` branch\n result.message << \"Base Branch check |\"\n is_to_develop = github.branch_for_base == \"develop\"\n if is_to_develop\n result.message << \":o:\\n\"\n else\n fail \"Please send the PR to `develop` branch.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## If PR is sent from a branch that begins with `version/`, do a release modification check\n if is_from_version\n release_modification_check_into_result(result)\n end\n\n ## PR shouldn't contain any merge commits\n result.message << \"Merge Commits check |\"\n contains_merge_commits = git.commits.any? { |c| c.parents.length > 1 }\n unless contains_merge_commits\n result.message << \":o:\\n\"\n else\n fail \"Please don't contain any merge commits in the branch. Consider Rebase if required.\"\n result.message << \":x:\\n\"\n result.errors += 1\n end\n\n ## PR should have less than 1000 lines of modifications if possible.\n result.message << \"Modification Volumn check |\"\n is_fix_too_big = git.lines_of_code > 1_000\n unless is_fix_too_big\n result.message << \":o:\\n\"\n else\n warn \"Too many modifications. Please consider splitting the PR if possible.\"\n result.message << \":heavy_exclamation_mark:\\n\"\n result.warnings += 1\n end\n\n return result\n\nend", "def merge; end", "def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n attributes = {\n iid: pull_request.iid,\n title: pull_request.truncated_title,\n description: description,\n source_project_id: project.id,\n target_project_id: project.id,\n source_branch: pull_request.formatted_source_branch,\n target_branch: pull_request.target_branch,\n state: pull_request.state,\n milestone_id: milestone_finder.id_for(pull_request),\n author_id: author_id,\n assignee_id: user_finder.assignee_id_for(pull_request),\n created_at: pull_request.created_at,\n updated_at: pull_request.updated_at\n }\n\n create_merge_request_without_hooks(project, attributes, pull_request.iid)\n end", "def post_repo_target(repo_target)\n repo_target= {\n \"name\"=>nil, \n \"contentClass\"=>\"maven2\", \n \"patterns\"=>[]\n }.merge(repo_target)\n request = {\"data\"=>repo_target}\n post(\"#{url_base}/repo_targets\", request)[\"data\"]\n end", "def build_branch(branch, params = {}, body = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).post(body)\n end", "def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end", "def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end", "def merge_pull(repo, pull_number, options = {})\n put \"#{Repository.path repo}/pulls/#{pull_number}/merge\", options\n end", "def create_or_update_git_branch(issue_id, papers)\n id = \"%05d\" % issue_id\n pdf_path = \"joss.#{id}/10.21105.joss.#{id}.pdf\"\n\n begin\n # If the PDF is there already then delete it\n github_client.contents(papers, :path => pdf_path, :ref => \"heads/joss.#{id}\")\n blob_sha = github_client.contents(papers, :path => pdf_path, :ref => \"heads/joss.#{id}\").sha\n github_client.delete_contents(papers,\n pdf_path,\n \"Deleting 10.21105.joss.#{id}.pdf\",\n blob_sha,\n :branch => \"joss.#{id}\")\n rescue Octokit::NotFound\n github_client.create_ref(papers, \"heads/joss.#{id}\", get_master_ref(papers))\n end\n end", "def merge(source); end", "def perform\n git.if_clean do\n check_out_branch\n merge_pull_request\n comment_about_merge\n end\n rescue => e\n case e\n when GitHub::PullRequest::NotFound\n cli.say \"Unable to find pull request #{pull_request_id}. Please retry with a valid ID.\"\n when Git::MergeFailed\n cli.say \"Merge failed. Please identify the source of this merge conflict resolve this conflict in your pull request's branch. NOTE: Merge conflicts resolved in the #{branch_type} branch are NOT used when deploying.\"\n when Git::CheckoutFailed\n cli.say \"Checkout of #{branch_to_merge_into} failed. Please contact Infrastructure to determine the cause.\"\n when GitHub::PullRequest::CommentFailed\n cli.say \"Unable to write comment. Please navigate to #{pull_request.url} and add the comment, '#{comment_body}'\"\n else\n cli.say \"An unknown error occurred: #{e.inspect}\"\n end\n raise\n end", "def intra_branch?(pr)\n q = <<-QUERY\n select IF(base_repo_id = head_repo_id, true, false) as intra_branch\n from pull_requests where id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:intra_branch]\n end", "def checkout(branch_name)\n local_branches = @rugged_repository.branches.each_name.to_a\n if !local_branches.include?(branch_name) && self.remote_branch_from_local(branch_name)\n @rugged_repository.branches.create(branch_name, self.remote_branch_from_local(branch_name))\n end\n @rugged_repository.checkout(branch_name)\n end", "def merge_commit\n @org = Org.find(params[:id])\n authorize @org\n\n @target_org = Org.find_by(id: merge_params[:target_org])\n\n if @target_org.present?\n if @target_org.merge!(to_be_merged: @org)\n msg = \"Successfully merged '#{@org.name}' into '#{@target_org.name}'\"\n redirect_to super_admin_orgs_path, notice: msg\n else\n msg = _('An error occurred while trying to merge the Organisations.')\n redirect_to admin_edit_org_path(@org), alert: msg\n end\n else\n msg = _('Unable to merge the two Organisations at this time.')\n redirect_to admin_edit_org_path(@org), alert: msg\n end\n rescue JSON::ParserError\n msg = _('Unable to determine what records need to be merged.')\n redirect_to admin_edit_org_path(@org), alert: msg\n end", "def merge(treeish=upstream_branch)\n sandbox do |git, work_tree, index_file|\n des, src = safe_rev_parse(branch, treeish)\n base = des.nil? ? nil : git.merge_base({}, des, src).chomp(\"\\n\")\n \n case\n when base == src\n break\n when base == des\n # fast forward situation\n grit.update_ref(branch, src)\n else\n # todo: add rebase as an option\n \n git.read_tree({\n :m => true, # merge\n :i => true, # without a working tree\n :trivial => true, # only merge if no file-level merges are required\n :aggressive => true, # allow resolution of removes\n :index_output => index_file\n }, base, branch, src)\n \n commit!(\"gitgo merge of #{treeish} into #{branch}\", \n :tree => git.write_tree.chomp(\"\\n\"),\n :parents => [des, src]\n )\n end\n \n reset\n end\n \n self\n end", "def merge_to(data)\n\n # prevent cross merging tickets\n target_ticket = Ticket.find_by(id: data[:ticket_id])\n raise 'no target ticket given' if !target_ticket\n raise Exceptions::UnprocessableEntity, 'ticket already merged, no merge into merged ticket possible' if target_ticket.state.state_type.name == 'merged'\n\n # check different ticket ids\n raise Exceptions::UnprocessableEntity, 'Can\\'t merge ticket with it self!' if id == target_ticket.id\n\n # update articles\n Transaction.execute do\n\n Ticket::Article.where(ticket_id: id).each(&:touch)\n\n # quiet update of reassign of articles\n Ticket::Article.where(ticket_id: id).update_all(['ticket_id = ?', data[:ticket_id]]) # rubocop:disable Rails/SkipsModelValidations\n\n # mark target ticket as updated\n # otherwise the \"received_merge\" history entry\n # will be the same as the last updated_at\n # which might be a long time ago\n target_ticket.updated_at = Time.zone.now\n\n # add merge event to both ticket's history (Issue #2469 - Add information \"Ticket merged\" to History)\n target_ticket.history_log(\n 'received_merge',\n data[:user_id],\n id_to: target_ticket.id,\n id_from: id,\n )\n history_log(\n 'merged_into',\n data[:user_id],\n id_to: target_ticket.id,\n id_from: id,\n )\n\n # create new merge article\n Ticket::Article.create(\n ticket_id: id,\n type_id: Ticket::Article::Type.find_by(name: 'note').id,\n sender_id: Ticket::Article::Sender.find_by(name: 'Agent').id,\n body: 'merged',\n internal: false,\n )\n\n # reassign links to the new ticket\n # rubocop:disable Rails/SkipsModelValidations\n Link.where(\n link_object_source_id: Link::Object.find_by(name: 'Ticket').id,\n link_object_source_value: id,\n ).update_all(link_object_source_value: data[:ticket_id])\n Link.where(\n link_object_target_id: Link::Object.find_by(name: 'Ticket').id,\n link_object_target_value: id,\n ).update_all(link_object_target_value: data[:ticket_id])\n # rubocop:enable Rails/SkipsModelValidations\n\n # link tickets\n Link.add(\n link_type: 'parent',\n link_object_source: 'Ticket',\n link_object_source_value: data[:ticket_id],\n link_object_target: 'Ticket',\n link_object_target_value: id\n )\n\n # set state to 'merged'\n self.state_id = Ticket::State.find_by(name: 'merged').id\n\n # rest owner\n self.owner_id = 1\n\n # save ticket\n save!\n\n # touch new ticket (to broadcast change)\n target_ticket.touch # rubocop:disable Rails/SkipsModelValidations\n end\n true\n end", "def db_update_pull_request(db, pr, org, repo)\n db[\n \"UPDATE items SET merged_at=? WHERE org=? AND repo=? AND item_number=?\",\n gh_to_db_timestamp(pr.merged_at), org, repo, pr.number.to_s].update\n end", "def branch(params)\n Processor.task(params)\n end", "def pr_is_intra_branch(req)\n return false unless pr_has_head_repo(req)\n\n if req['head']['repo']['owner']['login'] ==\n req['base']['repo']['owner']['login'] and\n req['head']['repo']['full_name'] == req['base']['repo']['full_name']\n true\n else\n false\n end\n end", "def merge\n frm.link(:text=>\"Merge\").click\n AnnouncementsMerge.new(@browser)\n end", "def merge(user_name, repo_name, params={})\n normalize! params\n filter! VALID_MERGE_PARAM_NAMES, params\n assert_required_keys REQUIRED_MERGE_PARAMS, params\n\n post_request(\"/repos/#{user_name}/#{repo_name}/merges\", params)\n end", "def commit\n\t$VP.join('.git/refs/heads/master').read[0..8] rescue nil\nend", "def verify_valid_branch_merge\n # trying to merge backwards with a direct ancestor of the current directory.\n # that's crazy.\n if ancestor == remote\n raise abort(\"can't merge with ancestor\")\n elsif ancestor == @local_parent\n # If we're at the branch point, without a difference in branch names, just do an update.\n # Kind of the opposite of the last case, only isntead of trying to merge directly backward,\n # we're trying to merge directly forward. That's wrong.\n if @local_parent.branch == remote.branch\n raise abort(\"nothing to merge (use 'amp update' or check\"+\n \" 'amp heads')\")\n end\n end\n # Can't merge when you have a dirty working directory. We don't want to lose\n # those changes!\n if !force && (working_changeset.changed_files.any? || working_changeset.deleted.any?)\n raise abort(\"oustanding uncommitted changes\")\n end\n end", "def find_current_release_mr(source_branch, target_branch)\n Gitlab.merge_requests(@project_name, state: :opened).find do |mr|\n mr.source_branch == source_branch && mr.target_branch == target_branch\n end\n end", "def create_pull_request(oauth_token, source_branch, base_branch, pr_title, pr_body, reviewers)\n client = Octokit::Client.new(access_token: oauth_token)\n pull_number = client.create_pull_request(full_repo_name, base_branch, source_branch, pr_title, pr_body)[:number]\n client.request_pull_request_review(full_repo_name, pull_number, reviewers: reviewers)\n end", "def sync_addon_branch_to_blessed_repo(repoName, remoteBranch, localBranch, pushForce = false)\n self.log(INFO,repoName,\"Checkout #{remoteBranch} branch (it is perhaps not the default) for #{repoName}...\")\n s = system(\"git checkout #{localBranch}\")\n if !s\n print(\"[ERROR] No #{remoteBranch} branch in repository #{repoName}, Skip this repo!!!\\n\")\n self.log(INFO,repoName,\"Done.\")\n # Let's process the next one\n else\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Reset #{localBranch} to #{remoteBranch} for #{repoName} ...\")\n s = system(\"git reset --hard #{remoteBranch}\")\n if !s\n abort(\"[ERROR] Reset #{localBranch} to #{remoteBranch} for #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Push #{localBranch} branch content from exo-addons repository to blessed repository ...\")\n\n forceParam = \"\"\n if pushForce\n forceParam = \"--force\"\n end\n\n s = system(\"git push #{forceParam} blessed #{localBranch}\")\n if !s\n abort(\"[ERROR] Push of #{localBranch} branch updates to repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n end\n end", "def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n # This work must be wrapped in a transaction as otherwise we can leave\n # behind incomplete data in the event of an error. This can then lead\n # to duplicate key errors when jobs are retried.\n MergeRequest.transaction do\n attributes = {\n iid: pull_request.iid,\n title: pull_request.truncated_title,\n description: description,\n source_project_id: project.id,\n target_project_id: project.id,\n source_branch: pull_request.formatted_source_branch,\n target_branch: pull_request.target_branch,\n state: pull_request.state,\n milestone_id: milestone_finder.id_for(pull_request),\n author_id: author_id,\n assignee_id: user_finder.assignee_id_for(pull_request),\n created_at: pull_request.created_at,\n updated_at: pull_request.updated_at\n }\n\n # When creating merge requests there are a lot of hooks that may\n # run, for many different reasons. Many of these hooks (e.g. the\n # ones used for rendering Markdown) are completely unnecessary and\n # may even lead to transaction timeouts.\n #\n # To ensure importing pull requests has a minimal impact and can\n # complete in a reasonable time we bypass all the hooks by inserting\n # the row and then retrieving it. We then only perform the\n # additional work that is strictly necessary.\n merge_request_id = GithubImport\n .insert_and_return_id(attributes, project.merge_requests)\n\n merge_request = project.merge_requests.find(merge_request_id)\n\n # These fields are set so we can create the correct merge request\n # diffs.\n merge_request.source_branch_sha = pull_request.source_branch_sha\n merge_request.target_branch_sha = pull_request.target_branch_sha\n\n merge_request.keep_around_commit\n merge_request.merge_request_diffs.create\n\n merge_request.id\n end\n rescue ActiveRecord::InvalidForeignKey\n # It's possible the project has been deleted since scheduling this\n # job. In this case we'll just skip creating the merge request.\n end", "def apply\n #TODO: generate a better commit message\n @gl_admin.commit_index(\"Commit by gitolite gem\")\n @gl_admin.git.push({}, \"origin\", \"master\")\n end", "def perform_or_request_merge(src, dest)\n if in_admin_mode? || src.can_merge_into?(dest)\n perform_merge(src, dest)\n else\n request_merge(src, dest)\n end\n end", "def merge_into(target)\n target_id = target.id\n # Find all the Entries attached to this name, that will need to be\n # reindexed after the merge\n entry_ids = entry_ids_to_index_on_update\n\n ids = EntryArtist.where(artist_id: self.id).pluck(:id)\n EntryArtist.where(artist_id: self.id).update_all({ artist_id: target_id })\n EntryArtist.where( id: ids ).each(&:update_bunny)\n\n ids = EntryAuthor.where(author_id: self.id).pluck(:id)\n EntryAuthor.where(author_id: self.id).update_all({ author_id: target_id })\n EntryAuthor.where( id: ids ).each(&:update_bunny)\n\n ids = EntryScribe.where(scribe_id: self.id).pluck(:id)\n EntryScribe.where(scribe_id: self.id).update_all({ scribe_id: target_id })\n EntryScribe.where( id: ids ).each(&:update_bunny)\n\n ids = SaleAgent.where(agent_id: self.id).pluck(:id)\n SaleAgent.where(agent_id: self.id).update_all({ agent_id: target_id })\n SaleAgent.where( id: ids ).each(&:update_bunny)\n\n ids = SourceAgent.where(agent_id: self.id).pluck(:id)\n SourceAgent.where(agent_id: self.id).update_all({ agent_id: target_id })\n SourceAgent.where( id: ids ).each(&:update_bunny)\n\n ids = Provenance.where(provenance_agent_id: self.id).pluck(:id)\n Provenance.where(provenance_agent_id: self.id).update_all({ provenance_agent_id: target_id })\n Provenance.where( id: ids ).each(&:update_bunny)\n\n ids = DericciLink.where(name_id: self.id).pluck(:id)\n DericciLink.where(name_id: self.id).update_all({ name_id: target_id })\n DericciLink.where( id: ids ).each(&:update_bunny)\n\n ids = DericciRecord.where(verified_id: self.id).pluck(:id)\n DericciRecord.where(verified_id: self.id).update_all({verified_id: target_id})\n DericciRecord.where( id: ids ).each(&:update_bunny)\n\n # update flags on the target\n target.is_artist ||= self.is_artist\n target.is_author ||= self.is_author\n target.is_scribe ||= self.is_scribe\n target.is_provenance_agent ||= self.is_provenance_agent\n\n target.save\n\n # but ... CAN't SAVE when name is BLANK (nil)\n # self.name = nil\n self.viaf_id = nil\n self.deleted = true\n self.save!\n\n # slice into managable chunks to avoid running out of space in mysql\n entry_ids.each_slice(200) do |slice|\n SDBMSS::IndexJob.perform_later(Entry.to_s, slice)\n end\n\n Name.update_counters(target.id,\n :authors_count => target.author_entries.where(deprecated: false, draft: false).count - target.authors_count,\n :artists_count => target.artist_entries.where(deprecated: false, draft: false).count - target.artists_count,\n :scribes_count => target.scribe_entries.where(deprecated: false, draft: false).count - target.scribes_count,\n :sale_agents_count => target.sale_entries.where(deprecated: false, draft: false).count - target.sale_agents_count,\n :provenance_count => target.provenance_entries.where(deprecated: false, draft: false).count - target.provenance_count,\n :source_agents_count => target.agent_sources.count - target.source_agents_count\n )\n end", "def update!(**args)\n @branches = args[:branches] if args.key?(:branches)\n end", "def git_push(host, branch, git_repo_path)\n git_on(host, \"push origin #{branch}\", git_repo_path)\nend", "def checkout(ref, branch: true)\n raise\n end", "def create_branch(name, target = 'upstream/master')\n # fetch the remote if defined in the target\n unless branch_exist?(name)\n remote_name, ref = target.split('/', 2)\n fetch(remote_name)\n logger.info(\"Creating branch: #{name} for #{path} from #{target}\")\n found_ref = find_ref(target)\n repo.create_branch(name, found_ref)\n else\n repo.branches[name]\n end\n end", "def branch_and_merge(name=next_branch_tag(), actor=nil, &block)\n raise InvalidDbError if @stale\n\n # Force a commit before the merge\n # TODO: determine if this is really necessary\n staging.sync\n staging.commit('auto-commit before branch-and-merge', self.actor)\n\n # ensure staging index is nil [in case branch name was re-used]\n unstage\n\n # save old actor\n old_actor = self.actor\n self.actor = actor if actor\n\n sha = commits.last ? commits.last.id : nil\n tag = create_branch(name, sha)\n set_branch(tag, self.actor)\n\n # execute block in a transaction\n rv = true\n begin\n transaction(&block)\n merge_branch(tag, self.actor)\n rescue Exception =>e\n rv = false\n end\n\n # restore actor\n self.actor = old_actor if actor\n\n rv\n end", "def merge\n @parent_vendor = Vendor.find(params[:id])\n @child_vendor = Vendor.find(params[:vendor_id])\n\n if @parent_vendor.id != @child_vendor.id\n @parent_vendor.delay.merge!(@child_vendor, current_user)\n notice = \"Your sous chef is working to merge vendor #{@child_vendor.name}. It should be done soon.\"\n else\n notice = \"Sorry, could not merge the vendors.\"\n end\n\n redirect_to edit_admin_vendor_path(@parent_vendor), notice: notice\n end" ]
[ "0.742202", "0.7404796", "0.6897114", "0.6328288", "0.6287318", "0.6116008", "0.5946049", "0.59200597", "0.59033775", "0.58943677", "0.58930343", "0.5880678", "0.58181566", "0.577461", "0.57574403", "0.5752447", "0.5744066", "0.5736197", "0.5690128", "0.5679538", "0.56374127", "0.5629402", "0.5619821", "0.5595403", "0.5585452", "0.55829006", "0.55652434", "0.5564129", "0.55585504", "0.554067", "0.5529447", "0.5527077", "0.55219996", "0.55106825", "0.5493185", "0.54829055", "0.54688126", "0.54607296", "0.54374284", "0.5403199", "0.5400391", "0.5388009", "0.5381005", "0.53806925", "0.5380495", "0.5377073", "0.5360382", "0.5352819", "0.5351605", "0.53351414", "0.53317195", "0.53084624", "0.5303872", "0.53013265", "0.52939504", "0.5290293", "0.5276341", "0.5271457", "0.52659255", "0.5250708", "0.5248989", "0.52486366", "0.5247748", "0.523941", "0.5224887", "0.5223531", "0.52196926", "0.5217109", "0.52102715", "0.5197463", "0.5188113", "0.5188113", "0.5155957", "0.5153883", "0.5141894", "0.5130932", "0.51307577", "0.51266533", "0.51226974", "0.5115884", "0.5108468", "0.51052815", "0.5105221", "0.5100759", "0.50917566", "0.5085894", "0.5085725", "0.508367", "0.50824714", "0.50801134", "0.5078643", "0.50705826", "0.5069349", "0.5069065", "0.5066561", "0.50596434", "0.5058868", "0.5054394", "0.5054153", "0.5050946", "0.5044644" ]
0.0
-1
merge pr_branch into upstream targeted branch
def merge_pr_totarget(upstream, pr_branch, repo) goto_prj_dir(repo) # check that we are in a git dir check_git_dir `git checkout #{upstream}` `git remote update` `git fetch` `git pull origin #{upstream}` `git checkout -b PR-#{pr_branch} origin/#{pr_branch}` puts `git branch` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_pr_totarget(upstream, pr_branch)\n goto_prj_dir\n check_git_dir\n `git checkout #{upstream}`\n check_duplicata_pr_branch(\"#{pr_fix}#{pr_branch}\")\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b #{pr_fix}#{pr_branch} origin/#{pr_branch}`\n return if $CHILD_STATUS.exitstatus.zero?\n\n # if it fails the PR contain a forked external repo\n repo_external.checkout_into\n end", "def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D #{pr_fix}#{pr}`\n end", "def merge_pull_request\n git.merge pull_request.branch\n end", "def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D PR-#{pr}`\n end", "def push(_branch)\n puts 'TODO: Implement Git.push'\n end", "def upstream_branch\n remote = grit.config[\"branch.#{branch}.remote\"]\n merge = grit.config[\"branch.#{branch}.merge\"]\n \n # No remote, no merge, no tracking.\n if remote.nil? || merge.nil?\n return nil\n end\n \n unless merge =~ /^refs\\/heads\\/(.*)$/\n raise \"invalid upstream branch\"\n end\n \n \"#{remote}/#{$1}\"\n end", "def branch_to_merge_into\n @branch_to_merge_into ||= git.latest_branch_for(branch_type)\n end", "def merge_branch( tag=@current_branch, actor=nil )\n raise \"Invalid branch '#{tag}'\" if not is_head?(tag)\n\n tag.gsub!(/['\\\\]/, '')\n\n # switch to master branch\n set_branch(DEFAULT_BRANCH, actor)\n\n # merge target branch to master branch\n\n rv = nil\n begin\n rv = exec_git_cmd(\"git merge -n --no-ff --no-log --no-squash '#{tag}'\", \n actor)\n rescue CommandError => e\n $stderr.puts e.message\n end\n rv\n end", "def fetch_and_pull_branch(branch_name)\n `cd #{project_repo_path} && git fetch && git checkout #{branch_name} && git pull origin #{branch_name} && git checkout #{self.trunk_branch}`\n end", "def merge(branch_name)\n remote_commit = last_commit(remote_branch_from_local(branch_name))\n\n @rugged_repository.references.update(rugged_repository.head, remote_commit.oid)\n end", "def push(downstream, upstream, remote_branch='svn_git_port')\n name=get_dir_name(downstream, upstream)\n upstream_dir=File.join(name, 'upstream')\n Dir.chdir(upstream_dir) do\n puts `git checkout -b push`\n puts `git push upstream HEAD:#{remote_branch}`\n end\nend", "def update!(**args)\n @remote_branch = args[:remote_branch] if args.key?(:remote_branch)\n end", "def git_merge(branch = \"origin/#{current_default_branch}\")\n mysystem(\"git merge #{branch}\")\n end", "def process_pr(pr, cmd)\n head = pr[:head]\n repo = head[:repo]\n\n pending_status(pr, 'Merge in progress.')\n\n return true if skip_pr?(pr)\n\n begin\n cmd.run 'git fetch', repo[:ssh_url], head[:ref] if repo\n\n merge_status = cmd.run! 'git merge --no-ff --no-edit', head[:sha]\n\n if merge_status.success?\n success_status(pr, \"Merge with '#{@base_branch}' was successful.\")\n else\n cmd.run 'git merge --abort'\n\n message = \"Failed to merge '#{head[:ref]} with #{@base_branch}.\"\n failure_status(pr, message)\n end\n rescue => e\n failure_status(pr, \"Merge encountered an error: #{e.message}.\")\n\n return false\n end\n\n true\n end", "def updateRepo()\n $repo.checkout(BRANCH)\n\n # fetch\n remote = $repo.remotes['' << REMOTE]\n remote.fetch()\n\n # merge\n distant_commit = $repo.branches['' << REMOTE << '/' << BRANCH].target\n $repo.references.update($repo.head, distant_commit.oid)\nend", "def propose_dependency_update(app, branch_key, dependencies, target_version, base_branch)\n am_suffix = current_default_branch == base_branch ? '' : \"-#{base_branch}\"\n branch_name = '' == branch_key ? \"AM#{am_suffix}_update_#{get_shortest_group_name(dependencies)}\" : \"AM#{am_suffix}_#{branch_key}\"\n merge_origin = git_local_branch_list.include?(branch_name)\n git_checkout(base_branch)\n git_checkout(branch_name, true)\n git_merge(\"origin/#{base_branch}\") if merge_origin\n\n if patch_versions(app, dependencies, target_version)\n git_push\n else\n git_checkout(base_branch)\n mysystem(\"git branch -D #{branch_name} 2> /dev/null 1> /dev/null\")\n end\n end", "def update_pull_branch(repo, pull_number, options = {})\n opts = options.dup\n opts[:accept] = 'application/vnd.github.lydian-preview+json' if opts[:accept].nil?\n\n put \"#{Repository.path repo}/pulls/#{pull_number}/update-branch\", opts\n end", "def merge_branch\n git.merge branch\n rescue Git::MergeFailed\n cli.say \"Merge failed. Please resolve these conflicts.\"\n end", "def update_branch!(branch)\n self.name = Job.name_for_branch(self.name, branch)\n xml = REXML::Document.new(self.data)\n REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text = REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text.gsub /template/, branch\n self.data = xml.to_s\n\n self\n end", "def merge_branch_to_master(branch, tag, message, repo_path)\n\tDir.chdir(repo_path) do |path|\n\t\tcmds = [\n\t\t\t\t\"git checkout master\",\n\t\t\t\t\"git merge --no-ff -Xtheirs #{branch}\",\n\t\t\t\t\"git tag -a -f #{tag} -m '#{message}'\"\n\t\t\t\t]\n\t\tcmds.insert(0, \"git branch master origin/master\") unless branch_exists?(path, \"master\")\n\t\tapprove_and_execute(cmds, \"in #{path}\")\n\tend\nend", "def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end", "def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end", "def push_branch\n return puts \"Not pushing, isn't a branch: #{@name}\" unless valid?\n\n puts \"Checking if we can push something on #{@source.name}\"\n return puts \"...nothing to push for #{@source.name}\" unless dirty? && valid?\n\n puts \"...pushing #{@source.name}[#{shortsha(@source.name)}]\"\n @git.push('origin', @source.name)\n @pushed = true\n end", "def track(upstream_branch)\n if upstream_branch.nil?\n # currently grit.config does not support unsetting (grit-2.0.0)\n grit.git.config({:unset => true}, \"branch.#{branch}.remote\")\n grit.git.config({:unset => true}, \"branch.#{branch}.merge\")\n else\n unless tracking_branch?(upstream_branch)\n raise \"the upstream branch is not a tracking branch: #{upstream_branch}\"\n end\n \n remote, remote_branch = upstream_branch.split('/', 2)\n grit.config[\"branch.#{branch}.remote\"] = remote\n grit.config[\"branch.#{branch}.merge\"] = \"refs/heads/#{remote_branch}\"\n end\n end", "def push!\n notify.write(\"Pushing to origin\")\n proj.push('origin', proj_branch)\n proj.push('origin', report_branch)\n end", "def checkout(branch_name)\n local_branches = @rugged_repository.branches.each_name.to_a\n if !local_branches.include?(branch_name) && self.remote_branch_from_local(branch_name)\n @rugged_repository.branches.create(branch_name, self.remote_branch_from_local(branch_name))\n end\n @rugged_repository.checkout(branch_name)\n end", "def pull(branch=nil)\n # git pull --all\n command('pull', '--all')\n track_missing\n unless branch.nil?\n checkout branch\n end\n true\n end", "def handle_repo_push_request\n return unless @repository\n\n branch_name = payload[\"ref\"].sub(%r{\\Arefs/heads/}, '')\n branch = @repository.branches.where(name: branch_name).first\n if branch.present? && branch.convergence? && @repository.run_ci?\n sha = payload[\"after\"]\n branch.kickoff_new_build_unless_currently_busy(sha)\n end\n end", "def pull(tracking_branch=upstream_branch)\n sandbox do |git, work_tree, index_file|\n remote, remote_branch = parse_tracking_branch(tracking_branch)\n git.fetch({}, remote, \"#{remote_branch}:remotes/#{tracking_branch}\")\n merge(tracking_branch)\n end\n reset\n end", "def git_push(host, branch, git_repo_path)\n git_on(host, \"push origin #{branch}\", git_repo_path)\nend", "def check_duplicata_pr_branch(pr)\n puts `git branch --list #{pr}`\n `git branch -D #{pr} 2>/dev/null` if $CHILD_STATUS.exitstatus.zero?\n end", "def merge(merge_branch, options = {})\n merge_analysis = rugged.merge_analysis(merge_branch.name)\n if merge_analysis.include?(:fastforward)\n rugged.references.update(helper.head_ref, merge_branch.target_id)\n rugged.checkout_head(strategy: :force)\n elsif merge_analysis.include?(:normal)\n ours = helper.head_target\n theirs = merge_branch.target\n merge_base = rugged.merge_base(ours, theirs)\n raise(NoCommonCommit) unless merge_base\n\n base = rugged.rev_parse(merge_base)\n index = ours.tree.merge(theirs.tree, base.tree)\n\n commit_message =\n if index.conflicts?\n raise(MergeConflict) unless block_given?\n\n message = yield(index, rugged, helper.working_directory)\n raise(MergeConflict) unless message\n\n index.conflict_cleanup\n message\n else\n \"Merge branch '#{helper.head_branch.name}' of #{helper.head_remote.url}\"\n end\n\n helper.commit_create(\n commit_message,\n index.write_tree(rugged),\n [ours, theirs],\n options\n )\n rugged.checkout_head(strategy: :force)\n end\n\n self\n end", "def fetch_remote_branch(target_branch)\n create_remote_branch(target_branch) unless remote_branch_exists?(target_branch)\n run_git_cmd 'fetch', 'origin'\n run_git_cmd('branch', '--delete', '--force', target_branch) rescue Gitx::Executor::ExecutionError\n checkout_branch target_branch\n end", "def copy_branch_commits(src_repo_path, src_branch, src_branch_point, dest_repo_path)\n `(cd \"#{src_repo_path}\" && git format-patch --stdout #{src_branch_point}..#{src_branch}) | (cd \"#{dest_repo_path}\" && git am)`\n end", "def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n unless deployable? || @force\n CLI.say 'Pull request status checks have not passed. Cannot be marked deployable.'\n exit!\n end\n\n merge_result = merge\n add_deployable_label if config.deployable_label && merge_result\n end\n end", "def apply\n repo.push('origin', ['refs/heads/master'], credentials: credentials)\n end", "def pull(args, options)\n _closest_branch = closest_branch\n\n if _closest_branch\n branch_name = clean_branch_name_for( _closest_branch )\n link = @url_generator.pull_request_url( branch_name, options[:to] || \"master\" )\n\n launch link\n else\n fail \"Could not find closest remote branch for sha: #{@git_object.oid.inspect}\"\n end\n end", "def merge(branch, message = 'merge', opts = {})\n self.lib.merge(branch, message, opts)\n end", "def update\n working_dir do\n git 'fetch', 'origin'\n git 'checkout', branch\n git 'reset', '--hard', \"origin/#{branch}\"\n git 'submodule', 'update', '--init'\n end\n end", "def merge_pull(repo, pull_number, options = {})\n put \"#{Repository.path repo}/pulls/#{pull_number}/merge\", options\n end", "def git_pull\n if `git branch -a` =~ /remotes\\/#{@remote}\\/#{@branch}/ ||\n `git ls-remote #{@remote}` =~ /refs\\/heads\\/#{@branch}/\n `git pull #{@remote} #{@branch}`\n end\n end", "def sync_addon_branch_to_blessed_repo(repoName, remoteBranch, localBranch, pushForce = false)\n self.log(INFO,repoName,\"Checkout #{remoteBranch} branch (it is perhaps not the default) for #{repoName}...\")\n s = system(\"git checkout #{localBranch}\")\n if !s\n print(\"[ERROR] No #{remoteBranch} branch in repository #{repoName}, Skip this repo!!!\\n\")\n self.log(INFO,repoName,\"Done.\")\n # Let's process the next one\n else\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Reset #{localBranch} to #{remoteBranch} for #{repoName} ...\")\n s = system(\"git reset --hard #{remoteBranch}\")\n if !s\n abort(\"[ERROR] Reset #{localBranch} to #{remoteBranch} for #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Push #{localBranch} branch content from exo-addons repository to blessed repository ...\")\n\n forceParam = \"\"\n if pushForce\n forceParam = \"--force\"\n end\n\n s = system(\"git push #{forceParam} blessed #{localBranch}\")\n if !s\n abort(\"[ERROR] Push of #{localBranch} branch updates to repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n end\n end", "def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n if config.deployable_label\n with_labelling do\n merge\n end\n else\n merge\n end\n end\n end", "def merge(build)\n Rails.logger.info(\"Trying to merge branch: #{build.branch} to master after build id: #{build.id}\")\n\n checkout_log, status = Open3.capture2e(\"git checkout master && git pull\")\n raise_and_log(\"Was unable checkout and pull master:\\n\\n#{checkout_log}\") if status.exitstatus != 0\n\n commit_message = \"Kochiku merge of branch #{build.branch} for build id: #{build.id} ref: #{build.ref}\"\n merge_log, status = Open3.capture2e(merge_env, \"git merge --no-ff -m '#{commit_message}' #{build.ref}\")\n abort_merge_and_raise(\"git merge --abort\",\n \"Was unable to merge your branch:\\n\\n#{merge_log}\") unless status.success?\n\n push_log, status = Open3.capture2e(\"git push origin master\")\n rebase_log, second_push_log = recover_failed_push unless status.success?\n\n [checkout_log, merge_log, push_log, rebase_log, second_push_log].join(\"\\n\")\n end", "def checkout_branch(repo_path, branch)\n Dir.chdir(repo_path) {\n system('git fetch')\n system(\"git checkout #{branch}\")\n }\n end", "def update!(**args)\n @branches = args[:branches] if args.key?(:branches)\n end", "def intra_branch?(pr)\n q = <<-QUERY\n select IF(base_repo_id = head_repo_id, true, false) as intra_branch\n from pull_requests where id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:intra_branch]\n end", "def checkout_branch\n Dir.chdir(@dir) { git!('checkout', @configuration.branch) } if @configuration.branch\n end", "def merge(join_request)\n work = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n work.checkout(join_request.target_stream)\n work.fetch\n work.pull\n work.merge(join_request.source_stream)\n work.branch(join_request.source_stream).delete\n work.push\n work.fetch\n work.pull\n end", "def intra_branch?(pr_id)\n q = <<-QUERY\n select IF(base_repo_id = head_repo_id, true, false) as intra_branch\n from pull_requests where id = ?\n QUERY\n if_empty(db.fetch(q, pr_id).all, :intra_branch)\n end", "def check_branch\n same_branch = `git branch -a` =~ /\\* #{@branch}/\n\n if current_remote = `git remote -v`.match(/\\s\\S+/)\n same_remote = current_remote[0].match(/#{@repo}/)\n end\n\n if same_remote && same_branch\n puts \"Deploy to #{@branch} canceled:\".red\n puts \"You cannot deploy to the same branch you are working in. This will overwrite the source for your site.\\n\"\n puts \"First, back up your site's source to a branch:\"\n puts \"\\n git checkout -b source\".yellow\n puts \" git push origin source\".yellow\n puts \"\\nWith that, you'll work in the #{\"source\".bold} branch and deploy to the #{@branch.bold} branch.\"\n abort\n end\n end", "def db_update_pull_request(db, pr, org, repo)\n db[\n \"UPDATE items SET merged_at=? WHERE org=? AND repo=? AND item_number=?\",\n gh_to_db_timestamp(pr.merged_at), org, repo, pr.number.to_s].update\n end", "def pull_execute(branch, dir)\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n pull = @parse_json_config['deploy']['github']['config']['pull']\n if pull == \"yes\"\n system_commands(\"cd #{dir}; git pull origin #{branch}\")\n end\n end", "def build_branch(branch, params = {}, body = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).post(body)\n end", "def build_branch(branch, params = {}, body = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).post(body)\n end", "def migrate(branch)\n zombie_check\n b = @repo.branch(self.class.branch_name(@name, branch: branch))\n base = @repo.merge_base(['HEAD', b])\n diff = @repo.diff(base, @repo.current_branch)\n files = diff.stats[:files].keys() \\\n .delete_if{ |f| File.split(f).any?{ |ff| ff != \".\" && ff.start_with?('.') } } \\\n .keep_if{ |f| contains?(f, branch: branch) }\n files.each do |file|\n puts \" Patching file #{file}\"\n on_worktree(branch) do |repo|\n repo.apply_diff(diff[file])\n repo.add(file)\n end\n end\n end", "def create_branch\n ErrorEmittingExecutor.execute(\"git checkout -B #{BRANCH_NAME}\")\n\n # Ensure local branch matches any existing upstream branch; will reset to HEAD by default\n ErrorEmittingExecutor.execute('git reset --hard', exit_on_error: true)\nend", "def change_git!\n @jobs.each_value do |job|\n job[:value][:scm_branch] = \"origin/pr/#{@number}/head\"\n job[:value][:scm_params] = {} unless job[:value][:scm_params]\n job[:value][:scm_params][:refspec] = 'refs/pull/*:refs/remotes/origin/pr/*'\n end\n end", "def pull(remote = nil, branch = nil)\n self.lib.pull(remote, branch)\n end", "def merge(repo, base, head, options = {})\n params = {\n :base => base,\n :head => head\n }.merge(options)\n post \"#{Repository.path repo}/merges\", params\n end", "def push\n ensure_git_and_cucumber_available\n ensure_repository\n\n puts \"Not implemented yet... pull request for push please!\"\n end", "def set_branch( tag, actor=nil )\n # allow creating of new branches via -b if they do not exist\n opt = (is_head? tag) ? '' : '-b'\n\n # Save staging index for current branch\n @saved_stages[@current_branch] = self.staging if staging?\n\n exec_git_cmd( \"git checkout -q -m #{opt} '#{tag}'\", actor )\n\n # Synchronize staging index (required before merge)\n unstage\n\n # Update current_branch info and restore staging for branch\n self.staging = @saved_stages[tag]\n self.staging.sync if staging?\n @current_branch = tag\n end", "def include other_branch\n Dir.chdir @root do\n cmd = \"git merge --no-ff --no-commit \\\"#{other_branch}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n if /Not a git repository/.match stderr\n raise NotARepositoryError\n elsif /Automatic merge failed/.match stdout\n return false\n else\n raise Error, stderr\n end\n end\n end\n return true\n end", "def related\n\t\t\tup=upstream\n\t\t\tpu=push\n\t\t\tpu=new_branch(nil) if up==pu\n\t\t\treturn up, pu\n\t\tend", "def sync_develop_branch(repoName)\n sync_addon_branch_to_blessed_repo(repoName, \"origin/develop\", \"develop\", false)\n end", "def merge(treeish=upstream_branch)\n sandbox do |git, work_tree, index_file|\n des, src = safe_rev_parse(branch, treeish)\n base = des.nil? ? nil : git.merge_base({}, des, src).chomp(\"\\n\")\n \n case\n when base == src\n break\n when base == des\n # fast forward situation\n grit.update_ref(branch, src)\n else\n # todo: add rebase as an option\n \n git.read_tree({\n :m => true, # merge\n :i => true, # without a working tree\n :trivial => true, # only merge if no file-level merges are required\n :aggressive => true, # allow resolution of removes\n :index_output => index_file\n }, base, branch, src)\n \n commit!(\"gitgo merge of #{treeish} into #{branch}\", \n :tree => git.write_tree.chomp(\"\\n\"),\n :parents => [des, src]\n )\n end\n \n reset\n end\n \n self\n end", "def pull_on_operand_branch *args\n self.on_operand_branch :pull, *args\n end", "def create_branch(branch)\n client.create_ref repo, \"heads/#{branch}\", base_sha\n end", "def branch; end", "def merge_and_push\n Rails.logger.info(\"Trying to merge branch: #{@build.branch} to master after build id: #{@build.id}\")\n\n begin\n git_fetch_and_reset\n\n merge_log = merge_to_master\n\n push_log = push_to_remote\n rescue GitFetchFailedError, GitPushFailedError\n tries = (tries || 0) + 1\n if tries < 3\n sleep(10 * tries)\n retry\n else\n raise\n end\n end\n\n [merge_log, push_log].join(\"\\n\")\n end", "def update\n `cd #{__dir__} && git pull origin master`\n install\nend", "def update\n @pullRequest = PullRequest.find(params[:id])\n\t\t@git = Git.init()\n\t\tDir.chdir(@pullRequest.source_repo.path)\n\t\trequestor_path = \"#{@pullRequest.repository.path}\"\n\t\t@git.pull(requestor_path, \"master\") # fetch and a merge\n\t\t@pullRequest.status = \"ACCEPTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while updating your pull request\"}\n end\n end", "def update\n # Reset --hard repo before update\n reset! if @settings[:reset_before_update]\n\n # Fetch changes from origin\n repo.fetch('origin', credentials: credentials)\n\n # Create the merged index in memory\n merge_index = repo.merge_commits(local_branch, remote_branch)\n\n # Complete the merge by comitting it\n opts = {\n parents: [local_branch, remote_branch],\n tree: merge_index.write_tree(repo),\n update_ref: update_ref,\n message: update_message,\n author: commit_author,\n committer: commit_author\n }\n Rugged::Commit.create(repo, opts)\n\n reload!\n end", "def is_branch_build\n self.pull_request_number == '-1'\n end", "def checkout_to_base_branch!\n current_branch = git_command.current_branch\n return if base_branch == current_branch\n\n puts \"Current branch is expected to '#{base_branch}', but '#{current_branch}'.\"\n puts \"Checkout to '#{base_branch}'.\"\n git_command.checkout(base_branch)\n end", "def update!(**args)\n @author = args[:author] if args.key?(:author)\n @remote_branch = args[:remote_branch] if args.key?(:remote_branch)\n end", "def fetch_update\n remote_branch = ErrorEmittingExecutor.execute(\"git branch -r --list origin/#{BRANCH_NAME}\")\n if remote_branch == 'origin/cocina-level2-updates'\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS} #{GIT_BRANCH_FETCH_REFS}\")\n else\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS}\", exit_on_error: true)\n end\nend", "def target_branch\n # TODO: Enable possibility to manually override this and set arbitrary branches.\n ENV['TARGET_BRANCH'] || 'master'\n end", "def create_branch\n check_current_repo\n exists = `git branch --list #{branch}`.squish == branch\n if exists\n `git checkout #{branch}`\n else\n `git checkout master` unless current_branch == 'master'\n `git checkout -b #{branch}`\n end\nend", "def pullapprove_merge_hook\n context = params[:context]\n state = params[:state]\n target = params[:target_url]\n\n if context == 'code-review/pullapprove' && state == 'success'\n pr_num = %r{https?:\\/\\/pullapprove\\.com\\/Charcoal-SE\\/SmokeDetector\\/pull-request\\/(\\d+)\\/?}.match(target)[1].to_i\n pr = Octokit.client.pull_request('Charcoal-SE/SmokeDetector', pr_num)\n\n if pr[:user][:login] != 'SmokeDetector'\n render plain: \"Not a blacklist PR, not merging (##{pr_num})\"\n return\n end\n\n unless Dir.exist?('SmokeDetector')\n system 'git clone git@github.com:Charcoal-SE/SmokeDetector'\n\n Dir.chdir('SmokeDetector') do\n system 'git config user.name metasmoke'\n system 'git', 'config', 'user.email', AppConfig['github']['username']\n end\n end\n\n if !Octokit.client.pull_merged?('Charcoal-SE/SmokeDetector', pr_num)\n File.open('SmokeDetector/.git/info/attributes', File::RDWR) do |f|\n f.flock(File::LOCK_EX)\n\n Dir.chdir('SmokeDetector') do\n ref = pr[:head][:ref]\n\n system 'git fetch origin master; git checkout -B master origin/master'\n system 'git', 'fetch', 'origin', ref\n system 'git', 'merge', \"origin/#{ref}\", '--no-ff', '-m', \"Merge pull request ##{pr_num} from Charcoal-SE/#{ref} --autopull\"\n system 'git push origin master'\n system 'git', 'push', 'origin', '--delete', ref\n system 'git', 'branch', '-D', ref\n end\n end\n\n message = \"Merged SmokeDetector [##{pr_num}](https://github.com/Charcoal-SE/SmokeDetector/pull/#{pr_num}).\"\n ActionCable.server.broadcast('smokedetector_messages', message: message)\n render plain: \"Merged ##{pr_num}\"\n else\n render plain: \"##{pr_num} already merged\"\n end\n else\n render plain: 'Not PullApprove successful status, ignoring'\n end\n end", "def check_out_branch\n git.check_out branch_to_merge_into\n rescue Git::NoBranchOfType\n cli.say \"No #{branch_type} branch available. Creating one now.\"\n git.check_out DatedBranchCreator.perform(branch_type).branch_name\n end", "def get_merged(br)\n __branches \"-l --merged #{br}\"\nend", "def process\n check_github_token\n config.base_jobs.each do |base_job_name|\n if branch_deleted?\n Job.delete!(base_job_name, branch)\n else\n Job.find_or_create_copy(base_job_name, branch).run!\n end\n end\n end", "def pull\n fetch\n merge\n end", "def checkout(branch)\n zombie_check\n workdir = File.join(@repo.dir.to_s, \".worktree\", @name, branch)\n worktree = @repo.new_worktree(workdir, self.class.branch_name(@name, branch: branch)) \n end", "def pull(remote, options={})\n raise RuntimeError, \"Unknown remote #{remote}\" unless remote_list.include?(remote)\n\n git.fetch({}, remote)\n git.fetch({:tags => true}, remote)\n\n ref_rx = /^#{Regexp.quote(remote)}\\//\n remote_branches = Hash[remotes.map{|r| [$',r] if r.name =~ ref_rx }.compact]\n\n # FIXME: should we depend on Vendorificator::Config here?\n Vendorificator::Config.each_module do |mod|\n remote_head = remote_branches[mod.branch_name]\n ours = mod.head && mod.head.commit.sha\n theirs = remote_head && remote_head.commit.sha\n\n if remote_head\n if not mod.head\n say_status 'new', mod.branch_name, :yellow\n git.branch({:track=>true}, mod.branch_name, remote_head.name) unless options[:dry_run]\n elsif ours == theirs\n say_status 'unchanged', mod.branch_name\n elsif fast_forwardable?(theirs, ours)\n say_status 'updated', mod.name, :yellow\n unless options[:dry_run]\n mod.in_branch do\n git.merge({:ff_only => true}, remote_head.name)\n end\n end\n elsif fast_forwardable?(ours, theirs)\n say_status 'older', mod.branch_name\n else\n say_status 'complicated', mod.branch_name, :red\n indent do\n say 'Merge it yourself.'\n end\n end\n else\n say_status 'unknown', mod.branch_name\n end\n end\n\n private\n\n def conf\n Vendorificator::Config\n end\n\n def say_status(*args)\n conf[:shell].say_status(*args) if conf[:shell]\n end\n end", "def push(tracking_branch=upstream_branch)\n sandbox do |git, work_tree, index_file|\n remote, remote_branch = parse_tracking_branch(tracking_branch)\n git.push({}, remote, \"#{branch}:#{remote_branch}\") unless head.nil?\n end\n end", "def push(uuid, repo, from_repo_uuid = nil, to_repo_uuid = nil)\n from_repo_uuid ||= @uuid\n to_repo_uuid ||= repo.uuid\n remote_head = repo.head(uuid, to_repo_uuid)\n # TODO: receiver must store received versions somewhere, \n # then try fast-forward merge or report an error.\n # Find out what this \"somewhere\" is. Maybe, a temporary\n # repo/branch.\n end", "def add_merge(options={})\n if message = options[:message]\n message = \"-m '#{message}'\"\n end\n branch = options[:branch] || \"foobar\"\n base = options[:base] || \"master\"\n sh(\"git checkout -b #{branch} 2>&1 && echo asd >> xxx && git commit -am 'xxx' && git checkout #{base} 2>&1 && git merge #{branch} --no-ff #{message}\")\n commits = last_commits\n return commits[0], commits[1]\n end", "def add_branch(new_branch, opts = {})\n if opts[:empty]\n git_command__change_head_symbolic_ref(new_branch)\n git_command__empty_commit \n else\n checkout(opts[:sha] || @branch) do\n git_command__add_branch(new_branch)\n end\n end\n add_remote_files?(new_branch, opts[:add_remote_files_info])\n end", "def push(remote_repo = remote, remote_branch = current_branch)\n git 'push', remote, current_branch\n end", "def push(remote_repo = remote, remote_branch = current_branch)\n git 'push', remote, current_branch\n end", "def push\n unless system(\"cd #{repo_path};git push origin #{branch}\")\n raise GitCloud::GitException.new(\"Push\")\n end\n end", "def pull\n ui.info(\"Pulling from origin\")\n git.pull(REMOTE, [ REMOTE, BRANCH ], AUTO_MERGE_MSG)\n end", "def merge_pull_request(repo, number, commit_message='', options = {})\n put \"#{Repository.path repo}/pulls/#{number}/merge\", options.merge({:commit_message => commit_message})\n end", "def to_checkout\n @to_checkout ||= begin\n clean_local_branch\n remote_branch? ? \"origin/#{ref}\" : ref\n end\n end", "def target\n \"#{target_repo}/#{target_branch}\"\n end", "def set_head(project, branch)\n url = \"/projects/#{project}/HEAD\"\n body = {\n ref: 'refs/heads/' + branch\n }\n put(url, body)\n end", "def set_branch\n @branch = Branch.get_branch(params[:id], params[:workspace_id]).first\n end", "def commit_to_test_proj!\n test_proj.add(full_report_path)\n result = test_proj.commit(\"#{proj_branch} #{report_name}\")\n notify.write(\"Pushing back to local repo\")\n test_proj.real_pull('origin', report_branch)\n test_proj.push('origin', report_branch)\n end" ]
[ "0.8051848", "0.6836924", "0.6743151", "0.6703898", "0.6445372", "0.63865745", "0.6333562", "0.6296837", "0.6247566", "0.6168456", "0.61101", "0.6103195", "0.60160255", "0.6002186", "0.6000863", "0.59704703", "0.59190494", "0.587834", "0.5839706", "0.5823195", "0.582193", "0.582193", "0.5787472", "0.57770246", "0.5764467", "0.57441807", "0.5734506", "0.5729291", "0.57106096", "0.566157", "0.56453985", "0.56356275", "0.5571959", "0.5563493", "0.5557285", "0.55498624", "0.55348617", "0.5529747", "0.54785883", "0.54781747", "0.54640377", "0.54487795", "0.5442396", "0.54292053", "0.54190844", "0.5408109", "0.5394552", "0.5388044", "0.5387764", "0.53789717", "0.5376487", "0.53716385", "0.53678936", "0.5343457", "0.5336847", "0.53206867", "0.5295911", "0.52431947", "0.52422345", "0.52369136", "0.5221832", "0.52202135", "0.51988417", "0.5186615", "0.5182243", "0.51581496", "0.514721", "0.5146042", "0.51454115", "0.5142528", "0.5136589", "0.5136024", "0.513596", "0.51247185", "0.51022047", "0.51011735", "0.50972897", "0.509723", "0.5088247", "0.50862443", "0.50831884", "0.5078711", "0.50731164", "0.50704217", "0.50690526", "0.50679135", "0.50608116", "0.50585896", "0.50574213", "0.5053247", "0.5049896", "0.5049896", "0.5049146", "0.5033841", "0.50274736", "0.50147873", "0.50042707", "0.49904048", "0.49877152", "0.49876806" ]
0.8003641
1
cleanup the pr_branch(delete it)
def del_pr_branch(upstream, pr) `git checkout #{upstream}` `git branch -D PR-#{pr}` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_pr_branch(upstream, pr)\n `git checkout #{upstream}`\n `git branch -D #{pr_fix}#{pr}`\n end", "def clean_tree(branch)\n\n branch.children = branch.children.inject(Children.new(branch)) do |r, c|\n cc = if c.name == 'sequence' and c.children.size == 1\n c.children.first\n else\n c\n end\n r << clean_tree(cc)\n end\n\n branch\n end", "def purge\n self.branches.each do |b|\n b.purge\n b.destroy\n end\n end", "def purge\n self.branches.each do |b|\n b.purge\n b.destroy\n end\n end", "def clean_local_branch\n run_and_success?(\"#{git} show-branch #{ref} > /dev/null 2>&1 && #{git} branch -D #{ref} > /dev/null 2>&1\")\n end", "def cleanup!; end", "def cleanup!; end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup\n end", "def cleanup\n end", "def cleanup\r\n end", "def cleanup\n\tend", "def cleanup\n\tend", "def unbranch\n @child\n end", "def delete_branch\n #we'll get all descendants by level descending order. That way we'll make sure deletion will come from children to parents\n children_to_be_deleted = self.class.find(:all, :conditions => \"id_path like '#{self.id_path},%'\", :order => \"level desc\")\n children_to_be_deleted.each {|d| d.destroy}\n #now delete my self :)\n self.destroy\n end", "def delete_tree\n @root = nil # In ruby it will be taken care by garbage collector\n end", "def delete_head_branch\n repository.delete_branch(commit_head)\n\n journalize_action(\n :property => 'attr',\n :prop_key => 'branch',\n :old_value => commit_head\n )\n end", "def cleanup!\n # This method may be left unimplemented if that is applicable\n end", "def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end", "def clean_up\n end", "def clean_up\n end", "def clean()\n rels = releases()\n rels.pop()\n\n unless rels.empty?\n rm = ['rm', '-rf'].concat(rels.map {|r| release_dir(r)})\n rm << release_dir('skip-*')\n cmd.ssh(rm)\n end\n end", "def cleanup\n true\n end", "def cleanup\n true\nend", "def remove(branch)\n target_entry = entries.find { |e| e['branch_name'] == branch }\n target_entry['removed'] = true if target_entry\n end", "def remove_remote_branch\n Gitlab.delete_branch(GITLAB_DOCS_REPO, docs_branch)\n puts \"=> Remote branch '#{docs_branch}' deleted\"\nend", "def trim_tree\n\t\t@corridor_seeds.each { |seed| check_branch(corridor_map[seed]) }\n\tend", "def remove\n working_repo.remove tree\n end", "def clean_all\n update\n # Protect all open requests' branches from deletion.\n protected_branches = @current_requests.collect {|request| request.head.ref }\n # Select all branches with the correct prefix.\n review_branches = all_branches.collect do |branch|\n # Only use uniq branch names (no matter if local or remote).\n branch.split('/').last if branch.include?('review_')\n end\n (review_branches.uniq - protected_branches).each do |branch_name|\n # Only clean up obsolete branches.\n delete_branch(branch_name) unless unmerged_commits?(branch_name, false)\n end\n end", "def do_remove_from_termination (term)\r\n term.aln_path_id = nil\r\n term.aln_path = nil\r\n term.save\r\n end", "def cleanup_hook; end", "def finalize\n @list.each do |bp|\n bp.related_bp.each { |bp| bp.remove! }\n bp.remove!\n end\n clear\n end", "def cleanup(paths)\n item = path_tree.descend(paths)\n item.cleanup \n save_path_tree\n # print what happened here\n print_depth item\n end", "def git_reset_branch(branch = '')\n mysystem(\"git reset --hard #{branch} 2> /dev/null > /dev/null\")\n git_clean_filesystem\n end", "def ref_cleanup(xmldoc)\n xmldoc.xpath(\"//p/ref\").each do |r|\n parent = r.parent\n parent.previous = r.remove\n end\n end", "def clean_single(force_deletion = false)\n update 'closed'\n return unless request_exists?('closed')\n # Ensure there are no unmerged commits or '--force' flag has been set.\n branch_name = @current_request.head.ref\n if unmerged_commits?(branch_name) and not force_deletion\n puts 'Won\\'t delete branches that contain unmerged commits.'\n puts 'Use \\'--force\\' to override.'\n return\n end\n delete_branch(branch_name)\n end", "def delete_branch(name)\n repo.branches.delete(name)\n !branch_exist?(name)\n end", "def cleanup\n return unless @dst\n\n @dst.unlink\n @dst = nil\n end", "def purge \n\t\t@head = nil\n\t\t@tail = nil\n\tend", "def _clean; end", "def clear\n each_child { |child| child.clear if child.kind_of?(BranchNode) }\n @children.clear\n end", "def cleanup_release\n if ssh.directory_exists?(release_path)\n ssh.run(\"rm -rf #{release_path}\")\n end\n end", "def trim_tree\n @corridor_seeds.each { |seed| check_branch(corridor_map[seed]) }\n end", "def prune\n sandbox {|git,w,i| git.prune }\n self\n end", "def delete( branch )\n\t\tself.log.info \"Deleting %s from the directory.\" % [ branch ]\n\t\tself.conn.delete( branch.dn )\n\tend", "def check_duplicata_pr_branch(pr)\n puts `git branch --list #{pr}`\n `git branch -D #{pr} 2>/dev/null` if $CHILD_STATUS.exitstatus.zero?\n end", "def remove_trivial_branches(code)\n code = code.dup\n nil while\n code.gsub!(TRIVIAL_BRANCH_RE) do\n if ($2 == \"if\") == ($3 == \"true\")\n indent(-2, $4)\n else\n $5 ? indent(-2, $5) : \"\"\n end\n end\n code\n end", "def do_cleanup; \"\" end", "def remove_active_branch(project = 'gardener', branch = 'branches/gsteamer-nightly')\n if (branch =~/live|trunk/i &&\n branch !=/tags/i)\n raise(\"Do not try and remove #{branch}\")\n end\n svn_uri = project + '/' + branch\n if (repo_exists?(svn_uri))\n Log.logger.info(\"Attempting to remove #{svn_uri}\")\n svn = SvnCommand.new\n svn.credentials = @it.svn_credentials.get\n svn.url = @it.engineering_svn_url + '/' + svn_uri\n svn.ci_comment = 'Removing for QA Automated Test'\n run(svn.remove)\n end\n end", "def destroy\n Branch.friendly.find(params[:id]).destroy\n flash[:success] = \"Branch deleted.\"\n redirect_to admintools_url\n end", "def cleanup\n # override and do something appropriate\n end", "def destroy\n @branch = Branch.find(params[:id])\n @parentTitle = Branch.find(params[:id]).uid\n Branch.where(parent: @parentTitle).delete_all\n @branch.destroy\n render :json => @branch.to_json\n end", "def cleanup\n File.delete(@tmp_state) rescue nil\n end", "def purge\r\n @head = nil\r\n @tail = nil\r\n end", "def structure_reform(curNode, addNode)\n # reset branches for reform\n @branches = []\n @branch_count = 0\n # puts 'before cleanup'\n # lNode.print_tree\n # rNode.print_tree\n # rNode.print_tree\n # remove_PH_node(lNode)\n # remove_PH_node(rNode)\n # remove_PH_node(curNode)\n # puts 'after cleanup'\n # curNode.print_tree\n # addNode.print_tree\n # rNode.print_tree\n curChildren = curNode.children.count == 0 ? [curNode] : curNode.children\n addChildren = addNode.children.count == 0 ? [addNode] : addNode.children\n count = 0\n # p 'lnode'\n # pp lChildren\n # p 'rnode'\n curChildren.each do |ln|\n curNode.remove!(ln)\n addChildren.each do |rn|\n # p '--------------'\n # p 'ln'\n # ln.print_tree\n # p 'rn'\n # rn.print_tree\n # binding.pry\n # phName=\"PH#{@branch_count}\"\n # ph =Tree::TreeNode.new(phName, '')\n ln_append = ln.detached_subtree_copy\n # p 'ln_append before'\n # ln_append.print_tree\n append_to_end(ln_append, rn)\n # p 'ln_append'\n # ln_append.print_tree\n # ph<<ln_append #unless curNode==newNode\n ln_append = add_branch(ln_append)\n # p 'ln_append after'\n # ln_append.print_tree\n curNode << ln_append\n # p 'ph'\n # ph.print_tree\n # p 'curNode'\n # curNode.print_tree\n end\n end\n end", "def trim_branches\n @selection = Downup::Base.new(\n options: branch_options,\n type: :multi_select,\n multi_select_selector: multi_select_selector,\n selected_color: selected_color,\n header_proc: header_proc\n ).prompt\n\n delete_branches_confirmation\n @selection\n end", "def cleanup(path)\n Monsove.logger.info(\"Cleaning up local path #{path}\")\n\n FileUtils.rm_rf(path)\n File.delete(\"#{path}.tar.bz2\")\n end", "def process\n check_github_token\n config.base_jobs.each do |base_job_name|\n if branch_deleted?\n Job.delete!(base_job_name, branch)\n else\n Job.find_or_create_copy(base_job_name, branch).run!\n end\n end\n end", "def clean_up\n show do\n title 'Store pellets on ice'\n note temp_instructions(ON_ICE)\n\n note 'Keep the labeled cell pellets, in the 24-well aluminum block, on ice until you are ready for FACS.'\n end\n\n buffers = operations.map { |op| op.inputs.select { |i| ALL_BUFFERS.include?(i.name) } }.flatten\n buffers.map! { |b| b.child_item }.uniq!\n\n release(buffers, interactive: true)\n\n show do\n title 'Clean up'\n\n check 'Any items that remain on the bench (other than the labeled cell pellets) can be discarded.'\n check \"Set the refigerated centrifuge back to 25 #{DEGREES_C}.\"\n end\n end", "def uncap_cap!(git_dir)\n # grab info we need to restore state, and remove the cap\n branches = Branches.new(git_dir)\n group_head = branches.current_group\n current_branch = branches.current_branch\n git_command(\"reset\", \"--hard HEAD~1\", git_dir)\n yield branches # give block the branches object so it knows where it is\n branches.update\n opt_str = \"\"\n branches[group_head].each{|branch| opt_str << branch << \" \"}\n git_command(\"checkout\", current_branch, git_dir) #back to prev branch\n git_command(\"merge\", opt_str, git_dir) # merge 'em in!\n end", "def preClean(leave_ours = false)\n end", "def cleanup\n FileUtils.rm_f(@path)\n delete\n end", "def cleanup\n if ::File.exist?(chef_backup_dir) # rubocop:disable Style/GuardClause\n converge_by(\"removing #{chef_backup_dir}\") do\n FileUtils.rm_rf chef_backup_dir\n end\n end\nend", "def delete_branches(github_branches)\n logger.info \"Current Github Branches: #{github_branches}\"\n project.branches.find_each do |branch|\n next if github_branches.include?(branch.name)\n logger.info \"Deleting #{branch.name}\"\n branch.destroy\n end\n end", "def cleanup_state\n delete_if_exists(state_file_path)\n delete_if_exists(chef_file_path)\n delete_if_exists(past_scripts_path)\n delete_if_exists(log_path)\n end", "def cleanup(options=nil)\n end", "def destroy\n @branch = @repository.branches.where(:name => params[:branch_name]).first!\n @branch.destroy\n\n respond_to do |format|\n format.html { redirect_to(branches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Tools.write2log(current_user.id, 'Удаление', 'Филиалы', 0, '# ' + @branch.id.to_s)\n @branch.destroy\n respond_to do |format|\n format.html { redirect_to branches_url }\n format.json { head :no_content }\n end\n end", "def git_prune\n mysystem('git prune')\n end", "def clean_up(*args)\n # Remove all orphan Entries and Products\n SemiStatic::Entry.all{|e| e.destroy if e.tag.nil?}\n SemiStatic::Product.all{|p| p.destroy if p.entry.nil?}\n\n # Get rid of newsletter tags where the actual newsletter has been deleted\n SemiStatic::Tag.select{|t| t.newsletter_id.present? && t.newsletter.nil?}.each{|t| t.destroy}\n\n # There was a bug where some Entry.master_entry_id were not reset to nil, fix these\n SemiStatic::Entry.where.not(:master_entry_id => nil).each{|e| e.master_entry_id = nil; e.save;}\n end", "def bootstrap_cleanup\n end", "def destroy\n group_description = @group_branch.description\n @group_branch.destroy\n if @group_branch.errors.any?\n redirect_to location_group_branches_path, alert: \"Grupo de ramo (#{group_description}) não pode ser excluido, existe(m) dependência(s)\"\n else\n redirect_to location_group_branches_path, notice: \"Grupo de ramo (#{group_description}) foi excluido com sucesso\"\n end\n end", "def clean_up\n access_processes do |processes|\n processes.values.select(&:exited?).each do |process|\n process.io.stdout.path.unlink rescue nil\n end\n processes.delete_if { |_, process| process.exited? }\n # Do not leak @processes outside\n # We are using dRuby, keep input/output objects simple\n nil\n end\n end", "def clean_environment\n `rm -rf /tmp/#{@upload_id}` # all sliced pages of the source file\n end", "def mina_cleanup!\n run! if commands.any?\n end", "def cleanup(release)\n\n if (release)\n num = @release_version\n str = \"release\"\n else\n num = @devel_version\n str = \"devel\"\n end\n\n keys_to_delete = []\n @link_map.keys.each do |k|\n if k =~ /packages\\/#{num}/\n newkey = k.sub \"packages/#{num}\", \"packages/#{str}\"\n @link_map[newkey] = 1\n keys_to_delete.push k\n end\n end\n for key in keys_to_delete\n @link_map.delete key\n end\nend", "def cleanup(pages)\n end", "def cleanup\n tmpdir = File.join(OBS_BUILD_DIR,OBS_LOCAL_TMP)\n if File.exists?(tmpdir)\n FileUtils.rm_rf(tmpdir)\n end\n end", "def destroy\n @branch = @repository.branches.where(name: params[:branch_name]).first!\n @branch.destroy\n\n respond_to do |format|\n format.html { redirect_to(branches_url) }\n format.xml { head :ok }\n end\n end", "def cleanup(vm_ref)\n ui.warn \"Clenaing up work and exiting\"\n xapi.VM.destroy(vm_ref)\n exit 1 \n end", "def cleanup\n\tsh 'del /F /Q .\\_site\\*'\n\t# sh 'rm -rf ./_site'\nend", "def teardown\n @root.remove!(@left_child1)\n @root.remove!(@right_child1)\n @root = nil\n end", "def delete_branch(branch_name)\n # Delete local branch if it exists.\n git_call(\"branch -D #{branch_name}\", true) if branch_exists?(:local, branch_name)\n # Delete remote branch if it exists.\n git_call(\"push origin :#{branch_name}\", true) if branch_exists?(:remote, branch_name)\n end", "def restore_branch\n @@obj.branch(@@save_branch.pop).checkout\n end", "def clean!\n @changes = []\n end", "def clean()\n\t\tSystem::clean target()\n\tend", "def clean()\n\t\tSystem::clean target()\n\tend", "def cleanup!\n input.drop\n output.drop\n end", "def clean_post_fetch\n @base = nil\n end", "def clean_up()\n File.delete(ZIP_FILE)\n end" ]
[ "0.7179789", "0.6870446", "0.678229", "0.678229", "0.6617888", "0.6564336", "0.6564336", "0.6541621", "0.6541621", "0.6541621", "0.6541621", "0.651397", "0.651397", "0.651397", "0.6484305", "0.6484305", "0.6484305", "0.6484305", "0.647548", "0.647548", "0.6420382", "0.64040446", "0.64040446", "0.63658255", "0.6317697", "0.6165632", "0.613632", "0.61030674", "0.6096643", "0.60848874", "0.60848874", "0.6071918", "0.5984743", "0.5980632", "0.5956027", "0.595089", "0.59504646", "0.594198", "0.59155697", "0.5913494", "0.59071213", "0.5901425", "0.5892251", "0.58552957", "0.585323", "0.5838635", "0.5812413", "0.57791543", "0.5769114", "0.5766707", "0.57523644", "0.57487035", "0.57428086", "0.57326967", "0.57272834", "0.57237", "0.5699366", "0.56960416", "0.5674452", "0.5667295", "0.56543267", "0.56510794", "0.56473064", "0.5642087", "0.56391984", "0.56256604", "0.56251836", "0.56236744", "0.5623069", "0.5620586", "0.56082606", "0.55834633", "0.5576342", "0.55735326", "0.5570387", "0.5566904", "0.55610764", "0.5558311", "0.55575633", "0.555674", "0.5554622", "0.55519205", "0.5550966", "0.55476993", "0.55382335", "0.55369097", "0.55274856", "0.55261534", "0.5525429", "0.5525071", "0.5523599", "0.5522148", "0.55207765", "0.55166703", "0.5494247", "0.5493583", "0.5493583", "0.5479722", "0.54792017", "0.54603094" ]
0.711742
1
Only allow a trusted parameter "white list" through.
def update_basic_model_params params.require(:basic_model).permit(:name, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
before date 20140723 all data 20140724 tradedate after date 20140724 all data 20140725 tradedate
def quotationfileprocess path File.open(path, 'r') do |file| file.each_line do |line| cols = line.force_encoding('gb2312').split("\t") if /\d{6}/ =~ cols[0][2..7].strip #added new quotation q = Quotation.new q.marketdate = tradedate q.code = cols[0][2..7].strip q.name = cols[1].strip q.cqstatus = 'chuquan' unless q.name[0..1] != 'XD' q.plate = cols[18].strip if cols[11].strip == '--' preq = Quotation.find_by(marketdate: pretradedate, code: q.code) q.open = 0 q.high = 0 q.low = 0 q.close = cols[14].strip q.dprofit = 0 q.tpstatus = 'tingpai' else q.open = cols[11].strip q.high = cols[12].strip q.low = cols[13].strip q.close = cols[3].strip q.dprofit = cols[2].strip end q.save end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_date(stock_data)\n stock_data.map { |date| date.trade_date }\n end", "def stock_picker(data) \n\tday1 = 0\n\twhile day1 < data.length - 1\n\t\tday2 = day1 + 1\t\n\t\twhile day2 < data.length\n\t\t\tprofit ||= 0 #initialize profit at 0\n\t\t\tif data[day2] - data[day1] > profit\n\t\t\t\tprofit = data[day2] - data[day1] #update these variables if profit margin is larger than existing\n\t\t\t\tsellDate = day2\n\t\t\t\tbuyDate = day1\n\t\t\tend\n\t\t\tday2 += 1\n\t\tend\n\t\tday1 += 1\n\tend\n\treturn [buyDate, sellDate] \nend", "def stock_picker(arr)\n buy = \"\"\n sell = \"\"\n biggest_difference = 0\n profit = 0\n arr.each_with_index do |day, index|\n #no days after last day so last day can't be the buy day\n if (day != arr[-1])\n #sell date must be after purchase date, therefore only want indicies after current\n future_date = (index +1)\n while future_date < arr.length\n profit = arr[future_date] - arr[index]\n if profit > biggest_difference\n buy = index\n sell = future_date\n biggest_difference = profit\n end\n future_date += 1\n end\n end\n end\n [buy,sell]\nend", "def dates_for_axis influences\n\t\tmin = influences[0].date\n\t\tmax = influences[0].date\n\n\t\tinfluences.each do |influence| \n\t\t\tif influence.date < min\n\t\t\t\tmin = influence.date\n\t\t\tend\n\t\t\tif influence.date > max\n\t\t\t\tmax = influence.date\n\t\t\tend\n\t\tend\n\t\thours = ((max - min)/3600)/3\n\n\t\tmedia = min + hours.hour\n\n\t\tdates = []\n\n\t\tdates << min \n\t\tdates << media\n\t\tdates << max\n\n\t\tdates\n\tend", "def last_trade_date\n quote.last_trade_date\n end", "def get_historical_quotes(from, to)\n \tstocks = Stock.find(:all)\n \tfor stock in stocks\n \t\t\n market = (sec.market == 'sh' ? 'ss' : sec.market) \n sid = (sec.market == 'hk' ? sec.sid.slice(1,4) : sec.sid)\n \t\t\t\n \t\tYahooFinance::get_HistoricalQuotes( \"#{sid}.#{market}\", \n Date.parse(from),\n Date.parse(to) ) {|hq|\n \t\t\tquote = Quote.new\n \t\t\tquote.security = stock\n \t\t\tquote.sid = stock.sid\n \t\t\tquote.market = stock.market\n \t\t\tquote.name = stock.name\n quote.result_date = hq.date\n \t\t\tquote.open = hq.open\n \t\t\tquote.high = hq.high\n \t\t\tquote.low = hq.low\n \t\t\tquote.close = hq.close\n \t\t\tquote.adjClose = hq.adjClose\n \t\t\tquote.vol = hq.volume\n \t\t\tquote.save!\n \t\t}\n\t end\n end", "def date_of_application?(d)\n d[:date_applied] >= 15.days.ago.to_date\n #RIDICULOUSE BRAIN WARPING ONE! AHH!!!\n #what I'm really asking is April 24th less than April 15th on a plotted line from left to right? Nope! \n\nend", "def stock_picker(data)\n #setup\n buy_day = 0\n sell_day = 0\n #algorithm\n for i in 0...data.length\n for j in (i+1)...data.length\n if (data[j]-data[i]) > (sell_day-buy_day)\n buy_day = i\n sell_day = j\n end\n end\n end\n #return\n [buy_day,sell_day]\nend", "def out_of_date\n last_order_detail = self.order_details.order(\"created_at DESC\").first\n last_priced = self.product_prices.order(\"created_at DESC\").first\n\n if last_order_detail.nil?\n last_date = self.updated_at\n else\n last_date = last_order_detail.updated_at\n end\n\n if last_priced.present?\n if last_date < last_priced.created_at\n last_date = last_priced.created_at\n end\n end\n\n return (self.stock <= 0 and last_date < Time.now - 6.months)\n end", "def index\n from = DateTime.now - 7.days\n @wallet_histories = WalletHistory.where(\"? <= trade_time\",from).order(\"trade_time desc\")\n end", "def getData(ticker, extraPoints)\n # This method should return false if the ticker symbol is invalid. In this sample\n # code, as we are using a random number generator for the data, all ticker symbol\n # is allowed, but we still assumed an empty symbol is invalid.\n if ticker == \"\"\n return false\n end\n\n # In this demo, we can get 15 min, daily, weekly or monthly data depending on the\n # time range.\n # @resolution = 86400\n # if durationInDays <= 10\n # # 10 days or less, we assume 15 minute data points are available\n # @resolution = 900\n# \n # # We need to adjust the startDate backwards for the extraPoints. We assume 6.5\n # # hours trading time per day, and 5 trading days per week.\n # dataPointsPerDay = 6.5 * 3600 / @resolution\n # adjustedStartDate = startDate - startDate % 86400 - (\n # extraPoints / dataPointsPerDay * 7 / 5 + 0.9999999\n # ).to_i * 86400 - 2 * 86400\n# \n # # Get the required 15 min data\n # get15MinData(ticker, adjustedStartDate, endDate)\n# \n # elsif durationInDays >= 4.5 * 360\n # # 4 years or more - use monthly data points.\n # @resolution = 30 * 86400\n# \n # # Adjust startDate backwards to cater for extraPoints\n # yMD = ChartDirector::getChartYMD(startDate)\n # currentMonth = (yMD / 100).to_i % 100 - extraPoints\n # currentYear = (yMD / 10000).to_i\n # while currentMonth < 1\n # currentYear = currentYear - 1\n # currentMonth = currentMonth + 12\n # end\n # adjustedStartDate = ChartDirector::chartTime(currentYear, currentMonth, 1)\n# \n # # Get the required monthly data\n # getMonthlyData(ticker, adjustedStartDate, endDate)\n# \n # elsif durationInDays >= 1.5 * 360\n # # 1 year or more - use weekly points.\n # @resolution = 7 * 86400\n# \n # # Adjust startDate backwards to cater for extraPoints\n # adjustedStartDate = startDate - extraPoints * 7 * 86400 - 6 * 86400\n# \n # # Get the required weekly data\n # getWeeklyData(ticker, adjustedStartDate, endDate)\n# \n # else\n # # Default - use daily points\n # @resolution = 86400\n# \n # # Adjust startDate backwards to cater for extraPoints. We multiply the days by\n # # 7/5 as we assume 1 week has 5 trading days.\n # adjustedStartDate = startDate - startDate % 86400 - ((extraPoints * 7 + 4) / 5\n # ).to_i * 86400 - 2 * 86400\n# \n # # Get the required daily data\n # getDailyData(ticker, adjustedStartDate, endDate)\n # end\n \n stock_details = Stock.find_by_stock_name(ticker).stocks_details\n @timeStamps = stock_details.collect(&:date)[-250..-1]\n @timeStamps.map! do |e| \n e = e.to_time\n e = ChartDirector::chartTime2(e.to_i) \n end\n @highData = stock_details.collect(&:high)[-250..-1]\n @lowData = stock_details.collect(&:low)[-250..-1]\n @openData = stock_details.collect(&:open)[-250..-1]\n @closeData = stock_details.collect(&:close)[-250..-1]\n @volData = stock_details.collect(&:volume)[-250..-1]\n #debugger\n \n return true\n end", "def days_until_xmas(date = Date.today)\n xmas_day = Date.new(date.year, 12, 25)\n if xmas_day < date\n xmas_day = xmas_day.next_year\n end\n (xmas_day - date).to_i\nend", "def stock_picker(arr)\n final_profit = 0\n current_profit = 0\n final_dates = []\n\n arr.each do |buy_price|\n buy_date = arr.index(buy_price)\n \n arr.each do |sell_price| \n sell_date = arr.index(sell_price)\n \n if (sell_date > buy_date && sell_price > buy_price) \n current_profit = sell_price - buy_price\n if current_profit > final_profit\n final_profit = current_profit\n final_dates = [buy_date, sell_date]\n end\n end \n end\n end\n puts final_dates\nend", "def adjusted_sell_by(supplier_code, product_code, delivery_date)\n date = Date.parse(delivery_date) + get_sell_by(product_code)\n return date - 3 if @trouble_suppliers.include? supplier_code.to_i\n date\nend", "def index_data(symbol, start_date, end_date)\n @all_dates = dates(start_date, end_date)\n json = quan(symbol,start_date,end_date)\n @dates = date_array(json)\n value = value_array(json)\n @missing_dates = compare_json_dates_range_dates(@dates, @all_dates)\n create_value(@missing_dates, value)\n @final = @all_dates.zip(value)\n return @final\n end", "def before date\n @before = date\n end", "def getMiniWater\n #Water\n \n oldDate = nil\n if ( ! @water.nil? && @water.size > 0) then\n \n if ( @chartoptions[:water][0])\n \n @set1 = ChartItem.new(\"Ounces Water\") \n\n for water in @water\n if oldDate.nil?\n daily_water_sum = water.ounces\n oldDate = water.date.to_date\n @set1.addPoint(water.date.to_time.to_i * 1000, daily_water_sum)\n elsif oldDate != water.date.to_date\n @set1.addPoint(water.date.to_time.to_i * 1000, daily_water_sum)\n daily_water_sum = water.ounces\n oldDate = water.date.to_date\n else #must be same date as previous record (records should be ordered)\n daily_water_sum += water.ounces\n @set1.addPoint(water.date.to_time.to_i * 1000, daily_water_sum)\n end\n end \n \n #Make last post to chart\n if oldDate != @water.last.date.to_date then\n daily_water_sum += water.ounces\n @set1.addPoint(water.date.to_time.to_i * 1000, daily_water_sum)\n end\n \n \n if @chartoptions[:water][0]\n @miniWater.add(@set1)\n end \n end \n \n end\nend", "def initialize(ticker, from_date, to_date)\n @from_date = from_date\n @to_date = to_date\n # @raw_data = YahooFinance::get_historical_quotes(ticker, @from_date-Extra_Days, to_date).reverse\n quote = get_quote(ticker)\n @raw_data = transpose_reverse(quote)\n convert_raw_data_strings!\n # We will never have need of the extraneous dates so we trim here\n @dates = trim_dates\n end", "def trending_up(date)\n self.sickness_quotient(date).round(2) > self.sickness_quotient(date-1).round(2)\n end", "def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end", "def quality_driven_software_export\n @from = Time.zone.now - 1.week\n @to = Time.zone.now\n end", "def generate_sell_signal(processed_data,back_day,sell_policy_class,date)\n \n sell_signal=true\n price_hash=processed_data[0]\n macd_hash=processed_data[1]\n low_price_hash=processed_data[2]\n high_price_hash=processed_data[3]\n volume_hash=processed_data[4]\n\n full_price_array=price_hash.to_a\n\n date=full_price_array[back_day][0]\n #puts \"first date=#{date},index=#{index}\"\n price_array=full_price_array[back_day][1]\n\n macd_array=macd_hash[date]\n low_price_array=low_price_hash[date]\n high_price_array=high_price_hash[date]\n volume_array=volume_hash[date]\n #puts \"last price =#{price_array[27]}\"\n last_date=full_price_array[back_day+1][0]\n last_price=full_price_array[back_day+1][1]\n last_macd_array=macd_hash[last_date]\n last_low_price_array=low_price_hash[last_date]\n last_high_price_array=high_price_hash[last_date]\n last_volume_array=volume_hash[last_date]\n\n price_signal = generate_price_buy_signal(price_array,sell_policy_class)\n macd_signal = generate_macd_buy_signal(macd_array,sell_policy_class,date)\n last_macd_signal = generate_last_macd_buy_signal(last_macd_array,sell_policy_class,date)\n low_price_signal = generate_low_price_buy_signal(low_price_array,price_array,sell_policy_class)\n high_price_signal = generate_high_price_buy_signal(high_price_array,price_array,sell_policy_class)\n volume_signal = generate_volume_buy_signal(volume_array,sell_policy_class)\n \n sell_signal=price_signal && macd_signal && last_macd_signal && low_price_signal && high_price_signal && volume_signal\n \n return sell_signal\nend", "def free_storage_valid_thru_date\n sale_date =\n if self.auction_datum.present? && self.auction_datum.auction_date.present?\n self.yard.utc_sale_date_with_time_for_date(self.auction_datum.auction_date)\n elsif self.sale_confirmed_date.present?\n self.sale_confirmed_date\n else\n DateTime.now\n end\n # No bid history at all may be a data issue,\n # but as far as we're concerned here, it's \n # 3 business days.\n if self.bid_histories.empty?\n self.three_business_days_later_inclusive(sale_date)\n # Kiosk winners get 3 days\n elsif self.high_bid_is_kiosk?\n self.three_business_days_later_inclusive(sale_date)\n # Next scenarios depend on bid type existing\n elsif self.bid_histories.first.bid_type.present?\n bid_type_code = self.bid_histories.first.bid_type.code\n # Live Auction winners / prelim-bid winners / \n # counter-bid (offline) / Buy Now winners / Sale Now \n # winners get 7 days (counting sale_date).\n if bid_type_code == BidType::AURORA_LIVE_BID_CODE || \n bid_type_code == BidType::AURORA_PRELIM_BID_CODE || \n bid_type_code == BidType::AURORA_BUY_NOW_CODE || \n bid_type_code == BidType::FIGS_SALE_NOW_CODE ||\n !self.current_buyer_also_high_bidder?\n sale_date + 6.days\n # Unknown code was received, per Karla they get 3\n # days. (todo: important enough to email us so we know?)\n elsif bid_type_code.present?\n logger.info(\"Unknown bid type received, code is: #{bid_type_code}\")\n self.three_business_days_later_inclusive(sale_date)\n # Code not present also gets the three (we should prevent\n # this scenario in the api, but you know, safety first)\n else\n logger.info(\"BidType.code not present on bid type of description: #{self.bid_histories.first.bid_type.description}\")\n self.three_business_days_later_inclusive(sale_date)\n end\n # All other scenarios get 3 business days\n # (so incomplete data scenarios will get 3 days).\n else\n self.three_business_days_later_inclusive(sale_date)\n end\n end", "def get_historic_stock_data(ticker, date_from, date_to, frequency = \"1d\")\n url = \"https://query1.finance.yahoo.com/v7/finance/download/#{ticker}?period1=#{date_from.strftime(\"%s\")}&period2=#{date_to.strftime(\"%s\")}&interval=#{frequency}&events=history\"\n\n request = Typhoeus::Request.new(url)\n request.run\n result = request.response.body\n\n result.split(\"\\n\").drop(1).map { |row| YahooDataPoint.new(row) }\n end", "def cutoff_date\n case date.wday\n when 0\n date + (weeks.to_i * 7)\n when 1\n date + (weeks.to_i * 7) - 1\n when 2\n date + (weeks.to_i * 7) - 2\n when 3\n date + (weeks.to_i * 7) - 3\n when 4\n date + (weeks.to_i * 7) - 4\n when 5\n date + (weeks.to_i * 7) - 5\n when 6\n date + (weeks.to_i * 7) + 1\n end\n end", "def vix_futures_settlement_date(year, month)\n subsequent_month, year_of_subsequent_month = *next_month(month, year)\n third_friday_of_subsequent_month = nth_weekday_of_month(3, DayOfWeek::Friday, subsequent_month, year_of_subsequent_month)\n if cboe_holiday?(third_friday_of_subsequent_month)\n prior_cboe_business_day(third_friday_of_subsequent_month) - 30\n else\n third_friday_of_subsequent_month - 30\n end\nend", "def generate_buy_signal(processed_data,back_day,buy_policy_class,date)\n \n #puts \"hihihi\"\n buy_signal=true\n price_hash=processed_data[0]\n macd_hash=processed_data[1]\n low_price_hash=processed_data[2]\n high_price_hash=processed_data[3]\n volume_hash=processed_data[4]\n\n full_price_array=price_hash.to_a\n\n date=full_price_array[back_day][0]\n #puts \"first date=#{date},index=#{index}\"\n price_array=full_price_array[back_day][1]\n\n macd_array=macd_hash[date]\n low_price_array=low_price_hash[date]\n high_price_array=high_price_hash[date]\n volume_array=volume_hash[date]\n #puts \"last price =#{price_array[27]}\"\n # 需要加1, 而不是减1\n last_date=full_price_array[back_day+1][0]\n last_price=full_price_array[back_day+1][1]\n # puts \"last date=#{last_date}\" if date==\"2013-05-06\"\n last_macd_array=macd_hash[last_date]\n last_low_price_array=low_price_hash[last_date]\n last_high_price_array=high_price_hash[last_date]\n last_volume_array=volume_hash[last_date]\n\n price_signal = generate_price_buy_signal(price_array,buy_policy_class)\n macd_signal = generate_macd_buy_signal(macd_array,buy_policy_class,date)\n last_macd_signal = generate_last_macd_buy_signal(last_macd_array,buy_policy_class,last_date)\n low_price_signal = generate_low_price_buy_signal(low_price_array,price_array,buy_policy_class)\n high_price_signal = generate_high_price_buy_signal(high_price_array,price_array,buy_policy_class)\n volume_signal = generate_volume_buy_signal(volume_array,buy_policy_class)\n \n \n buy_signal=(price_signal && macd_signal && last_macd_signal && low_price_signal && high_price_signal && volume_signal)\n # puts \"macd_singal=#{macd_signal},last_macd_signal=#{last_macd_signal},buy_signal=#{buy_signal} \" if buy_signal==true\n puts \"buy on #{date}\" if buy_signal==true\n return buy_signal\nend", "def trend_points_for_creation_date(obj)\n if obj.created_at > 1.day.ago then 50\n elsif obj.created_at > 1.week.ago then 25\n elsif obj.created_at > 2.weeks.ago then 10\n elsif obj.created_at > 3.weeks.ago then 3\n else 0\n end\nend", "def front_date (list)\n @listDate = []\n tmplist=list.find_all { |e| e and e.dateFinal }\n list=tmplist.uniq.sort_by { |obj| obj.dateFinal }\n if !list.empty?\n @firstDate = list.first.dateFinal\n list.each do |element|\n if @firstDate > element.dateFinal\n @firstDate = element.dateFinal\n end\n end\n\n dateBefore = list.first.dateFinal\n @listDate.push(dateBefore)\n list.each do |commande|\n if commande.dateFinal != dateBefore\n @listDate.each do |tmpdate|\n if commande.dateFinal == tmpdate\n break\n end\n end\n dateBefore=commande.dateFinal\n @listDate.push(commande.dateFinal)\n end\n end\n end\n end", "def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n self.spent_from = date\n self.spent_to = self.spent_from.advance(:hours=>hours) if self.spent_from && hours\n end", "def surrounding_vix_futures_expirations(date=Date.today)\n previous_exp = next_exp = nil\n File.open(vix_futures_expirations_file) do |f|\n while line = f.readline()\n next_exp, symbol = process_line(line)\n if date <= next_exp\n break\n else\n previous_exp = next_exp\n end\n end\n end\n [previous_exp, next_exp]\n end", "def dates_requiring_data\n collected = Dir.glob(File.join(@config[:data_dir], \"*-*-*.{csv,espi}\")).map { |f| File.basename(f).split(\".\")[0] }\n all_days = []\n\n count_of_days = (Date.today - @config[:start_date]).to_i\n\n count_of_days.times do |i|\n all_days << (@config[:start_date] + i).strftime(\"%Y-%m-%d\")\n end\n\n (all_days - collected).map { |d| Date.parse(d) }\n end", "def forecast_charged(date_from, date_to)\n query = <<-QUERY\n select sum(o.total_pending) as total, DATE_FORMAT(oi.date, '%Y-%m') as period \n from orderds_orders o\n join orderds_order_items oi on oi.order_id = o.id\n WHERE oi.date >= '#{date_from}' and \n oi.date < '#{date_to}' and\n o.status NOT IN (1,3)\n group by period\n QUERY\n @repository.adapter.select(query)\n end", "def get_graph_data\n #check for the amount of data the function needs to return, defualt = 3\n @date_scalar = params.has_key?(:num_months) ? params[:num_months] : 3\n #string -> int\n @date_scalar = @date_scalar.to_i\n #make a float copy\n @date_scalar_float = @date_scalar.to_f\n\n #instantiate YQuotes client to get historical data\n yahoo_client = YQuotes::Client.new\n #retrieve the data\n @graph_data = yahoo_client.get_quote(\n @stock.ticker_symbol, { \n #get one data point for each day\n period: 'd', \n #calculate the first date needed based on the amount of data requested\n #24*60*60*365 converts the fractions of a year into seconds\n start_date: (Time.now - (24*60*60*365*(@date_scalar_float/12))).strftime(\"%Y-%m-%d\"), \n #current date\n end_date: Time.now.strftime(\"%Y-%m-%d\")\n })\n\n @low = @graph_data.adj_close.min\n @max = @graph_data.adj_close.max\n #used to see if more data is requested than exists\n #i.e. request 12 months of data for a 3-month old stock \n @overflow = false;\n #figure out how many data points were returned\n @array_size = @graph_data.index.max+1\n @i = 0\n #the number of points that will be displayed on the graph\n num_points = @array_size/150\n start_time = Time.now\n #initialize empty array\n @array_data = Array.new\n #checks for overflow, first case: no overflow \n if (@array_size > (251*(@date_scalar_float/12))-2)\n (@array_size).times do\n if !(num_points == 0)\n #decide whether or not to add it to data set based on number of points desired\n if @i % num_points == 0\n #add to data set that will be used to make graph\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n #always add the first point\n else\n #add to data set that will be used to make graph\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n @i += 1\n end\n #overflow\n else\n (@array_size).times do\n if !(num_points == 0)\n if @i % num_points == 0\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n else\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n \n @i += 1\n \n end\n #used to display warning\n @overflow = true\n @array_data.push(@overflow)\n end\n\n #convert to a json string for easy parsing in javascript function\n @json_string = @array_data.to_json \n respond_to do |format|\n #for AJAX call to dynamically update graph\n format.json { render json: @array_data, status: :ok }\n format.html { @json_string }\n end\n end", "def get_price_on(date)\n \turl = \"https://s3-us-west-2.amazonaws.com/bloombergrisk/historical_data/SP500/\" + self.symbol + \"+US+Equity_data.txt\"\n \tf = open(url).read().split(\"\\n\")\n\n \ti = 0\n \tf.each do |line|\n \t\tdata_date = line.split(\",\")[0]\n \t\tprice = line.split(\",\")[1].strip.to_f\n\n \t\tif date == data_date\n \t\t\treturn price\n \t\tend\n\n \t\t# If we have already passed the date\n \t\tif Metric.date_gt(data_date, date)\n \t\t\tbreak\n \t\tend\n\n \t\ti += 1\n \tend\n\n \t# Get the closest price\n \tclosest = f[i]\n \treturn closest.split(\",\")[1].strip.to_f\n end", "def get_supplier_payments0(fecha1,fecha2)\n @vouchers = SupplierPayment.where([\" company_id = ? AND fecha1 >= ? and fecha1<= ? \", self.id, \"#{fecha1} 00:00:00\",\"#{fecha2} 23:59:59\" ]).order(:id)\n return @vouchers \nend", "def get_supplier_payments0(fecha1,fecha2)\n @vouchers = SupplierPayment.where([\" company_id = ? AND fecha1 >= ? and fecha1<= ? \", self.id, \"#{fecha1} 00:00:00\",\"#{fecha2} 23:59:59\" ]).order(:id)\n return @vouchers \nend", "def get_supplier_payments0(fecha1,fecha2)\n @vouchers = SupplierPayment.where([\" company_id = ? AND fecha1 >= ? and fecha1<= ? \", self.id, \"#{fecha1} 00:00:00\",\"#{fecha2} 23:59:59\" ]).order(:id)\n return @vouchers \nend", "def prevQuarter( date )\n m = date.month;\n y = date.year;\n m -= 3;\n if( m < 1 ) then\n m += 12;\n y -= 1;\n end;\n return Date.new( y, m, 1 );\nend", "def get_response( date )\r\n date_range = [parse_date( date ), parse_date( date.next_month )]\r\n puts \"Getting records modified from #{date_range.join(' to ')} ...\"\r\n \r\n response = ERP::ERPAgent.post(\r\n :url => AppConfig.SOAP_CU_SERV,\r\n :body => ERP::Customer.generate_xml( \"find_entity_key_list_customers\", :operator => \"Range\", :value1 => date_range.first, :value2 => date_range.last )\r\n )\r\nend", "def yesterday_pomodoros\n storage.find_all_day_before(Pomodoro, Time.now)\n end", "def fetch_history(days)\n raw = YahooFinance::get_historical_quotes_days(self.stock_id, days)\n raw.each do |r|\n rd = Rawdatum.find_or_create_by_stock_map_id_and_record_date(self.id, r[0])\n rd.open_price = r[1]\n rd.high_price = r[2]\n rd.low_price = r[3]\n rd.close_price = r[4]\n rd.volume = r[5]\n rd.adjusted_close_price = r[6]\n rd.save\n end\n end", "def transactions_since(start_date = Account.last_month)\n transactions_between(start_date, Date.today)\n end", "def fix_dates( data )\n\n ## check for missing / no dates \n ## examples\n ## - rubytogether feed @ https://rubytogether.org/news.xml\n data.items.each do |item|\n if item.updated.nil? &&\n item.published.nil?\n ## try to get date from slug in url\n ## e.g. /news/2019-10-17-growing-ruby-together\n if (m=FIX_DATE_SLUG_RE.match( item.url ))\n ## todo/fix: make sure DateTime gets utc (no timezone/offset +000)\n published = DateTime.new( m[:year].to_i(10),\n m[:month].to_i(10),\n m[:day].to_i(10) )\n item.published_local = published\n item.published = published\n end\n end\n end\n\n \n ## check if all updated dates are the same (uniq count is 1)\n ## AND if all published dates are present\n ## than assume \"fake\" updated dates and nullify updated dates\n ## example real-world \"messed-up\" feeds include:\n ## - https://bundler.io/blog/feed.xml\n ## - https://dry-rb.org/feed.xml\n ##\n ## todo/check - limit to atom feed format only - why? why not?\n\n count = data.items.size\n count_published = data.items.reduce( 0 ) {|count,item| count += 1 if item.published; count }\n\n if count == count_published\n uniq_count_updated = 0\n last_updated = nil\n\n data.items.each do |item|\n uniq_count_updated += 1 if item.updated != last_updated\n last_updated = item.updated\n end\n\n if uniq_count_updated == 1\n puts \"bingo!! nullify all updated dates\"\n ## todo/fix: log report updated date fix!!!!\n data.items.each do |item|\n item.updated = nil\n item.updated_local = nil\n end\n end\n end\n end", "def days_until_xmas(date)\n return 0\nend", "def check_reorder_date\n if reorder_on <= Date.today\n reorder_on = Date.tomorrow\n save\n end\n end", "def trade; end", "def stock_historical_data(ticker)\n ############################################################################\n # Yahoo Finance historical quotes has been deprecated\n # YahooFinance::Client.new.historical_quotes(ticker, { start_date: Date.today - days, end_date: Date.today })\n ############################################################################\n i = 0\n history = { date: [], price: [] }\n\n url = \"https://finance.yahoo.com/quote/\" + ticker + \"/history?\"\n doc = Nokogiri::HTML(open(url))\n data = doc.at('table[data-test=\"historical-prices\"]')\n\n while i < data.children[1].children.length do\n check = data.children[1].children[i].text\n\n if (!check.include?('Dividend') && !check.include?('Split'))\n \thistory[:date] << data.children[1].children[i].children[0].text\n \thistory[:price] << data.children[1].children[i].children[5].text.to_f\n end\n\n i+=1\n end\n history\n end", "def weighIntrade()\n\n end", "def on_sale\n all.select {|event| (event.starts..event.ends) === (@date_for_test || Date.today)}\n end", "def check_dates\n if(self.d_publish.nil?) && (self.d_remove.nil?)\n self.d_remove = \"2094-03-25\"\n self.d_publish = Time.zone.today\n elsif(self.d_publish?)\n self.d_remove = \"2094-03-25\"\n elsif(self.d_remove?)\n self.d_publish = Time.zone.today\n end\n end", "def trade(ticker, day)\n # this day's price\n price = @account.broker.exchange.quote(ticker, day)\n\n# if @last_purchase.key? ticker # If we've purchased this stock before, we continue with Dr. Rushton's trading rule.\n if @account.portfolio[ticker] == 0 # try to buy the given ticker\n last_hold_time = if @last_purchase[ticker][:buy_day] && @last_purchase[ticker][:sell_day]\n @last_purchase[ticker][:buy_day] - @last_purchase[ticker][:sell_day]\n else\n 0\n end\n \n # Wait for a time interval equal to gamma * HT to pass (cool-down period) OR Price < P to buy more\n if(!@last_purchase.key?(ticker) || \n price < @last_purchase[ticker][:price] || \n @last_purchase[ticker][:sell_day] - day >= @gamma * last_hold_time)\n s = @account.buy_amap(ticker, day, @amount_per_company)\n @last_purchase[ticker] = {price: price, buy_day: day}\n puts \"bought #{s} shares of #{ticker} on #{@account.broker.exchange.eod(ticker, day).date}\" if $DEBUG\n end\n else # try to sell our holdings of the given ticker\n # compute t, the return multiplier, given the interval between now and last purchase of the given stock (ticker)\n t = @fn_t.call(@last_purchase[ticker][:buy_day] - day)\n\n # compute alpha, given the value t, to determine the percentage gain multiplier\n alpha = @fn_alpha.call(t)\n\n puts \"t = #{t}\", \"alpha = #{alpha}\" if $DEBUG\n\n puts \"price of #{ticker} on #{@account.broker.exchange.eod(ticker, day).date} is #{price}\" if $DEBUG\n\n if(price > (1.0 + alpha) * @last_purchase[ticker][:price])\n s = @account.sell_all(ticker, day)\n @last_purchase[ticker][:sell_day] = day\n puts \"sold #{s} shares of #{ticker} on #{@account.broker.exchange.eod(ticker, day).date}\" if $DEBUG\n end\n end\n# else # We use SMA to make our initial purchase of each stock\n# # compute average over number of days\n# avg = average_price(ticker, day)\n\n # if price > avg -> price - avg = positive\n # price < avg -> price - avg = negative\n # price = avg -> price - avg = 0\n# @price_relation_to_average[\"#{ticker}#{day}\"] = price - avg\n\n # decide whether the price has just upcrossed or downcrossed the MA line\n# if(price > avg && @price_relation_to_average[\"#{ticker}#{day + 1}\"] < 0) # upcross - BUY as much as possible\n# s = @account.buy_amap(ticker, day, @amount_per_company)\n# @last_purchase[ticker] = {price: price, buy_day: day}\n# puts \"bought #{s} shares of #{ticker} on #{@account.broker.exchange.eod(ticker, day).date}\" if $DEBUG\n# end\n# end\n \n puts \"account: #{@account.to_s(day)}\" if $DEBUG\n end", "def processField008(field)\n return nil if field.nil?\n field = field.value[6..15]\n if field[0] == \"p\" or field[0] == \"r\"\n \n first_date = field[1..4]\n second_date = field[5..9]\n start_date = first_date.gsub(\"u\", \"9\").to_i\n end_date = second_date.gsub(\"u\", \"9\").to_i\n \n if ( start_date > end_date && !second_date.include?(\"u\") )\n # if the secondDate is lower and there was not a \"u\" in the date field.\n return MARC::DataField.new('980', '', ' ', ['a', end_date], ['b', \"008\"], ['c', field[0] ])\n elsif ( start_date > end_date && second_date.include?(\"u\") ) \n # if the 2nd date is lower and there was a 'u', this means we need to add a date range.\n start_date = end_date - 9\n return MARC::DataField.new('980', '', ' ', ['a', \"#{start_date}-#{end_date}\"], ['b', \"008\"], ['c', field[0] ])\n elsif ( first_date.include?(\"u\") )\n # first date is larger, but there's a 'u' so, it needs a range. \n end_date = start_date - 9\n return MARC::DataField.new('980', '', ' ', ['a', \"#{start_date}-#{end_date}\"], ['b', \"008\"], ['c', field[0] ])\n else\n # at this point, we assume first date was larger and no 'u' so we just add the first date\n return MARC::DataField.new('980', '', ' ', ['a', start_date], ['b', \"008\"], ['c', field[0] ])\n end\n\n end\n end", "def getLeasesByDate(date)\n leases = getLeases()\n today_leases = []\n if leases.length !=0\n leases.each do |lease|\n if lease[\"status\"] == \"accepted\"\n #puts \"Gia na assssssssssssss\"\n #puts lease[\"valid_from\"].split('T')[0]\n #puts date\n #puts lease[\"valid_until\"].split('T')[0]\n if lease[\"valid_from\"].split(' ')[0] <= date && lease[\"valid_until\"].split(' ')[0]>=date\n #puts \"mpika\"\n today_leases << lease\n end\n end\n end\n end\n\n return today_leases\n end", "def set_param_date\n # sets datas based on params or last transaction\n # if params include a date from/to converted to beginning and end of month\n # if only front will set from and to (or today of to missing)\n # if parmans not present will get last transaction and set from to beginning of its month\n # if from is in current month, may look back 7 days from from date\n @today = Date.today\n minus7 = @today.day < 8 ? 8 - @today.day : 0 # if in first week of month, look back 7 days\n if params[:date].present? # from month pulldown\n @date = Ledger.set_date(params[:date])\n @from = @date.beginning_of_month\n @to = @date.end_of_month\n elsif params[:from].present? # from date picker(from,to)\n @from = Ledger.set_date(params[:from])\n @to = params[:to].present? ? Ledger.set_date(params[:to]) : @today.end_of_month\n else\n last_tran = @account.last_entry_date ||= @today.beginning_of_year\n @from = last_tran.beginning_of_month\n @from -= minus7 if Ledger.dates_in_same_month(@today,@from)\n @to = @today.end_of_month\n end\n end", "def parse_chart_data(dates, prices)\n dates.zip(prices).to_h\n end", "def service_date_reference\n svc_date_segments = []\n from_date = @service.date_of_service_from.strftime(\"%Y%m%d\") unless @service.date_of_service_from.blank?\n to_date = @service.date_of_service_to.strftime(\"%Y%m%d\") unless @service.date_of_service_to.blank?\n from_eqls_to_date = (from_date == to_date)\n is_client_upmc = (@client_name == \"UNIVERSITY OF PITTSBURGH MEDICAL CENTER\")\n if from_date && (!to_date || from_eqls_to_date || @client.group_code.to_s.strip == 'KOD')\n if(@client_name == \"ISTREAMS\" && from_date == \"20000101\")\n svc_date_segments = dtm_472(\"00000000\")\n elsif !(is_client_upmc && from_date == \"20000112\")\n svc_date_segments = dtm_472(from_date) if can_print_service_date(from_date)\n end\n else\n svc_date_segments << dtm_150(from_date) if can_print_service_date(from_date)\n svc_date_segments << dtm_151(to_date) if can_print_service_date(to_date)\n svc_date_segments unless svc_date_segments.join.blank?\n end\n end", "def date_in_range?(date = @date, new_rates = @all_rates)\n # ECB feed rates for the day are not updated until ~4pm CET.\n # In the case where we want the rates for today, but we still have\n # yesterday's feed, we need to step the query date back by a day\n if date == Date.today\n if new_rates.first[:date] != date\n date = date - 1\n end\n end\n\n # ECB feed only contains 3 months of data, so we need to check\n # to see whether the supplied date falls into that range.\n # If it doesn't, we throw an exception and bail\n oldest_date = (Date.today << 3)\n\n return date if date >= oldest_date\n\n raise Exception, 'Invalid date - must be within last 3 months'\n end", "def old_weather_reports(today = Date.today)\n old_days = (4..18).collect {|i| today - i}.collect {|d| \"#{d.year}#{d.month.to_s.rjust(2,'0')}#{d.day.to_s.rjust(2,'0')}\"}\n weather_reports.where(:date => old_days)\n end", "def has_future_exchange_dates\n now = Time.now.utc.to_i\n self.exchange_dates.each do |availability_date|\n if availability_date.latest_date.to_i > now\n return true\n end\n end\n return false\n end", "def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil\n end", "def setup_transaction_dates_step\n @lbtt_return.effective_date = @lbtt_return.effective_date&.to_date\n @lbtt_return.relevant_date = @lbtt_return.relevant_date&.to_date\n @lbtt_return.contract_date = @lbtt_return.contract_date&.to_date\n convert_lease_transaction_date\n end", "def stock_picker(stocks)\n profit = 0\n\n for i in 0...stocks.length\n # ensures when looping through the prices, sell date comes after buy date\n for j in (i + 1)...stocks.length\n if (stocks[j] - stocks[i]) > profit\n profit = stocks[j] - stocks[i]\n buy_date = i\n sell_date = j\n end\n end\n end\n\n days = [buy_date, sell_date]\n p days\n p \"Total profit would be $#{profit}\"\nend", "def did_stock_perform date,company_id,price\n\t\tprofit_book_price = price - price * @profit_book_percentage\n\t\tstop_loss_price = price + price * @stop_loss_percentage\n\t\tprofit_book_quote = Quote.get_worst_performer_after_interval date,company_id,profit_book_price\n\t\tstop_loss_quote = Quote.get_best_performer_after_interval date,company_id,stop_loss_price\n\n\t\treturn find_performance_by_profit_quote_and_loss_quote(profit_book_quote,stop_loss_quote)\n \tend", "def extendbythirthydays\n update_at = update_at + 14.days.from_now\n end", "def days_before(number, date)\n current_date = date\n\n until number <= 0\n number -= 1 if active?(current_date.prev_day)\n current_date = current_date.prev_day\n end\n\n current_date\n rescue NoMethodError\n p 'provided data is not of valid type'\n nil\n end", "def assign_order_date\n @booked_quotes = Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Ordered\").where(wholesale_order_date: nil) + Quote.where(florist_id: session[\"found_florist_id\"]).where(status: \"Booked\").where(wholesale_order_date: nil)\n for booked_quote in @booked_quotes\n if params[\"place_order-#{booked_quote.id}\"]\n booked_quote.status = \"Ordered\"\n #booked_quote.wholesale_order_date = Date.civil(params[:place_order_on][\"element(1i)\"].to_i, params[:place_order_on][\"element(2i)\"].to_i, params[:place_order_on][\"element(3i)\"].to_i)\n booked_quote.wholesale_order_date = params[\"place_order_on\"]\n booked_quote.save!\n else\n end\n end\n redirect_to \"/wholesale_order_list/#{params[\"place_order_on\"]}\" and return\n end", "def spent_on=(date)\n super\n self.tyear = spent_on ? spent_on.year : nil\n self.tmonth = spent_on ? spent_on.month : nil\n self.tweek = spent_on ? spent_on.cweek : nil\n end", "def convert_to_est\n self.start_date += 18000\n self.end_date += 18000\n end", "def trade_updates(date)\n @update_date = date\n mail to: \"louis.fourrier@gmail.com\", subject: \"Mise à jour des trades sur le serveur !\"\n end", "def show\n @barcode = @product_stock_book.list_barcode\n @prod = ProductList.where(list_barcode: @product_stock_book.list_barcode).pluck(:extproductcode)\n @old_product_stocks = ProductStockBook.where(:list_barcode => @product_stock_book.list_barcode)\n .where(\"TRUNC(stock_date) < ?\", @product_stock_book.stock_date)\n if @old_product_stocks.present?\n\n @old_product_stock = @old_product_stocks.order(\"stock_date DESC\").first\n if (@old_product_stock.stock_date.month != 3 && @old_product_stock.stock_date.day != 31)\n @prev_closing_stock = @old_product_stock.closing_qty\n\n @prev_date = @old_product_stock.stock_date\n else\n @prev_closing_stock = 0\n @prev_date = \"Not Applicable\"\n end\n\n end\n\n end", "def include?(date)\n date >= start_date && date < self.next.date\n end", "def adjust_dates(date)\n first_date = planned.minimum(:actual_date)\n if first_date && first_date < date\n gap = date - first_date\n planned.each do |repetition|\n repetition.increment!(:actual_date, gap)\n end\n end \n end", "def event_tickets_sold_data(period_data = 'this_month')\n res = event_payments\n range, daily_report = period_data.to_s.report_period_to_range\n data = [[period_data.to_s.report_period_to_title, I18n.t('number.currency.format.unit')]]\n range.each{|d| data << [d.strftime(daily_report ? '%d' : '%Y-%m'), res.where(payment_at: d.beginning_of_day..(daily_report ? d.end_of_day : d.end_of_month.end_of_day)).sum(:amount).to_f] }\n data\n end", "def offset_date(ref_date, offset)\n return ref_date if offset.zero?\n trading_day_count = ((1.day / bars_per_day ) * offset) /1.day\n new_date = Timeseries.trading_date_from(ref_date, trading_day_count)\n return new_date if new_date.is_a? Date\n new_date = new_date.change(:hour => 6, :min => 30) unless new_date.zone.first == 'E' #Eastern Time\n new_date\n end", "def previous days_ago=0\n Inventory.where(product: product, store: store).where(\"lcbo_updated_on < ?\", (lcbo_updated_on - days_ago)).order(lcbo_updated_on: :desc).first\n end", "def get_quarterly\n # get last year earnings\n l_year = latest_eps.year\n\n # get which quarters are the last 4\n fp = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Fiscal Period\" }\n fp = fp.xpath('./td') if fp\n\n if fp.nil?\n puts \"--------------------------------------Cannot get info for #{ticker}\"\n return false\n end\n # Find last year by counting 'td's up to \"TMM\"\n years_available = 0 # Some stocks may not have 10 years worth of data\n for i in 1..fp.size\n if fp[i].nil? || !fp[i].text.match(\"TTM\").nil?\n break\n end\n years_available = i\n end\n\n puts \"Counted #{years_available} years of available data for #{ticker}\"\n\n update_year = 1 # Some stocks may not be updated for 2012 yet\n update_year = 0 if fp[years_available].text.last == \"2\"\n\n\n\n\n #Acces data page\n url = \"http://www.gurufocus.com/financials/#{ticker}\"\n doc = open_url_or_nil(url)\n if doc.nil?\n puts \"Could not get quarterly finantial data from gurufocus.com\"\n return false\n end\n\n # Get last 4 quarters quarterly data\n # Check first if all 4 quarters are available?\n (1..4).each do |i|\n if fp[i].nil? || !fp[i].text.match(\"TTM\").nil?\n break\n end\n years_available = i\n end\n\n puts \"Counted #{years_available} years of available data for #{ticker}\"\n\n update_year = 1 # Some stocks may not be updated for 2012 yet\n update_year = 0 if fp[years_available].text.last == \"2\"\n\n # A boolean to test if current asset values are available\n using_current_data = true\n\n # Scrape data from doc\n # Current Assets\n ca = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Current Assets\" }\n if ca\n ca = ca.xpath('./td')\n else\n using_current_data = false\n end\n\n ta = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Assets\" }\n ta = ta.xpath('./td') if ta\n\n cl = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Current Liabilities\" }\n if cl\n cl = cl.xpath('./td')\n else\n using_current_data = false\n end\n\n tl = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Liabilities\" }\n tl = tl.xpath('./td') if tl\n\n # Debt, book value, net tangible assets\n ltd = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Long-Term Debt\" }\n ltd = ltd.xpath('./td') if ltd\n\n bv = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Equity\" }\n bv = bv.xpath('./td') if bv\n\n ocs = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Other Current Assets\" }\n ocs = ocs.xpath('./td') if ocs\n\n # Create balance sheet for 10 years\n (1..years_available).each do |i|\n cas = \"\"\n cls = \"\"\n ntas = \"\"\n if using_current_data\n cas = (clean_string(ca[i].text).to_f.round * MILLION).to_s\n cls = (clean_string(cl[i].text).to_f.round * MILLION).to_s\n if ocs\n ntas = (( clean_string(ca[i].text).to_f - clean_string(ocs[i].text).to_f - clean_string(cl[i].text).to_f ).round * MILLION ).to_s\n else\n ntas = cas\n end\n end\n\n # Some trusts don't have liabilities\n tler = \"\"\n tler = (clean_string(tl[i].text).to_f.round * MILLION).to_s if tl\n der = \"\"\n der = (clean_string(ltd[i].text).to_f.round * MILLION).to_s if ltd\n bver = \"\"\n bver = (clean_string(bv[i].text).to_f.round * MILLION).to_s if bv\n bs = BalanceSheet.create(:stock_id => self.id,\n :year => YEAR - (years_available+1 - i) - update_year, #This reveses the year from i\n :current_assets => cas,\n :total_assets => (clean_string(ta[i].text).to_f.round * MILLION).to_s,\n :current_liabilities => cls,\n :total_liabilities => tler,\n :long_term_debt => der,\n :net_tangible_assets => ntas,\n :book_value => bver,\n :quarter => q)\n puts \"Got bs data for #{ticker}, year: #{bs.year}, ta = #{bs.total_assets}\" if !bs.id.nil?\n end\n\n update_attributes( :has_currant_ratio => using_current_data)\n\n end", "def future_expense_checker (record)\n\t\tdate = record.date_paid\n \ttime = date.to_time\n \ttime.future?\n end", "def future_expense_checker (record)\n\t\tdate = record.date_incurred\n \ttime = date.to_time\n \ttime.future?\n end", "def thirty \n now = Date.today\n end_date = Date.today + 30\n dates = (now...end_date).to_a\n create_log(dates) \n end", "def transactions_in_date_range(from_date, to_date, transaction_type = :all)\n validate_transaction_type transaction_type\n\n from_date = format_date from_date\n to_date = format_date to_date\n\n url = \"history/transactions/#{transaction_type.to_s.upcase}/#{from_date}/#{to_date}\"\n\n @dealing_platform.gather url, :transactions, AccountTransaction\n end", "def closing_stock_on_date(given_date, branch_id)\n opening_stock_on_date(given_date.tomorrow, branch_id)\n end", "def before?(inclusive, date, event)\n if (inclusive)\n event[:timestamp] <= date\n else\n event[:timestamp] < date\n end\nend", "def get_price_intersections history\n close_prices = history[\"historicals\"].map{|h| h[\"close_price\"].to_f}\n period_one = 50\n period_two = 200\n periods = [period_one, period_two].sort!\n shorter_sma = simple_moving_average(close_prices, periods.first)\n longer_sma = simple_moving_average(close_prices, periods.last)\n combined = longer_sma.reverse.map.with_index{|longer,i| {shorter_sma: shorter_sma[(i*-1)-1], longer_sma: longer}}\n combined.each_with_index do |data,i|\n data[:current_price] = history[\"historicals\"][(i*-1)-1][\"close_price\"].to_f\n data[:date] = history[\"historicals\"][(i*-1)-1][\"begins_at\"]\n end\n combined.reverse!\n prev_change = combined.first[:shorter_sma] / combined.first[:longer_sma] - 1\n combined.each_with_index do |data,i|\n next if i == 0\n change = data[:shorter_sma] / data[:longer_sma] - 1\n if prev_change.negative? && change.positive?\n # upward trend\n data[:action] = :buy\n end\n if prev_change.positive? && change.negative?\n # downward trend\n data[:action] = :sell\n end\n prev_change = change\n end\n raise combined.select{|data| data[:action].present?}.to_s\n end", "def get_price_intersections history\n close_prices = history[\"historicals\"].map{|h| h[\"close_price\"].to_f}\n period_one = 50\n period_two = 200\n periods = [period_one, period_two].sort!\n shorter_sma = simple_moving_average(close_prices, periods.first)\n longer_sma = simple_moving_average(close_prices, periods.last)\n combined = longer_sma.reverse.map.with_index{|longer,i| {shorter_sma: shorter_sma[(i*-1)-1], longer_sma: longer}}\n combined.each_with_index do |data,i|\n data[:current_price] = history[\"historicals\"][(i*-1)-1][\"close_price\"].to_f\n data[:date] = history[\"historicals\"][(i*-1)-1][\"begins_at\"]\n end\n combined.reverse!\n prev_change = combined.first[:shorter_sma] / combined.first[:longer_sma] - 1\n combined.each_with_index do |data,i|\n next if i == 0\n change = data[:shorter_sma] / data[:longer_sma] - 1\n if prev_change.negative? && change.positive?\n # upward trend\n data[:action] = :buy\n end\n if prev_change.positive? && change.negative?\n # downward trend\n data[:action] = :sell\n end\n prev_change = change\n end\n raise combined.select{|data| data[:action].present?}.to_s\n end", "def handle_date\n today = DateTime.now.beginning_of_day.to_date\n @max_end = today + 400.days\n @inv_start = today\n @master_rates_start = today\n @agoda_rates_start = today\n @expedia_rates_start = today\n @bookingcom_rates_start = today\n @gta_travel_rates_start = today\n @orbitz_rates_start = today\n @ctrip_rates_start = today\n\n begin\n # set the date in inventory table\n @inv_start = Date.strptime(params[:inv_start]) unless params[:inv_start].blank?\n @inv_start = today if @inv_start < today\n @inv_start = @max_end if @inv_start > @max_end\n\n # set the date in master rate table\n @master_rates_start = Date.strptime(params[:master_rates_start]) unless params[:master_rates_start].blank?\n @master_rates_start = today if @master_rates_start < today\n @master_rates_start = @max_end if @master_rates_start > @max_end\n\n # set the date in agoda rates table\n @agoda_rates_start = Date.strptime(params[:agoda_rates_start]) unless params[:agoda_rates_start].blank?\n @agoda_rates_start = today if @agoda_rates_start < today\n @agoda_rates_start = @max_end if @agoda_rates_start > @max_end\n\n # set the date in expedia rates table\n @expedia_rates_start = Date.strptime(params[:expedia_rates_start]) unless params[:expedia_rates_start].blank?\n @expedia_rates_start = today if @expedia_rates_start < today\n @expedia_rates_start = @max_end if @expedia_rates_start > @max_end\n\n # set the date in booking.com table\n @bookingcom_rates_start = Date.strptime(params[:bookingcom_rates_start]) unless params[:bookingcom_rates_start].blank?\n @bookingcom_rates_start = today if @bookingcom_rates_start < today\n @bookingcom_rates_start = @max_end if @bookingcom_rates_start > @max_end\n\n # set the date in gta travel\n @gta_travel_rates_start = Date.strptime(params[:gta_travel_rates_start]) unless params[:gta_travel_rates_start].blank?\n @gta_travel_rates_start = today if @gta_travel_rates_start < today\n @gta_travel_rates_start = @max_end if @gta_travel_rates_start > @max_end\n\n # set the date in orbitz\n @orbitz_rates_start = Date.strptime(params[:orbitz_rates_start]) unless params[:orbitz_rates_start].blank?\n @orbitz_rates_start = today if @orbitz_rates_start < today\n @orbitz_rates_start = @max_end if @orbitz_rates_start > @max_end\n\n # set the date in ctrip\n @ctrip_rates_start = Date.strptime(params[:ctrip_rates_start]) unless params[:ctrip_rates_start].blank?\n @ctrip_rates_start = today if @ctrip_rates_start < today\n @ctrip_rates_start = @max_end if @ctrip_rates_start > @max_end\n \n rescue => ex\n flash[:alert] = ex.message\n end\n end", "def range_check(date)\n if date < @start_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh menor que #{@start_date} -> #{@end_date}\"\n build(date - 2.days, @end_date, @holidays)\n elsif date > @end_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh maior que #{end_date}\"\n build(@start_date, date + 252.days, @holidays)\n end\n end", "def load_data!(date)\n if date.to_date == Date.today\n @euro ||= load_daily\n elsif !defined?(@euro) || @euro.size < 2\n @euro = load_ninty\n end\n end", "def revenue(date)\n end", "def service_date_reference\n service_date_elements, svc_date_segments = [], []\n from_date = service.date_of_service_from.strftime(\"%Y%m%d\") unless service.date_of_service_from.blank?\n to_date = service.date_of_service_to.strftime(\"%Y%m%d\") unless service.date_of_service_to.blank? \n if from_date\n service_date_elements << 'DTM'\n service_date_elements << '150'\n service_date_elements << from_date\n svc_date_segments << service_date_elements.join(@element_seperator)\n end\n if to_date\n service_date_elements = []\n service_date_elements << 'DTM'\n service_date_elements << '151'\n service_date_elements << to_date\n svc_date_segments << service_date_elements.join(@element_seperator)\n end\n svc_date_segments unless svc_date_segments.blank?\n end", "def x_axis_for(date)\n case @conditions[:breakdown_type]\n when \"Weekly\"\n \"Week of \" + date.to_s\n when \"Quarterly\"\n string = date.strftime(\"%Y-Q\")\n temp = date.strftime(\"%m\").to_i\n hash = {:t1 => [1,2,3], :t2 => [4,5,6], :t3 => [7,8,9], :t4 => [10,11,12]}\n hash.each{|k,v|\n string += k.to_s.sub(/t/, \"\") if v.include?(temp)\n }\n string\n when \"Daily\"\n date.to_s\n when \"Yearly\"\n date.year.to_s\n when \"Monthly\"\n date.strftime(\"%b %y\")\n when \"Day of week\"\n Date.strptime(date.to_s, \"%w\").strftime(\"%A\")\n when \"Hour\"\n DateTime.strptime(date.to_s, \"%H\").strftime(\"%I:00 %p\")\n else\n raise NoMethodError\n end\n end", "def stock_picker(prices)\n index = 0\n lowest = 0\n best_value = []\n for i in prices\n for j in prices[index..prices.length-1]\n if i - j < lowest\n lowest = i - j # lowest will be equal to the greatest price difference (greatest negative number)\n min = prices.index(i) # index of buy date\n max = prices.index(j) # index of sell date\n end\n end\n index += 1 # increments each iteration to ensure sell dates cannot be past dates\n end \n best_value << min\n best_value << max\n puts \"#{best_value} If you buy on day #{min} and sell on day #{max},\n you will make $#{lowest.abs} profit.\"\nend", "def isDataUpToDate?\n DailyNews.first.updated_at.to_s.slice(5..6).eql? Time.now.to_s.slice(8..9)\n end", "def portfolio_line_chart interval=\"5minute\", opts={span: \"day\"}\n get_portfolio_history get_accounts.first[\"account_number\"], interval, opts\n columns = [ {role: :none, data: ['number', 'X']} ] # add x axis\n\n # each stock has a value and a tooltip\n columns = columns + \n [\n {role: :none, data: ['number', \"Portfolio\"]},\n {role: :tooltip, data: {type: :string, role: :tooltip}}\n ]\n\n rows = []\n @portfolio_history[\"equity_historicals\"].each_with_index do |h,i|\n rows[i] ||= [i+1]\n price = (opts[:span] == \"day\" ? h[\"adjusted_open_equity\"] : h[\"adjusted_close_equity\"]).to_f\n date = h[\"begins_at\"].in_time_zone('EST').strftime '%m/%d/%y %l:%M%P'\n rows[i] = rows[i] + [price, \"$#{price} on #{date}\"]\n end\n \n previous_close_price = @portfolio_history[\"adjusted_previous_close_equity\"].to_f\n previous_close_price = @portfolio_history[\"equity_historicals\"].first[\"adjusted_open_equity\"].to_f if previous_close_price == 0.0\n most_recent_price = @portfolio_history[\"equity_historicals\"].last[\"adjusted_open_equity\"].to_f\n color = most_recent_price > previous_close_price ? ROBINHOOD_GREEN : ROBINHOOD_ORANGE\n options = {\n #title: \"Price chart\",\n hAxis: {\n #title: 'Date',\n ticks: 'none', #rows.map{ |r| r.first },\n gridlines: {color: \"transparent\"}\n },\n vAxis: {\n #title: 'Price',\n gridlines: {color: \"transparent\"}\n },\n focusTarget: :category, # show all tooltips for column on hover,\n #curveType: :function, # curve lines, comment out to disable\n legend: :none,\n chartArea: { width: '90%', height: '75%' },\n series: {\"0\": {color: color}},\n backgroundColor: \"#090d16\"\n }\n \n {columns: columns, rows: rows, options: options}\n end", "def recalculate_dates(date = nil)\n if self.standing_line_items.count > 0\n date ||= Date.current\n current = date.in_time_zone(self.vendor.time_zone)\n self.standing_order_schedules.where(\"deliver_at > ? and created_at is null\", current).update_all(visible: false)\n current_next = current\n mlt = max_lead_time\n\n start_next = self.start_at.in_time_zone(self.vendor.time_zone)\n # allow start_at to be the first date selected if lead_time is met based on current date\n if current_next + mlt.days > start_next\n start_next += mlt.days\n end\n\n if current_next > start_next\n self.calculate_next(current_next, self.vendor, self.max_lead_time)\n else\n self.calculate_next(start_next, self.vendor, self.max_lead_time)\n end\n end\n end", "def start_date_of_roll_period(year, month)\n # todo, to be truly accurate with respect to the description, this should figure out the date of the Tuesday prior to the settlement date, but I think subtracting one day is the real intention.\n vix_futures_settlement_date(year, month) - 1\n # prior_cboe_business_day(vix_futures_settlement_date(year, month))\nend", "def prepare_data(id, day_out, day_back, dose_out, dose_back)\r\n total_dose_in_lab = 0\r\n days_in_lab = Date.parse(day_back).mjd - Date.parse(day_out).mjd\r\n (0...days_in_lab).each do |step|\r\n day_dose = dose_out * Math.exp( step.to_f / days_in_lab * Math.log( dose_back / dose_out))\r\n total_dose_in_lab += day_dose\r\n end\r\n return [id, days_in_lab, total_dose_in_lab]\r\nend", "def generate_top_tracks(year)\n weeklycharts = lastfm.user.get_weekly_chart_list(\"pulleasy\")\n weeklycharts.each do |weekly_chart|\n charts = []\n if weekly_chart[\"from\"] > year.to_time.to_i && weekly_chart[\"to\"] < year.next_year.to_time.to_i\n charts << weekly_chart\n end\n end\nend", "def extention_valid_date\n if service_learning_risk_date_extention?\n if service_learning_risk_date > DateTime.new(service_learning_risk_date.year, 9, 1) \n DateTime.new(service_learning_risk_date.year.next, 9, 1)\n else \n DateTime.new(service_learning_risk_date.year, 9, 1)\n end\n end\n end", "def opening_stock_on_date(given_date, branch_id)\n quantity=0\n purchased_qty = purchase_line_items.joins(:purchase)\n .where(:purchases =>{:company_id => self.company_id, :status_id => [0,1,3], :branch_id => branch_id})\n .where(\"purchases.record_date < ?\", given_date)\n .sum(:quantity)\n\n received_qty = stock_receipt_line_items.joins(:stock_receipt_voucher)\n .where(:stock_receipt_vouchers =>{:company_id => self.company_id, :branch_id => branch_id})\n .where(\"stock_receipt_vouchers.voucher_date < ?\",given_date)\n .sum(:quantity)\n\n invoice_returns = invoice_return_line_items.\n select(\" sum(quantity * unit_rate) as total_stk_retrn_amount, sum(quantity) as total_stk_retrn_qty\").\n joins(:invoice_return).\n where(:invoice_returns => {:company_id=> self.company_id}).\n where(\"invoice_returns.record_date < ?\", given_date)\n total_stk_retrn_amount = invoice_returns[0].total_stk_retrn_amount.blank? ? 0 : invoice_returns[0].total_stk_retrn_amount\n invoice_retrn_qty = invoice_returns[0].total_stk_retrn_qty.blank? ? 0 : invoice_returns[0].total_stk_retrn_qty\n\n\n invoiced_qty = invoice_line_items.joins(:invoice)\n .where(:invoices =>{:company_id => self.company_id, :invoice_status_id => [0,2,3,4], :branch_id => branch_id})\n .where(\"invoices.invoice_date < ?\", given_date)\n .sum(:quantity)\n issued_qty = stock_issue_line_items.joins(:stock_issue_voucher)\n .where(:stock_issue_vouchers => {:company_id => self.company_id, :branch_id => branch_id})\n .where(\"stock_issue_vouchers.voucher_date < ?\",given_date)\n .sum(:quantity)\n\n wastage_qty = stock_wastage_line_items.joins(:stock_wastage_voucher)\n .where(:stock_wastage_vouchers => {:company_id => company_id})\n .where(\"stock_wastage_vouchers.voucher_date < ?\", given_date).sum(:quantity)\n\n purchase_retrn_qty = purchase_return_line_items.joins(:purchase_return)\n .where(:purchase_returns => {:company_id => company_id})\n .where(\"purchase_returns.record_date < ?\", given_date)\n .sum(:quantity)\n\n quantity = (get_opening_stock_quantity + purchased_qty + received_qty + invoice_retrn_qty)-(invoiced_qty + issued_qty + wastage_qty + purchase_retrn_qty)\n quantity\n end", "def stock_picker(prices)\n buy_date = 0\n sell_date = 0\n max_profit = 0\n \n (0...prices.size).each do |buy|\n ((buy + 1)...prices.size).each do |sell|\n \n profit = prices[sell] - prices[buy] \n if max_profit < profit\n max_profit = profit\n buy_date = buy\n sell_date = sell\n end\n end\n end\n [buy_date, sell_date]\nend" ]
[ "0.612637", "0.5765744", "0.57104886", "0.55969465", "0.5443216", "0.5436239", "0.5429118", "0.5402995", "0.5389769", "0.53847605", "0.53809094", "0.53223085", "0.5309074", "0.5289704", "0.52865505", "0.52699673", "0.526799", "0.52490634", "0.52456653", "0.52250874", "0.52250355", "0.5174498", "0.5168193", "0.5151454", "0.5147519", "0.51372945", "0.5135434", "0.5133693", "0.5127426", "0.5127314", "0.5118635", "0.51169163", "0.5114432", "0.51079196", "0.50953794", "0.5091563", "0.5091563", "0.5091563", "0.5080284", "0.5077782", "0.50697", "0.505996", "0.5057174", "0.50528896", "0.50513136", "0.5049397", "0.5026619", "0.5023968", "0.49986845", "0.49972308", "0.49970782", "0.49935472", "0.49883884", "0.49862942", "0.49754983", "0.4974122", "0.49714097", "0.4970416", "0.49660647", "0.4962178", "0.49485493", "0.49384072", "0.49295112", "0.4926201", "0.49194798", "0.49125636", "0.49082556", "0.49025154", "0.48995098", "0.48986185", "0.48984882", "0.48961782", "0.48952463", "0.4889007", "0.4882808", "0.4876944", "0.48717847", "0.48676306", "0.4860547", "0.485431", "0.48478976", "0.4843489", "0.48432672", "0.48420402", "0.48420402", "0.4839359", "0.48378775", "0.4836735", "0.4826622", "0.48250833", "0.48247075", "0.4821847", "0.48202142", "0.48192233", "0.48153996", "0.4813601", "0.48096117", "0.4803152", "0.48020622", "0.4799724", "0.47953507" ]
0.0
-1
Start a pryremoteem server
def run(obj, host = DEFHOST, port = DEFPORT, opts = {:tls => false}) tries = :auto == port ? 100.tap{ port = DEFPORT } : 1 # TODO raise a useful exception not RuntimeError raise "root permission required for port below 1024 (#{port})" if port < 1024 && Process.euid != 0 begin EM.start_server(host, port, PryRemoteEm::Server, obj, opts) do |pre| Fiber.new { begin yield pre if block_given? #Pry.start(obj, :input => pre, :output => pre) pry_instance.input = pre pry_instance.output = pre pry_instance.repl ensure pre.close_connection end }.resume end rescue => e # EM 1.0.0.beta4's message tells us the port is in use; 0.12.10 just says, 'no acceptor' if (e.message.include?('port is in use') || e.message.include?('no acceptor')) && tries >= 1 tries -= 1 port += 1 retry end raise e end scheme = opts[:tls] ? 'pryems' : 'pryem' (opts[:logger] || ::Logger.new(STDERR)).info("[pry-remote-em] listening for connections on #{scheme}://#{host}:#{port}/") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_server\n erl = CliRunner.open 'skirmish_server', 'erl', /\\d>/, /Eshell/\n erl << \"code:add_path(\\\"#{server_dir}/ebin\\\").\" >> /true/\n erl << \"application:start(skirmish_server).\" >> /ok/\n @automation_server = erl\n log.info(\"Automation#start_server\") { \"server started\" }\n end", "def spawn_server(options = {}, **args)\n unless port_available?(options[\"port\"])\n raise \"Port #{options[\"port\"]} is already in use. Change it to an available port in \"\\\n \"config/config.yml.\"\n end\n prefix = get_fuseki_command_prefix args\n command = \"#{prefix}fuseki-server --memTDB --update --port #{options[\"port\"]} \"\\\n \"--jetty-config=#{File.join(Rails.root, \"config\", \"jetty-fuseki.xml\")} \"\\\n \"/#{options[\"dataset\"]} > /dev/null\"\n spawn command\n end", "def start\n @serv = EventMachine::start_server \"0.0.0.0\", @port, Server, self\n \t\t\t\tif @peers\n \t\t\t\t\t@peers.each do |peer|\n \t\t\t\t\t\tpeer.connection = EventMachine::connect peer.ip, peer.port, Client, self, peer\n @pm.add(peer)\n \t\t\t\t\tend\n \t\t\t\tend\n end", "def start_server_at( screen_name, port = \"\" )\n %x( screen -S #{screen_name} -X python -m SimpleHTTPServer #{port} )\nend", "def start\n puts 'launching server'\n EM::run do\n EM::WebSocket.run(:host => \"0.0.0.0\", :port => 6262) do |ws|\n sigHandler\n SparrowWSHandler.new ws\n end\n end\n end", "def run\n start\n jetty.join\n end", "def start_app_manager_server\n @state = \"Starting up AppManager\"\n env_vars = {}\n start_cmd = [\"/usr/bin/python #{APPSCALE_HOME}/AppManager/app_manager_server.py\"]\n stop_cmd = \"/usr/bin/pkill -9 app_manager_server\"\n port = [AppManagerClient::SERVER_PORT]\n MonitInterface.start(:appmanagerserver, start_cmd, stop_cmd, port, env_vars)\n end", "def start(host, port); end", "def start\n return if @vim_started\n return unless @gtk_socket\n @vim_started = true\n listen\n fork do\n #exec %Q[#{Executable} --servername #{@vim_server_name} --socketid #{@gtk_socket.id} -nb:localhost:#{port}:#{Password} -S #{extras_source_path}]\n exec %Q[#{Executable} --servername #{@vim_server_name} --socketid #{@gtk_socket.id} -S #{extras_source_path}]\n end\n self\n end", "def start_manager\n if !Invoker::CONFIG.processes || Invoker::CONFIG.processes.empty?\n raise Invoker::Errors::InvalidConfig.new(\"No processes configured in config file\")\n end\n install_interrupt_handler()\n unix_server_thread = Thread.new { Invoker::CommandListener::Server.new() }\n thread_group.add(unix_server_thread)\n run_power_server()\n Invoker::CONFIG.processes.each { |process_info| add_command(process_info) }\n at_exit { kill_workers }\n start_event_loop()\n end", "def start_server(options = {})\n\n # Backward compatibility\n if options.is_a? String\n url = options\n port = nil\n logfile = nil\n else\n url = options[:url]\n port = options[:port]\n logfile = options[:logfile]\n end\n\n url = ENV['TALKSHOW_REMOTE_URL'] if ENV['TALKSHOW_REMOTE_URL']\n port = ENV['TALKSHOW_PORT'] if ENV['TALKSHOW_PORT']\n logfile = ENV['TALKSHOW_LOG'] if ENV['TALKSHOW_LOG']\n\n Talkshow::Server.set_port port if port\n Talkshow::Server.set_logfile logfile if logfile\n \n if !url\n @type = :thread\n @question_queue = ::Queue.new\n @answer_queue = ::Queue.new\n @thread = Thread.new do\n Talkshow::Server.question_queue(@question_queue)\n Talkshow::Server.answer_queue(@answer_queue)\n Talkshow::Server.run!\n end\n else\n @type = :remote\n @question_queue = Talkshow::Queue.new(url)\n @answer_queue = Talkshow::Queue.new(url)\n end\n \n end", "def start_server!; @server = TCPServer.open($port) end", "def start_server\n if @task.said_yes?(\"Would you like to start #{@name} server?\")\n action = Marv::Server::Actions.new(@server)\n action.start(false)\n end\n end", "def run\n return self if ip.nil?\n cmd = platform_opts\n cmd << '-o PasswordAuthentication=yes'\n cmd << '-o UsePrivilegeSeparation=no'\n cmd << '-o PidFile=/tmp/sshd.pid'\n cmd = ['sh', '-c', cmd.join(' ')]\n container.exec(cmd, detach: true)\n self\n end", "def start_server(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def start\n UI.info \"Starting up WEBrick...\"\n if running?\n UI.error \"Another instance of WEBrick::HTTPServer is running.\"\n false\n else\n @pid = Spoon.spawnp('ruby',\n File.expand_path(File.join(File.dirname(__FILE__), %w{webrick server.rb})),\n @options[:host],\n @options[:port].to_s,\n @options[:ssl].to_s,\n @options[:docroot]\n )\n wait_for_port\n if @options[:launchy]\n scheme = options[:ssl] ? \"https\" : \"http\"\n Launchy.open(\"#{scheme}://#{@options[:host]}:#{@options[:port]}\")\n @options[:launchy] = false # only run once\n end\n @pid\n end\n end", "def listen\n @@em.schedule {\n @@em.start_server @host, @port, TCPConnection, { :rjr_node => self }\n }\n self\n end", "def begin!\n start_server\n end", "def start!(mode = nil)\n\t\traise \"Server must be stopped\" unless status == :stopped\n\n\t\tgenerate_config! unless slave?\n\n\t\tDatabass.pg_ctl(path, :start, '-w', '-o', \"-c port=#{port}\")\n\tend", "def run opts = {}\n boot!\n\n handler = opts.delete(:server)\n (handler && Rack::Handler.const_defined?(handler)) || (handler = HTTP__DEFAULT_SERVER)\n\n port = opts.delete(:port)\n opts[:Port] ||= port || HTTP__DEFAULT_PORT\n\n host = opts.delete(:host) || opts.delete(:bind)\n opts[:Host] = host if host\n\n $stderr.puts \"\\n--- Starting Espresso for %s on %s port backed by %s server ---\\n\\n\" % [\n environment, opts[:Port], handler\n ]\n Rack::Handler.const_get(handler).run app, opts do |server|\n %w[INT TERM].each do |sig|\n Signal.trap(sig) do\n $stderr.puts \"\\n--- Stopping Espresso... ---\\n\\n\"\n server.respond_to?(:stop!) ? server.stop! : server.stop\n end\n end\n server.threaded = opts[:threaded] if server.respond_to? :threaded=\n yield server if block_given?\n end\n end", "def run(_remote_host = nil, _remote_port = nil)\n @sink.host = _remote_host if not _remote_host.nil?\n @sink.port = _remote_port if not _remote_port.nil?\n raise 'Remote host not set!' if @sink.host == 'localhost'\n\n run_main(true)\n end", "def start(host=\"localhost\", port=2230)\n output_stream.puts \"waiting till an opponent connect...\"\n EventMachine::run {\n EventMachine::start_server host, port, GameBroker, &method(:setup_handler) \n }\n end", "def start_server(options = {})\n @is_owner_process = true\n\n method = extract_deploy_method(options)\n if method == :InProc\n @is_in_proc_server = true\n start_local_server(options)\n else #method == :StandAlone\n @is_in_proc_server = false\n start_remote_server(options)\n end\n end", "def initialize_server(port)\r\n set :port, port # Specify Port For Sinatra Server\r\n set :bind, \"0.0.0.0\" # Allow Ping From External Devices\r\n set :environment, :production # Allow External Nodes To Query Websocket\r\n set :run, true # Start Sinatra Server\r\nend", "def start_node_ripple_lib\n unless is_port_open?(\"127.0.0.1\", 52134)\n current_dir = File.dirname(__FILE__).split(\"/\")\n current_dir.pop 2\n current_dir = current_dir + Array('node')\n current_dir = current_dir.join('/')\n system(\"cd #{current_dir} && node server.js &\")\n end\n self.node_ripple_lib= true\n end", "def start\n @pid = Process.fork do\n if (@options.rack) \n # NOTE: This does not support command-line setting of repo!\n opts = { :server => :webrick, :host => @host, :port => @port}\n PlanR::Application::LocalHttpd::WebApp.run!( repo, opts ) \n else\n # rack doesn't do the one thing we need it to: \n # pass WebApp instantiation arguments to Webrick.mount\n opts = { :BindAddress => @host, :Port => @port}\n @webrick = ::WEBrick::HTTPServer.new(opts)\n @webrick.mount \"/\", Servlet,\n [ PlanR::Application::LocalHttpd::WebApp, \n @options ]\n @webrick.start\n end\n end\n\n trap('INT') { Process.kill 'INT', @pid }\n trap('TERM') { Process.kill 'INT', @pid }\n\n self\n end", "def start\n\t\tself.log.debug \"Starting.\"\n\t\tself.spawn_server\n\t\tself.read_hello\n\tend", "def start\n api = @settings[:api] || {}\n bind = api[:bind] || \"0.0.0.0\"\n port = api[:port] || 4567\n start_http_server(bind, port)\n super\n end", "def connect_server(hostname)\n exec \"ssh #{hostname}\"\n exit 0\n end", "def start\n retry_jobs if JR.config[:retry_jobs_at_start]\n EM.start_server(*self.config[:server], Server, self, self.storage)\n self.config[:distributors].each do |distributor|\n connect_to(distributor)\n end\n end", "def start_server!\n httpd_root = \"#{__dir__}/fixtures/httpd\"\n\n # The command to start the server must reset the BUNDLE_GEMFILE environment\n # setting.\n # command = \"cd ../simple-httpd/ && BUNDLE_GEMFILE= PORT=12345 bin/simple-httpd start #{httpd_root} -q\" \n command = \"PORT=12345 bundle exec simple-httpd start #{httpd_root}\" \n command = \"#{command} -q 2> log/simple-httpd.log\" \n\n ::RSpec::Httpd::Server.start! port: PORT, command: command\n end", "def run\n check_host\n Server.run(self)\n\n rescue Errno::EADDRINUSE\n puts \"** Could not bind to port #{config[:port]}.\"\n puts \" Is SequenceServer already accessible at #{server_url}?\"\n puts ' No? Try running SequenceServer on another port, like so:'\n puts\n puts ' sequenceserver -p 4570.'\n rescue Errno::EACCES\n puts \"** Need root privilege to bind to port #{config[:port]}.\"\n puts ' It is not advisable to run SequenceServer as root.'\n puts ' Please use Apache/Nginx to bind to a privileged port.'\n puts ' Instructions available on http://sequenceserver.com.'\n end", "def start_remote(host = nil, port = PORT, post_mortem = false)\n return if @thread\n return if started?\n\n self.interface = nil\n start\n self.post_mortem if post_mortem\n\n if port.kind_of?(Array)\n cmd_port, ctrl_port = port\n else\n cmd_port, ctrl_port = port, port + 1\n end\n\n ctrl_port = start_control(host, ctrl_port)\n\n yield if block_given?\n\n mutex = Mutex.new\n proceed = ConditionVariable.new\n\n server = TCPServer.new(host, cmd_port)\n @cmd_port = cmd_port = server.addr[1]\n @thread = Debugger::DebugThread.new do\n while (session = server.accept)\n self.interface = RemoteInterface.new(session)\n if wait_connection\n mutex.synchronize do\n proceed.signal\n end\n end\n end\n end\n if wait_connection\n mutex.synchronize do\n proceed.wait(mutex)\n end\n end\n end", "def start_remote(host = nil, port = PORT, post_mortem = false)\n return if @thread\n return if started?\n\n self.interface = nil\n start\n self.post_mortem if post_mortem\n\n if port.kind_of?(Array)\n cmd_port, ctrl_port = port\n else\n cmd_port, ctrl_port = port, port + 1\n end\n\n start_control(host, ctrl_port)\n \n yield if block_given?\n \n mutex = Mutex.new\n proceed = ConditionVariable.new\n \n @thread = DebugThread.new do\n server = TCPServer.new(host, cmd_port)\n while (session = server.accept)\n self.interface = RemoteInterface.new(session)\n if wait_connection\n mutex.synchronize do\n proceed.signal\n end\n end\n end\n end\n if wait_connection\n mutex.synchronize do\n proceed.wait(mutex)\n end \n end\n end", "def run_server\n EM.synchrony do\n @app = Rack::Builder.new do\n use Rack::Lint\n use Rack::ShowExceptions\n run Rack::Cascade.new([Souffle::Http])\n end.to_app\n\n Rack::Handler.get(:thin).run(@app, rack_options)\n end\n end", "def start_infrastructure_manager\n if HelperFunctions.is_port_open?(\"localhost\", \n InfrastructureManagerClient::SERVER_PORT, HelperFunctions::USE_SSL)\n\n Djinn.log_debug(\"InfrastructureManager is already running locally - \" +\n \"don't start it again.\")\n return\n end\n\n start_cmd = \"/usr/bin/python #{APPSCALE_HOME}/InfrastructureManager/infrastructure_manager_service.py\"\n stop_cmd = \"/usr/bin/pkill -9 infrastructure_manager_service\"\n port = [InfrastructureManagerClient::SERVER_PORT]\n env = {\n 'APPSCALE_HOME' => APPSCALE_HOME,\n 'EC2_HOME' => ENV['EC2_HOME'],\n 'JAVA_HOME' => ENV['JAVA_HOME']\n }\n\n MonitInterface.start(:iaas_manager, start_cmd, stop_cmd, port, env)\n Djinn.log_info(\"Started InfrastructureManager successfully!\")\n end", "def start_remote(host = nil, port = PORT, post_mortem = false)\n return if @thread\n return if started?\n\n self.interface = nil\n start\n self.post_mortem if post_mortem\n\n if port.kind_of?(Array)\n cmd_port, ctrl_port = port\n else\n cmd_port, ctrl_port = port, port + 1\n end\n\n start_control(host, ctrl_port)\n \n yield if block_given?\n \n mutex = Mutex.new\n proceed = ConditionVariable.new\n \n @thread = DebugThread.new do\n server = TCPServer.new(host, cmd_port)\n while (session = server.accept)\n self.interface = RemoteInterface.new(session)\n if wait_connection\n mutex.synchronize do\n proceed.signal\n end\n end\n end\n end\n if wait_connection\n STDERR.puts \"Waiting for connections on #{host}:#{cmd_port}\"\n mutex.synchronize do\n proceed.wait(mutex)\n end\n end\n end", "def start!(host: \"0.0.0.0\", port:, command:, logger: nil)\n @servers ||= {}\n @servers[[host, port, command]] ||= command ? do_start(host, port, command) : check_server(host, port)\n @logger = logger if logger\n end", "def run\n check_host\n Server.run(self)\n rescue Errno::EADDRINUSE\n puts \"** Could not bind to port #{config[:port]}.\"\n puts \" Is SequenceServer already accessible at #{server_url}?\"\n puts ' No? Try running SequenceServer on another port, like so:'\n puts\n puts ' sequenceserver -p 4570.'\n rescue Errno::EACCES\n puts \"** Need root privilege to bind to port #{config[:port]}.\"\n puts ' It is not advisable to run SequenceServer as root.'\n puts ' Please use Apache/Nginx to bind to a privileged port.'\n puts ' Instructions available on http://sequenceserver.com.'\n end", "def startServer()\n\tserver = TCPServer.open($ports[$hostname])\n\tloop {\n\t\tThread.start(server.accept) do |client|\n\t \treceiveMessage(client)\n\t\tend\n\t}\nend", "def listen\n em_run do\n end\n end", "def request_listen\n send_command RemoteListenCommand.new(@client.remote_listen_address)\n enable_tunnel_timeouts \n end", "def start\n @virtual_machine_state = 'NOSTATE'\n Profitbricks.request :start_server, server_id: self.id\n return true\n end", "def bind\n EventMachine.run do\n Signal.trap(\"INT\") {\n WORLD.players.each {|p|\n WORLD.unregister(p)\n }\n \n while WORLD.work_thread.waiting > 0\n sleep(0.01)\n end\n \n EventMachine.stop if EventMachine.reactor_running?\n exit\n }\n \n Signal.trap(\"TERM\") {\n EventMachine.stop\n }\n \n EventMachine.start_server(\"0.0.0.0\", @config.port + 1, Calyx::Net::JaggrabConnection) if $cache\n EventMachine.start_server(\"0.0.0.0\", @config.port, Calyx::Net::Connection)\n @log.info \"Ready on port #{@config.port}\"\n end\n end", "def start_server(type, date)\n Shell.execute \"start #{upstart_script_filename(type, date).gsub(/^#{script_directory}\\//, '').gsub(/\\.conf$/, '')}\"\n end", "def main\n this_dir = File.expand_path(File.dirname(__FILE__))\n echo_server_path = File.join(this_dir, 'echo_server.rb')\n to_child_r, _to_child_w = IO.pipe\n to_parent_r, to_parent_w = IO.pipe\n Process.spawn(RbConfig.ruby, echo_server_path, \"--secure\", in: to_child_r, out: to_parent_w, err: \"server_log\")\n to_child_r.close\n to_parent_w.close\n child_port = to_parent_r.gets.strip\n STDERR.puts \"server running on port: #{child_port}\"\n channel_creds = create_channel_creds.compose(\n GRPC::Core::CallCredentials.new(proc do |args|\n { 'authorization' => 'test' }.merge(args)\n end))\n stub = Echo::EchoServer::Stub.new(\n \"localhost:#{child_port}\", channel_creds,\n channel_args: { GRPC::Core::Channel::SSL_TARGET => 'foo.test.google.fr' })\n 2.times do\n run_client(stub)\n end\nend", "def start_server(server)\n server.start\n end", "def start\n with_pid_lock do |file|\n # Check if the daemon is already started...\n if running?(file)\n @ui.info \"[landrush] DNS server already running with pid #{read_pid(file)}\" unless @ui.nil?\n return\n end\n\n # On a machine with just Vagrant installed there might be no other Ruby except the\n # one bundled with Vagrant. Let's make sure the embedded bin directory containing\n # the Ruby executable is added to the PATH.\n Landrush::Util::Path.ensure_ruby_on_path\n\n ruby_bin = Landrush::Util::Path.embedded_vagrant_ruby.nil? ? 'ruby' : Landrush::Util::Path.embedded_vagrant_ruby\n start_server_script = Pathname(__dir__).join('start_server.rb').to_s\n @ui.detail(\"[landrush] starting DNS server: '#{ruby_bin} #{start_server_script} #{port} #{working_dir} #{gems_dir}'\") unless @ui.nil?\n if Vagrant::Util::Platform.windows?\n # Need to handle Windows differently. Kernel.spawn fails to work, if\n # the shell creating the process is closed.\n # See https://github.com/vagrant-landrush/landrush/issues/199\n #\n # Note to the Future: Windows does not have a\n # file handle inheritance issue like Linux and Mac (see:\n # https://github.com/vagrant-landrush/landrush/issues/249)\n #\n # On windows, if no filehandle is passed then no files get\n # inherited by default, but if any filehandle is passed to\n # a spawned process then all files that are\n # set as inheritable will get inherited. In another project this\n # created a problem (see: https://github.com/dustymabe/vagrant-sshfs/issues/41).\n #\n # Today we don't pass any filehandles, so it isn't a problem.\n # Future self, make sure this doesn't become a problem.\n info = Process.create(command_line: \"#{ruby_bin} #{start_server_script} #{port} #{working_dir} #{gems_dir}\",\n creation_flags: Process::DETACHED_PROCESS,\n process_inherit: false,\n thread_inherit: true,\n cwd: working_dir.to_path)\n pid = info.process_id\n else\n # Fix https://github.com/vagrant-landrush/landrush/issues/249)\n # by turning of filehandle inheritance with :close_others => true\n # and by explicitly closing STDIN, STDOUT, and STDERR\n pid = spawn(ruby_bin, start_server_script, port.to_s, working_dir.to_s, gems_dir.to_s,\n in: :close,\n out: :close,\n err: :close,\n close_others: true,\n chdir: working_dir.to_path,\n pgroup: true)\n Process.detach pid\n end\n\n write_pid(pid, file)\n # As of Vagrant 1.8.6 this additional sleep is needed, otherwise the child process dies!?\n sleep 1\n end\n end", "def remote\n log_and_exit read_template('help') if options.empty?\n \n # Attempts to run the specified command\n run_remote_command(options[0])\n end", "def run_command_for_host\n ready_to_open_host_session do |spawn_cmd|\n open_interactive_process(spawn_cmd) do\n before_run_command\n run_command\n end\n end\n end", "def start_tpm2sim_on(hosts)\n on hosts, 'runuser tpm2sim --shell /bin/sh -c ' \\\n '\"cd /tmp; nohup /usr/local/bin/tpm2-simulator &> /tmp/tpm2-simulator.log &\"', \\\n pty: true, run_in_parallel: true\nend", "def start\n if !started?\n configure(false)\n FileUtils.touch($config[:'log-file'])\n FileUtils.chmod(0640, $config[:'log-file'])\n $log = File.open($config[:'log-file'], 'a')\n @pid = fork do\n Process.egid = $config[:gid]\n Process.euid = $config[:uid]\n server = PostwhiteServer.new\n server.start\n STDERR.reopen('/dev/null') # silence STDERR\n sleep # until INT signal\n end || (raise \"cannot not fork server process\")\n File.open($config[:'pid-file'], 'w') {|file| file.puts @pid }\n puts \"postwhite started on #{$config[:host]}:#{$config[:port]} with pid #{@pid}\" if !$config[:quiet]\n Signal.trap('INT') { cleanup }\n if $config[:detach]\n Process.detach(@pid)\n else\n Process.wait\n end\n else\n raise \"postwhite already running\"\n end\n 0\n end", "def start\n $stdout.puts \"Starting the pow server...\"\n %x{sudo launchctl load -Fw /Library/LaunchDaemons/cx.pow.firewall.plist 2>/dev/null}\n %x{launchctl load -Fw \"$HOME/Library/LaunchAgents/cx.pow.powd.plist\" 2>/dev/null}\n $stdout.puts \"Done!\"\n end", "def start_mplayer()\n @pid = Process.spawn(mplayer(),\n #'-softvol', # software volume mixer\n #'-nocache', # don't cache anything\n '-cache',\n '8192', # cache long stream tracks so they don't time out\n '-cache-min',\n '4', # start playing streams right away\n '-nolirc', # don't attempt to initialise a LIRC remote\n #'-really-quiet', # no informational messages\n '-quiet', # no informational messages\n '-idle', # run without immediately playing anything\n '-input', # listen on a FIFO for commands\n \"file=#{fifo()}\",# the FIFO location\n #'-ao', # use this audio output\n #'alsa:device=hw=0.0', # specifically for Raspberry Pi\n '-key-fifo-size',# limit the number of events we buffer\n '5' # ...to 4. This allows stop() to work.\n )\n\n # don't care when the process ends... mostly\n Process.detach(@pid)\n end", "def run\n prepare_process\n reporter.welcome_message\n exit(1) if print_config_errors\n\n # Set up our console input handling and history\n console = Console.new(config, reporter)\n\n # Start the server\n while console_run_loop(console)\n # just need to run the loop\n end\n\n console.store_history\n\n cleanup_process\n end", "def remote_debug args\n require 'pry-remote'\n remote(args) do |ssh|\n ssh.forward.local 9876, '127.0.0.1', 9876\n ssh.forward.remote 9877, '127.0.0.1', 9877\n debugging = true\n Thread.new { ssh.loop { debugging } }\n PryRemote::CLI.new(['-P', '9877']).run\n debugging = false\n end\n end", "def start_server!\n @logger.info \"Listening on #{@host}:#{@port}\"\n @server = TCPServer.new(@host, @port)\n end", "def start(host, port, opts = {})\n @connect_to = opts[:connect_to] && opts[:connect_to].join(':')\n @host = host\n @port = port\n JR::JobLogger.log \"Distributor listens #{host}:#{port}\"\n EM.start_server(host, port, JobReactor::Distributor::Server)\n end", "def start_server(is_daemon)\n case status_server\n when 0\n puts 'server is already running'\n return 1\n when 1\n puts \"pid file exists. I'll delete it to run the server.\"\n FileUtils.rm(PID_FILE)\n end\n\n vardir = File::dirname(PID_FILE)\n FileUtils.mkdir_p(vardir) unless FileTest.exist?(vardir)\n\n config = RenkeiVPE::ServerConfig.read_config(CNF_FILE)\n server = RenkeiVPE::Server.new(config)\n if is_daemon\n RenkeiVPE::Server.daemonize(PID_FILE) do\n server.start\n end\n else\n server.start\n end\n\n return 0\nend", "def start_webrick(config = {})\n config.update(:Port => 8080) \n server = HTTPServer.new(config)\n yield server if block_given?\n ['INT', 'TERM'].each {|signal| \n trap(signal) {server.shutdown}\n }\n server.start\n\nend", "def start_monit\n pidfile = \"/var/run/lock/#{app['shortname']}/puma.pid\"\n context.execute \"monit start #{adapter}_#{app['shortname']}\" do\n retries 3\n creates pidfile\n end\n end", "def start_server\n @watchman = Thread.new {\n while !@stopped\n @pool_mutex.synchronize\n socket = @server.accept\n @pool << Thread.new(socket) {|socket|\n serve(socket)\n }\n end \n }\n end", "def start_server(config, server_ctrl)\n pid = Process.fork do\n cmd = \"hop_hop server --identifier #{config.control.identifier}\"\n # puts \"starting #{cmd}\"\n $0 = cmd\n HopHop::ConsumerServer.start(config)\n end\n\n Process.detach(pid) # so we leave no zombies behind\n HopHop::Helper.wait_unless(config.control.wait_spinup){!server_ctrl.alive?} # now wait for it to spin up\n raise \"Could not spin up the consumer server\" unless server_ctrl.alive?\n end", "def start!\n http_server.start\n self\n end", "def start_ssl_mitm(host, port)\n # WORKAROUND for \"adress is already in use\", just increase\n # the port number and kill the old webrick\n @mitm_port += 1\n @mitm_server.stop if @mitm_server\n @mitm_thread.kill if @mitm_thread\n\n @mitm_server = ::WEBrick::HTTPServer.new({\n :Port => @mitm_port,\n :SSLEnable => true,\n :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,\n :SSLCertName => [ [\"C\", \"US\"], [\"O\", host], [\"CN\", host] ]\n })\n\n @mitm_server.mount_proc('/') do |req, res|\n method, url, version = req.request_line.split(\" \")\n\n remote_request = case method.upcase\n when 'GET'\n ::Net::HTTP::Get.new(req.unparsed_uri)\n when 'POST'\n ::Net::HTTP::Post.new(req.unparsed_uri)\n when 'PUT'\n ::Net::HTTP::Put.new(req.unparsed_uri)\n when 'DELETE'\n ::Net::HTTP::Delete.new(req.unparsed_uri)\n when 'HEAD'\n ::Net::HTTP::Head.new(req.unparsed_uri)\n when 'OPTIONS'\n ::Net::HTTP::Options.new(req.unparsed_uri)\n else\n puts \"HTTP method '#{method}' not supported!\"\n end\n\n remote_request.body = req.body\n remote_request.body = req.body\n remote_request.initialize_http_header(transform_header(req.header))\n\n uri = req.request_uri\n http = ::Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = ::OpenSSL::SSL::VERIFY_NONE\n\n remote_response = http.request(remote_request)\n\n remote_response.code\n res.body = remote_response.body\n res.status = remote_response.code\n\n remote_response.header.each do |k|\n res.header[k] = remote_response.header[k]\n end\n end\n\n @mitm_thread = ::Thread.new { @mitm_server.start }\n end", "def run_webrick(config = {})\n config.update :Port => 8080\n server = HTTPServer.new config\n yield server if block_given?\n [\"INT\", \"TERM\"].each { |signal| trap(signal) { server.shutdown } }\n server.start\nend", "def setup_server(s)\n # noop\n end", "def start\n # Generate Device Description XML file\n generate_xml_device_description\n\n # Start server for M-SEARCH request\n start_ssdp_server\n\n # Start server for HTTP request\n start_http_server\n\n # Send initial notification\n notify :alive\n\n # increase BOOTID\n @boot_id = (@boot_id + 1) % 2**31\n\n # and then set a periodic timer for future notifications\n @notify_timer = EM.add_periodic_timer(@notify_interval) { notify :alive }\n end", "def start(host = T.unsafe(nil), port = T.unsafe(nil)); end", "def start(&blk)\n EM.epoll\n EM.synchrony do\n trap(\"INT\") { stop }\n trap(\"TERM\") { stop }\n\n if RUBY_PLATFORM !~ /mswin|mingw/\n trap(\"HUP\") { load_config(options[:config]) }\n end\n\n load_config(options[:config])\n load_plugins\n\n EM.set_effective_user(options[:user]) if options[:user]\n\n config[Goliath::Constants::GOLIATH_SIGNATURE] = start_server(options) do |conn|\n if options[:ssl]\n conn.start_tls(\n :private_key_file => options[:ssl_key],\n :cert_chain_file => options[:ssl_cert],\n :verify_peer => options[:ssl_verify]\n )\n end\n\n conn.port = port\n conn.app = app\n conn.api = api\n conn.logger = logger\n conn.status = status\n conn.config = config\n conn.options = options\n end\n\n blk.call(self) if blk\n end\n end", "def sleep_until_puppetserver_started(host, port = nil)\n port = options[:puppetserver_port] if port.nil?\n curl_with_retries('start puppetserver (ssl)',\n host, \"https://#{host.node_name}:#{port}\", [35, 60])\n end", "def return_client()\n Net::SSH.start('qa-host','root',:password=>'fortigate')\nend", "def spawn_server\n\t\tself.reader, child_writer = IO.pipe\n\t\tchild_reader, self.writer = IO.pipe\n\n\t\tcmd = self.server_start_command\n\t\tself.pid = Process.spawn( *cmd, out: child_writer, in: child_reader, close_others: true )\n\t\tself.log.debug \"Spawned command server at PID %d\" % [ self.pid ]\n\n\t\tchild_writer.close\n\t\tchild_reader.close\n\tend", "def run port\n puts \"Starting Proxy to #{$remote_server}:#{$remote_port}. Listening on #{port}\"\n @server = TCPServer.new port\n loop do\n Thread.start @server.accept do |s|\n proxy_request s\n s.close\n end\n end\n end", "def start\n UI.info \"Starting up Rack...\"\n if running?\n UI.error \"Another instance of Rack is running.\"\n false\n else\n @pid = Spoon.spawnp 'rackup', *(options_array << (config_file if config_file)).reject(&:nil?)\n end\n wait_for_port\n if running?\n Notifier.notify(@reloaded ? 'reloaded' : 'up') unless @options[:hide_success]\n @reloaded = false\n else\n UI.info \"Rack failed to start.\"\n Notifier.notify('failed')\n end\n end", "def exec_server; Ricer4::Server.where(:conector => 'shell').first; end", "def boot params={}\n Server.node = Server.start! params\n Server.semaphore = Mutex.new\n Server.workers = []; true\n end", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to\n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to\n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def server(port = 9319)\r\n puts \"- Starting server on port: #{port}\"\r\n\r\n $servers[port] = WEBrick::HTTPServer.new(:Port => port) if $servers[port].nil?\r\n server = $servers[port]\r\n $mounts.keys.each{|url|\r\n server.unmount(url)\r\n server.mount(url, $mounts[url][0], *$mounts[url][1])\r\n }\r\n $mounts.clear\r\n\r\n Thread.new { server.start unless server.status == :Running }\r\nend", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to \n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def start\n if @options[:\"disable-watcher\"]\n bootup\n else\n @server_job = fork {\n Signal.trap(::Middleman::WINDOWS ? :KILL : :TERM) { exit! }\n bootup\n }\n end\n end", "def server(&blk); end", "def server(&blk); end", "def init_server\n box = @boxes[@environment_name]\n if box.nil?\n launch!\n else\n @cloud.connect_to_server(box)\n end\n end", "def start\n begin\n @query.connect\n rescue Exception => e\n puts \"#{e}. Could not connect to Teamspeak server. No server is running or you provided incorrect login data in your config/ENV vars.\"\n exit(1)\n end\n\n @api = @query.get_api\n @api.select_virtual_server_by_id(1)\n Bootstrap.start if Settings.run_bootstrapping?\n $has_sort_values = Server.groups.values.any? do |group|\n group[1] > 0\n end\n info = $has_sort_values ? \"SORT IDS\" : \"IDS\"\n puts \"Pigeon Info: Use group #{info} for determing permissions.\"\n end", "def run\n EventMachine::run do\n @tcp = EventMachine::connect(config.server.host, config.server.port, TCPConnection)\n @tcp.client = self\n spectator_join\n end\n end", "def main\n # Check that there was an argument supplied to the application\n if ARGV.length > 0\n # Convert the argument to an integer to be used as a port number\n port = ARGV[0].to_i\n if port < 1024 || port > 49151\n puts \"illegal port #{ARGV[0].to_i}: Choose one in range 1024-49151\"\n exit\n end\n else\n # If no port was specified, create a random port number\n port = Random.new.rand(48128) + 1024\n end\n serve port\nend", "def start\n [:INT, :TERM, :ABRT].each{|signal|Signal.trap(signal, ->{stop})}\n\n connector = SelectChannelConnector.new\n connector.port = http_port\n connector.confidential_port = https_port if https_port\n\n jetty.add_connector connector\n jetty.start\n end", "def run\n AMQP.start(:host => \"localhost\") {\n @mq = MQ.new\n @update_channel = EM::Channel.new\n @deferred_responses = {}\n\n @queue_name = \"cmdr:websocket:#{self.object_id}\"\n @queue = @mq.queue(@queue_name)\n \n # watch for responses from devices\n @queue.subscribe{|json|\n msg = JSON.parse(json)\n puts \"Got response: #{msg}\"\n if @deferred_responses[msg[\"id\"]]\n @deferred_responses.delete(msg[\"id\"]).succeed(msg)\n end\n }\n\n topic = @mq.topic(EVENT_TOPIC)\n @mq.queue(\"cmdr:websocket:#{self.object_id}:response\").bind(topic, :key => \"device.*\").subscribe do |json|\n handle_event json\n end\n\n setup\n\n EM::WebSocket.start({\n :host => \"0.0.0.0\",\n :port => 8000,\n :debug => false\n #:secure => true \n }) do |ws|\n\n ws.onopen { onopen ws }\n \n ws.onmessage {|json| onmessage ws, json}\n \n ws.onclose do\n @update_channel.unsubscribe(@sid) if @sid\n DaemonKit.logger.debug \"Connection on #{ws.signature} closed\"\n end\n\n ws.onerror do\n DaemonKit.logger.debug \"Error on #{ws.signature}\"\n end\n end\n }\n end", "def establish_remote_server(remote)\n fail \"establish_remote_server called with remote established\" if @remote\n m, host, port = *remote.match(/^(.+):(.+)$/)\n @remote = [host, port]\n connect_to_server\n end", "def setup\n %w{ echo_server deaf_server stubborn_server simple_server }.each do |server|\n begin\n Process.kill 9, possible_pid(server)\n rescue Errno::ESRCH\n # good, no process to kill\n end\n begin\n File.unlink pid_file(server)\n rescue Errno::ENOENT\n # good, no pidfile to clear\n end\n end\n end", "def run\n begin\n @socket = TCPSocket.open(server, port)\n rescue => e\n puts \"An error occurred: #{e.message}\"\n exit 1\n end\n\n send 'USER ruben 0 * :Ruben'\n send \"NICK #{@nick}\"\n send \"JOIN ##{@channel}\"\n\n listen until @socket.eof?\n end", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(RequesterServer)\n s.run_till_terminated\nend", "def setup_server\n ENV[\"RAILS_ENV\"] = \"test\"\n require \"rails\"\n fork do\n exec \"cd test/rails#{Rails::VERSION::MAJOR}_dummy && COVERBAND_TEST=test bundle exec rackup config.ru -p 9999 --pid /tmp/testrack.pid\"\n end\n end", "def runserver!(host: '127.0.0.1', port: '3456')\n configure!(mode: :server, target: :development)\n status = 0 # running: 0, reload: 1, exit: 2\n # spawn a thread to watch the status flag and trigger a reload or exit\n monitor = Thread.new do\n sleep 0.1 while status.zero?\n # Shutdown the server, wait for it to finish and then wait a tick\n Rack::Handler::WEBrick.shutdown\n sleep 0.1\n # Use ps to get the command that the user executed, and use Kernel.exec\n # to execute the command, replacing the current process.\n # Basically restart everything.\n Kernel.exec(`ps #{$PID} -o command`.split(\"\\n\").last) if status == 1\n end\n\n # trap ctrl-c and set status flag\n trap('SIGINT') do\n if status == 1\n status = 2 # ctrl-c hit twice or more, set status to exit\n elsif status.zero?\n # ctrl-c hit once, notify user and set status to reload\n puts \"\\nReloading the server, hit ctrl-c twice to exit\\n\"\n status = 1\n end\n end\n\n puts \"\\nStarting Dev server, hit ctrl-c once to reload, twice to exit\\n\"\n require 'webrick/accesslog'\n access_log = [[$stderr, WEBrick::AccessLog::COMMON_LOG_FORMAT]]\n Rack::Handler::WEBrick.run(self, Host: host, Port: port, AccessLog: access_log)\n monitor.join # let the monitor thread finish its work\n end", "def run_host(ip)\n\n\t\tself.target_port = datastore['RPORT']\t\n\n\t\tbegin\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET'\n\t\t\t}, 10)\n\n\t\t\tif (res and res.headers['Server'])\n\t\t\t\textra = http_fingerprint(res)\n\t\t\t\tprint_status(\"#{ip} is running #{res.headers['Server']}#{extra}\")\n\n\t\t\t\trep_id = wmap_base_report_id(\n\t\t\t\t\t\twmap_target_host,\n\t\t\t\t\t\twmap_target_port,\n\t\t\t\t\t\twmap_target_ssl\n\t\t\t\t)\n\t\t\t\twmap_report(rep_id,'WEB_SERVER','TYPE',\"#{res.headers['Server']}#{extra}\",nil)\n\t\t\tend\n\t\t\t\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\n\tend", "def run\n Minion.info(\"Starting minion\")\n Signal.trap(\"INT\") { AMQP.stop { EM.stop } }\n Signal.trap(\"TERM\") { AMQP.stop { EM.stop } }\n\n EM.run do\n AMQP.start(config) do\n AMQP::Channel.new.prefetch(1)\n execute_handlers\n end\n end\n end", "def start_drb_server\r\n drb_server = DRb.start_service(\r\n \"druby://#{@drb_server_host}:#{@drb_server_port}\")\r\n @drb_server_uri = drb_server.uri\r\n @log.info(\"Watir Grid started on : #{@drb_server_uri}\")\r\n end", "def serve\n server_options = {}\n options.each { |k, v| server_options[k.to_sym] = v }\n server_options[:server] = {}\n [:port, :handler, :host].each do |k|\n server_options[:server][k] = server_options.delete(k) if server_options.key?(k)\n end\n\n @project.server.set_options(server_options[:server])\n end" ]
[ "0.63203704", "0.61644065", "0.61449873", "0.60924476", "0.6028563", "0.6018178", "0.58099306", "0.57852554", "0.5699426", "0.5672735", "0.56571615", "0.56401294", "0.563884", "0.5634684", "0.56253934", "0.56201166", "0.556598", "0.5563213", "0.55624896", "0.55548394", "0.5549773", "0.5548952", "0.55334216", "0.5529468", "0.5506822", "0.5487274", "0.5458511", "0.5449437", "0.5446917", "0.54446566", "0.5440353", "0.5404193", "0.53976214", "0.5386686", "0.537895", "0.53768027", "0.5374426", "0.5372035", "0.5356641", "0.5345887", "0.5343738", "0.5340696", "0.53330636", "0.5330895", "0.53267074", "0.53193563", "0.53072", "0.5290815", "0.528339", "0.52822995", "0.52821505", "0.5281706", "0.52796704", "0.5277812", "0.5260414", "0.52574915", "0.52531224", "0.5246972", "0.5244611", "0.52444595", "0.5236662", "0.5235324", "0.52316284", "0.52308095", "0.52277", "0.52264273", "0.5224309", "0.5216112", "0.5207855", "0.5203607", "0.5201026", "0.5194238", "0.5190809", "0.5190526", "0.5188084", "0.5183258", "0.51758516", "0.51738137", "0.51738137", "0.51724356", "0.51712024", "0.516932", "0.515405", "0.515405", "0.51524866", "0.5148333", "0.51477945", "0.51459867", "0.51395065", "0.5139422", "0.5138708", "0.5137436", "0.5134563", "0.5133708", "0.5133265", "0.51308864", "0.51222444", "0.511853", "0.5112353", "0.5109436" ]
0.6956129
0
run(obj, host = DEFHOST, port = DEFPORT) The list of pryremoteem connections for a given object, or the list of all pryremoteem connections for this process. The peer list is used when broadcasting messages between connections.
def peers(obj = nil) @peers ||= {} obj.nil? ? @peers.values.flatten : (@peers[obj] ||= []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(obj, host = DEFHOST, port = DEFPORT, opts = {:tls => false})\n tries = :auto == port ? 100.tap{ port = DEFPORT } : 1\n # TODO raise a useful exception not RuntimeError\n raise \"root permission required for port below 1024 (#{port})\" if port < 1024 && Process.euid != 0\n begin\n EM.start_server(host, port, PryRemoteEm::Server, obj, opts) do |pre|\n Fiber.new {\n begin\n yield pre if block_given?\n #Pry.start(obj, :input => pre, :output => pre)\n pry_instance.input = pre\n pry_instance.output = pre\n pry_instance.repl\n ensure\n pre.close_connection\n end\n }.resume\n end\n rescue => e\n # EM 1.0.0.beta4's message tells us the port is in use; 0.12.10 just says, 'no acceptor'\n if (e.message.include?('port is in use') || e.message.include?('no acceptor')) && tries >= 1\n tries -= 1\n port += 1\n retry\n end\n raise e\n end\n scheme = opts[:tls] ? 'pryems' : 'pryem'\n (opts[:logger] || ::Logger.new(STDERR)).info(\"[pry-remote-em] listening for connections on #{scheme}://#{host}:#{port}/\")\n end", "def connect()\n\t\t\t# Check queen(s) for peer list\n\n\t\t\t# Connect to peers\n\t\tend", "def remote_connections; end", "def each_host(wspace=framework.db.workspace, &block)\n ::ApplicationRecord.connection_pool.with_connection {\n wspace.hosts.each do |host|\n block.call(host)\n end\n }\n end", "def grab_connections\n connections = []\n connections << @host\n end", "def execute_with(host_list, options = {}, &block)\n host_list.each { |host| @connections[host] ||= LazyConnection.new(host, @net_ssh_options) }\n args = options[:args] || []\n num_threads = options[:num_threads] || DEFAULT_THREAD_POOL_SIZE\n if options[:serial]\n host_list.each { |host| @connections[host].self_eval args, &block }\n elsif options[:batch_by]\n num_threads = options[:batch_by] if num_threads == :unlimited\n host_list.each_slice(options[:batch_by]) do |batch|\n Weave.with_thread_pool(batch, num_threads) do |host, mutex|\n @connections[host].self_eval args, mutex, &block\n end\n end\n else\n num_threads = host_list.size if num_threads == :unlimited\n Weave.with_thread_pool(host_list, num_threads) do |host, mutex|\n @connections[host].self_eval args, mutex, &block\n end\n end\n end", "def each_streamhost(my_jid, &block)\n @addresses.each { |address|\n yield SOCKS5BytestreamsServerStreamHost.new(self, my_jid, address, @port)\n }\n end", "def start_peers\n\t\tDRb.stop_service\n\t\tremote_process do\n\t\t DRb.start_service DISCOVERY_SERVER, Rinda::TupleSpace.new\n\t\tend\n\n\t\tif engine.running?\n\t\t begin\n\t\t\tengine.quit\n\t\t\tengine.join\n\t\t rescue ControlQuitError\n\t\t end\n\t\tend\n\n\t\tremote_process do\n\t\t central_tuplespace = DRbObject.new_with_uri(DISCOVERY_SERVER)\n\n\t\t cs = ConnectionSpace.new :ring_discovery => false, \n\t\t\t:discovery_tuplespace => central_tuplespace, :name => \"remote\",\n :plan => plan\n\n getter = Class.new do\n attr_accessor :cs\n def get; DRbObject.new(cs) end\n end.new\n getter.cs = cs\n\n Distributed.state = cs\n\n DRb.start_service REMOTE_SERVER, getter\n\n\t\t cs.extend RemotePeerSupport\n\t\t cs.testcase = self\n\n\t\t def cs.start_control_thread\n\t\t\tengine.run\n\t\t end\n\n\t\t yield(cs) if block_given?\n\t\tend\n\n\t\tDRb.start_service LOCAL_SERVER\n\t\t@central_tuplespace = DRbObject.new_with_uri(DISCOVERY_SERVER)\n\t\t@remote = DRbObject.new_with_uri(REMOTE_SERVER).get\n\t\t@local = ConnectionSpace.new :ring_discovery => false, \n\t\t :discovery_tuplespace => central_tuplespace, :name => 'local', \n\t\t :plan => plan\n Distributed.state = local\n\n remote.start_control_thread\n engine.run\n\t end", "def start\n @serv = EventMachine::start_server \"0.0.0.0\", @port, Server, self\n \t\t\t\tif @peers\n \t\t\t\t\t@peers.each do |peer|\n \t\t\t\t\t\tpeer.connection = EventMachine::connect peer.ip, peer.port, Client, self, peer\n @pm.add(peer)\n \t\t\t\t\tend\n \t\t\t\tend\n end", "def run\n connect\n end", "def connections_here(whom = nil)\n list = []\n if whom\n whom = whom.map(&:downcase)\n end\n @connection.server.connections.each { |key, connection|\n if whom\n if whom.include?(connection.agent.name.downcase) and connection.agent.item == item\n list.push(connection)\n end\n else\n if connection.agent.item == item\n list.push(connection)\n end\n end\n }\n return list\n end", "def peers_connect\r\n\t\t\tpr = protocols.first\r\n\t\t\th = {\r\n\t\t\t\thandler: self.type.to_s,\r\n\t\t\t\tprotocol: pr.type.to_s,\r\n\t\t\t\tssl: @parent.ssl_enabled?\r\n\t\t\t}\r\n\t\t\tps = hive.peers_random(h,20)\r\n\t\t\tcounter = 0\r\n\t\t\tps.each{|ph| \r\n\t\t\t\tpeer = hive.peer_from_hash(ph)\r\n\t\t\t\tnext if peer.host_id == @parent.queen_id\r\n\t\t\t\tnext if peer.uuid == @parent.uuid\r\n\t\t\t\tnext if peers.any?{|p| p.uuid == peer.uuid }\r\n\t\t\t\tret = pr.connect_peer(peer.host,peer.port)\r\n\t\t\t\tnext if !ret\r\n\t\t\t\tcounter += 1\r\n\t\t\t\tbreak if counter > 20# @parent::MIN_PEERS\r\n\t\t\t}\r\n\t\t\tcounter\r\n\t\tend", "def each_host(&block)\n hosts.each do |host|\n host.instance_exec &block\n end\n end", "def execute(method, host, *args)\n options = args.last.is_a?(Hash) ? args.pop : Hash.new\n\n connector = connector_for(host, options)\n if connector.nil?\n log.warn { \"No connector ports open on '#{host}'\" }\n HostConnector::Response.new(host, stderr: \"No connector ports open on '#{host}'\")\n elsif connector.is_a?(winrm.class)\n options.delete(:ssh)\n connector.send(method, host, *args, options)\n elsif connector.is_a?(ssh.class)\n options.delete(:winrm)\n connector.send(method, host, *args, options)\n end\n end", "def peer\n @peer ||= { ip: socket.peer_ip, port: @port.to_i, host: @host, canonized: host_as_string }\n end", "def start\n raise 'Cannot start a peer pool twice.' if started\n logger.debug 'Start connecting other pears.'\n addr_list = peer_discovery.peers\n\n connect(addr_list)\n\n @started = true\n end", "def get_peers\n peers = self.peers\n end", "def spawn_connection\n connect\n end", "def exec(*args, &block)\n if current = Thread.current[:squirm_connection]\n current.exec(*args, &block)\n else\n use {|conn| conn.exec(*args, &block)}\n end\n end", "def remote_connections\n @remote_connections || @mutex.synchronize { @remote_connections ||= RemoteConnections.new(self) }\n end", "def open_remote(*uris, &block)\n open_worker(RemoteWorker, *uris, &block)\n end", "def peers_send(peers,message)\r\n\t\t\tpeers.each{|peer|\r\n\t\t\t\tsend_peer(peer,message)\r\n\t\t\t}\r\n\t\tend", "def peers\n @peers ||= ArkEcosystem::Client::API::Peers.new(@client)\n end", "def roby_app_call_remote_interface(\n host: \"localhost\", port: Interface::DEFAULT_PORT\n )\n interface = Interface.connect_with_tcp_to(host, port)\n yield(interface) if block_given?\n ensure\n interface&.close\n end", "def manageConnections(classifiedPeers)\n\n n = classifiedPeers.handshakingPeers.size + classifiedPeers.establishedPeers.size\n if n < @targetActivePeerCount\n result = classifiedPeers.disconnectedPeers.shuffle.first(@targetActivePeerCount - n)\n @logger.debug \"There are #{n} peers connected or in handshaking. Will establish #{result.size} more connections to peers.\"\n result\n else\n []\n end\n end", "def run_host\n loop {\n Thread.start(@host.accept) do |host|\n log(\"EDURange \", host, \" is accepted\\n\")\n while input = host.gets.split\n @connections.each do |client|\n inputCopy = input.clone\n inputCopy.slice!(0,1)\n if client.instanceID == input[0]\n puts(\"Client match\")\n string = inputCopy.join(\" \")\n client.client.puts(string)\n end\n end\n end\n end\n }.join\n end", "def tunnel_peer\n\tend", "def tunnel_peer\n\tend", "def peers\n if sessions.count > 0\n puts\n puts \"Currently Managing\"\n puts \"------------------\"\n puts\n sessions.each_with_index do |session, i|\n puts \"[#{i}] #{session.peername}\"\n end\n puts\n else\n puts \"No active sessions\"\n end\n nil\n end", "def establish_connections\n klass = Struct.new(:ip,:port)\n if t_servers = BackgrounDRb::BDRB_CONFIG[:client]\n connections = t_servers.split(',')\n connections.each do |conn_string|\n ip = conn_string.split(':')[0]\n port = conn_string.split(':')[1].to_i\n @bdrb_servers << klass.new(ip,port)\n end\n end\n @bdrb_servers << klass.new(BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip],BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port].to_i)\n @bdrb_servers.each_with_index do |connection_info,index|\n next if @backend_connections.detect { |x| x.server_info == \"#{connection_info.ip}:#{connection_info.port}\" }\n @backend_connections << Connection.new(connection_info.ip,connection_info.port,self)\n end\n end", "def remote_processes\n stdout = ''\n self.exec!(\"ps -o pid,ppid,cmd -u #{self.options[:user]}\") do |_channel, stream, data|\n stdout << data if stream == :stdout\n end\n # Sample output:\n # PID PPID CMD\n # 2202 1882 /bin/sh /usr/bin/startkde\n # 2297 2202 /usr/bin/ssh-agent /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/sa\n # 2298 2202 /usr/bin/gpg-agent --daemon --sh --write-env-file=/home/sayantamd/.gnupg/gpg-\n # 2301 1 /usr/bin/dbus-launch --exit-with-session /usr/bin/startkde\n # 2302 1 /bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session\n\n @remote_processes = []\n ps_line_rexp = Regexp.compile('^(\\d+)\\s+(\\d+)\\s+(.+?)$')\n stdout.split(\"\\n\").each do |line|\n line.strip!\n next if line.blank? || line.match(/^PID/i)\n matcher = ps_line_rexp.match(line)\n process = OpenStruct.new\n process.pid = matcher[1].to_i\n process.ppid = matcher[2].to_i\n process.cmd = matcher[3]\n @remote_processes.push(process.freeze)\n end\n\n @remote_processes\n end", "def join(c)\n connections << c\n end", "def each_host(wspace=workspace, &block)\n\t\twspace.hosts.each do |host|\n\t\t\tblock.call(host)\n\t\tend\n\tend", "def listpeers\n id = @utils.id_generate\n send_packet @utils.packet_mangler({\"Identifier\" => id, \"WithMetaData\" => true, \"WithVolatile\" => false},\"ListPeers\")\n wait_for id, /EndListPeers/\n end", "def connections\n @connections ||= []\n end", "def relay_command(data)\r\n EM.epoll\r\n EM.run do\r\n WinRM::Log.debug(\":relay_to_servers => #{data}\")\r\n servers ||= @servers.values.compact\r\n servers.each do |s|\r\n operation = proc do\r\n WinRM::Log.debug(\":relayed => #{s.host}\")\r\n @commands << s.run_command(data)\r\n end\r\n EM.defer(operation)\r\n end\r\n end\r\n end", "def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end", "def open\n iq1 = Iq.new(:set, @target_jid)\n iq1.from = @initiator_jid\n bs = iq1.add IqQueryBytestreams.new(@session_id)\n @streamhosts.each { |se|\n bs.add(se)\n }\n\n peer_used = nil\n @stream.send_with_id(iq1) { |response|\n if response.query.kind_of?(IqQueryBytestreams)\n peer_used = response.query.streamhost_used\n raise \"No streamhost-used\" unless peer_used\n raise \"Invalid streamhost-used\" unless peer_used.jid\n end\n }\n\n @streamhost_used = nil\n @streamhosts.each { |sh|\n if peer_used.jid == sh.jid\n @streamhost_used = sh\n break\n end\n }\n if @streamhost_used.jid == @initiator_jid\n # This is our own JID, so the target chose SOCKS5BytestreamsServer\n @socks = @streamhost_used.server.peer_sock(stream_address)\n raise \"Target didn't connect\" unless @socks\n @streamhost_cbs.process(@streamhost_used, :success, nil)\n else\n begin\n @socks = connect_socks(@streamhost_used)\n rescue Exception => e\n Jabber::debuglog(\"SOCKS5 Bytestreams: #{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\")\n @streamhost_cbs.process(@streamhost_used, :failure, e)\n raise e\n end\n iq2 = Iq.new(:set, @streamhost_used.jid)\n iq2.add(IqQueryBytestreams.new(@session_id)).activate = @target_jid.to_s\n @stream.send_with_id(iq2)\n end\n end", "def connect(*) end", "def reply(*args, &block)\n self.rooms.each do |room|\n room.reply(*args, &block)\n end\n end", "def peer\n \"#{rhost}:#{rport}\"\n end", "def update_peers( peers, &block )\n @peers_array = peers\n sorted_peers = @peers_array.inject( {} ) do |h, p|\n h[p[:url]] = framework.connect_to_instance( p )\n h\n end.sort\n\n @peers = Hash[sorted_peers]\n\n @peers[framework.multi_self_url] = framework\n\n @peers = Hash[@peers.sort]\n\n @peer_urls = @peers.keys\n @peer_clients = @peers.values\n\n if !master?\n block.call if block_given?\n return true\n end\n\n each = proc do |peer, iter|\n peer.spider.update_peers( @peers_array | [self_instance_info] ) {\n iter.return\n }\n end\n\n map_peers( each, proc { block.call if block_given? } )\n\n true\n end", "def exec &block\n connect!\n yield self\n ensure\n disconnect!\n end", "def connect(peer)\n return if @connections[peer]\n @connections[peer] = []\n peer.connections[self] = []\n\n Layout.parallel_links.times do\n local = add_link\n remote = peer.add_link\n @connections[peer].push([local, remote])\n peer.connections[self].push([remote, local])\n end\n end", "def execute(options = {}, &block)\n execute_with(@hosts, options, &block)\n end", "def get_results(in_progress)\nhostname2pid = {}\nin_progress.each { |pid, hostname|\n hostname2pid[hostname] = pid\n}\nissue_command_on_hosts(hostname2pid, 30){ |vp, pid| vp.get_results(pid) }\nend", "def connections\n connections = []\n self.requests.each do |request|\n if request.status == \"accepted\"\n if request.post.author == self\n connections << request.messenger\n else\n connections << request.post.author\n end\n end\n end\n connections\n end", "def run\n AMQP.start(:host => \"localhost\") {\n @mq = MQ.new\n @update_channel = EM::Channel.new\n @deferred_responses = {}\n\n @queue_name = \"cmdr:websocket:#{self.object_id}\"\n @queue = @mq.queue(@queue_name)\n \n # watch for responses from devices\n @queue.subscribe{|json|\n msg = JSON.parse(json)\n puts \"Got response: #{msg}\"\n if @deferred_responses[msg[\"id\"]]\n @deferred_responses.delete(msg[\"id\"]).succeed(msg)\n end\n }\n\n topic = @mq.topic(EVENT_TOPIC)\n @mq.queue(\"cmdr:websocket:#{self.object_id}:response\").bind(topic, :key => \"device.*\").subscribe do |json|\n handle_event json\n end\n\n setup\n\n EM::WebSocket.start({\n :host => \"0.0.0.0\",\n :port => 8000,\n :debug => false\n #:secure => true \n }) do |ws|\n\n ws.onopen { onopen ws }\n \n ws.onmessage {|json| onmessage ws, json}\n \n ws.onclose do\n @update_channel.unsubscribe(@sid) if @sid\n DaemonKit.logger.debug \"Connection on #{ws.signature} closed\"\n end\n\n ws.onerror do\n DaemonKit.logger.debug \"Error on #{ws.signature}\"\n end\n end\n }\n end", "def __rebuild_connections(arguments={})\n @hosts = arguments[:hosts] || []\n @options = arguments[:options] || {}\n __close_connections\n @connections = __build_connections\n end", "def propagate_connections(klass)\n connections.each { |n, o| klass.connection(n, o) }\n end", "def run (queue)\n loop do\n @LOG.debug \"waiting on #{@port_num}\"\n Thread.start(@server.accept) do |client|\n addr = client.addr\n addr.shift # removes \"AF_INET\"\n @LOG.info(\"accept connection addr: #{addr.join(\":\")}\")\n peer_addr = client.peeraddr\n peer_addr.shift # removes \"AF_INET\"\n @LOG.debug(\"connected to peer: #{peer_addr.join(\":\")}\")\n while size = client.recv(4).unpack(\"l\")[0]\n @LOG.debug \"begin receiving data with size #{size}\"\n data = client.recv(size)\n unmarshaled_data = Marshal.load(data)\n @LOG.debug \"data received (#{unmarshaled_data})\"\n queue.push unmarshaled_data\n end\n @LOG.info \"connection #{peer_addr.join(\":\")} is closed by other side\" \n end \n end\n end", "def use(*hosts, &block)\n options = hosts.last.is_a?(Hash) ? hosts.pop : {}\n options = { :via => default_gateway }.merge(options)\n\n results = hosts.map do |host|\n server_list.add(Server.new(self, host, options))\n end\n\n if block\n results << server_list.add(DynamicServer.new(self, options, block))\n end\n\n group [] => results\n results.length > 1 ? results : results.first\n end", "def hosts(opts)\n ::ApplicationRecord.connection_pool.with_connection {\n # If we have the ID, there is no point in creating a complex query.\n if opts[:id] && !opts[:id].to_s.empty?\n return Array.wrap(Mdm::Host.find(opts[:id]))\n end\n\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n\n conditions = {}\n conditions[:state] = [Msf::HostState::Alive, Msf::HostState::Unknown] if opts[:non_dead]\n conditions[:address] = opts[:address] if opts[:address] && !opts[:address].empty?\n\n if opts[:search_term] && !opts[:search_term].empty?\n column_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Mdm::Host, opts[:search_term])\n tag_conditions = Arel::Nodes::Regexp.new(Mdm::Tag.arel_table[:name], Arel::Nodes.build_quoted(\"(?mi)#{opts[:search_term]}\"))\n search_conditions = column_search_conditions.or(tag_conditions)\n wspace.hosts.where(conditions).where(search_conditions).includes(:tags).references(:tags).order(:address)\n else\n wspace.hosts.where(conditions).order(:address)\n end\n }\n end", "def launch!(options = {})\n @launch_time = Time.now\n @connected_to_socket = false\n @backend.spawn!\n\n b = self\n estabconn = proc do\n b.establish_connection\n end\n estabconn_callback = proc do |res|\n logger.info(\"Connection to #{b.socket} dead #{b.dead}\")\n end\n EM.defer(estabconn, estabconn_callback)\n end", "def execute( host_list = hosts, component_plan = [], opts = {} )\n opts = default_options.merge( opts )\n @formatter.colorize = ( opts[ :colorize ] != false )\n component_plan = resolve_component_plan( component_plan )\n\n if opts[ :threads ] && host_list.length > opts[ :threads ]\n queue = Queue.new\n host_list.each { |host| queue.push( host ) }\n threads = opts[ :threads ].times.map do\n Thread.new( queue, component_plan, opts ) do |q, cp, o|\n success = true\n begin\n while host = q.pop( true ) # non-block\n r = execute_host( host, cp, o )\n success &&= r\n end\n rescue ThreadError\n #exit, from queue being empty\n end\n success\n end\n end\n else\n threads = host_list.map do |host|\n Thread.new( host, component_plan, opts ) do |h, cp, o|\n execute_host( h, cp, o )\n end\n end\n end\n threads.inject(true) { |s,t| t.value && s }\n # Note: Unhandled (i.e. non-SyncError) exceptions will be\n # propigated and re-raised on call to value above, resulting in\n # standard ruby stack trace and immediate exit.\n end", "def run\n super\n r = Rex::Socket::RangeWalker.new @object.range\n r.each do|address|\n create_object(Host, {:ip_address => address})\n end\nend", "def run *ports\n @ports = ports unless ports.length == 0\n self.each do |vhost|\n vhost.on_server_start self\n end\n\n @running_processes = @ports.map do |port|\n launch_port(port)\n end\n @running_processes.flatten!\n self\n end", "def active_remotes\n @remote_forwarded_ports.keys\n end", "def slaveof(host, port); end", "def execute_remote\n\t\tcurAp = @apListBox.value;\n\t\tcmd = getVal(\"exec-remote on #{curAp.ip}\");\n\t\treturn if cmd.nil? or cmd == \"\";\n\n\t\ta = curAp.execute_remote(cmd).split( \"\\n\" );\n\t\t@entryListBox.empty\n\t\ta.each { |line|\n\t\t\t@entryListBox.add( \"#{line}\", {});\n\t\t}\n\tend", "def delete_host(opts)\n raise ArgumentError.new(\"The following options are required: :ids\") if opts[:ids].nil?\n\n ::ApplicationRecord.connection_pool.with_connection {\n deleted = []\n opts[:ids].each do |host_id|\n host = Mdm::Host.find(host_id)\n begin\n deleted << host.destroy\n rescue # refs suck\n elog(\"Forcibly deleting #{host.address}\")\n deleted << host.delete\n end\n end\n\n return deleted\n }\n end", "def peer; end", "def each_host(&blk)\r\n @hosts.each do |host|\r\n yield host\r\n end\r\n end", "def run(query)\n @connections.with { |c| query.run(c) }\n end", "def joinall\n @connections.each do |k,v|\n\tv[:thread].join\n end\n end", "def each_host(&block)\n\t\thosts.each do |host|\n\t\t\tblock.call(host)\n\t\tend\n\tend", "def remotes\n Supercarrier::RemoteProxy.new(@repository)\n end", "def remote_process\n start_r, start_w = IO.pipe\n quit_r, quit_w = IO.pipe\n remote_pid = fork do\n begin\n start_r.close\n yield\n rescue Exception => e\n puts e.full_message\n end\n\n start_w.write(\"OK\")\n quit_r.read(2)\n end\n start_w.close\n result = start_r.read(2)\n\n remote_processes << [remote_pid, quit_w]\n remote_pid\n ensure\n start_r.close\n end", "def worker\n\t\t require \"drb/drb\"\n\t\t require File.dirname(__FILE__) + \"/base\"\n\t\t $: << \"./\"\n\t\t Experiment::Config::init @options.env\n\t\t loop do\n\t\t @server_uri=\"druby://#{@options.master}:8787\"\n \t\t connect\n \t\t Notify::init 0, STDOUT, false, @master\n while item = @master.new_item\n #puts item\n exp = @master.experiment item\n require \"./experiments/experiment\"\n require \"./experiments/#{exp}/#{exp}\"\n \t\t\t cla = eval(as_class_name(exp))\n \t\t\t\texperiment = cla.new :slave, exp, @options\n \t\t\t experiment.master = @master.instance item\n \t\t\t experiment.run! 0\n end\n end\n\t end", "def run_host(ip)\n\n\t\t@thost = ip\n\n\t\tbegin\n\t\t\tudp_sock = nil\n\n\t\t\t@probes.each do |probe|\n\n\t\t\t# Send each probe to each host\n\n\t\t\t\tbegin\n\t\t\t\t\tdata, port = self.send(probe, ip)\n\t\t\t\t\t@tport = port\n\n\t\t\t\t\t# Create an unbound UDP socket if no CHOST is specified, otherwise\n\t\t\t\t\t# create a UDP socket bound to CHOST (in order to avail of pivoting)\n\t\t\t\t\tudp_sock = Rex::Socket::Udp.create( {\n\t\t\t\t\t\t'LocalHost' => datastore['CHOST'] || nil,\n\t\t\t\t\t\t'PeerHost' => ip, 'PeerPort' => port,\n\t\t\t\t\t\t'Context' => {'Msf' => framework, 'MsfExploit' => self}\n\t\t\t\t\t})\n\n\t\t\t\t\tudp_sock.put(data)\n\n\t\t\t\t\tr = udp_sock.recvfrom(65535, 0.1) and r[1]\n\t\t\t\t\tparse_reply(r) if r\n\n\t\t\t\trescue ::Interrupt\n\t\t\t\t\traise $!\n\t\t\t\trescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused, ::IOError\n\t\t\t\t\tnil\n\t\t\t\tensure\n\t\t\t\t\tudp_sock.close if udp_sock\n\t\t\t\tend\n\n\t\t\tend\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Unknown error: #{@thost}:#{@tport} #{e.class} #{e}\")\n\t\tend\n\tend", "def with_connections\n source_model.connection_pool.with_connection do\n destination_model.connection_pool.with_connection do\n yield\n end\n end\n end", "def connected_ports; end", "def run()\n Log.debug1(\"Running remote content client.\")\n threads = []\n threads << @remote_tcp.tcp_thread if @remote_tcp != nil\n threads << Thread.new do\n loop do\n # if need content data\n sleep_time_span = Params['remote_content_save_timeout']\n if @last_fetch_timestamp\n sleep_time_span = Time.now.to_i - @last_fetch_timestamp\n end\n Log.debug1(\"sleep_time_span: %s\", sleep_time_span)\n if sleep_time_span >= Params['remote_content_save_timeout']\n # Send ping!\n @remote_tcp.send_obj(nil)\n Log.info(\"sending ping request for remote content data!\")\n end\n sleep(sleep_time_span) if sleep_time_span > 0\n end\n end\n end", "def run(_remote_host = nil, _remote_port = nil)\n @sink.host = _remote_host if not _remote_host.nil?\n @sink.port = _remote_port if not _remote_port.nil?\n raise 'Remote host not set!' if @sink.host == 'localhost'\n\n run_main(true)\n end", "def call(*args)\n @procs.each { |e| e.call(*args) }\n end", "def find_github_connections(dev_list)\n dev_list_handles = dev_list.map(&:handle)\n GithubClient.find_connections(handle: handle, handle_list: dev_list_handles)\n end", "def run_queue(url='druby://127.0.0.1:61676')\n queue = Queue.new # Containing the jobs to be processed\n \n #Start up DRb with URI and object to share:\n DRb.start_service(url, queue)\n puts \"Listening for connection...\"\n while job = queue.deq\n yield job\n end\nend", "def cast()\n\n if @nodes.any? then\n \n threads = []\n dns = @dns\n\n @nodes.each do |raw_host, password|\n \n host, user = raw_host.split(/@/,2).reverse\n @results[host] = {}\n \n threads << Thread.new do\n begin\n puts ('host: ' + host.inspect).debug if @debug\n ssh = Net::SSH.start( host, user, password: password)\n @results[host] = Session.new(host, ssh, dns: dns, debug: @debug).exec @scroll\n ssh.close\n puts (host + ' result: ' + @results[host].inspect).debug if @debug\n rescue\n @results[host] = nil\n end\n end\n \n end \n\n threads.each(&:join)\n\n else\n \n if @scroll then\n host = `hostname`.chomp\n @results[host] = Session.new(host, dns: @dns, debug: @debug).exec(@scroll)\n end\n \n end\n\n @scroll = nil\n @results\n end", "def connections\n @connection_pool\n end", "def get_connections(queue)\n @connections.select { |con| con.src.label == queue.label }\n end", "def all_connections\n yield @conn.first if @conn\n end", "def peeraddrs\n @peeraddrs ||= {}\n end", "def remote_debug args\n require 'pry-remote'\n remote(args) do |ssh|\n ssh.forward.local 9876, '127.0.0.1', 9876\n ssh.forward.remote 9877, '127.0.0.1', 9877\n debugging = true\n Thread.new { ssh.loop { debugging } }\n PryRemote::CLI.new(['-P', '9877']).run\n debugging = false\n end\n end", "def remote(args, &block)\n args = { args => :servers } unless args.is_a?(Hash)\n local(args) do\n name = args.is_a?(Hash) ? args.keys[0] : args\n servers_selected.each do |current|\n begin\n server_was, @_current_server = @_current_server, current\n self.class.send(:define_method, name, &block)\n method = self.class.instance_method(name)\n self.class.send(:remove_method, name)\n block.arity == 1 ? method.bind(self).call(current) : method.bind(current).call\n ensure\n @_current_server = server_was\n end # begin\n end # servers\n end # local\n end", "def run_queue(url='druby://127.0.0.1:61676')\n queue = Queue.new # Containing the jobs to be processed\n\n # Start up DRb with URI and object to share\n DRb.start_service(url, queue)\n puts 'Listening for connection...'\n while job = queue.deq\n yield job\n end\nend", "def tunnel_peer\n\t\tbegin\n\t\t\t@peer_info = rstream.peerinfo\n\t\trescue ::Exception\n\t\t\t@peer_info ||= '127.0.0.1'\n\t\tend\n\tend", "def connect_to_members\n members = []\n\n seed = get_valid_seed_node\n\n seed.node_list.each do |host|\n node = Mongo::Node.new(self.connection, host)\n if node.connect && node.set_config\n members << node\n end\n end\n\n if members.empty?\n raise ConnectionFailure, \"Failed to connect to any given member.\"\n end\n\n members\n end", "def drb_queen(host = 'localhost')\n DRb.start_service\n queen = DRbObject.new_with_uri \"druby://#{host}:6666\"\n rescue => e\n puts e\n end", "def connect\r\n if @opts[:threadsafe]\r\n @conns = Knj::Threadhandler.new\r\n \r\n @conns.on_spawn_new do\r\n self.spawn\r\n end\r\n \r\n @conns.on_inactive do |data|\r\n data[:obj].close\r\n end\r\n \r\n @conns.on_activate do |data|\r\n data[:obj].reconnect\r\n end\r\n else\r\n @conn = self.spawn\r\n end\r\n end", "def make_call(*args)\n raise \"No connection established on #{@hostname}.\" unless connected?\n \n debug(\"Remote call: #{args.first} (#{args[1..-1].inspect})\")\n result = connection.call(*args)\n debug(\"Result: #{result}\\n\")\n result\n end", "def spawn_detached(args); end", "def remote_process\n\t start_r, start_w= IO.pipe\n\t quit_r, quit_w = IO.pipe\n\t remote_pid = fork do\n begin\n start_r.close\n yield\n rescue Exception => e\n puts e.full_message\n end\n\n start_w.write('OK')\n quit_r.read(2)\n\t end\n\t start_w.close\n\t result = start_r.read(2)\n\n\t remote_processes << [remote_pid, quit_w]\n\t remote_pid\n\n\tensure\n\t # start_r.close\n\tend", "def run\n EventMachine::run do\n @tcp = EventMachine::connect(config.server.host, config.server.port, TCPConnection)\n @tcp.client = self\n spectator_join\n end\n end", "def initialize(rhost,rport) end", "def run\n\t\tsuper\n\t\n\t\twhitelist = \"\"\n\t\tif (@object.class == Host)\n\t\t\twhitelist = @object.ip\n\t\telse \n\t\t\twhitelist = @object.range\n\t\tend\n\t\t\n\t\tif (@options[:task] == discover)\n\t\t\tconf = {\n\t\t\t\t'workspace' => \"default\",\n\t\t\t\t'username' => @project_name,\n\t\t\t\t\"ips\" => [whitelist], \n\t\t\t\t'DS_BLACKLIST_HOSTS' => \"\",\n\t\t\t\t'DS_PORTSCAN_SPEED' => \"3\",\n\t\t\t\t'DS_PORTS_EXTRA' => \"\",\n\t\t\t\t'DS_PORTS_BLACKLIST' => \"\",\n\t\t\t\t'DS_PORTS_CUSTOM' => \"\",\n\t\t\t\t'DS_PORTSCAN_TIMEOUT' => \"5\",\n\t\t\t\t'DS_UDP_PROBES' => \"true\",\n\t\t\t\t'DS_IDENTIFY_SERVICES' => \"true\",\n\t\t\t\t'DS_SMBUser' => \"\",\n\t\t\t\t'DS_SMBPass' => \"\",\n\t\t\t\t'DS_SMBDomain' => \"\",\n\t\t\t\t'DS_DRY_RUN' => \"false\",\n\t\t\t\t'DS_SINGLE_SCAN' => \"false\",\n\t\t\t\t'DS_FAST_DETECT' => \"false\",\n\t\t\t \t'DS_CustomNmap' => \"--reason\"\n\t\t\t}\n\n\t\t\tputs \"starting discover task\"\n\t\t\tret = @pro.start_discover(conf)\n\n\t\t\ttask_id = ret['task_id']\n\t\t\tputs \"started discover task \" + task_id\n\t\t\tpro.task_wait(ret['task_id'])\n\t\t\tputs \"done!\"\t\n\t\tend\n\n\t\t@object.save!\n\t\tnil\n\tend", "def manage(options)\n options = {:peername => options} if options.kind_of?(String)\n sessions << Session.open(options)\n \"Opened session to manage peer: #{options[:peername]}\"\n end", "def list\n if remotes.empty?\n puts \"No Roku boxes known\\n\" +\n \"Use the scan or add operations to find or add boxes\"\n else\n puts 'Roku boxes:'\n remotes.each_with_index do |box, i|\n print \"#{i+1}. #{box.name || '(no name)'} at #{box.host}\"\n print \"#{' <-- active' if i == remotes.active_index}\\n\"\n end\n end\n end", "def monitor_relays\n begin\n # Helps with latency\n Thread.current.priority = 2\n\n # See if we have any new connections on the existing reverse port\n # forward relays\n rev_chans.each do |rrfd|\n accept_reverse_relay(rrfd)\n end\n\n # Poll all the streams...\n begin\n socks = Rex::ThreadSafe.select(rfds, nil, nil, 0.25)\n rescue StreamClosedError => e\n dlog(\"monitor_relays: closing stream #{e.stream}\", 'rex', LEV_3)\n\n # Close the relay connection that is associated with the stream\n # closed error\n if e.stream.kind_of?(Stream)\n close_relay_conn(e.stream)\n end\n\n dlog(\"monitor_relays: closed stream #{e.stream}\", 'rex', LEV_3)\n\n next\n rescue => e\n elog(\"Error in #{self} monitor_relays select:\", 'rex', error: e)\n return\n end\n\n # If socks is nil, go again.\n next unless socks\n\n # Process read-ready file descriptors, if any.\n socks[0].each { |rfd|\n\n # If this file descriptor is a server, accept the connection\n if (rfd.kind_of?(StreamServer))\n accept_relay_conn(rfd)\n else\n # Otherwise, it's a relay connection, read data from one side\n # and write it to the other\n begin\n # Pass the data onto the other fd, most likely writing it.\n data = rfd.sysread(65536)\n rfd.other_stream.on_other_data(data)\n # If we catch an error, close the connection\n rescue ::Exception => e\n elog(\"Error in #{self} monitor_relays read\", 'rex', error: e)\n close_relay_conn(rfd)\n end\n end\n\n } if (socks[0])\n\n end while true\n end", "def hosts=(_arg0); end", "def hosts=(_arg0); end" ]
[ "0.66141766", "0.5685814", "0.5447587", "0.5206275", "0.51846236", "0.5155107", "0.5141587", "0.5111461", "0.510834", "0.5048246", "0.5025278", "0.49100885", "0.48911005", "0.48559332", "0.48534557", "0.4838163", "0.4836324", "0.48361152", "0.4830353", "0.48205438", "0.48202246", "0.48183408", "0.48114988", "0.47819117", "0.4752395", "0.47442144", "0.47403345", "0.47403345", "0.47382692", "0.4736928", "0.47237712", "0.47219163", "0.47194958", "0.47185317", "0.46992818", "0.46948498", "0.46854645", "0.4684777", "0.46567857", "0.46558186", "0.4652046", "0.46324876", "0.4620987", "0.46112874", "0.46009365", "0.45964277", "0.4582988", "0.4581808", "0.45741656", "0.4554645", "0.4551451", "0.45484477", "0.4539794", "0.4535087", "0.45304936", "0.452506", "0.45244667", "0.4522808", "0.45192242", "0.45130748", "0.45046774", "0.4496399", "0.44931975", "0.4491674", "0.44911268", "0.4486898", "0.44848263", "0.448222", "0.4481276", "0.4479534", "0.4478684", "0.4474808", "0.44649768", "0.4459335", "0.44586965", "0.44569826", "0.44508705", "0.44455102", "0.444419", "0.4442383", "0.44340584", "0.44308555", "0.44281453", "0.44245833", "0.44219485", "0.44217038", "0.441478", "0.44124505", "0.44123703", "0.44120347", "0.44050977", "0.44027367", "0.4398945", "0.43946746", "0.43933722", "0.43892825", "0.43807074", "0.43787536", "0.4376668", "0.4376668" ]
0.5155629
5
Record the association between a given object and a given pryremoteem connection.
def register(obj, peer) peers(obj).tap { |plist| plist.include?(peer) || plist.push(peer) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_associated_object(opts, o)\n raise(Error, \"associated object #{o.inspect} does not have a primary key\") if o && !o.pk\n _set_associated_object(opts, o)\n end", "def connection_established(pid, conn)\n @connections[pid.uuid] ||= conn\n __send__(conn.connected_callback, pid)\n @connections[pid.uuid].remote_pid || pid # looks like hack, but it is not.\n end", "def post_init\n puts \"connection established\"\n \n # store the eventmachine connection object id\n @connection.id = self.object_id\n end", "def associated_object\n bond.associated_object\n end", "def store_association(server_url, assoc)\n remove_association(server_url, assoc.handle)\n\n Association.create(:server_url => server_url,\n :handle => assoc.handle,\n :secret => Moped::BSON::Binary.new(:generic, assoc.secret),\n :issued => assoc.issued.to_i,\n :lifetime => assoc.lifetime,\n :assoc_type => assoc.assoc_type)\n end", "def setRelatedObject objid\n attribute_set(:relatedObjectId, objid)\n end", "def add_associated_object(opts, o)\n raise(Sequel::Error, 'model object does not have a primary key') unless pk\n raise(Sequel::Error, 'associated object does not have a primary key') if opts.need_associated_primary_key? && !o.pk\n return if run_association_callbacks(opts, :before_add, o) == false\n send(opts._add_method, o)\n @associations[opts[:name]].push(o) if @associations.include?(opts[:name])\n add_reciprocal_object(opts, o)\n run_association_callbacks(opts, :after_add, o)\n o\n end", "def store_association(server_url, association)\n oa = OpenidAssociation.new\n oa.server_url = server_url\n oa.target = targetize(server_url)\n oa.handle = association.handle\n oa.secret = association.secret\n oa.issued = association.issued\n oa.lifetime = association.lifetime\n oa.assoc_type = association.assoc_type\n oa.save\n end", "def association(name, *options); end", "def add_associated_object(opts, o, *args)\n o = make_add_associated_object(opts, o)\n raise(Sequel::Error, \"model object #{inspect} does not have a primary key\") if opts.dataset_need_primary_key? && !pk\n ensure_associated_primary_key(opts, o, *args)\n return if run_association_callbacks(opts, :before_add, o) == false\n return if !send(opts._add_method, o, *args) && opts.handle_silent_modification_failure?\n if array = associations[opts[:name]] and !array.include?(o)\n array.push(o)\n end\n add_reciprocal_object(opts, o)\n run_association_callbacks(opts, :after_add, o)\n o\n end", "def add_associated_object(opts, o, *args)\n klass = opts.associated_class\n if o.is_a?(Hash) && opts[:join_class].nil?\n o = klass.new(o)\n elsif o.is_a?(Integer) || o.is_a?(String) || o.is_a?(Array)\n o = klass.with_pk!(o)\n elsif !o.is_a?(klass)\n raise(Sequel::Error, \"associated object #{o.inspect} not of correct type #{klass}\")\n end\n raise(Sequel::Error, \"model object #{inspect} does not have a primary key\") if opts.dataset_need_primary_key? && !pk\n ensure_associated_primary_key(opts, o, *args)\n return if run_association_callbacks(opts, :before_add, o) == false\n return if !(r = send(opts._add_method, o, *args)) && opts.handle_silent_modification_failure?\n raise(Sequel::Error, \"expected #{opts[:join_class]} from _add_method got #{r.inspect}\") unless !opts[:join_class] or r.instance_of?(opts[:join_class])\n if array = associations[opts[:name]] and !array.include?(o)\n array.push(o)\n end\n add_reciprocal_object(opts, o)\n run_association_callbacks(opts, :after_add, o)\n opts[:join_class] ? r : o\n end", "def createAssociation\n bda = nil\n if (@source.class == UONObject) && (@destination.class == UONObject) then\n # need to create three items: associator, two connections\n ed = self.getEditor\n \n # position half-way between the @source and the @destination\n srcCenter, destCenter, w = @source.getCenter, @destination.getCenter, 15\n x0, y0 = (srcCenter[0] + destCenter[0])/2, (srcCenter[1] + destCenter[1])/2\n\n bda = UONAssociator.new( ed.getModelCanvas, x0, y0, x0 + w, y0 + w, ed)\n # will need to passivate bda srcConnector and destConnector attributes, and fill color\n bda.srcConnector = UONConnection.new( ed.getModelCanvas, 0, 0, 0, 0, ed, @source, bda) {\n updateCoords; filling \"purple\"; lower\n }\n bda.destConnector = UONConnection.new( ed.getModelCanvas, 0, 0, 0, 0, ed, bda, @destination) {\n updateCoords; filling \"purple\"; lower\n }\n end\n bda\n end", "def association\n a = element.dataset[:association]\n # send is spoopy, make sure the message you're sending is actually an association\n return unless safe?(session[:model], a)\n\n session[:model].send(a)\n end", "def associate_target(object)\n case target_class.associations[target_association][:type]\n when :has_one, :belongs_to\n object.update_attribute(target_attribute, source.id)\n when :has_many, :has_and_belongs_to_many\n object.update_attribute(target_attribute, target_ids.merge(Array(source.id)))\n end\n end", "def make_add_associated_object(opts, o)\n klass = opts.associated_class\n\n case o\n when Hash\n klass.new(o)\n when Integer, String, Array\n klass.with_pk!(o)\n when klass\n o\n else \n raise(Sequel::Error, \"associated object #{o.inspect} not of correct type #{klass}\")\n end\n end", "def connection\n self.class.connection[id] unless new_record?\n end", "def add_connection(connection)\n self.connections[connection.id] = connection\n end", "def store_association(server_url, association)\n raise NotImplementedError\n end", "def remote_object(object)\n\t if object.kind_of?(RemoteID)\n\t\tobject\n\t else object.sibling_on(self)\n\t end\n\tend", "def set_one_to_one_associated_object(opts, o)\n raise(Error, \"object #{inspect} does not have a primary key\") unless pk\n _set_associated_object(opts, o)\n end", "def associated_callbacks_log(obj, callback)\n\t\tif obj.associated_object\n\t\t\tmodel_obj = obj.associated_object\n\t\t\tcalling_obj = obj\n\t\tend\n\t\tlog_this(model_obj, callback, calling_obj, true)\n\tend", "def connect(args, &block)\n raise \"No object given.\" if !args[\"object\"]\n raise \"No signals given.\" if !args.key?(\"signal\") and !args.key?(\"signals\")\n args[\"block\"] = block if block_given?\n object = args[\"object\"].to_sym\n\n @callbacks[object] = {} if !@callbacks[object]\n conn_id = @callbacks[object].length.to_s\n @callbacks[object][conn_id] = args\n return conn_id\n end", "def set_one_through_one_associated_object(opts, o)\n raise(Error, \"object #{inspect} does not have a primary key\") unless pk\n raise(Error, \"associated object #{o.inspect} does not have a primary key\") if o && !o.pk\n _set_associated_object(opts, o)\n end", "def object_from_client(object, connection)\n\t\t\n\t\t\n\t\tobject\n\tend", "def <<(object)\n source.update_attribute(source_attribute, source_ids.merge(Array(object).collect(&:id)))\n Array(object).each {|o| self.send(:associate_target, o)} if target_association\n object\n end", "def test_binding_user_to_connection\n marge = users(:marge)\n maggie = users(:maggie)\n maggie_new_email = 'little_maggie@example.com'\n connection = create_connection_for(marge, name: 'The little one', email: maggie_new_email)\n\n assert_nil connection.friend, \"connection.friend should be blank, but is #{connection.friend}\"\n\n # now add identity with such email to Maggie\n idnt = User::Identity.new(email: maggie_new_email, provider: User::Identity::LOCAL_PROVIDER)\n assert maggie.identities << idnt\n\n # should be binded after_save\n assert_equal maggie, connection.reload.friend\n\n # when identity is destroyed, friend is set nil\n idnt.destroy\n\n assert_nil connection.reload.friend_id\n end", "def save(model)\n associated = model.instance_variable_get(\"@#{local_attr}\") # back door, don't want to trigger resolution\n promise = nil\n local_key_value = model.send(local_key)\n if has?\n if has_many?\n if associated\n unless associated.is_a?(Enumerable)\n fail \"#{model.class} expects has_many attr #{local_attr} to be an array or enumerable\"\n end\n associated.each do |a|\n check_associate(model, a, local_key_value, false)\n end\n end\n else # has_one?\n if associated\n check_associate(model, associated, local_key_value, true)\n associated = [associated]\n else\n msg = \" : #{model.class} association #{type} : expected #{local_attr} to be set\"\n trace __FILE__, __LINE__, self, __method__, msg\n # fail msg\n end\n end\n # is model is the owner, then do the database save of associations here\n if associated && owner?\n associated = associated\n promise = save_associates(local_key_value, associated)\n end\n elsif belongs_to? || join?\n check_associate(model, associated, local_key_value, true)\n else\n fail \"unhandled association type #{type}\"\n end\n Robe::Promise.value(promise || model)\n end", "def _set_associated_object(opts, o)\n a = associations[opts[:name]]\n return if a && a == o && !set_associated_object_if_same?\n run_association_callbacks(opts, :before_set, o)\n remove_reciprocal_object(opts, a) if a\n send(opts._setter_method, o)\n associations[opts[:name]] = o\n add_reciprocal_object(opts, o) if o\n run_association_callbacks(opts, :after_set, o)\n o\n end", "def add_associations(association, records, opts); end", "def publish(object)\n @channel << object\n end", "def save(object)\n tracker.queue(state(object).save(relation))\n self\n end", "def new_connection(relation_name, other_object, bidi)\n return Relation.create(relation_name, self.node, other_object.node, bidi)\n end", "def add(name, connection)\n @connections.store(name, connection)\n end", "def associate_data(object, key, data, opts = {})\n AssociationMap.associate_data(object, key, data, opts)\n end", "def find_and_connect_to_an_association(local_copy)\n if !(self.association_method.blank? || self.association_uuid.blank?) && (self.association_method_changed? || self.association_uuid_changed?)\n name_of_the_association_type = local_copy.attribute_names.delete_if{|x| !x.include?('_type')}.first\n association = local_copy.send(name_of_the_association_type).constantize.where(:uuid => self.association_uuid).first\n if association\n local_copy.send \"#{association_method}=\", association\n end\n end\n end", "def update_identity(identity_map)\n identity_map[@remote_key]=@object\n\n self\n end", "def register_tunnel_connection(connection)\n @tunnel_connections[connection.connection_id] = connection\n control_connection = connection.control_connection\n @tunnel_connections_by_control[control_connection] ||= Set.new\n @tunnel_connections_by_control[control_connection] << connection\n end", "def store_instance(object, attachment_method = nil)\n # ensure the impl has a reference to the wrapper object\n object.impl.instance_eval { @proton_wrapper = object }\n registry_key = get_key(object.impl)\n unless attachment_method.nil?\n record = Cproton.__send__(attachment_method, object.impl)\n rbkey = Cproton.Pn_rbkey_new\n Cproton.Pn_rbkey_set_registry(rbkey, Cproton.pn_rb2void(Qpid::Proton::Util::Wrapper.registry))\n Cproton.Pn_rbkey_set_method(rbkey, \"delete\")\n Cproton.Pn_rbkey_set_key_value(rbkey, registry_key)\n Cproton.pn_record_def(record, RBCTX, Cproton.Pn_rbkey__class());\n Cproton.pn_record_set(record, RBCTX, rbkey)\n end\n Qpid::Proton::Util::Wrapper.registry[registry_key] = object\n end", "def call_association(object, associations); end", "def connection\n self.field('Connection')\n end", "def set_project_connection\n @project = Project.find(params[:project_id])\n @project_connection = @project.project_connection\n end", "def connection=(val)\n @@connection = val\n end", "def attachTo _obj, _args\n \"_obj attachTo _args;\" \n end", "def associate klass, ident\n @associated_objects[klass].add?(ident) != nil\n end", "def associate(instance_id)\n associate_address(_id, instance_id)\n end", "def join(c)\n connections << c\n end", "def set_connection\n @connection = Connection.find(params[:id])\n end", "def set_connection\n @connection = Connection.find(params[:id])\n end", "def set_connection\n @connection = Connection.find(params[:id])\n end", "def put_object(parent_object, connection_name, args = {}, options = {}, &block)\n put_connections(parent_object, connection_name, args, options, &block)\n end", "def add_association(current_user)\n self.associate(current_user)\n 'New Oauth provider added'\n end", "def establish_connection\n end", "def create_association(obj, type)\n @logger.info(\"Creating association for #{type} #{obj.name}\")\n case type\n when \"agent\"\n iso = find_sugarcrm_object('iso', 'sf_id', obj.sf_iso)\n obj.associate! iso if iso\n when \"merchant\"\n \n payment_method_id = find_payment_method_id(obj.sf_id)\n if payment_method_id\n payment_method = find_sugarcrm_object('payment_method', 'sf_id', payment_method_id)\n obj.associate! payment_method\n end\n \n email_id = find_email_id(obj.sf_id)\n if email_id\n email = find_sugarcrm_object('email', 'sf_id', email_id)\n obj.associate! email\n end\n \n agent = find_sugarcrm_object('agent', 'sf_id', obj.sf_agent)\n if agent\n obj.associate! agent\n obj.assigned_user_id = agent.assigned_user_id\n end\n \n when \"settlement_bank_account\"\n merchant = find_sugarcrm_object('merchant', 'sf_id', obj.sf_merchant)\n obj.associate! merchant if merchant\n end\n obj\n end", "def set_findconnection\n @findconnection = Findconnection.find(params[:id])\n end", "def configure\n create_belongs_to :subject, class_name_option(:subject)\n create_belongs_to :object, class_name_option(:object)\n end", "def object_from_guzzoni(object, connection) \n\t\tobject\n\tend", "def associated_record\n assoication.active_record\n end", "def associate_address!(conn, server, pool_name = nil)\n pool_name ||= conn.addresses.get_address_pools.first['name']\n ip = conn.addresses.create(:pool => pool_name)\n ip.server = server\n server.reload\n end", "def remote_connections; end", "def association(association_name); end", "def foreign_object(*attributes)\n self.foreign_objects += attributes\n end", "def register_id(object, type, remote_id, local_id)\n @keymap[type.to_s][remote_id] = local_id\n c = object.class\n while !['Object', 'ActiveRecord::Base'].include?(c.name)\n @keymap[c.name][remote_id] = local_id\n c = c.superclass\n end\n end", "def on_connect(m)\n User(m.user.nick).monitor\n end", "def attach; end", "def relate\n resource_class = params[:related][:model].typus_constantize\n association_name = params[:related][:association_name].tableize\n\n if @item.send(association_name) << resource_class.find(params[:related][:id])\n notice = Typus::I18n.t(\"%{model} successfully updated.\", :model => @resource.model_name.human)\n end\n\n redirect_to :back, :notice => notice\n end", "def connect(venue)\n ContactVenueRelationship.create(contact_id: id,\n venue_id: venue.id)\n end", "def set_associated_object_if_same?\n @set_associated_object_if_same\n end", "def persist_to_database object, database\n object.with(session: database).save!\n $logger.debug \"..persisted to MongoDB: database: #{database.inspect}\\n....#{object.inspect}\\n\"\n end", "def association\n relation(source).associations[target]\n end", "def put_connection(conn)\n conn.close if !active?\n @connections.offer(conn)\n end", "def association!(association, record_id)\n if preloadable_association?(association.name)\n associations.register(association, record_id)\n end\n end", "def add_association(user_attribute_pe, operation_set, object_attribute_pe)\n assert_policy_element_in_machine(user_attribute_pe)\n assert_policy_element_in_machine(object_attribute_pe)\n assert_policy_element_in_machine(operation_set)\n\n PM::Association.create(user_attribute_pe, operation_set, object_attribute_pe, @uuid, @policy_machine_storage_adapter)\n end", "def propagate_connections(klass)\n connections.each { |n, o| klass.connection(n, o) }\n end", "def destination_connection=(val)\n @destination_connection = val\n end", "def add_relationship(rel_attr); end", "def process_push\n factory = \"::#{object_type}\".constantize\n local_object = factory.find(object_local_id)\n syncer = factory.synchronizer\n syncer.push_object(local_object)\n \n self.state = 'done'\n self.save\n end", "def on_connect(client_id, ip_address)\n @client_manager.add(client_id, ip_address)\n end", "def set_one_to_one_associated_object(opts, o)\n if opts.dataset_need_primary_key? && new?\n delay_validate_associated_object(opts, o)\n after_create_hook { super(opts, o) }\n o\n else\n super\n end\n end", "def attachObject _obj, _args\n \"_obj attachObject _args;\" \n end", "def connect_through_proxy; end", "def conn= x\n @conn_owned = false\n @conn = x\n end", "def relation_added(issue)\n journalize_action(\n :property => 'relation',\n :prop_key => 'relates',\n :value => issue.try(:id)\n )\n end", "def push_to_epic(epic_interface, origin, identity_id=nil, withhold_calendar=false)\n begin\n self.last_epic_push_time = Time.now\n self.last_epic_push_status = 'started'\n save(validate: false)\n\n Rails.logger.info(\"Sending study message to Epic - Study #{self.id}\")\n withhold_calendar ? epic_interface.send_study_creation(self) : epic_interface.send_study(self)\n\n self.last_epic_push_status = 'complete'\n save(validate: false)\n\n EpicQueueRecord.create(protocol_id: self.id, status: self.last_epic_push_status, origin: origin, identity_id: identity_id)\n rescue Exception => e\n Rails.logger.error(\"Push to Epic failed - Study #{self.id}\")\n Rails.logger.error([e.message, *e.backtrace].join($/))\n\n self.last_epic_push_status = 'failed'\n save(validate: false)\n EpicQueueRecord.create(protocol_id: self.id, status: self.last_epic_push_status, origin: origin, identity_id: identity_id)\n raise e\n end\n end", "def send_identity\n Eventr.delegate_to_receivers(:identity, ident_id, to_identity)\n end", "def checkin_connection(conn)\n @queue.push(conn)\n conn\n end", "def assoc_options\n # Wait to implement this in Phase IVa. Modify `belongs_to`, too.\n @assoc_options ||= {}\n @assoc_options\n end", "def set_monitor_association(opts)\n opts = check_params(opts,[:monitor_associations])\n super(opts)\n end", "def association_link(mc, assoc_obj)\n if mc\n t = h(mc.object_display_name(:association, request, assoc_obj))\n if mc.supported_action?(type, request)\n t = \"<a href=\\\"#{base_url_for(\"#{mc.link}/#{type}/#{mc.primary_key_value(assoc_obj)}\")}\\\">#{t}</a>\"\n end\n t\n else\n h(model.default_object_display_name(assoc_obj))\n end\n end", "def setup_associations; end", "def <<(object)\n unless include?(object)\n object.send(:\"#{@foreign_key}=\", @parent)\n object.save\n super\n end\n end", "def dump(object)\n if droby_id = context_objects[object]\n droby_id\n elsif object.respond_to?(:droby_dump)\n if sibling = object_manager.registered_sibling_on(object, peer_id)\n RemoteDRobyID.new(peer_id, sibling)\n else\n object.droby_dump(self)\n end\n else\n object\n end\n end", "def push_connection(conn_key, spec, th = nil)\n conns = tconf(th).connections\n n_conn = new_conn(conn_key, spec)\n conns.push(n_conn)\n tconf(th).stack_size += 1\n conns.last\n end", "def connection\n @em_connection\n end", "def triggerAttachObject _obj, _args\n \"_obj triggerAttachObject _args;\" \n end", "def add_artist_object_to_album_object!(album_object, artist_object)\n album_object.artist_id = artist.id\n end", "def associate(unit_id_source, unit_id_dest, group_id)\n debug_msg \"Adding node #{unit_id_dest} to receive events from group #{group_id} on node #{unit_id_source}\"\n self.send_cmd [\n Constants::Framing::PKT_START,\n Constants::FunctionClass::SEND_DATA,\n unit_id_source,\n 4, # length of command (class, command, two arguments)\n Constants::CommandClass::ASSOCIATION,\n Constants::Command::Association::SET,\n group_id,\n unit_id_dest,\n 0x25, # from reversing, no idea what this is\n next_callback_id\n ]\n end", "def associate(embed)\n embed.embed_will_change = lambda { embeds_will_change! }\n embed\n end", "def method_missing(method, *args, &block)\n connection_name = $1.pluralize.to_sym if method.to_s =~ /(.+?)(_ids)?(=)?$/\n if connection = connection_definition(connection_name || method)\n puts \"#{self.class.name} is building connection for #{connection[:klass].name}##{connection_name || method} in method_missing \" if Connectable.debug\n connection[:klass].instance_eval do\n connects_to connection[:destination], connection[:options].merge(now: true)\n end\n send method, *args\n else\n super\n end\n end", "def owned_connection(thread)\n sync{@allocated[thread]}\n end", "def owned_connection(thread)\n sync{@allocated[thread]}\n end" ]
[ "0.56070936", "0.54814255", "0.54501635", "0.5445855", "0.54047143", "0.53537416", "0.53358924", "0.5321213", "0.5310794", "0.5300171", "0.5268312", "0.5266322", "0.52365273", "0.5233372", "0.52143663", "0.52002984", "0.5198543", "0.5160214", "0.51321083", "0.5128225", "0.50924087", "0.50839967", "0.5073744", "0.5067949", "0.50454444", "0.5044237", "0.5014295", "0.49747682", "0.49716568", "0.49584207", "0.49339855", "0.49269527", "0.49053195", "0.48884663", "0.48874736", "0.4884555", "0.4863679", "0.48631385", "0.4861358", "0.4851438", "0.4838626", "0.4835696", "0.48311996", "0.48123786", "0.4798347", "0.47975534", "0.47857335", "0.47857335", "0.47857335", "0.4781428", "0.47806072", "0.47788727", "0.47717685", "0.4766187", "0.47658467", "0.4764962", "0.476016", "0.4752773", "0.47241262", "0.47231045", "0.47192582", "0.4715806", "0.4715723", "0.47088474", "0.47011393", "0.47008562", "0.46967366", "0.4694659", "0.46896964", "0.4689634", "0.46792823", "0.46789446", "0.46673784", "0.4663704", "0.46619242", "0.46617705", "0.46612412", "0.46498585", "0.4647416", "0.46448666", "0.4643575", "0.46422273", "0.46409938", "0.4635646", "0.46310598", "0.46302292", "0.4628331", "0.46272454", "0.4623884", "0.4608861", "0.46086678", "0.46080643", "0.46036932", "0.46033776", "0.46032372", "0.4598463", "0.45885575", "0.45858455", "0.45617205", "0.45617205" ]
0.4607448
92
Remove the association between a given object and a given pryremoteem connection.
def unregister(obj, peer) peers(obj).tap {|plist| true while plist.delete(peer) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_connection(relation_name, other_object, bidi)\n return Relation.delete(relation_name, self.node, other_object.node, bidi)\n end", "def remove_association(server_url, handle)\n raise NotImplementedError\n end", "def remove_associated_object(opts, o)\n raise(Sequel::Error, 'model object does not have a primary key') unless pk\n raise(Sequel::Error, 'associated object does not have a primary key') if opts.need_associated_primary_key? && !o.pk\n return if run_association_callbacks(opts, :before_remove, o) == false\n send(opts._remove_method, o)\n @associations[opts[:name]].delete_if{|x| o === x} if @associations.include?(opts[:name])\n remove_reciprocal_object(opts, o)\n run_association_callbacks(opts, :after_remove, o)\n o\n end", "def remove_relation\n relation_scope.where(@id_key => deleted_remote_objects_ids)\n end", "def remove_connection(connection)\n self.connections.delete(connection.id)\n end", "def remove(conn)\n @connections.delete conn\n @available.delete conn\n\n release conn.owner\n\n @available.add checkout_new_connection if @available.any_waiting?\n end", "def unconnect(args)\n raise ArgumentError, \"No object given.\" if !args[\"object\"]\n object = args[\"object\"].to_sym\n raise ArgumentError, \"Object doesnt exist: '#{object}'.\" if !@callbacks.key?(object)\n\n if args[\"conn_id\"]\n conn_ids = [args[\"conn_id\"]]\n elsif args[\"conn_ids\"]\n conn_ids = args[\"conn_ids\"]\n else\n raise ArgumentError, \"Could not figure out connection IDs.\"\n end\n\n conn_ids.each do |conn_id|\n raise Errno::ENOENT, \"Conn ID doest exist: '#{conn_id}' (#{args}).\" if !@callbacks[object].key?(conn_id)\n @callbacks[object].delete(conn_id)\n end\n end", "def unconnect\n relationship = ContactVenueRelationship.find_by(contact_id: id,\n venue_id: venue.id)\n relationship.destroy\n end", "def remove_associated_object(opts, o, *args)\n klass = opts.associated_class\n if o.is_a?(Integer) || o.is_a?(String) || o.is_a?(Array)\n o = remove_check_existing_object_from_pk(opts, o, *args)\n elsif !o.is_a?(klass)\n raise(Sequel::Error, \"associated object #{o.inspect} not of correct type #{klass}\")\n elsif opts.remove_should_check_existing? && send(opts.dataset_method).where(o.pk_hash).empty?\n raise(Sequel::Error, \"associated object #{o.inspect} is not currently associated to #{inspect}\")\n end\n raise(Sequel::Error, \"model object #{inspect} does not have a primary key\") if opts.dataset_need_primary_key? && !pk\n raise(Sequel::Error, \"associated object #{o.inspect} does not have a primary key\") if opts.need_associated_primary_key? && !o.pk\n return if run_association_callbacks(opts, :before_remove, o) == false\n return if !send(opts._remove_method, o, *args) && opts.handle_silent_modification_failure?\n associations[opts[:name]].delete_if{|x| o === x} if associations.include?(opts[:name])\n remove_reciprocal_object(opts, o)\n run_association_callbacks(opts, :after_remove, o)\n o\n end", "def remove(conn)\n synchronize do\n @connections.delete conn\n @available.delete conn\n\n release conn, conn.owner\n\n @available.add checkout_new_connection if @available.any_waiting?\n end\n end", "def remove_relation\n relation_scope.where.not(@id_key => remote_objects_ids)\n end", "def remove_connection\n\n\t\t# Set A and B\n\t\ta = self.current_user.id\n\t\tb = params[:user_id]\n\n\t\t# Delete both A -> B and B -> A (If we missed any duplicated records)\n\t\tConnection.where('(`owned_by` = ? && `user_id` = ?) || (`user_id` = ? && `owned_by` = ?)', a, b, a, b).each do |x|\n\t\t\tx.destroy\n\t\tend\n\t\t\n\t\t# Return to my connections\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to :my_connections }\n\t\tend\n\tend", "def remove_association(server_url, handle)\n deleted = delete(assoc_key(server_url, handle))\n server_assoc = get_association(server_url)\n if server_assoc && server_assoc.handle == handle\n deleted = delete(assoc_key(server_url)) | deleted\n end\n return deleted\n end", "def remove_and_close(connection)\n @connections.delete(connection)\n close_connection(connection)\n end", "def remove_relation(rel)\n relations.delete(rel)\n Roby.remove_relation(rel)\n end", "def remove_connection(resource, connection)\n @data['powerConnections'].reject! do |conn|\n conn['connectionUri'] == resource['uri'] && conn['deviceConnection'] == connection\n end\n end", "def remove(id, connection)\n found = find(id)\n\n if found.nil?\n return\n else\n @users[found[:index]][:connections].delete connection\n\n if @users[found[:index]][:connections].empty?\n @chat.root_room.shout Chat::Message.system(\"#{@users[found[:index]][:user].name} left\", @users[found[:index]][:user]).to_json\n @users.delete_at found[:index]\n else\n @chat.root_room.shout Chat::Message.system(\"#{@users[found[:index]][:user].name} left #{connection.room.identifier}\", @users[found[:index]][:user]).to_json\n end\n end\n end", "def unbind\n puts \"Connection terminated #{@my_connection_index}) #{@my_address} - #{@signature}\"\n\n pp self.inspect if error?\n\n # TODO: Remove connection from $connection_list\n end", "def deregister_object(local_object)\n siblings = siblings_by_local_object_id.delete(local_object.droby_id)\n siblings.each do |peer_id, droby_id|\n siblings_by_peer[peer_id].delete(droby_id)\n end\n\n if local_object.respond_to?(:name)\n n = local_object.name\n models_by_name.delete(n) if local_object == models_by_name[n]\n end\n end", "def delete(obj)\n association.delete_target(obj)\n end", "def remove! identifier\n connect do |connection|\n connection.remove( identifier )\n end\n end", "def remove_from(associated_model)\n self.send(associated_model.class.to_s.foreign_key + '=', nil)\n save(false)\n end", "def delete(object)\n source.update_attribute(source_attribute, source_ids - Array(object).collect(&:id))\n Array(object).each {|o| self.send(:disassociate_target, o)} if target_association\n object\n end", "def remove(connection)\n @mutex.synchronize do\n @connections.delete(connection)\n @checked_out.delete(connection)\n @condition.signal\n end\n close_connection(connection)\n @logger.debug {\"#{@name}: Removed connection #{connection}(#{connection.object_id}) self=#{self}\"}\n end", "def remove_connection(owner)\n self.clear_cache\n # Don't return a ConnectionSpecification hash since we've disabled establish_connection anyway\n return nil\n end", "def remove_connectionPoint! s\n _log { \"remove_connectionPoint! #{s.inspect}\" }\n\n @ownedMember.delete(s) # ownedElement?!?!\n @connectionPoint.delete(s)\n s.state = nil\n\n # Notify.\n s.connectionPoint_removed! self\n\n self\n end", "def disassociate!(target)\n associate!(target,{:delete => 1})\n end", "def delete(o); removeObject o end", "def remove_association(server_url, handle)\n assoc = get_association(server_url, handle)\n \n if assoc.nil?\n return false\n else\n filename = get_association_filename(server_url, handle)\n return self.remove_if_present(filename)\n end\n end", "def unsubscribe(object)\n subscriptions.delete(remote_object(object))\n end", "def disassociate_target(object)\n case target_class.associations[target_association][:type]\n when :has_one, :belongs_to\n object.update_attribute(target_attribute, nil)\n when :has_many, :has_and_belongs_to_many\n object.update_attribute(target_attribute, object.send(target_attribute) - Array(source.id))\n end\n end", "def remove_relationship(destiny, label)\n return if destiny.nil? or destiny == self\n edge_class = ModelFabric.get_class(SocialFramework.edge_class)\n\n edge = edge_class.where([\"(origin_id = :origin_id AND destiny_id = :destiny_id OR \n destiny_id = :origin_id AND origin_id = :destiny_id) AND label = :label\",\n { origin_id: self.id, destiny_id: destiny.id, label: label }]).first\n\n self.edges.destroy(edge.id) unless edge.nil?\n end", "def removed_sibling(remote_object)\n if remote_object.respond_to?(:remote_siblings)\n remote_object.remote_siblings.each_value do |remote_id|\n proxies.delete(remote_id)\n end\n else\n proxies.delete(remote_object)\n end\n end", "def delete(object)\n key_name = attributes.key[0].name\n key_value = object.public_send(key_name)\n relation.delete(key_name => key_value)\n object\n end", "def scaffold_remove_associated_object(association, object, associated_object)\n object.send(association).delete(associated_object)\n object.save\n end", "def remove(thread, conn, server)\n @connections_to_remove.delete(conn)\n allocated(server).delete(thread) if @servers.include?(server)\n @disconnection_proc.call(conn) if @disconnection_proc\n end", "def remove_remote(name)\n self.lib.remote_remove(name)\n end", "def remove_association(server_url, handle)\n oas = OpenidAssociation.find_all_by_target targetize(server_url)\n return false unless oas.collect(&:handle).include? handle\n oas.find_all { |oa| oa.handle == handle }.each(&:delete).size > 0\n end", "def delete(object)\n tracker.queue(state(object).delete(relation))\n self\n end", "def remove_relation(from, to)\n if !linked?(from, to)\n return\n end\n\n\t rel = self\n\t relations = []\n\t while rel\n\t\trelations << rel\n\t\trel = rel.parent\n\t end\n\n\t if from.respond_to?(:removing_child_object)\n\t\tfrom.removing_child_object(to, relations)\n\t end\n\t if to.respond_to?(:removing_parent_object)\n\t\tto.removing_parent_object(from, relations)\n\t end\n\n\t for rel in relations\n\t\trel.unlink(from, to)\n\t end\n\n\t if from.respond_to?(:removed_child_object)\n\t\tfrom.removed_child_object(to, relations)\n\t end\n\t if to.respond_to?(:removed_parent_object)\n\t\tto.removed_parent_object(from, relations)\n\t end\n\tend", "def forget_peer(peer)\n\t if remote_object = remove_sibling_for(peer)\n\t\tpeer.removing_proxies[remote_object] << droby_dump(nil)\n\n\t\tif peer.connected?\n\t\t peer.transmit(:removed_sibling, remote_object, self.remote_id) do\n\t\t\tset = peer.removing_proxies[remote_object]\n\t\t\tset.shift\n\t\t\tif set.empty?\n\t\t\t peer.removing_proxies.delete(remote_object)\n\t\t\tend\n\t\t\tyield if block_given?\n\t\t end\n\t\telse\n\t\t peer.removing_proxies.delete(remote_object)\n\t\tend\n\t end\n\tend", "def unlinkItem _obj, _args\n \"_obj unlinkItem _args;\" \n end", "def delete(connection)\n @streams[connection.class.to_s].delete(connection)\n end", "def unfriend!(resource)\n redis.multi do\n redis.hdel(friend_list_key, resource.id)\n redis.hdel(resource.friend_list_key, self.id)\n end\n end", "def remove_related(guid, name, other_guid, find_model=model)\n do_related('remove', guid, name, other_guid, find_model)\n end", "def destroy\n conn.delete(self_link)\n end", "def remove_connection\n flash[:notice] = I18n.t(:remove_social_connection)\n\t Authentication.remove_conn(current_gamer.id, params[:provider])\n\t redirect_to \"/gamers/edit\"\n\tend", "def delete(name)\n @connections.delete(name)\n end", "def unbind\n puts \"connection #{@connection.id.to_s} unbound\"\n begin\n unless !@registered\n self.unregister(@user.uuid)\n $ws_notifier.call(\"#{@user.uuid} just left the server\",\"disconnection\")\n else\n puts \"Never registered. So don't try to kill connection data\"\n end\n rescue\n puts \"Error (unbind). Couldn't delete from hash\"\n end\n puts \"Person is no longer connected\"\n end", "def delete(obj_or_request)\n Connection.new.delete get_request(obj_or_request)\n end", "def remove_pending(*args)\n\n\t\t# Redirect to remove connection since it is an unbiased connection removed and would do this anyway\n\t\tself.send('remove_connection', *args)\n\tend", "def remove_membership(entity)\n\t\tremove_association(entity, \"membership\", \"joinable\", \"joined\")\n\tend", "def deregister_tunnel_connection(connection)\n @tunnel_connections.delete connection.connection_id\n control_connection = connection.control_connection\n @tunnel_connections_by_control[control_connection].delete connection\n end", "def delete( object )\n\n write_targets do |target|\n rel = rel_for_object( object )\n target.reject! { |l| l['rel'] == rel }\n end\n\n if (c = @klass.correlation_for( object )) && c.recipocal?\n if self.owner && object.respond_to?( :links )\n if object.links.recipocal?( self.owner )\n object.links.delete( self.owner )\n object.save unless object.new? || @recipocating\n end\n end\n end\n\n self.owner.save if self.owner && !self.owner.new? && !@recipocating\n\n self\n end", "def finalizer\n lambda { |object_id| Tunnel.remove(object_id.abs.to_s) rescue nil }\n end", "def pop\n connections.synchronize do\n evict\n _, connection = connections.pop\n connection\n end\n end", "def remove(obj)\n @set.removeObject obj\n end", "def del\n connection.del(key_label)\n end", "def unbind\n #@node.notifiers.unsubscribe(@notify_sid) if @notify_sid\n @node.command_connections.delete(self)\n end", "def delete_relation_for association\n @relations.reject!{ |r| r.association == association || r.association == association.singularize}\n end", "def op_remove_relation!(field, objects = [])\n objects = [objects] unless objects.is_a?(Array)\n return false if objects.empty?\n relation_action = Parse::RelationAction.new(field, polarity: false, objects: objects)\n operate_field! field, relation_action\n end", "def forget_dependencies_for(object)\n @graph.delete_edges_to(object)\n end", "def removeHandgunItem _obj, _args\n \"_obj removeHandgunItem _args;\" \n end", "def delete_active_connection\n super\n end", "def with_connection_auto_remove\n with_connection do |connection|\n begin\n yield connection\n rescue Exception\n remove(connection)\n raise\n end\n end\n end", "def delete\n @mapper.delete(@remote_key)\n\n forget\n end", "def scaffold_remove_associated_objects(association, object, options, *associated_object_ids)\n unless associated_object_ids.empty?\n scaffold_transaction do\n associated_objects = associated_object_ids.collect do |associated_object_id|\n associated_object = scaffold_association_find_object(association, associated_object_id.to_i, :session=>options[:session])\n scaffold_remove_associated_object(association, object, associated_object)\n associated_object\n end\n associated_object_ids.length == 1 ? associated_objects.first : associated_objects\n end\n end\n end", "def remove_from_graph\n # Ignores trying to delete nonexistent records\n connection.execute <<-EOS\n DELETE IGNORE FROM #{oqgraph_table_name} WHERE origid = #{self.send(self.class.from_key)} AND destid = #{self.send(self.class.to_key)};\n EOS\n end", "def remove_observer(o)\n @cpg.remove_observer(o)\n end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def rm(target)\n target.active_record_instance.destroy\n end", "def unfollow(other_person)\n active_relationships.find_by(followed_id: other_person.id).destroy\n end", "def remove_all_associated_objects(opts, *args)\n raise(Sequel::Error, \"model object #{inspect} does not have a primary key\") if opts.dataset_need_primary_key? && !pk\n send(opts._remove_all_method, *args)\n ret = associations[opts[:name]].each{|o| remove_reciprocal_object(opts, o)} if associations.include?(opts[:name])\n associations[opts[:name]] = []\n ret\n end", "def destroy_associations\n end", "def remove_all_associated_objects(opts)\n raise(Sequel::Error, 'model object does not have a primary key') unless pk\n send(opts._remove_all_method)\n ret = @associations[opts[:name]].each{|o| remove_reciprocal_object(opts, o)} if @associations.include?(opts[:name])\n @associations[opts[:name]] = []\n ret\n end", "def plan_remove_object(plan, object)\n\t\tif local = peer.local_object(object, false)\n\t\t # Beware, transaction proxies have no 'plan' attribute\n\t\t plan = peer.local_object(plan)\n\t\t Distributed.update(plan) do\n\t\t\tDistributed.update(local) do\n\t\t\t plan.remove_object(local)\n\t\t\tend\n\t\t end\n\t\t local.forget_peer(peer)\n\t\tend\n\n\t rescue ArgumentError => e\n\t\tif e.message =~ /has not been included in this plan/\n\t\t Roby::Distributed.warn \"filtering the 'not included in this plan bug'\"\n\t\telse\n\t\t raise\n\t\tend\n\t end", "def delete_identity(identity_map)\n identity_map.delete(@remote_key)\n\n self\n end", "def destroy(context={})\n self.class.rpc_execute('unlink', self.id, context)\n end", "def unassociated_mtm_objects(request, assoc, obj)\n ref = model.association_reflection(assoc)\n assoc_class = associated_model_class(assoc)\n lambda do |ds|\n subquery = model.db.from(ref[:join_table]).\n select(ref.qualified_right_key).\n where(ref.qualified_left_key=>obj.pk)\n ds = ds.exclude(S.qualify(ref.associated_class.table_name, ref.associated_class.primary_key)=>subquery)\n ds = assoc_class.apply_dataset_options(:association, request, ds) if assoc_class\n ds\n end\n end", "def unlink(actor)\n current_actor = Thread.current[:actor]\n\n actor.notify_unlink(current_actor.proxy)\n current_actor.notify_unlink(actor)\n end", "def unbind\n client = $clients_list.delete(self.object_id)\n \n $clients_list.values.each do |c|\n send_client_disconnect(c, client) if c.socket != self\n end\n \n end", "def unregister(uuid)\n if $connections.has_key? (@user.uuid)\n $connections.delete(@user.uuid)\n end\n end", "def remove_association request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_remove_association_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def delete(sObjectType, hParams)\n case sObjectType\n when :network\n HPNetwork.delete_network(hParams[:network_connection],\n hParams[:network])\n when :rule\n HPSecurityGroups.delete_rule(hParams[:network_connection],\n hParams[:id])\n obj = hParams[:network_connection]\n obj.security_group_rules.get(hParams[:id]).destroy\n when :server\n required?(hParams, :compute_connection)\n required?(hParams, :server)\n HPCompute.delete_server(hParams[:compute_connection],\n hParams[:server])\n end\n end", "def delete(object); end", "def synced_destroy(association)\n set_callback(\n :destroy,\n :after\n ) do |doc|\n doc.remove_inverse_keys(association)\n end\n self\n end", "def remove_check_existing_object_from_pk(opts, o, *args)\n key = o\n pkh = opts.associated_class.qualified_primary_key_hash(key)\n raise(Sequel::Error, \"no object with key(s) #{key.inspect} is currently associated to #{inspect}\") unless o = send(opts.dataset_method).first(pkh)\n o\n end", "def relation_removed(issue)\n journalize_action(\n :property => 'relation',\n :prop_key => 'relates',\n :old_value => issue.try(:id)\n )\n end", "def delete(obj) ; end", "def dissociate klass, ident\n @associated_objects[klass].delete?(ident) != nil\n end", "def disconnect_connection(conn)\n sync{@size[0] -= 1}\n super\n end", "def destroy\n connection.close\n end", "def destroy\n orchio_delete\n end", "def destroy\n object_id = BSON::ObjectId.from_string(@id)\n self.class.collection.find(:_id => object_id).delete_one\n end", "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def disconnect!() @connections.each_value(&:disconnect) end", "def remove_connectionPoint! s\n _log { \"remove_connectionPoint! #{s.inspect}\" }\n\n @connectionPoint.delete(s)\n s.state = nil\n\n # Notify.\n s.connectionPoint_removed! self\n\n self\n end", "def delete(object)\n @monitor.delete(object.key)\n object.unsubscribe(self)\n super(object)\n end", "def detach_relationship(data) #FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.\n return @client.raw(\"post\", \"/config/relationships/detach\", nil, data)\n end", "def unown!(owned)\r\n master_song_relationships.find_by_master_song_owned_id(owned).destroy\r\n end" ]
[ "0.67301714", "0.65093297", "0.6493623", "0.6415994", "0.63365436", "0.6322572", "0.6269781", "0.6254589", "0.6248836", "0.62135637", "0.6198612", "0.6184476", "0.6069441", "0.6059727", "0.5975634", "0.5964121", "0.5946139", "0.59359527", "0.5907842", "0.5901945", "0.58937865", "0.58549553", "0.5838252", "0.58190596", "0.5800212", "0.57946193", "0.57905143", "0.5782973", "0.57745886", "0.57568306", "0.57282394", "0.57156026", "0.57076603", "0.5703576", "0.56965125", "0.5688829", "0.56860477", "0.56777644", "0.56613237", "0.56492543", "0.5638519", "0.56367594", "0.5595597", "0.55908763", "0.5585519", "0.55845326", "0.55815643", "0.55782264", "0.55778295", "0.5564683", "0.55546546", "0.55524683", "0.5548468", "0.5546512", "0.5505661", "0.5488724", "0.54850805", "0.54796016", "0.5477527", "0.54473644", "0.54410535", "0.541686", "0.5416277", "0.5407077", "0.5400869", "0.5392244", "0.53899807", "0.53897417", "0.53892815", "0.5376823", "0.53721637", "0.53643435", "0.5345881", "0.5336925", "0.5336916", "0.5332488", "0.5321936", "0.5316532", "0.5307707", "0.53055006", "0.53019947", "0.5289927", "0.52877253", "0.5282465", "0.52805454", "0.5275339", "0.5272678", "0.52674186", "0.5259519", "0.52593553", "0.5255432", "0.52540344", "0.52519596", "0.5240659", "0.5236529", "0.52346796", "0.52263856", "0.52117187", "0.5195388", "0.5181824" ]
0.5416738
62
added by banisterfiend, return a hash of nests classes/modules for mod each key in hash is the class/module and the value is true/false indicating whether nested classes exist under it
def browser_hash_for(mod) mod.constants(false).each_with_object({}) do |c, h| if (o = mod.const_get(c)).is_a?(Module) then begin h[c] = o.constants(false).any? { |c| o.const_get(c).is_a? Module } rescue next end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classes\n return @classes if @classes\n @classes = {}\n @stores.each do |store|\n store.cache[:modules].each do |mod|\n # using default block causes searched-for modules to be added\n @classes[mod] ||= []\n @classes[mod] << store\n end\n end\n @classes\n end", "def classes\n return @classes if @classes\n\n @classes = {}\n\n @stores.each do |store|\n store.cache[:modules].each do |mod|\n # using default block causes searched-for modules to be added\n @classes[mod] ||= []\n @classes[mod] << store\n end\n end\n\n @classes\n end", "def search_class(module_name)\n file_array = module_name.split('::')\n\n #search module path for the class\n $mod_dir.each do |y|\n if File.directory?(\"#{y}/#{file_array[0]}\")\n @filename = \"#{y}/#{file_array[0]}\"\n break\n end\n end\n\n #did we find the class?\n if defined? @filename\n @filename = \"#{@filename}/manifests\"\n #if base case make the path correct, else fill out the whole path with sub classes\n if file_array.count == 1\n @filename = \"#{@filename}/init\"\n else\n file_array.shift\n file_array.each do |k|\n @filename = \"#{@filename}/#{k}\"\n end\n end\n @filename = \"#{@filename}.pp\"\n else\n #Error if class cannot be found\n puts \"Cannot find class\"\n return 0\n end\n\n #Determine if the file actually exists\n if not File.exists?(@filename)\n puts \"No such class\"\n return 1\n end\n\n #Read the file\n f = File.open(@filename,'r')\n g =f.readlines\n\n #loop through the lines and find recourses and included classes\n g.each do |val|\n # find resources\n if n = val.match(/^[ \\t]*[a-z:].*{[ \\t]*['\\\"].*['\\\"]:/)\n out_val = n[0].sub(/\"/,\"'\").gsub(/\\s+/,\"\")\n #Determine if we have a duplicate resource and display if we do\n if $resource_variables.has_key?(out_val)\n puts \"\\n******** DEPLICATE FOUND! ********\"\n $resource_variables[out_val] = $resource_variables[out_val].push(module_name)\n puts \"#{out_val} defined in these classes: #{$resource_variables[out_val]}\"\n else\n #Add resource to hash with name of containing class\n $resource_variables[out_val] = [module_name]\n end\n next\n end\n # find included classes\n if m = val.match(/^[ \\t]*include[ \\t]*.*/)\n out_val = m[0]\n x = m[0].gsub(/^[ \\t]*include[ \\t]/,'')\n #if class is not in our array add it and then call this class to iterate that included class\n if not $include_variables.include?(x)\n $include_variables.push(x.strip)\n search_class(x)\n end\n end\n end\nend", "def classes_and_modules\n classes + modules\n end", "def classes_and_modules\n classes + modules\n end", "def lookup_classes(met)\n new_klasses = @module_collection.keys\n res = Hash.new { |h, k| h[k] = [] }\n @method_collection.list.select { |method_info| method_info.name == met.to_sym }.map do |method_info|\n m_owner = method_info.owner\n # add method_info myself to res\n res[m_owner] << MethodStat.new(method_info, ModuleInfo.root(m_owner), 0)\n\n owner_module_info = find_module_info(method_info)\n new_klasses.each do |klass|\n next if klass == method_info.owner\n if (idx = klass.ancestors.index(method_info.owner))\n raise ModuleNotFoundError if owner_module_info.nil?\n res[klass] << MethodStat.new(method_info, owner_module_info, idx - self.class.offset(klass))\n end\n end\n end\n res\n end", "def namespace_hierarchy(mod)\n parent = Object\n hier = [parent]\n\n # name is not present on anonymous modules\n if mod.name\n mod.name.split('::').each do |part|\n parent = parent.const_get(part)\n hier << parent\n end\n end\n\n hier.reverse\n end", "def tree(visited, tree_ary, mod, depth=0)\n if !mod.is_a?(Module) || visited[mod]\n return nil\n end\n ary = []\n tree_ary.push(mod, ary)\n visited[mod] = true\n mod.constants.map do |name|\n tree(visited, ary, mod.const_get(name), depth+1)\n end\nend", "def all_modules klass, trash = []\n trash = [*trash]\n trash += [klass]\n children = shallow(klass, trash)\n all = [klass, children.\n map { |x| all_modules x, trash + children }].\n flatten.select { |x| Module === x }\n all\n end", "def has_classes_or_modules?\n has_classes? || has_modules?\n end", "def nested_has_many_classes\n has_many_classes.select{|k| nested_attributes.include?(k)}\n end", "def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend", "def model_classes(classes = Map.model_classes)\n nested_hash = classes.each_with_object({}) do |klass, hash|\n hash[klass] = Node.new(klass)\n end\n nested_hash.each do |klass, node|\n node.parent = parent = nested_hash[klass.superclass]\n parent.children << node if parent\n end\n nested_hash.values.select { |v| v.parent.nil? }\n end", "def class_tree\n @class_tree ||= generate_class_tree\n end", "def all_classes_and_modules\n @classes_hash.values + @modules_hash.values\n end", "def nested_belongs_to_classes\n belongs_to_classes.select{|k| nested_attributes.include?(k)}\n end", "def included_in_modules\n modules = []\n ObjectSpace.each_object(Module) { |k| modules << k if k.included_modules.include?(self) }\n\n modules.reverse.inject([]) do |unique_modules, klass|\n unique_modules << klass unless unique_modules.collect { |k| k.to_s }.include?(klass.to_s)\n unique_modules\n end\n end", "def classes_and_includes_and_extends_for name\n klasses = []\n extends = []\n includes = []\n\n found = @stores.map do |store|\n begin\n klass = store.load_class name\n klasses << klass\n extends << [klass.extends, store] if klass.extends\n includes << [klass.includes, store] if klass.includes\n [store, klass]\n rescue RDoc::Store::MissingFileError\n end\n end.compact\n\n extends.reject! do |modules,| modules.empty? end\n includes.reject! do |modules,| modules.empty? end\n\n [found, klasses, includes, extends]\n end", "def classes_hash\n @classes\n end", "def classes_hash\n @classes\n end", "def inheritance_tree(include_mods = T.unsafe(nil)); end", "def checkInheritCycle(pmaps)\n visited = Set.new\n pmaps.each do |c,_|\n # Skip this class if we've already seen it\n if visited.include?(c)\n next\n end\n visited.add(c)\n\n # Done if no parent class\n if pmaps[c] == 'Object'\n next\n end\n n = pmaps[c]\n\n # Follow super class chain to end, loop, or already visited class\n while n != 'Object' && n != c && !visited.include?(n) do\n visited.add(n)\n n = pmaps[n]\n end\n\n #if we are back at the start\n if n == c\n return true\n end\n end\n return false\nend", "def classmap\n return @classmap if @classmap\n # read SCHEMA and build class index to find .mof files quickly\n @classmap = Hash.new\n @includes = [ Pathname.new(\".\") ]\n SCHEMATA.each do |base, file|\n @includes << base\n allow_cim = (file =~ /^CIM_/) # allow CIM_ only for CIM_Schema.mof\n File.open(File.join(base, file)) do |f|\n f.each do |l|\n if l =~ /^\\#pragma\\sinclude\\s?\\(\\\"(([\\w\\/_]+)\\.mof)\\\"\\).*/\n # $1 Foo/Bar.mof\n # $2 Foo/Bar\n path = $1\n names = $2.split(\"/\")\n name = names[1] || names[0]\n next unless name =~ /_/ # class name must have underscore (rules out 'qualifiers.mof')\n# puts \"#{path}:#{name}\"\n next if !allow_cim && name =~ /^CIM_/ # skip CIM_ mofs unless allowed\n if @classmap[name]\n raise \"Dup #{name} : #{@classmap[name]}\"\n else\n @classmap[name] = { :path => path }\n end\n end\n end\n end\n end\n STDERR.puts \"Found MOFs for #{@classmap.size} classes\" if Wbem.debug\n @classmap\n end", "def class_scope?\n @type == :class or @type == :module\n end", "def modules_hash\n @modules\n end", "def modules_hash\n @modules\n end", "def all_classes_and_modules\n result = []\n ObjectSpace.each_object(Module) { |m| result << m }\n result.sort_by {|m| m.name}\nend", "def classes_hash\n @classes_hash\n end", "def class_scope?\n @type == :class || @type == :module\n end", "def her_sibling_class(name)\n if mod = her_containing_module\n @_her_sibling_class ||= Hash.new { Hash.new }\n @_her_sibling_class[mod][name] ||= \"#{mod.name}::#{name}\".constantize rescue nil\n end\n end", "def find_classes\n puppetClasses = []\n Dir.glob( SpkDashboard::MANIFEST_ROOT + \"/modules/**/*.pp\" ).each do |manifest|\n File.read( manifest ).each do |line|\n foundClass = line.match(/^class (\\S+).*\\{/)\n if foundClass and puppetClasses.include?( foundClass[1] ) == false\n puppetClasses << foundClass[1]\n end\n end\n end\n \n return puppetClasses\n end", "def all_classes_and_modules_in_gem_named(gem)\n self.all_classes_and_modules.select { |klassmod| klassmod.belongs_to?(gem) }\n end", "def boring_classes\n return [::Class, *::Class.included_modules,\n ::Module, *::Module.included_modules,\n ::Kernel, *::Kernel.included_modules,\n ::Object, *::Object.included_modules,\n ::BasicObject, *::BasicObject.included_modules].uniq\n end", "def get_all_classes(path = File.join(__dir__, '../knowledge/classes_hierarchy.json'))\n data = ensure_load_json(path, {})\n HashHelper.recursive_map_keys(data)\n end", "def handle_class_module(var_name, type, class_name, parent, in_module)\n parent_name = @known_classes[parent] || parent\n\n if in_module then\n enclosure = @classes[in_module] || @store.find_c_enclosure(in_module)\n\n if enclosure.nil? and enclosure = @known_classes[in_module] then\n enc_type = /^rb_m/ =~ in_module ? :module : :class\n handle_class_module in_module, enc_type, enclosure, nil, nil\n enclosure = @classes[in_module]\n end\n\n unless enclosure then\n @enclosure_dependencies[in_module] << var_name\n @missing_dependencies[var_name] =\n [var_name, type, class_name, parent, in_module]\n\n return\n end\n else\n enclosure = @top_level\n end\n\n if type == :class then\n full_name = if RDoc::ClassModule === enclosure then\n enclosure.full_name + \"::#{class_name}\"\n else\n class_name\n end\n\n if @content =~ %r%Document-class:\\s+#{full_name}\\s*<\\s+([:,\\w]+)% then\n parent_name = $1\n end\n\n cm = enclosure.add_class RDoc::NormalClass, class_name, parent_name\n else\n cm = enclosure.add_module RDoc::NormalModule, class_name\n end\n\n cm.record_location enclosure.top_level\n\n find_class_comment cm.full_name, cm\n\n case cm\n when RDoc::NormalClass\n @stats.add_class cm\n when RDoc::NormalModule\n @stats.add_module cm\n end\n\n @classes[var_name] = cm\n @known_classes[var_name] = cm.full_name\n @store.add_c_enclosure var_name, cm\n end", "def class_tree(root, show_methods = true, colorize = true)\n # get children of root\n children = Hash.new()\n maxlength = root.to_s.length\n ObjectSpace.each_object(Class) do |aClass|\n if (root != aClass && aClass.ancestors.include?(root))\n children[aClass.superclass] = Array.new() if children[aClass.superclass] == nil\n children[aClass.superclass].push(aClass)\n maxlength = aClass.to_s.length if aClass.to_s.length > maxlength\n end\n end\n maxlength += 3\n\n # print nice ascii class inheritance tree\n indentation = \" \"*4\n c = Hash.new(\"\")\n if colorize\n c[:lines] = term_color :blue\n c[:dots] = term_color :red\n c[:classNames] = term_color :yellow\n c[:moduleNames] = term_color :green\n c[:methodNames] = term_color :default\n end\n\n recursePrint = proc do |current_root,prefixString|\n if show_methods # show methods (but don't show mixed in modules)\n puts(prefixString.tr('`','|'))\n methods = (current_root.instance_methods - (begin current_root.superclass.instance_methods; rescue NameError; []; end))\n strings = methods.sort.collect {|m|\n prefixString.tr('`',' ') +\n ( children[current_root] == nil ? \" \"*maxlength : c[:lines]+indentation+\"|\"+\" \"*(maxlength-indentation.length-1)) + \n c[:dots]+\":.. \" +\n c[:methodNames]+m.to_s\n }\n strings[0] = prefixString + c[:lines]+\"- \"+c[:classNames]+current_root.to_s\n strings[0] += \" \" + c[:dots]+\".\"*(maxlength-current_root.to_s.length) + \" \"+c[:methodNames]+methods[0].to_s if methods[0] != nil\n strings.each {|aString| puts(aString) }\n else\n string = \"#{prefixString}#{c[:lines]}-#{c[:classNames]}#{current_root.to_s}\"\n modules = current_root.included_modules - [Kernel]\n if modules.size > 0\n string += \" \"*(maxlength-current_root.to_s.length)+c[:lines]+\"[ \"+c[:moduleNames]+\n modules.join( c[:lines]+\", \"+c[:moduleNames]) +\n c[:lines]+\" ]\"\n end\n puts(string)\n end\n if children[current_root] != nil\n children[current_root].sort! {|a, b| a.to_s <=> b.to_s}\n children[current_root].each do |child|\n recursePrint.call(\n child,\n prefixString.tr('`',' ') + indentation + c[:lines]+(child == children[current_root].last ? \"`\":\"|\"))\n end\n end\n end\n\n recursePrint.call(root,\"\")\nend", "def modules_hash\n @modules_hash\n end", "def nested_subclasses(parent=self)\n subclasses(parent).collect {|subclass|\n {subclass => nested_subclasses(subclass)}\n }\n end", "def parents( instance, create_if_needed = true )\n\n unless parents_array = @parents_hash[ instance.__id__ ] or ! create_if_needed\n parents_array = create_parents( instance )\n # Insert self in order\n parents_array.push( instance )\n case instance\n when ::Module\n if instance.class.equal?( ::Module )\n parents_array.register_parent( instance_parents( ::Module ), 1 )\n end\n else\n parents_array.register_parent( instance_parents( instance.class ), 1 )\n end\n end\n\n return parents_array\n \n end", "def parse_tree(*klasses)\n result = []\n klasses.each do |klass|\n klassname = klass.name rescue '' # HACK klass.name should never be nil\n # Tempfile's DelegateClass(File) seems to\n # cause this\n klassname = \"UnnamedClass_#{klass.object_id}\" if klassname.empty?\n klassname = klassname.to_sym\n\n code = if Class === klass then\n sc = klass.superclass\n sc_name = ((sc.nil? or sc.name.empty?) ? \"nil\" : sc.name).intern\n [:class, klassname, [:const, sc_name]]\n else\n [:module, klassname]\n end\n\n method_names = []\n method_names += klass.instance_methods false\n method_names += klass.private_instance_methods false\n # protected methods are included in instance_methods, go figure!\n\n method_names.sort.each do |m|\n r = parse_tree_for_method(klass, m.to_sym)\n code << r\n end\n\n klass.modules.each do |mod| # TODO: add a test for this \n mod.instance_methods.each do |m|\n r = parse_tree_for_method(mod, m.to_sym)\n code << r\n end\n end\n\n klass.singleton_methods(false).sort.each do |m|\n code << parse_tree_for_method(klass, m.to_sym, true)\n end\n\n result << code\n end\n return result\n end", "def get_class_or_module container, ignore_constants = false\n skip_tkspace\n name_t = get_tk\n given_name = ''.dup\n\n # class ::A -> A is in the top level\n if :on_op == name_t[:kind] and '::' == name_t[:text] then # bug\n name_t = get_tk\n container = @top_level\n given_name << '::'\n end\n\n skip_tkspace_without_nl\n given_name << name_t[:text]\n\n is_self = name_t[:kind] == :on_op && name_t[:text] == '<<'\n new_modules = []\n while !is_self && (tk = peek_tk) and :on_op == tk[:kind] and '::' == tk[:text] do\n prev_container = container\n container = container.find_module_named name_t[:text]\n container ||=\n if ignore_constants then\n c = RDoc::NormalModule.new name_t[:text]\n c.store = @store\n new_modules << [prev_container, c]\n c\n else\n c = prev_container.add_module RDoc::NormalModule, name_t[:text]\n c.ignore unless prev_container.document_children\n @top_level.add_to_classes_or_modules c\n c\n end\n\n record_location container\n\n get_tk\n skip_tkspace\n if :on_lparen == peek_tk[:kind] # ProcObjectInConstant::()\n parse_method_or_yield_parameters\n break\n end\n name_t = get_tk\n unless :on_const == name_t[:kind] || :on_ident == name_t[:kind]\n raise RDoc::Error, \"Invalid class or module definition: #{given_name}\"\n end\n if prev_container == container and !ignore_constants\n given_name = name_t[:text]\n else\n given_name << '::' + name_t[:text]\n end\n end\n\n skip_tkspace_without_nl\n\n return [container, name_t, given_name, new_modules]\n end", "def classes()\n result = @data[\"classes\"] || {}\n raise HashExpectedException.new() unless result.class == Hash\n return result\n end", "def load(ast)\n #build parent map\n pmaps = {}\n ast.classes.each do |c|\n #prevent SELF_TYPE class and multiple classes with same name\n if @@forbid_define.include?(c.name.name) || pmaps.has_key?(c.name.name)\n @errtext.push(\"ERROR: #{c.name.line}: Type-Check: Class #{c.name.name} cannot be (re)defined\")\n return self\n end\n #classes that do not have explicit inheritance inherit from Object by default\n if c.inherit.nil?\n pmaps[c.name.name] = 'Object'\n else\n #prevent classes that inherit from certain built-in types\n if @@forbid_inherit.include?(c.inherit.name)\n @errtext.push(\"ERROR: #{c.inherit.line}: Type-Check: Class #{c.name.name} cannot inherit from #{c.inherit.name}\")\n return self\n end\n #prevent inheritance from undefined classes\n unknown = true\n ast.classes.each do |cu|\n if cu.name.name == c.inherit.name\n unknown = false\n break\n end\n end\n if unknown\n @errtext.push(\"ERROR: #{c.inherit.line}: Type-Check: Class #{c.inherit.name} does not exist\")\n return self\n end\n #insert the mapping\n pmaps[c.name.name] = c.inherit.name\n end\n end\n #remove Object -> Object from pmaps\n pmaps.delete('Object')\n\n #check for inheritance cycle to prevent infinite loops later\n if checkInheritCycle(pmaps)\n @errtext.push(\"ERROR: 0: Type-Check: Detected inheritance cycle\")\n return self\n end\n\n #construct pmap with objects from string map\n pmaps.each do |key, val|\n kobj = nil\n vobj = nil\n ast.classes.each do |c|\n if c.name.name == key\n kobj = c\n end\n if c.name.name == val\n vobj = c\n end\n end\n @pmap[kobj] = vobj\n end\n #build class/implementation maps\n ast.classes.each do |c|\n @cmap[c.name.name] = []\n @imap[c.name.name] = []\n #recursively add attributes and methods\n if addFeatureMaps(c, c.name.name).nil?\n return self\n end\n end\n return self\n end", "def dump_module(mod)\n # Module / Class declaration\n modulename = mod.name.sub(/^#{@nesting}\\:\\:/, \"\")\n # Class\n if mod.is_a?(Class)\n superclass = mod.superclass\n superclass = (!superclass.nil? && superclass != Object) ? \" < \"+superclass.name : \"\"\n add_line(\"class #{modulename}#{superclass}\")\n # Module\n else\n add_line(\"module #{modulename}\")\n end\n @indentation_level += 1\n add_line\n\n # Includes\n # Collect constants and methods of included modules so we can skip them later.\n included_constants = []\n included_methods = []\n included_instance_methods = []\n # Included modules, but not those of a superclass or of nested modules.\n included = mod.included_modules\n included -= mod.superclass.included_modules if mod.is_a?(Class) && mod.superclass\n included.delete_if{ |m| m.name == @nesting.split(\"::\") }\n if !included.empty?\n included.reverse.each{|included_mod|\n add_line(\"include #{included_mod.name}\")\n included_constants.push(*included_mod.constants)\n included_methods.push(*included_mod.methods)\n included_instance_methods.push(*included_mod.instance_methods)\n }\n add_line\n end\n\n # Constants\n constants = mod.constants.sort - included_constants\n # Collect and exclude constants that are nested modules (or classes).\n nested_mods = []\n constants.each{|constant|\n value = mod.const_get(constant)\n if value.is_a?(Module)\n nested_mods << value\n constants.delete(constant)\n end\n }\n # Write all remaining constants.\n if !constants.empty?\n add_line(\"# Constants\")\n constants.each{|constant|\n value = mod.const_get(constant)\n add_line(\"#{constant} = #{value.inspect}\")\n }\n add_line\n end\n\n # Class variables\n class_variables = mod.class_variables\n if !class_variables.empty?\n add_line(\"# Class variables\")\n class_variables.sort.each{|variable|\n add_line(\"#{variable} = #{mod.__send__(:class_variable_get, variable).inspect}\")\n }\n add_line\n end\n\n # Class/module methods\n class_methods = mod.public_methods - included_methods - Object.public_methods\n if !class_methods.empty?\n add_line(\"# Class methods\")\n class_methods.sort.each{|methodname|\n dump_method(methodname, mod.method(methodname), \"self\")\n add_line\n }\n end\n\n # Instance methods\n pub_instance_methods = mod.public_instance_methods(false) # mod.public_instance_methods - included_instance_methods - Object.public_instance_methods\n if !pub_instance_methods.empty?\n add_line(\"# Instance methods\")\n pub_instance_methods.sort.each{|methodname|\n dump_method(methodname, mod.instance_method(methodname))\n add_line\n }\n end\n\n # Protected instance methods\n prot_instance_methods = mod.protected_instance_methods - included_instance_methods - Object.protected_instance_methods\n if !prot_instance_methods.empty?\n add_line(\"# Protected instance methods\")\n add_line()\n prot_instance_methods.sort.each{|methodname|\n dump_method(methodname, mod.instance_method(methodname))\n add_line(\"protected :#{methodname}\")\n add_line\n }\n end\n\n # Private instance methods\n priv_instance_methods = mod.private_instance_methods - included_instance_methods - Object.private_instance_methods\n if !priv_instance_methods.empty?\n add_line(\"# Private instance methods\")\n add_line()\n priv_instance_methods.sort.each{|methodname|\n dump_method(methodname, mod.instance_method(methodname))\n add_line(\"private :#{methodname}\")\n add_line\n }\n end\n\n # Nested classes/modules\n outer = @nesting\n @nesting = mod.name\n if !nested_mods.empty?\n # Sort the modules by inheritance\n temp, nested_mods = nested_mods, nested_mods.find_all{|m| !m.is_a?(Class) || !nested_mods.include?(m.superclass)}\n temp.each{|m|\n if m.is_a?(Class)\n if nested_mods.include?(m.superclass)\n i = nested_mods.index(m.superclass) || -1\n nested_mods.insert(i+1, m)\n end\n end\n }\n # Generate code.\n nested_mods.each{|m|\n dump_module(m)\n add_line\n }\n end\n @nesting = outer\n\n @indentation_level -= 1\n if mod.is_a?(Class)\n add_line(\"end # class #{modulename}\")\n else\n add_line(\"end # module #{modulename}\")\n end\n end", "def classes\n @classes\n end", "def remove_nodoc_children\n prefix = self.full_name + '::'\n\n modules_hash.each_key do |name|\n full_name = prefix + name\n modules_hash.delete name unless @store.modules_hash[full_name]\n end\n\n classes_hash.each_key do |name|\n full_name = prefix + name\n classes_hash.delete name unless @store.classes_hash[full_name]\n end\n end", "def instance_parents( instance, create_if_needed = true )\n \n parents_array = nil\n \n case instance\n\n when ::Module\n \n unless parents_array = @instance_parents_hash[ instance.__id__ ] or ! create_if_needed\n parents_array = create_instance_parents( instance )\n # Insert self in order\n parents_array.push( instance )\n end \n\n else\n\n parents_array = parents( instance, create_if_needed )\n \n end \n\n return parents_array\n \n end", "def generate top_levels\n top_levels.each do |top_level|\n @tags[top_level.relative_name] << [top_level.relative_name, 0, 'F']\n end\n\n RDoc::TopLevel.all_classes_and_modules.each do |klass|\n kind = \"class:#{klass.full_name}\"\n\n address =\n unless RDoc::TopLevel === klass.parent then\n \"/#{klass.type} \\\\(#{klass.parent.full_name}::\\\\)\\\\?#{klass.name}/\"\n else\n \"/#{klass.type} #{klass.full_name}/\"\n end\n\n klass.in_files.each do |file|\n @tags[klass.full_name] << [file.relative_name, address, 'c']\n @tags[klass.name] << [file.relative_name, address, 'c']\n end\n\n klass.each_attribute do |attr|\n where = [\n attr.file.relative_name,\n \"/attr\\\\w\\\\*\\\\s\\\\*\\\\[:'\\\"]#{attr.name}/\",\n 'f',\n kind\n ]\n\n @tags[attr.name] << where\n @tags[\"#{attr.name}=\"] << where\n end\n\n klass.each_constant do |constant|\n @tags[constant.name] << [\n constant.file.relative_name, \"/#{constant.name}\\\\s\\\\*=/\", 'd', kind]\n end\n\n klass.each_method do |method|\n address = if method.singleton then\n # \\w doesn't appear to work in [] with nomagic\n \"/def \\\\[A-Za-z0-9_:]\\\\+.#{method.name}/\"\n else\n \"/def #{method.name}/\"\n end\n\n @tags[method.name] << [\n method.file.relative_name, address, 'f', kind]\n end\n end\n\n unless @dry_run then\n write_tags\n merge_ctags\n end\n end", "def do_classes_and_modules\n do_boot_defclass if @file_name == \"class.c\"\n\n @content.scan(\n %r(\n (?<open>\\s*\\(\\s*) {0}\n (?<close>\\s*\\)\\s*) {0}\n (?<name>\\s*\"(?<class_name>\\w+)\") {0}\n (?<parent>\\s*(?:\n (?<parent_name>[\\w\\*\\s\\(\\)\\.\\->]+) |\n rb_path2class\\s*\\(\\s*\"(?<path>[\\w:]+)\"\\s*\\)\n )) {0}\n (?<under>\\w+) {0}\n\n (?<var_name>[\\w\\.]+)\\s* =\n \\s*rb_(?:\n define_(?:\n class(?: # rb_define_class(name, parent_name)\n \\(\\s*\n \\g<name>,\n \\g<parent>\n \\s*\\)\n |\n _under\\g<open> # rb_define_class_under(under, name, parent_name...)\n \\g<under>,\n \\g<name>,\n \\g<parent>\n \\g<close>\n )\n |\n (?<module>)\n module(?: # rb_define_module(name)\n \\g<open>\n \\g<name>\n \\g<close>\n |\n _under\\g<open> # rb_define_module_under(under, name)\n \\g<under>,\n \\g<name>\n \\g<close>\n )\n )\n |\n (?<attributes>(?:\\s*\"\\w+\",)*\\s*NULL\\s*) {0}\n struct_define(?:\n \\g<open> # rb_struct_define(name, ...)\n \\g<name>,\n |\n _under\\g<open> # rb_struct_define_under(under, name, ...)\n \\g<under>,\n \\g<name>,\n |\n _without_accessor(?:\n \\g<open> # rb_struct_define_without_accessor(name, parent_name, ...)\n |\n _under\\g<open> # rb_struct_define_without_accessor_under(under, name, parent_name, ...)\n \\g<under>,\n )\n \\g<name>,\n \\g<parent>,\n \\s*\\w+, # Allocation function\n )\n \\g<attributes>\n \\g<close>\n |\n singleton_class\\g<open> # rb_singleton_class(target_class_name)\n (?<target_class_name>\\w+)\n \\g<close>\n )\n )mx\n ) do\n if target_class_name = $~[:target_class_name]\n # rb_singleton_class(target_class_name)\n handle_singleton $~[:var_name], target_class_name\n next\n end\n\n type = $~[:module] ? :module : :class\n class_name = $~[:class_name]\n parent_name = $~[:parent_name] || $~[:path]\n under = $~[:under]\n\n handle_class_module($~[:var_name], type, class_name, parent_name, under)\n end\n end", "def record_class_definitions\n extant, novel = [], []\n ObjectSpace.each_object(Class) { |k| extant << k }\n yield\n ObjectSpace.each_object(Class) { |k| novel << k if !extant.include?(k) }\n novel\n end", "def actable_hierarchy\n erd_hierarchy = []\n current_klass = acting_as_name.to_sym\n while current_klass.present?\n erd_hierarchy << current_klass\n current_klass =\n begin\n current_klass.to_s.classify.constantize.acting_as_name.to_sym\n rescue\n nil\n end\n end\n\n if erd_hierarchy.count > 1\n idx = erd_hierarchy.length-2\n join_relations = Hash.new\n join_relations[erd_hierarchy[idx]] = erd_hierarchy[idx+1]\n idx -= 1\n while idx >= 0\n tmp = Hash.new\n tmp[erd_hierarchy[idx]] = join_relations\n join_relations = tmp\n idx -= 1\n end\n\n join_relations\n else\n acting_as_name.to_sym\n end\n end", "def sections_classes_all_there?\n sections_classes_to_check.flatten.all?(&:all_there?)\n end", "def class_hierarchy base_class: '', system_classes: nil\n#\t\t@actual_class_hash = get_classes('name', 'superClass') #if requery || @all_classes.blank?\n\t\tfv = ->( s )\t{ \t@actual_class_hash.find_all{|x| x['superClass']== s}.map{|v| v['name']} }\n\t\tfx = ->( v ) {\t\tfv[v.strip].map{|x| ar = fx[x]; ar.empty? ? x : [x, ar]} }\n\t\tif system_classes.present?\n\t\t\tfx[ base_class.to_s ]\n\t\telse\n\t\t\tfx[ base_class.to_s ] - system_classes() - [ [\"OIdentity\", [\"ORole\", \"OUser\"]]] - [ [\"OShape\",[\"OGeometryCollection\",\"OLineString\", \"OMultiLineString\", \"OMultiPoint\", \"OMultiPolygon\", \"OPoint\", \"OPolygon\", \"ORectangle\"] ] ]\n\t\tend\n\tend", "def build_modules\n module_set = BuildModuleSet.new(@root_dir)\n module_groups = { }\n\n @filenames.each do |filename|\n if FileTest.file?(filename.to_s)\n File.open(filename.to_s) do |file|\n yaml = YAML.load(file)\n\n modules = yaml['modules']\n modules.each do |a_module|\n options = {}\n if data = a_module.values[0]\n if module_options = data['options']\n module_options.each_pair { |k, v| options[k.to_sym] = v }\n options[:name] = a_module.keys[0]\n options[:dependencies] = data['dependencies'] || []\n end\n end\n module_set.add(options)\n end\n\n module_groups_source = yaml['module-groups']\n unless module_groups_source.nil?\n module_groups_source.each do |module_group_name, module_group_contents|\n arr = [ ]\n module_group_contents.each do |module_name|\n arr << module_set[module_name]\n end\n module_groups[module_group_name.to_sym] = arr\n end\n end\n end\n end\n end\n\n module_groups[:all] = [ ]\n module_set.each do |build_module|\n module_groups[:all] << build_module\n end\n\n { :module_set => module_set, :module_groups => module_groups }\n end", "def generate_class_tree_level(classes)\n tree = []\n list = classes.select{|c| c.with_documentation? }\n list = list.sort\n list.each do |c|\n item = c.to_h\n item[:methods] = c.method_list.map{ |m| m.to_h }\n item[:classes] = generate_class_tree_level(c.classes_and_modules)\n tree << item\n end\n tree\n end", "def has_class?(name)\n @class_syms ||= classes.map(&:to_sym)\n @class_syms.include?(name.to_sym)\n end", "def namespace_module?\n return false if exp.type == :casgn\n contents = exp.children.last\n contents && contents.find_nodes([:def, :defs], [:casgn, :class, :module]).empty?\n end", "def nests\n Nest.all.select do |nest|\n nest.tree == self\n end\n end", "def to_hash\n\t\t@classes.map { |name,klass| klass.to_hash }.reduce({}) { |sum,v| sum.merge( v) }\n\tend", "def get_sorted_module_list( classes )\n\t\tnscounts = classes.keys.inject({}) do |counthash, name|\n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\tcounthash[toplevel] ||= 0\n\t\t\tcounthash[toplevel] += 1\n\t\t\t\n\t\t\tcounthash\n\t\tend\n\n\t\t# Sort based on how often the toplevel namespace occurs, and then on the name \n\t\t# of the module -- this works for projects that put their stuff into a \n\t\t# namespace, of course, but doesn't hurt if they don't.\n\t\treturn classes.keys.sort_by do |name| \n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\t[\n\t\t\t\tnscounts[ toplevel ] * -1,\n\t\t\t\tname\n\t\t\t]\n\t\tend\n\tend", "def get_sorted_module_list( classes )\n\t\tnscounts = classes.keys.inject({}) do |counthash, name|\n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\tcounthash[toplevel] ||= 0\n\t\t\tcounthash[toplevel] += 1\n\t\t\t\n\t\t\tcounthash\n\t\tend\n\n\t\t# Sort based on how often the toplevel namespace occurs, and then on the name \n\t\t# of the module -- this works for projects that put their stuff into a \n\t\t# namespace, of course, but doesn't hurt if they don't.\n\t\treturn classes.keys.sort_by do |name| \n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\t[\n\t\t\t\tnscounts[ toplevel ] * -1,\n\t\t\t\tname\n\t\t\t]\n\t\tend\n\tend", "def section_classes_all_there?\n section_classes_to_check.all?(&:all_there?)\n end", "def has_classes?\n c = @context.classes.find{|c| c.document_self}\n c ? true : false\n end", "def test_nested_namespaced_class\n assert_signatures <<-CODE, [\"C\", \"C::B\", \"C::B::A\", \"C::B::A::D\"], [ModuleCode, ClassCode]\n module C::B::A\n class D\n end\n end\n CODE\n end", "def nestings\n @nestings ||= {}\n end", "def initialize_classes_and_modules\n @classes = {}\n @modules = {}\n end", "def unique_classes_and_modules\n @unique_classes + @unique_modules\n end", "def get_class_lut(class_map)\n\tclass_lut = {}\n\tfor ast_class in class_map.all_classes\n\t\tclass_lut[ast_class.name] = ast_class\n\tend\n\treturn class_lut\nend", "def get_class_lut(class_map)\n\tclass_lut = {}\n\tfor ast_class in class_map.all_classes\n\t\tclass_lut[ast_class.name] = ast_class\n\tend\n\treturn class_lut\nend", "def module_class(mod)\n @@modules ||= {}\n unless klass = @@modules[mod]\n klass = Class.new(Object) { include Handler.get_module(mod) }\n @@modules[mod] = klass\n end\n klass\n end", "def hide_tree(*classOrModules)\n\t\tclassOrModules.each do |classOrModule|\n\t\t\t@ignored_tree[classOrModule] = true\n\t\tend\n\tend", "def has_modules?\n m = @context.modules.find{|m| m.document_self}\n m ? true : false\n end", "def get_inheritance_graph(class_map)\n\tinheritance_graph = {}\n\n\tfor ast_class in class_map.all_classes\n\n\t\t# If there is a superclass, add the object to its list\n\t\tif ast_class.superclass != nil\n\t\t\tif inheritance_graph.has_key?(ast_class.superclass)\n\t\t\t\tinheritance_graph[ast_class.superclass] << ast_class\n\t\t\telse\n\t\t\t\tinheritance_graph[ast_class.superclass] = [ast_class]\n\t\t\tend\n\t\telse\n\t\t\t# If there is no superclass, add the object to Object's list (root of inheritance tree)\n\t\t\tif ast_class.name != \"Object\"\n\t\t\t\tif inheritance_graph.has_key?(\"Object\")\n\t\t\t\t\tinheritance_graph[\"Object\"] << ast_class\n\t\t\t\telse\n\t\t\t\t\tinheritance_graph[\"Object\"] = [ast_class]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn inheritance_graph\nend", "def get_inheritance_graph(class_map)\n\tinheritance_graph = {}\n\n\tfor ast_class in class_map.all_classes\n\n\t\t# If there is a superclass, add the object to its list\n\t\tif ast_class.superclass != nil\n\t\t\tif inheritance_graph.has_key?(ast_class.superclass)\n\t\t\t\tinheritance_graph[ast_class.superclass] << ast_class\n\t\t\telse\n\t\t\t\tinheritance_graph[ast_class.superclass] = [ast_class]\n\t\t\tend\n\t\telse\n\t\t\t# If there is no superclass, add the object to Object's list (root of inheritance tree)\n\t\t\tif ast_class.name != \"Object\"\n\t\t\t\tif inheritance_graph.has_key?(\"Object\")\n\t\t\t\t\tinheritance_graph[\"Object\"] << ast_class\n\t\t\t\telse\n\t\t\t\t\tinheritance_graph[\"Object\"] = [ast_class]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn inheritance_graph\nend", "def classes\n @classes.values\n end", "def classes\n @classes.values\n end", "def dependency_classes\n res = []\n\n eager_loaded_components.keys.each do |aggr|\n res += component_instance(aggr).dependency_classes\n end\n\n res += self.class.class_ancestors\n\n res << self.class\n res.uniq\n end", "def hierarchical_dimension?\n self.included_modules.include?(InstanceMethods)\n end", "def find_class_or_module name\n name = $' if name =~ /^::/\n @classes_hash[name] || @modules_hash[name]\n end", "def makena_classes\n Rails.application.eager_load!\n pass = ActiveRecord::Base.descendants.map{|a| a.to_s}\n pass.shift\n pass\n end", "def add_class_or_module mod, self_hash, all_hash\n mod.section = current_section # TODO declaring context? something is\n # wrong here...\n mod.parent = self\n mod.full_name = nil\n mod.store = @store\n\n unless @done_documenting then\n self_hash[mod.name] = mod\n # this must be done AFTER adding mod to its parent, so that the full\n # name is correct:\n all_hash[mod.full_name] = mod\n if @store.unmatched_constant_alias[mod.full_name] then\n to, file = @store.unmatched_constant_alias[mod.full_name]\n add_module_alias mod, mod.name, to, file\n end\n end\n\n mod\n end", "def evaluate_node_classes\n if @node.classes.is_a? Hash\n classes_with_params, classes_without_params = @node.classes.partition {|name,params| params and !params.empty?}\n\n # The results from Hash#partition are arrays of pairs rather than hashes,\n # so we have to convert to the forms evaluate_classes expects (Hash, and\n # Array of class names)\n classes_with_params = Hash[classes_with_params]\n classes_without_params.map!(&:first)\n else\n classes_with_params = {}\n classes_without_params = @node.classes\n end\n\n evaluate_classes(classes_with_params, @node_scope || topscope)\n evaluate_classes(classes_without_params, @node_scope || topscope)\n end", "def hide_current_state\n\t\t@classes = Array.new\n\t\tObjectSpace.each_object(Class) do |klass|\n\t\t\t@classes.push klass\n\t\tend\n\t\t@modules = Hash.new\n\t\tObjectSpace.each_object(Module) do |mod|\n\t\t\t@modules[mod] = true\n\t\tend\n\tend", "def classes; end", "def generate_class_tree\n debug_msg \"Generating class tree\"\n tree = generate_class_tree_level\n debug_msg \" writing class tree to %s\" % TREE_FILE\n File.open(TREE_FILE, \"w\", 0644) do |f|\n f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))\n end unless $dryrun\nend", "def analyses\n subklasses.map{|klass|\n [klass.name, klass]\n }.to_h\n end", "def check_infinite_nest(klass) # :nodoc:\n raise \"infinite nest detected\" if klass == self\n \n klass.configurations.each_value do |delegate|\n if delegate.kind_of?(NestConfig)\n check_infinite_nest(delegate.nest_class)\n end\n end\n end", "def inspect_modules\n modules = []\n\n if constant.respond_to?(:ancestors)\n parent = inspect_superclass\n\n # Take all the modules included *directly* into the constant.\n modules = constant.ancestors.take_while do |ancestor|\n parent && ancestor != parent\n end\n\n # Get rid of non Module instances and modules that don't have a name.\n modules = modules.select do |mod|\n mod.instance_of?(Module) && mod.name\n end\n end\n\n return modules\n end", "def complete min_visibility\n fix_basic_object_inheritance\n\n # cache included modules before they are removed from the documentation\n all_classes_and_modules.each { |cm| cm.ancestors }\n\n unless min_visibility == :nodoc then\n remove_nodoc @classes_hash\n remove_nodoc @modules_hash\n end\n\n @unique_classes = find_unique @classes_hash\n @unique_modules = find_unique @modules_hash\n\n unique_classes_and_modules.each do |cm|\n cm.complete min_visibility\n end\n\n @files_hash.each_key do |file_name|\n tl = @files_hash[file_name]\n\n unless tl.text? then\n tl.modules_hash.clear\n tl.classes_hash.clear\n\n tl.classes_or_modules.each do |cm|\n name = cm.full_name\n if cm.type == 'class' then\n tl.classes_hash[name] = cm if @classes_hash[name]\n else\n tl.modules_hash[name] = cm if @modules_hash[name]\n end\n end\n end\n end\n end", "def each_classmodule(&block) # :yields: module\n classes_and_modules.sort.each(&block)\n end", "def each_classmodule(&block) # :yields: module\n classes_and_modules.sort.each(&block)\n end", "def extension_modules\n local_extensions =\n class <<self\n included_modules-Object.included_modules\n end\n if local_extensions.size > 0\n local_extensions\n else\n [] # There weren't any; must be a literal node\n end\n end", "def all_classes_in_gem_named(gem)\n self.all_classes.select { |klass| klass.belongs_to?(gem) }\n end", "def process_classes(klass_hash, scope)\n interpolate_array(klass_hash['classes'], scope) +\n get_classes_from_groups(\n interpolate_array(klass_hash['class_groups'], scope), scope\n )\n end", "def module\n return @module if @module\n\n # search the current context\n return @name unless parent\n full_name = parent.child_name(@name)\n @module = @store.modules_hash[full_name]\n return @module if @module\n return @name if @name =~ /^::/\n\n # search the includes before this one, in reverse order\n searched = parent.includes.take_while { |i| i != self }.reverse\n searched.each do |i|\n inc = i.module\n next if String === inc\n full_name = inc.child_name(@name)\n @module = @store.modules_hash[full_name]\n return @module if @module\n end\n\n # go up the hierarchy of names\n up = parent.parent\n while up\n full_name = up.child_name(@name)\n @module = @store.modules_hash[full_name]\n return @module if @module\n up = up.parent\n end\n\n @name\n end", "def boot_classes\n classes = space.classes\n type_names.each do |name , vars|\n cl = object_with_type Parfait::Class\n cl.instance_type = @types[name]\n @types[name].object_class = cl\n @types[name].instance_methods = object_with_type Parfait::List\n cl.instance_methods = object_with_type Parfait::List\n #puts \"instance_methods is #{cl.instance_methods.class}\"\n cl.name = name\n classes[name] = cl\n end\n # superclasses other than default object\n supers = { :Object => :Kernel , :Kernel => :Value,\n :Integer => :Value , :BinaryCode => :Word }\n type_names.each do |classname , ivar|\n next if classname == :Value # has no superclass\n clazz = classes[classname]\n super_name = supers[classname] || :Object\n clazz.set_super_class_name super_name\n end\n end", "def modules\n modules = {}\n\n begin\n mods = Pathname.new(@conf['mod_dir']).children.select(&:directory?)\n\n mods.each do |m|\n modules[m.basename.to_s] = mod_versions(m)\n end\n rescue StandardError => err\n Pem.log_error(err, @logger)\n raise(err)\n end\n\n modules\n end", "def simple_classes\n _simple_classes\n end", "def submodules\n self.constants\n .map { |name| const_get(name) }\n .select { |const| const.class == Module }\n end", "def class_hierarchy\n @class_hierarchy ||= process_ontology_hierarchy\n end" ]
[ "0.6395142", "0.6385925", "0.614291", "0.61214894", "0.61214894", "0.61053467", "0.60452676", "0.6024766", "0.59719145", "0.59102803", "0.5880091", "0.5873416", "0.5837326", "0.5827594", "0.5812675", "0.5805403", "0.5781596", "0.57295495", "0.5708816", "0.5708816", "0.5669319", "0.5621216", "0.55288976", "0.5524491", "0.55124325", "0.55124325", "0.5507899", "0.550292", "0.54839796", "0.544364", "0.5429564", "0.5416115", "0.54132074", "0.5411435", "0.5405655", "0.5404361", "0.53919256", "0.53899467", "0.5371017", "0.53561324", "0.5350163", "0.53487307", "0.5341319", "0.5335116", "0.5333726", "0.531232", "0.5307419", "0.5302302", "0.52987564", "0.528289", "0.52748513", "0.52727073", "0.5256514", "0.5255664", "0.52505803", "0.52491057", "0.5245159", "0.52439916", "0.5221383", "0.5211227", "0.5211227", "0.51911527", "0.5188326", "0.517767", "0.51643974", "0.51415735", "0.5137013", "0.51359606", "0.51359606", "0.51288456", "0.51176125", "0.5113046", "0.5106438", "0.5106438", "0.51027316", "0.51027316", "0.5087674", "0.507115", "0.5070087", "0.50679916", "0.50572145", "0.50540745", "0.5053098", "0.5039081", "0.5037183", "0.50306743", "0.50264525", "0.502202", "0.50040805", "0.49929664", "0.49929664", "0.49877933", "0.49871367", "0.4963852", "0.4957978", "0.495117", "0.49499503", "0.49422753", "0.49370438", "0.49365398" ]
0.6062787
6
Sends a chat message to the client.
def send_message(msg, from = nil) msg = "#{msg} (@#{from})" unless from.nil? @auth_required ? @after_auth.push({:m => msg}) : send_data({:m => msg}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end", "def send_message(chat_id, message)\n ActionCable.server.broadcast \"Chat:#{chat_id}\", response: chat_message(message), type: 'message'\n end", "def send_message(message)\n self.broadcast({\n type: \"chat_message\",\n message: message\n })\n end", "def send_message message\n payload = { \"text\" => message }.to_json\n data = client.post \"#{api_prefix}/rooms/#{id}/chatMessages\", payload\n\n Message.new client, id, data\n end", "def send_message\n message = render_to_string(:partial => 'messages/message', :object => @message)\n Juggernaut.send_to_channel(javascript_chat_message(message), @message.channel_id)\n end", "def send(message, options = { channelID: 1 })\n params = { message: message, channelID: options[:channelID] }\n rest.post chat_path, params: params\n end", "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend", "def send_message(*args, **kwargs)\n bot = kwargs.fetch(:bot) { args.fetch(0) }\n args[0] = id\n kwargs[:chat_id] = id\n bot.send_message(*args, **kwargs)\n end", "def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts the message without a job. BUT: that is only the message.\n # We want do more :)\n # ActionCable.server.broadcast(\"chat_rooms_channel\", message: data[\"message\"])\n end", "def send_message\n chat = Chat.find(params[:chat])\n SendMessageToChat.call(@previa_group, chat, params[:message])\n\n respond_to do |format|\n format.html { redirect_to previa_group_chat_path(@previa_group, :chat => chat) }\n format.json { head :no_content }\n end\n end", "def send(message)\n @chats.each do |chat|\n begin\n chat.send(message)\n rescue\n @chats.delete(chat)\n end\n end\n end", "def chat_message(message)\n r = Skype.send_command \"CHATMESSAGE #{id} #{message}\"\n ChatMessage.parse_from(r)\n end", "def send(to, text)\n begin\n @log.info \"Sending message to '#{to}'\"\n @client.send Message::new(to, text).set_type(:chat).set_id('1').set_subject('Boti')\n return true\n rescue\n @log.error \"Error sending message to '#{to}'\"\n return false\n end\n end", "def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end", "def send_message(msg)\n send_data({:type => :message, :body => msg})\n end", "def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args['msg'])}\n )) #envia a mensagem para todos os clientes\n end\n end", "def send_message(_target, text) # rubocop:disable Metrics/AbcSize\n url = \"https://api.gitter.im/v1/rooms/#{config.room_id}/chatMessages\"\n uri = URI.parse(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: true,\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n ) do |http|\n request = Net::HTTP::Post.new(uri.path)\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.add_field('Authorization', \"Bearer #{config.token}\")\n request.body = { 'text' => text }.to_json\n response = http.request(request)\n\n @user_id = MultiJson.load(response.body)['fromUser']['id']\n end\n end", "def send_message( msg )\n @session.send_message msg\n self\n end", "def send_chat_text(msg, type)\n if @socket_srv\n unless msg.empty? \n cmd_to_send = build_cmd(type, msg)\n send_data_to_server(cmd_to_send)\n end\n else\n @cup_gui.log_sometext \"Non collegato in rete\\n\"\n end\n end", "def send_message(message)\n @socket.send(message << \"\\n\", 0, nil, @client)\n end", "def send_message_to(chatid, contact, message, transport=nil)\n return self.class.can_has_chat_server.send_message( :id => chatid,\n :to=>contact,\n :message=>message,\n :transport =>transport)\n end", "def remote_chat(sender, room, msg)\n add_msg \"<#{room || 'unknown'}> #{sender}: #{msg}\"\n end", "def send_message(payload)\n message = Message.new(author: current_user, text: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat\", message: render(message) if message.save\n end", "def send_message\n if message.present?\n sender.send_message(receiver, message, I18n.t(\"activity.verb.#{ contact_verb }.#{ receiver.subject_type }.message\", :name => sender.name))\n end\n end", "def chat_send(message, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ChatApi#chat_send ...\"\n end\n \n # verify the required parameter 'message' is set\n fail \"Missing the required parameter 'message' when calling chat_send\" if message.nil?\n \n # resource path\n path = \"/chat\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"message\"] = message\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:POST, 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 => 'Chat')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ChatApi#chat_send. Result: #{result.inspect}\"\n end\n return result\n end", "def send_message(msg)\n session.transport.send_message(msg)\n end", "def send_new_chat(data)\n stream_from \"Chat:#{data['chat']['id']}\"\n recipient = User.find(data['chat']['recipient_id'])\n unless current_user.id == recipient.id\n ActionCable.server.broadcast \"user_#{recipient.id}_chats\", chat: data['chat'], type: 'new_chat'\n end\n end", "def send_message(payload)\n message = Message.new(user: current_user, chat_id: payload[\"id\"], body: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat_#{payload['id']}\", message: render(message) if message.save\n end", "def send(body=nil)\n msg = Jabber::Message.new(@to)\n msg.type = :chat\n msg.body = body || @message\n @base.stanza(msg)\n end", "def send_mess(mess)\n\t@client.puts(mess)\t\nend", "def send_message(message)\n response = HTTParty.post(\n CHAT_URL,\n body: {\n token: ENV[\"SLACK_API_TOKEN\"],\n text: message,\n channel: @slack_id # need slack_id, per Slack documentation for send_message \n },\n )\n \n return response.code == 200 && response.parsed_response[\"ok\"]\n end", "def chat(message)\n final_message = nil\n if message.is_a?(Hash)\n final_message = message.to_json\n else\n final_message = JSON.dump(action: 'message', message: message)\n end\n log_to_file(\"#{self.class} sends JSON #{final_message}\")\n send_data(final_message)\n end", "def send_telegram message = nil\n chat_id = self.telegram\n if chat_id and !!@@telegram_client\n if message\n begin\n puts \"Enviando: #{message}\n to: #{chat_id}\"\n @@telegram_client.send_message(chat_id: chat_id, text: message)\n true\n rescue\n puts \"Error sending message to telegram group #{group_id}\"\n false\n end\n end\n end\n end", "def send_message(recipient_user_name, msg)\n raise RuntimeError.new(\"Attempt to send message but not connected\") if @ws.nil?\n\n @ws.send({request: \"message\", recipient_user_name: recipient_user_name, msg: msg}.to_json)\n end", "def send_message(message)\n check_parenthesis(message)\n puts \"Send: #{message}\" if @debug\n connection{|c| c.write(message)}\n end", "def send_message (*params)\n send_line Message.new(*params)\n end", "def personalChat\n puts \"This is a Personal Chat\"\n # puts message\n end", "def sendmsg(message)\n text = message.respond_to?(:sendmsg) ? message.sendmsg : message.to_s\n message = \"sendmsg\\n%s\\n\" % text\n self.respond_to?(:send_data) ? send_data(message) : message\n end", "def send_message(message)\n @networking.send_message(message)\n end", "def send_message(message)\n # currently use notifications to send message, as send message doesn't seem to \n # work to android devices. Otherwise would have used this:\n #\n # JSON.parse(User.notifo.send_message(self.username, message))\n send_notification(message)\n end", "def send(message)\n\t\t\t@conn.send(message)\n\t\tend", "def send_message(msg); end", "def chat_message\n @room=current_user.room\n\n @chat_message=ChatMessage.create! content: params[:message],owner_id: current_user.id\n chat_message=render_to_string partial: \"chat_message/chat_message\"\n\n publish_async(\"presence-room_#{@room.id}\", \"chat_message\", {\n message: chat_message\n })\n\n render json: {\n message: chat_message\n }\n end", "def send_msg(data, connection)\n connection.send_msg(data)\n end", "def send(target, message)\n @irc.send_msg(target, message)\n end", "def chat_meMessage(options = {})\n raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?\n raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?\n post('chat.meMessage', options)\n end", "def add_msg(msg, sender)\n\n @chatters.each do |chatter_id, chatter|\n if chatter_id != sender.id\n chatter.client_socket.puts \"#{sender.id} said: #{msg}\"\n end\n end\n\n end", "def message( msg, sender )\n @clients.each do |client|\n client.sock.puts \"#{sender}: #{msg}\" unless sender.port == client.port\n end\n log( \"[message] #{sender}: #{msg}\" )\n end", "def send_message(message); end", "def send_message(message); end", "def sendMsg user, content, wait = false\n # find the user account send to\n send_to = if user.instance_of? User\n user.account\n elsif user.instance_of? String\n user\n elsif user.instance_of? Fixnum\n User.find(:id => user).account\n end\n msg = Jabber::Message.new(send_to).set_type(:chat)\n if content.instance_of? Array\n content.each do |e|\n @cl.send(msg.set_body(e.to_s))\n $logger.info %|Send Message to \"#{send_to}\", with \"#{e.to_s}\"|\n end\n elsif content.instance_of? String\n @cl.send(msg.set_body(content))\n $logger.info %|Send Message to \"#{send_to}\", with \"#{content}\"|\n end\n sleep 0.4 if wait\n end", "def send_team_chat\n data = {display_name: params[:display_name],\n avatar: params[:avatar],\n chat_text: params[:chat]}\n Pusher.trigger(params[:channel], 'chat_message', data)\n end", "def send(msg=\"\")\n\t\tif @connected\n\t\t\t@sock.write \"\\1#{msg}\\r\\n\" # leading \\1 for terse reply\n\t\tend\n\tend", "def enviarMensaje(mensaje)\n @@socket.puts mensaje\n end", "def send(msg)\n @socket.puts msg\n puts '<< ' << msg\n end", "def secureChat\n puts \"This is a secure Chat\"\n puts message\n end", "def send_message(text)\n end", "def personal_chat(message) \n puts \"This is a Personal Chat\" \n puts message \n end", "def send_conversation_message(from, to, params = {})\n ConversationMessage.new(conversation_request(\n :post,\n 'send',\n params.merge(from: from,\n to: to)\n ))\n end", "def send_message(message_text)\n @selected.send_message(message_text)\n end", "def sendMessage(args, client = @send_client)\n jabmsg = Jabber::Message::new(args[:receiver], args[:message]).set_type(:chat).set_id('1')\n \n begin \n Timeout::timeout(10) do\n client.send(jabmsg)\n puts \"XMPP TO: \" + args[:receiver].to_s\n puts \"XMPP MESSAGE: \" + args[:message].to_s\n end\n\n rescue => e\n puts \"XMPP Exception in sending: \" + e + \"\\n\"\n puts \"XMPP Reconnecting to server and trying again\"\n puts \" (-- line #{e.backtrace[0].to_s} )\"\n if client == @receive_client\n puts \"re-connecting to RECEIVE_client\"\n connect(@receive_client)\n else\n puts \"re-connecting to SEND_client\"\n connect(@@send_client_info)\n end\n retry\n end\n end", "def send_message_to_channel(client, channel_id, title, message)\n client.chat_postMessage(\n channel: channel_id, \n as_user: true,\n text: \"*\" + title + \"*\",\n attachments: [\n text: message,\n color: \"warning\"\n ]\n )\nend", "def send( a )\n\t\tbegin\n\t @jabbermsg.body = a\n \t @jabberchatroom.send( @jabbermsg )\n \trescue Jabber::ServerDisconnected\n \t\tputs \"Server disconnected. Trying reconnect\"\n \t\t@jabberReconnect = true\n \t\t@jabberRetryMessage = a\n \trescue Jabber::JabberError => e\n \t\tputs \"Error for #{e.error.to_s.inspect}\"\n \t\tputs \"Trying reconnect\"\n \t\t@jabberReconnect = true\n \t\t@jabberRetryMessage = a\n \tend\n\tend", "def send_message(to, message)\n if !@client.is_connected?\n @log.warn \"Bot is not connected. Can't send the message.\"\n return false\n end\n\n case message\n when Array\n message.each do |text|\n sleep 1\n return unless send(to, text)\n end\n when String\n return send(to, message)\n else\n @log.error \"Message is not an Array nor a String. Can't send.\"\n return false\n end\n end", "def send(message)\n info(\"[Smartfocus] Send -> #{message}\")\n end", "def sendChatAction to, act\n self.query(\"sendChatAction\", {:chat_id=>to, :action=>act})\n end", "def handle_chat(msg, message)\n @user = msg.actor\n #raise \"#{self.class.name} doesn't implement `handle_chat`!\"\n end", "def send_channel(message)\n @bot.message_queue.push(\"PRIVMSG ##{bot.channel.name} :#{message}\")\n end", "def send_message(opts = {})\n @client.update(opts[:message])\n end", "def send(message)\n if message.length > 0\n # The client will return an empty string\n # on success, or it will return an error\n error = @client.transmit(message)\n if error.length > 0\n new_message(error)\n end\n end\n end", "def chat=(value)\n @chat = value\n end", "def send_message(*args, **kwargs)\n chat_id = kwargs.fetch(:chat_id) { args.fetch(0) }\n text = kwargs.fetch(:text) { args.fetch(1) }\n parse_mode = kwargs.fetch(:parse_mode) { args[2] }\n disable_web_page_preview = kwargs.fetch(:disable_web_page_preview) { args[3] }\n\n logger.info \"sending message: #{text.inspect}\"\n data = {text: text, chat_id: chat_id}\n data[:parse_mode] = parse_mode unless parse_mode.nil?\n data[:disable_web_page_preview] = disable_web_page_preview unless disable_web_page_preview.nil?\n\n args.shift(4)\n args.unshift(\"#{@base_path}/sendMessage\", data)\n Message.new(post_message(*args, **kwargs))\n end", "def send_message(data)\n @chatroom = Chatroom.find(data[\"chatroom_id\"])\n message = @chatroom.messages.create(body: data[\"body\"], user: current_user)\n MessageRelayJob.perform_later(message)\n #Rails.logger.info data\n end", "def update text\n payload = { \"text\" => message }.to_json\n data = client.post \"#{api_prefix}/rooms/#{room_id}/chatMessages/#{id}\", payload\n\n new client, room_id, data\n end", "def irc_send(message)\n puts(\"Sending: #{message}\")\n\n # We can call \"puts\" on the socket we opened earlier. Instead of outputting something on the\n # terminal, this will send the message accross the internet to the IRC server we are connected to\n @socket.puts(message)\nend", "def perform(message)\n\t\t# Broadcast the rendered message to the channel\n\t\tActionCable.server.broadcast 'chatroom_channel', message: render_message(message)\n\tend", "def send(message)\n message\n end", "def sendSecureMessage\n secureChat(\"This is confidential\")\n end", "def send_msg(data, connection)\n # TODO\n end", "def send(message)\n socket.send(message, 0, address, port)\n end", "def send(msg)\n @connection.write(\n @serializer.en(msg))\n rescue Exception => e\n raise\n end", "def handle_chat_msg(msg)\n if command_checker(msg)\n @conn.send(\">>> If you meant to send a command, try preceding it with <<<.\")\n @conn.send(\">>> If not, sorry for butting in. Type a backslash before your chat message whenever your chat message is identical to a command.\")\n else\n @server.forward(msg, self)\n end\n end", "def send_to(other_player, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: other_player, text: msg })\n\t\t\tm.save!\n\t\t\tother_player.send_message(m)\n\t\tend", "def sent_telegram( message )\n\tTelegram::Bot::Client.run($telegram_token) do |bot|\n\t\tbot.api.send_message( chat_id: 43716964, text: message)\n\tend\nend", "def send_reply(text)\n @bot.api.send_message(chat_id: @last_message.chat.id, text: text)\n end", "def respond(message)\n @channel.send_message(message) if @channel\n end", "def sendMsg(msg)\r\n @pubNub.publish(:message => msg, :channel => @channel, :http_sync => true)\r\n end", "def message(to, message)\n send_raw_line(\"PRIVMSG \"+to.to_s+\" :\"+message.chomp)\n end", "def secure_chat(message) \n puts \"This is a secure Chat\" \n puts message \n end", "def communicate value\n c = Chat.new\n c.created_at = Time.now\n c.message = value\n self.chats << c\n Player.connected.each { |p| \n p.packet(\"say\", [self.id, \"#{value.make_safe_for_web_client()}\"]) \n }\n c.save\n self.save\n end", "def speak(data)\n sender = current_user\n message = data['message']\n\n # Save message in database as historical data\n msg = Message.new\n msg.user_id = current_user.id \n msg.recipient_id = data[\"target_user\"]\n msg.content = data['message']\n puts msg\n msg.save!\n\n # Sends back the data in realtime using websockets\n ActionCable.server.broadcast \"RoomChannel\", {message: message, sender: current_user, recipient: User.find(msg.recipient_id)}\n\n end", "def set_chat_message\n @chat_message = ChatMessage.find(params[:id])\n end", "def peer_send(peer,message)\r\n\t\t\tpeer.socket.puts(message)\r\n\t\tend", "def send_message(mesg, options = {})\n @client.ping mesg, options\n end", "def start_command(message)\n user =\n TelegramUser.where(chat_id: message.chat.id).first_or_initialize\n user.chat_id = message.chat.id\n user.name = \"#{message.from.first_name} #{message.from.last_name}\"\n user.save!\n api_send_message(chat_id: message.chat.id,\n text: \"Hello #{message.from.first_name}\")\n end", "def send_channel(message)\n @handler.send_channel message\n end", "def perform(data)\n user = User.find(data[\"user_id\"])\n ActionCable.server.broadcast 'chat_channel', content: data[\"content\"], username: user.email, id: user.id\n end", "def sendM(message)\n\t\t@conexion.puts(message)\t\n\tend", "def send_message(msg)\n self.class.send_message queue_url, msg\n end", "def say(to, msg, using = :chat)\n client.write Blather::Stanza::Message.new(to, msg, using)\n end", "def send_message(content, parent=nil)\n if parent\n @connection.send_data(make_packet(\"send\", {\"content\" => content.to_s, \"parent\" => parent}))\n else\n @connection.send_data(make_packet(\"send\", {\"content\" => content.to_s}))\n end\n end" ]
[ "0.8093", "0.7949052", "0.78806484", "0.772044", "0.76901555", "0.7440954", "0.7390944", "0.7244094", "0.7238495", "0.72367567", "0.72233623", "0.72135496", "0.7116044", "0.7068467", "0.7053515", "0.70520043", "0.6998519", "0.69644886", "0.6891059", "0.68759143", "0.6875394", "0.6855757", "0.68265814", "0.6817815", "0.67907", "0.6783623", "0.6769553", "0.67500186", "0.67397326", "0.6739152", "0.6706487", "0.6687015", "0.66471547", "0.6627195", "0.6615533", "0.66128683", "0.6544275", "0.65348834", "0.65337986", "0.65313303", "0.6497665", "0.64948", "0.64876354", "0.6483989", "0.64728767", "0.6471492", "0.6469025", "0.64547926", "0.6452562", "0.6452562", "0.644982", "0.6441474", "0.6415078", "0.63973606", "0.63709897", "0.6367893", "0.6366574", "0.63645494", "0.63592875", "0.6342687", "0.6341177", "0.6339594", "0.6330236", "0.63166994", "0.63147134", "0.6306006", "0.63006115", "0.6294892", "0.62767345", "0.6267146", "0.62526834", "0.62501806", "0.624143", "0.6237201", "0.62359697", "0.6232349", "0.6213687", "0.6211053", "0.621072", "0.6187156", "0.618493", "0.617899", "0.6171428", "0.617138", "0.6138463", "0.6116689", "0.6115036", "0.61150306", "0.61096644", "0.6108327", "0.60954684", "0.6095439", "0.60918224", "0.6090053", "0.6080859", "0.6078201", "0.6073359", "0.6070997", "0.6069253", "0.6067084", "0.6061833" ]
0.0
-1
Sends a chat message to the client.
def send_bmessage(msg, from = nil) msg = "#{msg} (@#{from})" unless from.nil? @auth_required ? @after_auth.push({:mb => msg}) : send_data({:mb => msg}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end", "def send_message(chat_id, message)\n ActionCable.server.broadcast \"Chat:#{chat_id}\", response: chat_message(message), type: 'message'\n end", "def send_message(message)\n self.broadcast({\n type: \"chat_message\",\n message: message\n })\n end", "def send_message message\n payload = { \"text\" => message }.to_json\n data = client.post \"#{api_prefix}/rooms/#{id}/chatMessages\", payload\n\n Message.new client, id, data\n end", "def send_message\n message = render_to_string(:partial => 'messages/message', :object => @message)\n Juggernaut.send_to_channel(javascript_chat_message(message), @message.channel_id)\n end", "def send(message, options = { channelID: 1 })\n params = { message: message, channelID: options[:channelID] }\n rest.post chat_path, params: params\n end", "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend", "def send_message(*args, **kwargs)\n bot = kwargs.fetch(:bot) { args.fetch(0) }\n args[0] = id\n kwargs[:chat_id] = id\n bot.send_message(*args, **kwargs)\n end", "def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts the message without a job. BUT: that is only the message.\n # We want do more :)\n # ActionCable.server.broadcast(\"chat_rooms_channel\", message: data[\"message\"])\n end", "def send_message\n chat = Chat.find(params[:chat])\n SendMessageToChat.call(@previa_group, chat, params[:message])\n\n respond_to do |format|\n format.html { redirect_to previa_group_chat_path(@previa_group, :chat => chat) }\n format.json { head :no_content }\n end\n end", "def send(message)\n @chats.each do |chat|\n begin\n chat.send(message)\n rescue\n @chats.delete(chat)\n end\n end\n end", "def chat_message(message)\n r = Skype.send_command \"CHATMESSAGE #{id} #{message}\"\n ChatMessage.parse_from(r)\n end", "def send(to, text)\n begin\n @log.info \"Sending message to '#{to}'\"\n @client.send Message::new(to, text).set_type(:chat).set_id('1').set_subject('Boti')\n return true\n rescue\n @log.error \"Error sending message to '#{to}'\"\n return false\n end\n end", "def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end", "def send_message(msg)\n send_data({:type => :message, :body => msg})\n end", "def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args['msg'])}\n )) #envia a mensagem para todos os clientes\n end\n end", "def send_message(_target, text) # rubocop:disable Metrics/AbcSize\n url = \"https://api.gitter.im/v1/rooms/#{config.room_id}/chatMessages\"\n uri = URI.parse(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: true,\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n ) do |http|\n request = Net::HTTP::Post.new(uri.path)\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.add_field('Authorization', \"Bearer #{config.token}\")\n request.body = { 'text' => text }.to_json\n response = http.request(request)\n\n @user_id = MultiJson.load(response.body)['fromUser']['id']\n end\n end", "def send_message( msg )\n @session.send_message msg\n self\n end", "def send_chat_text(msg, type)\n if @socket_srv\n unless msg.empty? \n cmd_to_send = build_cmd(type, msg)\n send_data_to_server(cmd_to_send)\n end\n else\n @cup_gui.log_sometext \"Non collegato in rete\\n\"\n end\n end", "def send_message(message)\n @socket.send(message << \"\\n\", 0, nil, @client)\n end", "def send_message_to(chatid, contact, message, transport=nil)\n return self.class.can_has_chat_server.send_message( :id => chatid,\n :to=>contact,\n :message=>message,\n :transport =>transport)\n end", "def remote_chat(sender, room, msg)\n add_msg \"<#{room || 'unknown'}> #{sender}: #{msg}\"\n end", "def send_message(payload)\n message = Message.new(author: current_user, text: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat\", message: render(message) if message.save\n end", "def send_message\n if message.present?\n sender.send_message(receiver, message, I18n.t(\"activity.verb.#{ contact_verb }.#{ receiver.subject_type }.message\", :name => sender.name))\n end\n end", "def chat_send(message, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ChatApi#chat_send ...\"\n end\n \n # verify the required parameter 'message' is set\n fail \"Missing the required parameter 'message' when calling chat_send\" if message.nil?\n \n # resource path\n path = \"/chat\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"message\"] = message\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n result = @api_client.call_api(:POST, 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 => 'Chat')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ChatApi#chat_send. Result: #{result.inspect}\"\n end\n return result\n end", "def send_message(msg)\n session.transport.send_message(msg)\n end", "def send_new_chat(data)\n stream_from \"Chat:#{data['chat']['id']}\"\n recipient = User.find(data['chat']['recipient_id'])\n unless current_user.id == recipient.id\n ActionCable.server.broadcast \"user_#{recipient.id}_chats\", chat: data['chat'], type: 'new_chat'\n end\n end", "def send_message(payload)\n message = Message.new(user: current_user, chat_id: payload[\"id\"], body: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat_#{payload['id']}\", message: render(message) if message.save\n end", "def send(body=nil)\n msg = Jabber::Message.new(@to)\n msg.type = :chat\n msg.body = body || @message\n @base.stanza(msg)\n end", "def send_mess(mess)\n\t@client.puts(mess)\t\nend", "def send_message(message)\n response = HTTParty.post(\n CHAT_URL,\n body: {\n token: ENV[\"SLACK_API_TOKEN\"],\n text: message,\n channel: @slack_id # need slack_id, per Slack documentation for send_message \n },\n )\n \n return response.code == 200 && response.parsed_response[\"ok\"]\n end", "def chat(message)\n final_message = nil\n if message.is_a?(Hash)\n final_message = message.to_json\n else\n final_message = JSON.dump(action: 'message', message: message)\n end\n log_to_file(\"#{self.class} sends JSON #{final_message}\")\n send_data(final_message)\n end", "def send_telegram message = nil\n chat_id = self.telegram\n if chat_id and !!@@telegram_client\n if message\n begin\n puts \"Enviando: #{message}\n to: #{chat_id}\"\n @@telegram_client.send_message(chat_id: chat_id, text: message)\n true\n rescue\n puts \"Error sending message to telegram group #{group_id}\"\n false\n end\n end\n end\n end", "def send_message(recipient_user_name, msg)\n raise RuntimeError.new(\"Attempt to send message but not connected\") if @ws.nil?\n\n @ws.send({request: \"message\", recipient_user_name: recipient_user_name, msg: msg}.to_json)\n end", "def send_message(message)\n check_parenthesis(message)\n puts \"Send: #{message}\" if @debug\n connection{|c| c.write(message)}\n end", "def send_message (*params)\n send_line Message.new(*params)\n end", "def personalChat\n puts \"This is a Personal Chat\"\n # puts message\n end", "def sendmsg(message)\n text = message.respond_to?(:sendmsg) ? message.sendmsg : message.to_s\n message = \"sendmsg\\n%s\\n\" % text\n self.respond_to?(:send_data) ? send_data(message) : message\n end", "def send_message(message)\n @networking.send_message(message)\n end", "def send_message(message)\n # currently use notifications to send message, as send message doesn't seem to \n # work to android devices. Otherwise would have used this:\n #\n # JSON.parse(User.notifo.send_message(self.username, message))\n send_notification(message)\n end", "def send(message)\n\t\t\t@conn.send(message)\n\t\tend", "def send_message(msg); end", "def chat_message\n @room=current_user.room\n\n @chat_message=ChatMessage.create! content: params[:message],owner_id: current_user.id\n chat_message=render_to_string partial: \"chat_message/chat_message\"\n\n publish_async(\"presence-room_#{@room.id}\", \"chat_message\", {\n message: chat_message\n })\n\n render json: {\n message: chat_message\n }\n end", "def send_msg(data, connection)\n connection.send_msg(data)\n end", "def send(target, message)\n @irc.send_msg(target, message)\n end", "def chat_meMessage(options = {})\n raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?\n raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?\n post('chat.meMessage', options)\n end", "def add_msg(msg, sender)\n\n @chatters.each do |chatter_id, chatter|\n if chatter_id != sender.id\n chatter.client_socket.puts \"#{sender.id} said: #{msg}\"\n end\n end\n\n end", "def message( msg, sender )\n @clients.each do |client|\n client.sock.puts \"#{sender}: #{msg}\" unless sender.port == client.port\n end\n log( \"[message] #{sender}: #{msg}\" )\n end", "def send_message(message); end", "def send_message(message); end", "def sendMsg user, content, wait = false\n # find the user account send to\n send_to = if user.instance_of? User\n user.account\n elsif user.instance_of? String\n user\n elsif user.instance_of? Fixnum\n User.find(:id => user).account\n end\n msg = Jabber::Message.new(send_to).set_type(:chat)\n if content.instance_of? Array\n content.each do |e|\n @cl.send(msg.set_body(e.to_s))\n $logger.info %|Send Message to \"#{send_to}\", with \"#{e.to_s}\"|\n end\n elsif content.instance_of? String\n @cl.send(msg.set_body(content))\n $logger.info %|Send Message to \"#{send_to}\", with \"#{content}\"|\n end\n sleep 0.4 if wait\n end", "def send_team_chat\n data = {display_name: params[:display_name],\n avatar: params[:avatar],\n chat_text: params[:chat]}\n Pusher.trigger(params[:channel], 'chat_message', data)\n end", "def send(msg=\"\")\n\t\tif @connected\n\t\t\t@sock.write \"\\1#{msg}\\r\\n\" # leading \\1 for terse reply\n\t\tend\n\tend", "def enviarMensaje(mensaje)\n @@socket.puts mensaje\n end", "def send(msg)\n @socket.puts msg\n puts '<< ' << msg\n end", "def secureChat\n puts \"This is a secure Chat\"\n puts message\n end", "def send_message(text)\n end", "def personal_chat(message) \n puts \"This is a Personal Chat\" \n puts message \n end", "def send_conversation_message(from, to, params = {})\n ConversationMessage.new(conversation_request(\n :post,\n 'send',\n params.merge(from: from,\n to: to)\n ))\n end", "def send_message(message_text)\n @selected.send_message(message_text)\n end", "def sendMessage(args, client = @send_client)\n jabmsg = Jabber::Message::new(args[:receiver], args[:message]).set_type(:chat).set_id('1')\n \n begin \n Timeout::timeout(10) do\n client.send(jabmsg)\n puts \"XMPP TO: \" + args[:receiver].to_s\n puts \"XMPP MESSAGE: \" + args[:message].to_s\n end\n\n rescue => e\n puts \"XMPP Exception in sending: \" + e + \"\\n\"\n puts \"XMPP Reconnecting to server and trying again\"\n puts \" (-- line #{e.backtrace[0].to_s} )\"\n if client == @receive_client\n puts \"re-connecting to RECEIVE_client\"\n connect(@receive_client)\n else\n puts \"re-connecting to SEND_client\"\n connect(@@send_client_info)\n end\n retry\n end\n end", "def send_message_to_channel(client, channel_id, title, message)\n client.chat_postMessage(\n channel: channel_id, \n as_user: true,\n text: \"*\" + title + \"*\",\n attachments: [\n text: message,\n color: \"warning\"\n ]\n )\nend", "def send( a )\n\t\tbegin\n\t @jabbermsg.body = a\n \t @jabberchatroom.send( @jabbermsg )\n \trescue Jabber::ServerDisconnected\n \t\tputs \"Server disconnected. Trying reconnect\"\n \t\t@jabberReconnect = true\n \t\t@jabberRetryMessage = a\n \trescue Jabber::JabberError => e\n \t\tputs \"Error for #{e.error.to_s.inspect}\"\n \t\tputs \"Trying reconnect\"\n \t\t@jabberReconnect = true\n \t\t@jabberRetryMessage = a\n \tend\n\tend", "def send_message(to, message)\n if !@client.is_connected?\n @log.warn \"Bot is not connected. Can't send the message.\"\n return false\n end\n\n case message\n when Array\n message.each do |text|\n sleep 1\n return unless send(to, text)\n end\n when String\n return send(to, message)\n else\n @log.error \"Message is not an Array nor a String. Can't send.\"\n return false\n end\n end", "def send(message)\n info(\"[Smartfocus] Send -> #{message}\")\n end", "def sendChatAction to, act\n self.query(\"sendChatAction\", {:chat_id=>to, :action=>act})\n end", "def handle_chat(msg, message)\n @user = msg.actor\n #raise \"#{self.class.name} doesn't implement `handle_chat`!\"\n end", "def send_channel(message)\n @bot.message_queue.push(\"PRIVMSG ##{bot.channel.name} :#{message}\")\n end", "def send_message(opts = {})\n @client.update(opts[:message])\n end", "def send(message)\n if message.length > 0\n # The client will return an empty string\n # on success, or it will return an error\n error = @client.transmit(message)\n if error.length > 0\n new_message(error)\n end\n end\n end", "def chat=(value)\n @chat = value\n end", "def send_message(*args, **kwargs)\n chat_id = kwargs.fetch(:chat_id) { args.fetch(0) }\n text = kwargs.fetch(:text) { args.fetch(1) }\n parse_mode = kwargs.fetch(:parse_mode) { args[2] }\n disable_web_page_preview = kwargs.fetch(:disable_web_page_preview) { args[3] }\n\n logger.info \"sending message: #{text.inspect}\"\n data = {text: text, chat_id: chat_id}\n data[:parse_mode] = parse_mode unless parse_mode.nil?\n data[:disable_web_page_preview] = disable_web_page_preview unless disable_web_page_preview.nil?\n\n args.shift(4)\n args.unshift(\"#{@base_path}/sendMessage\", data)\n Message.new(post_message(*args, **kwargs))\n end", "def send_message(data)\n @chatroom = Chatroom.find(data[\"chatroom_id\"])\n message = @chatroom.messages.create(body: data[\"body\"], user: current_user)\n MessageRelayJob.perform_later(message)\n #Rails.logger.info data\n end", "def update text\n payload = { \"text\" => message }.to_json\n data = client.post \"#{api_prefix}/rooms/#{room_id}/chatMessages/#{id}\", payload\n\n new client, room_id, data\n end", "def irc_send(message)\n puts(\"Sending: #{message}\")\n\n # We can call \"puts\" on the socket we opened earlier. Instead of outputting something on the\n # terminal, this will send the message accross the internet to the IRC server we are connected to\n @socket.puts(message)\nend", "def perform(message)\n\t\t# Broadcast the rendered message to the channel\n\t\tActionCable.server.broadcast 'chatroom_channel', message: render_message(message)\n\tend", "def send(message)\n message\n end", "def sendSecureMessage\n secureChat(\"This is confidential\")\n end", "def send_msg(data, connection)\n # TODO\n end", "def send(message)\n socket.send(message, 0, address, port)\n end", "def send(msg)\n @connection.write(\n @serializer.en(msg))\n rescue Exception => e\n raise\n end", "def handle_chat_msg(msg)\n if command_checker(msg)\n @conn.send(\">>> If you meant to send a command, try preceding it with <<<.\")\n @conn.send(\">>> If not, sorry for butting in. Type a backslash before your chat message whenever your chat message is identical to a command.\")\n else\n @server.forward(msg, self)\n end\n end", "def send_to(other_player, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: other_player, text: msg })\n\t\t\tm.save!\n\t\t\tother_player.send_message(m)\n\t\tend", "def sent_telegram( message )\n\tTelegram::Bot::Client.run($telegram_token) do |bot|\n\t\tbot.api.send_message( chat_id: 43716964, text: message)\n\tend\nend", "def send_reply(text)\n @bot.api.send_message(chat_id: @last_message.chat.id, text: text)\n end", "def respond(message)\n @channel.send_message(message) if @channel\n end", "def sendMsg(msg)\r\n @pubNub.publish(:message => msg, :channel => @channel, :http_sync => true)\r\n end", "def message(to, message)\n send_raw_line(\"PRIVMSG \"+to.to_s+\" :\"+message.chomp)\n end", "def secure_chat(message) \n puts \"This is a secure Chat\" \n puts message \n end", "def communicate value\n c = Chat.new\n c.created_at = Time.now\n c.message = value\n self.chats << c\n Player.connected.each { |p| \n p.packet(\"say\", [self.id, \"#{value.make_safe_for_web_client()}\"]) \n }\n c.save\n self.save\n end", "def speak(data)\n sender = current_user\n message = data['message']\n\n # Save message in database as historical data\n msg = Message.new\n msg.user_id = current_user.id \n msg.recipient_id = data[\"target_user\"]\n msg.content = data['message']\n puts msg\n msg.save!\n\n # Sends back the data in realtime using websockets\n ActionCable.server.broadcast \"RoomChannel\", {message: message, sender: current_user, recipient: User.find(msg.recipient_id)}\n\n end", "def set_chat_message\n @chat_message = ChatMessage.find(params[:id])\n end", "def peer_send(peer,message)\r\n\t\t\tpeer.socket.puts(message)\r\n\t\tend", "def send_message(mesg, options = {})\n @client.ping mesg, options\n end", "def start_command(message)\n user =\n TelegramUser.where(chat_id: message.chat.id).first_or_initialize\n user.chat_id = message.chat.id\n user.name = \"#{message.from.first_name} #{message.from.last_name}\"\n user.save!\n api_send_message(chat_id: message.chat.id,\n text: \"Hello #{message.from.first_name}\")\n end", "def send_channel(message)\n @handler.send_channel message\n end", "def perform(data)\n user = User.find(data[\"user_id\"])\n ActionCable.server.broadcast 'chat_channel', content: data[\"content\"], username: user.email, id: user.id\n end", "def sendM(message)\n\t\t@conexion.puts(message)\t\n\tend", "def send_message(msg)\n self.class.send_message queue_url, msg\n end", "def say(to, msg, using = :chat)\n client.write Blather::Stanza::Message.new(to, msg, using)\n end", "def send_message(content, parent=nil)\n if parent\n @connection.send_data(make_packet(\"send\", {\"content\" => content.to_s, \"parent\" => parent}))\n else\n @connection.send_data(make_packet(\"send\", {\"content\" => content.to_s}))\n end\n end" ]
[ "0.8093", "0.7949052", "0.78806484", "0.772044", "0.76901555", "0.7440954", "0.7390944", "0.7244094", "0.7238495", "0.72367567", "0.72233623", "0.72135496", "0.7116044", "0.7068467", "0.7053515", "0.70520043", "0.6998519", "0.69644886", "0.6891059", "0.68759143", "0.6875394", "0.6855757", "0.68265814", "0.6817815", "0.67907", "0.6783623", "0.6769553", "0.67500186", "0.67397326", "0.6739152", "0.6706487", "0.6687015", "0.66471547", "0.6627195", "0.6615533", "0.66128683", "0.6544275", "0.65348834", "0.65337986", "0.65313303", "0.6497665", "0.64948", "0.64876354", "0.6483989", "0.64728767", "0.6471492", "0.6469025", "0.64547926", "0.6452562", "0.6452562", "0.644982", "0.6441474", "0.6415078", "0.63973606", "0.63709897", "0.6367893", "0.6366574", "0.63645494", "0.63592875", "0.6342687", "0.6341177", "0.6339594", "0.6330236", "0.63166994", "0.63147134", "0.6306006", "0.63006115", "0.6294892", "0.62767345", "0.6267146", "0.62526834", "0.62501806", "0.624143", "0.6237201", "0.62359697", "0.6232349", "0.6213687", "0.6211053", "0.621072", "0.6187156", "0.618493", "0.617899", "0.6171428", "0.617138", "0.6138463", "0.6116689", "0.6115036", "0.61150306", "0.61096644", "0.6108327", "0.60954684", "0.6095439", "0.60918224", "0.6090053", "0.6080859", "0.6078201", "0.6073359", "0.6070997", "0.6069253", "0.6067084", "0.6061833" ]
0.0
-1
Callbacks for events on the server Registers a block to call when authentication is attempted.
def auth_attempt(*args, &blk) block_given? ? @auth_attempt_cbs << blk : @auth_attempts.push(args) while (auth_data = @auth_attempts.shift) @auth_attempt_cbs.each { |cb| cb.call(*auth_data) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_login(&block)\n add_callback(:login, block)\n end", "def after_custom_authentication; end", "def callback\n rpx_auth\n after_auth(params[:on_complete_url])\n end", "def on_connection_success &block\n @connection_success_callback = block\n end", "def listen_account(&block)\n raise BlockMissingError unless block_given?\n ws_auth(&block)\n end", "def after_custom_authentication\n\n end", "def after_database_authentication; end", "def token_auth(*args, &block); end", "def when_auth &block # :yields: abs_url, realm\n @get_auth_details = block\n end", "def handle_request( request, &block )\n\t\tself.log.debug \"[:auth] Wrapping request in auth with a %p\" % [ self.auth_provider ]\n\n\t\trequest.auth_provider = self.auth_provider\n\t\tself.authenticate_and_authorize( request )\n\n\t\tsuper\n\tend", "def on_success(&block)\n @handlers[:success] = block\n self\n end", "def basic_auth(*args, &block); end", "def on_success(&block); end", "def auth_ok(*args, &blk)\n block_given? ? @auth_ok_cbs << blk : @auth_oks.push(args)\n while (ok_data = @auth_oks.shift)\n @auth_ok_cbs.each { |cb| cb.call(*ok_data) }\n end\n end", "def callback_phase\n @auth_token = get_auth_token(request.params[\"username\"], request.params[\"sid\"])\n @user_info = get_user_info(request.params[\"username\"], @auth_token)\n ap @user_info\n super\n rescue => ex\n fail!(\"Failed to retrieve user info from ebay\", ex)\n end", "def dropbox_callback\n start_session(RegisterUser.call(get_web_auth.finish(params)))\n connect_client\n\t\tredirect_to user_dash_path(current_user)\n end", "def auth\n case params[:provider]\n when 'sms_ident_auth'\n return current_user.add_event(:auth) if session[:sms_auth_success].present?\n current_user.add_event(:sms_ident)\n when 'sms_ident'\n current_user.add_event(:sms_ident)\n when 'sms_ident_adv'\n current_user.add_event(:sms_ident_adv)\n when 'guest_skip'\n current_user.add_event(:guest_skip)\n when 'guest_adv'\n current_user.add_event(:guest_adv)\n when 'guest_password'\n current_user.add_event(:guest_password)\n else\n current_user.add_event(:auth)\n end\n redirect_to router_url\n end", "def after_hash_token_authentication\n end", "def after_token_authentication\n end", "def after_token_authentication\n end", "def after_ip_authentication\n end", "def authentication_succeed(oidresp)\n end", "def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end", "def callback\n\t\t\n\t\t@dbsession = DropboxSession.deserialize(@@dropbox_session)\n\t\t@dbsession.get_access_token #we've been authorized, so now request an access_token\n\t\t@dropbox_session = @dbsession.serialize\n\t\tdropbox = Linkdropbox.new\n\t\tdropbox.dropbox_token = @dropbox_session\n\t dropbox.save\n\t\t#read_prices(DropboxSession.deserialize(@dropbox_session))\n\t\tflash[:success] = \"You have successfully authorized with dropbox.\"\n\n\t\tredirect_to services_show_path\n\n\t#rescue \n\t\t#session[:dropbox_session] = nil\n\t #flash[:success] = \"Failed to authorize\"\n\t\t#redirect_to services_show_path\n\n\t\t#redirect_to session[:return_to]\t\n\tend", "def on_success( &block )\n @on_success = block\n end", "def connection_successful\n @authenticating = false\n opened!\n\n exec_callback_yielding_self(:connect)\n end", "def authorization(*args, &block); end", "def auth\n end", "def auth\n end", "def on_success(&block)\n apply_hook(:success, &block)\n end", "def on_connection_established(&block)\n @on_connection_established_block = block\n end", "def callback_phase\n ym_session_id = env['rack.session'][RACK_SESSION_KEY]\n fail!(E_YM_SESSION_ID_BLANK) if ym_session_id.blank?\n ym_session = YourMembership::Session.new(ym_session_id, 100)\n\n begin\n fail! 'Failed To Log In' unless ym_session.authenticated?\n rescue YourMembership::Error => e\n fail! e.error_description\n end\n\n @user_id = ym_session.user_id\n @access_token = ym_session.to_s\n\n super\n end", "def on_open(&block)\n define_callback :connect, &block\n end", "def on_success( &block )\n @on_success_blocks ||= []\n @on_success_blocks << block\n end", "def callback(&block)\n @callbacks << block\n end", "def authenticate!\n if in_flow?\n continue_flow!\n else\n begin_flow!\n end\n end", "def after_crowd_authentication\n end", "def on_launch_request\n if authorized? && request_type.launch? && block_given?\n @response = yield user\n end\n end", "def before_method(request, response)\n if @current_principal\n # We already have authentication information. This means that the\n # event has already fired earlier, and is now likely fired for a\n # sub-request.\n #\n # We don't want to authenticate users twice, so we simply don't do\n # anything here. See Issue #700 for additional reasoning.\n #\n # This is not a perfect solution, but will be fixed once the\n # \"currently authenticated principal\" is information that's not\n # not associated with the plugin, but rather per-request.\n #\n # See issue #580 for more information about that.\n return nil\n end\n\n if @backends.empty?\n fail Dav::Exception, 'No authentication backends were configured on this server.'\n end\n\n reasons = []\n @backends.each do |backend|\n result = backend.check(request, response)\n\n if !result.is_a?(Array) ||\n result.size != 2 ||\n !(result[0].is_a?(TrueClass) || result[0].is_a?(FalseClass)) ||\n !result[1].is_a?(String)\n fail Dav::Exception, 'The authentication backend did not return a correct value from the check method.'\n end\n\n if result[0]\n @current_principal = result[1]\n # Exit early\n return nil\n end\n reasons << result[1]\n end\n\n # If we got here, it means that no authentication backend was\n # successful in authenticating the user.\n @current_principal = nil\n\n @backends.each do |backend|\n backend.challenge(request, response)\n end\n fail Exception::NotAuthenticated, reasons.join(', ')\n end", "def login_and_run(&block)\n login\n yield self\n logout\n end", "def on_recovery(&block)\n self.redefine_callback(:after_recovery, &block)\n end", "def on_recovery(&block)\n self.redefine_callback(:after_recovery, &block)\n end", "def pre_authorize_cb; end", "def authenticate(request, realm, &password_procedure); end", "def on_remote_call &block\n @on_remote_call = block\n end", "def on_error &block\n synchronize do\n @error_callbacks << block\n end\n end", "def on_ready(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_ready(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_request( &block )\n @on_request = block\n end", "def register_callback(&block)\n @_aclize_callback = block\n end", "def on_authorization\n send_data \"Hello #{entered_username}! You're authorized now.\\n\"\n # NOTE: first command prompt is sent automatically after this\n end", "def register_verify_callback(connection)\n connection.verify_callback = self\n end", "def after_login!(user, username = '', password = '', options = {})\n sorcery_config.after_login.each do |callback|\n send(callback, user, username, password, options)\n end\n end", "def pre_authorize_cb=(_arg0); end", "def authenticate\n end", "def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n # super\n end", "def on_trap &block\n @socket.callbacks << block\n end", "def authenticate_inviter!\n send(:\"authenticate_#{resource_name}!\")\n end", "def user_authentication\n end", "def on_connect(&block)\n raise IrcError.new('wrong arity') if block.arity != 4\n self[:connect] << block\n end", "def on_auth_event(_ctx, _authorization_id, _authentication_id, _authentication)\n # if authentification is used, override this event\n # and implement your own user management.\n # otherwise all authentifications are blocked per default\n raise Smtpd535Exception\n end", "def verify_callback; end", "def verify_callback; end", "def on_check_completed(&block)\n @check_completed_handler = block\n end", "def callback\n\n end", "def after_magic_link_authentication\n end", "def authenticate!\n # Do nothing yet\n end", "def connection_completed\n\t\tsend_data \"#{$username}:#{$password}\"\n\tend", "def login_required(&block)\n\n if !logged_in?\n login_from_cookie\n elsif !block.nil?\n block.call\n end\n \n logged_in? ? true : access_denied\n end", "def auth\n \n Pusher['presence-test-channel'].trigger('newPlayer', {:from => \"new name\", :subject => \"new subject\"})\n \n \n response = Pusher[params[:channel_name]].authenticate(params[:socket_id], {\n :user_id => 12, # => required\n :user_info => {\n :name => \"Robert\",\n :email => \"rkm_email@yahoo.com\"\n }\n })\n render :json => response\n \n Pusher['presence-test-channel'].trigger('count', {:from => \"new name\", :subject => \"new subject\"})\n end", "def on(what, *, &block)\n if STATES.include?(what) || %w[success failure].include?(what) || Integer === what\n @callbacks[what] << block\n else\n super\n end\n end", "def http_auth_login\n # FIXME: Implement\n end", "def auth_trap_state\n super\n end", "def on_auth_message(websocket, msg_type, *args)\n unless account_state\n player_data = @engine_accounts_obj.engine.item_by_name(\"players\")\n player_data.state = {}\n raise(\"Couldn't set account state!\") unless account_state\n end\n\n if msg_type == \"register_account\"\n username, salt, hashed = args[0][\"username\"], args[0][\"salt\"], args[0][\"bcrypted\"]\n if account_state[username]\n # Technically this is a failed registration, not a login.\n websocket_send websocket, \"failed_login\", \"Account #{username.inspect} already exists!\"\n return\n end\n account_state[username] = { \"account\" => { \"salt\" => salt, \"hashed\" => hashed, \"method\" => \"bcrypt\" } }\n\n return\n end\n if msg_type == \"hashed_login\"\n username, hashed = args[0][\"username\"], args[0][\"bcrypted\"]\n unless account_state[username]\n websocket_send websocket, \"failed_login\", \"No such user as #{username.inspect}!\"\n return\n end\n if account_state[username][\"account\"][\"hashed\"] == hashed\n # Let the browser side know that a login succeeded\n websocket_send websocket, \"login\", username: username\n # Let the app know that a login succeeded\n self.on_login(websocket, username, @engine_accounts_obj)\n else\n websocket_send websocket, \"failed_login\", \"Wrong password for user #{username.inspect}!\"\n end\n return\n end\n\n # TODO: some kind of rate-limiting to reduce our willingness to give out user salts in bulk\n if msg_type == \"get_salt\"\n username = args[0][\"username\"]\n unless account_state[username]\n websocket_send websocket, \"failed_login\", \"No such usr as #{username.inspect}!\"\n return\n end\n user_salt = account_state[username][\"account\"][\"salt\"]\n websocket_send websocket, \"login_salt\", user_salt\n return\n end\n\n raise \"Unrecognized authorization message: #{msg_data.inspect}!\"\n end", "def block\n current_user.block_user(@user.id)\n render json: {ok: 1}\n end", "def on_start(&block)\n @on_start << block\n end", "def login_with(&blk)\n @login_with = blk if blk\n @login_with\n end", "def handle_failed_login\n Log.error(\"failure.\")\n end", "def callback\n auth = build_auth\n respond_to do |format|\n if logged_in?\n add_identity_to_current_user(auth)\n welcome_user(current_user)\n format.html { redirect_logged_in_user }\n format.json { render_jsend_success(:logged_in) }\n else\n user = find_or_create_user_from_auth(auth)\n if user\n user.remember_me! if session.delete(:remember_me)\n if user.connected?\n setup_new_user(user, auth)\n format.html { redirect_to_signup_flow_entry_point }\n format.json { render_jsend_success(:connected, new_profile_data(user, auth)) }\n elsif user.registered?\n setup_existing_user(user)\n format.html { redirect_after_onboarding_check(user, request.env['omniauth.origin']) }\n format.json { render_jsend_success(:registered) }\n else\n notify_visitor_user_creation_failed(user)\n format.html { redirect_after_auth(request.env['omniauth.origin'] || login_path) }\n format.json { render_jsend(error: :user_creation) }\n end\n else\n format.html { redirect_to(login_path) }\n format.json { render_jsend(error: :no_user) }\n end\n end\n end\n end", "def on_auth_message(websocket, msg_type, *args)\n sync_account_state\n\n if msg_type == \"register_account\"\n username, salt, hashed = args[0][\"username\"], args[0][\"salt\"], args[0][\"bcrypted\"]\n if @account_state[username]\n websocket_send websocket, \"failed_registration\", \"Account #{username.inspect} already exists!\"\n return\n end\n unless username =~ ACCOUNT_NAME_REGEX\n websocket_send websocket, \"failed_registration\", \"Account name contains illegal characters: #{username.inspect}!\"\n return\n end\n @account_state[username] = { \"account\" => { \"salt\" => salt, \"hashed\" => hashed, \"method\" => \"bcrypt\" } }\n sync_account_state\n websocket_send websocket, \"registration\", { \"account\" => username }\n\n return\n end\n if msg_type == \"hashed_login\"\n username, hashed = args[0][\"username\"], args[0][\"bcrypted\"]\n unless @account_state[username]\n websocket_send websocket, \"failed_login\", \"No such user as #{username.inspect}!\"\n return\n end\n if @account_state[username][\"account\"][\"hashed\"] == hashed\n # Let the browser side know that a login succeeded\n websocket_send websocket, \"login\", username: username\n # Let the app know that a login succeeded\n self.on_login(websocket, username, @engine_accounts_obj)\n else\n websocket_send websocket, \"failed_login\", \"Wrong password for user #{username.inspect}!\"\n end\n return\n end\n\n # TODO: some kind of rate-limiting to reduce our willingness to give out user salts in bulk\n if msg_type == \"get_salt\"\n username = args[0][\"username\"]\n unless @account_state[username]\n websocket_send websocket, \"failed_login\", \"No such usr as #{username.inspect}!\"\n return\n end\n user_salt = @account_state[username][\"account\"][\"salt\"]\n websocket_send websocket, \"login_salt\", user_salt\n return\n end\n\n raise \"Unrecognized authorization message: #{msg_data.inspect}!\"\n end", "def authenticate_member!\n end", "def after_successful_token_authentication\n # binding.pry\n # Make the authentication token to be disposable - for example\n # renew_authentication_token!\n end", "def adopt client_handler\n \n # The following blocks for login,\n # and throws on bad username:\n name = client_handler.name\n \n # Okay, I love this method to death. Atomically shove the\n # client into the dictionary, but only if another user\n # hasn't already claimed that spot in the chat circle.\n # \n # Did I mention it's atomic and threadsafe?\n \n result = @circle.put_if_absent name, client_handler\n \n # Now,\n # did it go in?\n \n unless result.nil?\n # There was already someone by that name.\n client_handler.error UsernameTakenError.new\n client_handler.graceful\n \n return # Hits the ‘ensure’ block on its way out.\n end\n \n \n \n # All's well for a new user.\n # Welcome them!\n \n client_handler.receive TiscapTransmission.new( :']welcome', nil, nil )\n \n \n # The protocol leaves it up to the server, if it wants to push\n # an active users list. I'd rather not decide, so I'm leaving\n # it up to chance:\n if rand(2) == 1\n client_handler.receive TiscapTransmission.new( :']activeusers',\n self.users.join(','),\n nil )\n end\n \n \n # Broadcast the successful arrival of\n # this esteemed user:\n self.send_public(\n TiscapTransmission.new(:']connected', name, nil),\n nil)\n \n \n \n rescue TiscapError => you_eeediot\n # Some sort of client-understantable error. Pass it on to them.\n # That said, they haven't successfully logged in, so\n # we terminate the Transport connection as soon as the\n # error messages go out.\n \n client_handler.error you_eeediot\n client_handler.graceful\n \n ensure\n # ⎛This ALWAYS gets executed before the method terminates,⎞\n # ⎝even on early return! ⎠\n \n # Even if we return early, we must---MUST!---let the\n # client handler open up its communication queues\n # so that error messages properly filter down to the client.\n # Were circumstances to require that communications never\n # open, we could do client_handler.kill before returning.\n \n client_handler.talk\n \n end", "def on(what, &block)\n @callback_map[what] = block\n end", "def post_init\n send_message :PASS, @settings[:server_password] if @settings[:server_password]\n send_message :USER, @settings[:ident], \"0\", \"0\", @settings[:realname]\n send_message :NICK, @settings[:nick]\n end", "def callback\n @discogs = Discogs::Wrapper.new(\"Test OAuth\")\n request_token = session[:request_token]\n verifier = params[:oauth_verifier]\n access_token = @discogs.authenticate(request_token, verifier)\n \n session[:request_token] = nil\n session[:access_token] = access_token\n \n @discogs.access_token = access_token\n \n # You can now perform authenticated requests.\n end", "def connection_status_login_request; end", "def after_logout(&block)\n add_callback(:logout, block)\n end", "def callbacks; end", "def callbacks; end", "def register_request_callback(&block)\n request_callbacks << block\n end", "def after_ip_authentication(_remote_ip); end", "def on_status(&block)\n @on_status = block\n end", "def on_status(&block)\n @on_status = block\n end", "def auth_succeeded( request, credentials )\n\t\tself.log.info \"Authentication for %p succeeded.\" % [ credentials ]\n\t\t# No-op by default\n\tend", "def Authentication\n call('', '')\n end", "def callback(&block)\n @callbacks ||= []\n @callbacks << block\n end", "def set_authentication_listener(on_set_authentication, on_authentication)\n @on_set_authentication = on_set_authentication\n @on_authentication = on_authentication\n end", "def on_success(&blk)\n @on_success = blk\n @on_success.call(@response) if @response\n end", "def connect\n succeed # Triggers all callbacks for class\n end" ]
[ "0.7109251", "0.6351356", "0.6306088", "0.62733257", "0.62172306", "0.6111113", "0.61036783", "0.6078022", "0.60432506", "0.5974429", "0.595984", "0.59598106", "0.59377474", "0.5932868", "0.5932029", "0.59099734", "0.5870921", "0.5825908", "0.5808648", "0.5808648", "0.5778115", "0.5767098", "0.57338476", "0.5711545", "0.5697789", "0.5680413", "0.56788355", "0.56716794", "0.56716794", "0.566708", "0.56529355", "0.56513053", "0.5649895", "0.56438345", "0.56184375", "0.5601183", "0.5599529", "0.55925304", "0.5576022", "0.55505157", "0.5542294", "0.5542294", "0.55245787", "0.55115515", "0.55050474", "0.54997385", "0.54883415", "0.54883415", "0.5486324", "0.5469705", "0.54660696", "0.5465668", "0.54572177", "0.54451203", "0.54444414", "0.5444104", "0.5425875", "0.54248995", "0.54241306", "0.5421406", "0.54172885", "0.5403675", "0.5403675", "0.5400661", "0.5397468", "0.53956693", "0.53944254", "0.5388609", "0.5385864", "0.5384141", "0.5378193", "0.5376371", "0.53682965", "0.53572106", "0.5353969", "0.5343968", "0.53437537", "0.5341219", "0.53364587", "0.53323734", "0.53318715", "0.5324229", "0.5321105", "0.5319735", "0.5319685", "0.5315752", "0.531566", "0.531168", "0.530655", "0.530655", "0.53049695", "0.5304029", "0.5303558", "0.5303558", "0.52837473", "0.52835464", "0.52790433", "0.52763104", "0.52674776", "0.52671957" ]
0.5676483
27
auth_attempt(args, &blk) Registers a block to call when authentication fails.
def auth_fail(*args, &blk) block_given? ? @auth_fail_cbs << blk : @auth_fails.push(args) while (fail_data = @auth_fails.shift) @auth_fail_cbs.each { |cb| cb.call(*fail_data) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_attempt(*args, &blk)\n block_given? ? @auth_attempt_cbs << blk : @auth_attempts.push(args)\n while (auth_data = @auth_attempts.shift)\n @auth_attempt_cbs.each { |cb| cb.call(*auth_data) }\n end\n end", "def token_auth(*args, &block); end", "def auth_ok(*args, &blk)\n block_given? ? @auth_ok_cbs << blk : @auth_oks.push(args)\n while (ok_data = @auth_oks.shift)\n @auth_ok_cbs.each { |cb| cb.call(*ok_data) }\n end\n end", "def initiate_auth(email:, password:)\n client.initiate_auth(\n client_id: cognito_client_id,\n auth_flow: 'USER_PASSWORD_AUTH',\n auth_parameters: {\n 'USERNAME' => email,\n 'PASSWORD' => password,\n },\n )\n rescue Aws::CognitoIdentityProvider::Errors::NotAuthorizedException,\n Aws::CognitoIdentityProvider::Errors::UserNotFoundException => e\n if e.message == 'Temporary password has expired and must be reset by an administrator.'\n raise TemporaryPasswordExpiredException, e\n else\n raise NotAuthorizedException, e\n end\n rescue Aws::CognitoIdentityProvider::Errors::InvalidParameterException => e\n raise AuthenticationBackendException, e\n rescue Aws::CognitoIdentityProvider::Errors::PasswordResetRequiredException\n raise PasswordResetRequiredException\n end", "def authenticate( *args )\n\t\tself.log.error \"authentication failure (fallback method)\"\n\t\traise SecurityError, \"authentication failure\"\n\tend", "def with_authentication( txn, *args )\n\t\t\tself.log.debug \"wrapping a block in authentication\"\n\n\t\t\t# If the user doesn't have a session user, go to the login form.\n\t\t\tif user = self.get_authenticated_user( txn )\n\t\t\t\treturn yield( user )\n\t\t\telse\n\t\t\t\tself.log.warning \"Authentication failed from %s for %s\" %\n\t\t\t\t\t[ txn.remote_host(Apache::REMOTE_NOLOOKUP), txn.the_request ]\n\t\t\t\treturn self.subrun( :login, txn, *args )\n\t\t\tend\n\t\tend", "def attempt_login\n if params[:email].present? && params[:password].present?\n found_user = User.where(email: params[:email]).first\n authorized_user = found_user.authenticate(params[:password]) if found_user\n end\n\n if authorized_user\n authenticate_user(found_user.id)\n flash[:notice] = 'You are now logged in.'\n redirect_to(challenge_index_path)\n else\n flash.now[:notice] = 'Invalid email/password combination.'\n render('login')\n end\n end", "def attempt(message, &block)\n perform_action(message, false, @passfail, nil, true, false, &block)\nend", "def handle_failed_login\n Log.error(\"failure.\")\n end", "def auth_fail\n fail(Kankri::AuthenticationFailure)\n end", "def each_attempt(&block)\n @attempts.each(&block)\n end", "def ask_login(*args, &block)\n if block\n @@ask_login_block = block\n else\n @@ask_login_block.call if @@ask_login_block\n end\n end", "def authenticate(request, realm, &password_procedure); end", "def initiate_auth(email:, password:)\n client.initiate_auth(\n client_id: cognito_client_id,\n auth_flow: 'USER_PASSWORD_AUTH',\n auth_parameters: {\n 'USERNAME' => email,\n 'PASSWORD' => password\n }\n )\n rescue Aws::CognitoIdentityProvider::Errors::NotAuthorizedException,\n Aws::CognitoIdentityProvider::Errors::UserNotFoundException => e\n raise NotAuthorizedException.new(e.message)\n rescue Aws::CognitoIdentityProvider::Errors::InvalidParameterException => e\n raise AuthenticationBackendException.new(e.message)\n end", "def failed_login!\n @number_of_bad_logins = increment_bad_login_counter\n throttle_user if should_throttle?\n end", "def login_with(&blk)\n @login_with = blk if blk\n @login_with\n end", "def auth_mifare_block(blk, cuid = card_uid, key = PN532::MIFARE_DEFAULT_KEY)\n uid = PN532::DataBuffer.new.set(cuid)\n\n resp = PN532.mifare_authenticate_block(\n pn_struct,\n uid,\n uid.nonzero_length,\n blk,\n PN532::MIFARE_CMD_AUTH_A,\n key\n )\n\n check_error(resp)\n end", "def basic_auth(*args, &block); end", "def last_attempt_request(&block)\n resp = block.call\n error = invalid_access_token_response?(resp)\n error ? raise(error) : resp\n end", "def handle_errored_login(code)\n Log.error(\"error code #{code}.\")\n end", "def log_attempt(message='', return_on_fail=nil)\n begin\n r = 'unknown'\n error = false\n log_info_with_timestamp \"#{message} ...\" unless message.blank?\n r = yield\n rescue StandardError => e\n error = true\n log_exception(e)\n log_error_with_timestamp \"ERROR #{message}; result = #{return_on_fail.to_s[0,100]}\" unless message.blank?\n if return_on_fail == :raise\n raise(e)\n else\n return_on_fail\n end\n ensure\n unless error\n log_info_with_timestamp \"DONE #{message}; result = #{r.to_s[0,100]}\" unless message.blank?\n end\n end\nend", "def process_authorization(session)\n args = session.args\n\n if (session.reply.body.status_passadd?)\n args = session.reply.body.args\n session.pass_fail[:pass] = true\n session.pass_fail[:pass_type] = :add\n elsif (session.reply.body.status_passrepl?)\n args = session.reply.body.args\n session.pass_fail[:pass] = true\n session.pass_fail[:pass_type] = :repl\n end\n\n session.pass_fail[:server_msg] = session.reply.body.server_msg\n session.pass_fail[:data] = session.reply.body.data\n session.pass_fail[:args] = args\n session.terminate = true\n return(nil)\n end", "def authenticate(*args)\n authenticate!(*args)\n rescue\n nil\n end", "def invalid_login_attempt\n set_flash_message(:error, :invalid)\n render json: flash[:error], status: 401\n end", "def authorization(*args, &block); end", "def when_auth &block # :yields: abs_url, realm\n @get_auth_details = block\n end", "def invalid_login_attempt\n warden.custom_failure!\n render :json => {success: false, message: \"Error with your email or password\"}, status: 401\n end", "def with_account\n tries ||= 0\n\n refresh_access! if client.access.expired?\n\n yield\n rescue Redd::Errors::InvalidAccess\n refresh_access!\n\n # We *should* only get an invalid access error once, but let's be safe.\n retry if (tries += 1) < 1\n end", "def first_attempt_request(&block)\n resp = block.call\n resp unless invalid_access_token_response?(resp)\n end", "def login_required(&block)\n\n if !logged_in?\n login_from_cookie\n elsif !block.nil?\n block.call\n end\n \n logged_in? ? true : access_denied\n end", "def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end", "def authenticate!\n if in_flow?\n continue_flow!\n else\n begin_flow!\n end\n end", "def handle_login_error error\n logout_keeping_session!\n begin\n raise error\n rescue AccountNotActive => error\n log_failed_signin error\n redirect_back_or_default('/')\n rescue AccountNotFound, BadPassword => error\n log_failed_signin error\n try_again\n rescue AuthenticationError, SecurityError => error\n log_failed_signin error\n redirect_back_or_default('/')\n end\n # general exceptions are uncaught\n end", "def note_failed_signin\n error_status(true, :login_failure, {}, false)\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def with_user(new_user, new_pass, &block)\n old_user = user\n old_pass = (exists?(password) ? password : '')\n set_user(new_user, new_pass)\n begin\n yield\n rescue Exception => e\n set_user(old_user, old_pass)\n raise e\n end\n set_user(old_user, old_pass)\nend", "def authenticate_user!\n store_location and raise NotLoggedIn unless logged_in?\n end", "def authenticate!\n raise error!({meta: {code: RESPONSE_CODE[:unauthorized], message: I18n.t(\"errors.not_authenticated\"), debug_info: ''}}, RESPONSE_CODE[:unauthorized]) unless current_user\n end", "def invalid_login_attempt\n warden.custom_failure!\n json_response({ success: false, message: \"Username/Password incorrect.\" }, 400)\n end", "def note_failed_signin\r\n flash[:error] = \" Invalid user/password combination.\"\r\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end", "def authenticate_account(account, &firebase_handler)\n if !account\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'No Twitter account to authenticate.' })\n Dispatch::Queue.main.async do\n firebase_handler.call(error, nil)\n end if firebase_handler\n else\n @account = account\n @firebase_callback = firebase_handler\n make_reverse_request # kick off step 1b\n end\n end", "def successful_login!\n unthrottle_user\n clear_bad_login_counter\n end", "def with_authentication\n Adapters::AuthenticationRetryWrapper.with_authentication(adapter, @env) do\n yield\n end\n end", "def successful_authentication(user)\n set_brute_force_counter(user, 0)\n super\n end", "def retryable_authenticate(options = {})\n 1.upto(options[:retry_attempts]) do |count|\n begin\n # If exception is not thrown, then break out of loop.\n authenticate(username: options[:username], password: options[:password])\n break\n rescue StandardError => e\n # Sleep for 30 seconds 2 times. On the 3th time if it fails raise the exception without sleeping.\n if (count == options[:retry_attempts])\n raise e\n else\n sleep(30)\n end\n end\n end\n end", "def authenticate!(request, params, *rest)\n opts = rest.last.kind_of?(Hash) ? rest.pop : {}\n rest = rest.flatten\n \n strategies = if rest.empty?\n if request.session[:authentication_strategies] \n request.session[:authentication_strategies]\n else\n Merb::Authentication.default_strategy_order\n end\n else\n request.session[:authentication_strategies] ||= []\n request.session[:authentication_strategies] << rest\n request.session[:authentication_strategies].flatten!.uniq!\n request.session[:authentication_strategies]\n end\n \n msg = opts[:message] || error_message\n user = nil \n # This one should find the first one that matches. It should not run antother\n strategies.detect do |s|\n s = Merb::Authentication.lookup_strategy[s] # Get the strategy from string or class\n unless s.abstract?\n strategy = s.new(request, params)\n user = strategy.run! \n if strategy.halted?\n self.headers, self.status, self.body = [strategy.headers, strategy.status, strategy.body]\n halt!\n return\n end\n user\n end\n end\n \n # Check after callbacks to make sure the user is still cool\n user = run_after_authentication_callbacks(user, request, params) if user\n \n # Finally, Raise an error if there is no user found, or set it in the session if there is.\n raise Merb::Controller::Unauthenticated, msg unless user\n session[:authentication_strategies] = nil # clear the session of Failed Strategies if login is successful \n self.user = user\n end", "def after_login(&block)\n add_callback(:login, block)\n end", "def authenticate(*credentials, &block)\n raise ArgumentError, 'at least 2 arguments required' if credentials.size < 2\n\n if credentials[0].blank?\n return authentication_response(return_value: false, failure: :invalid_login, &block)\n end\n\n if @sorcery_config.downcase_username_before_authenticating\n credentials[0].downcase!\n end\n\n user = sorcery_adapter.find_by_credentials(credentials)\n\n unless user\n return authentication_response(failure: :invalid_login, &block)\n end\n\n set_encryption_attributes\n\n if user.respond_to?(:active_for_authentication?) && !user.active_for_authentication?\n return authentication_response(user: user, failure: :inactive, &block)\n end\n\n @sorcery_config.before_authenticate.each do |callback|\n success, reason = user.send(callback)\n\n unless success\n return authentication_response(user: user, failure: reason, &block)\n end\n end\n\n unless user.valid_password?(credentials[1])\n return authentication_response(user: user, failure: :invalid_password, &block)\n end\n\n authentication_response(user: user, return_value: user, &block)\n end", "def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end", "def login_and_run(&block)\n login\n yield self\n logout\n end", "def authenticate(attempted_password)\n if self.password == attempted_password\n true\n else\n raise \"That username and password combination does not exist\"\n end\n end", "def while_signed_in_as(user)\n sign_in(user)\n yield\n rescue ConnectionError => e\n logger.error(e)\n ensure\n sign_out(user)\nend", "def authenticate( raw_vals )\n\n username = (raw_vals[:username] || raw_vals['username']).to_s.strip\n password = (raw_vals[:password] || raw_vals['password']).to_s.strip\n ip_addr = (raw_vals[:ip_address] || raw_vals['ip_address']).to_s.strip\n user_agent = (raw_vals[:user_agent] || raw_vals['user_agent']).to_s.strip\n \n ip_addr = nil if ip_addr.empty?\n user_agent = nil if user_agent.empty?\n\n if username.empty? || password.empty?\n raise Wrong_Password, \"#{raw_vals.inspect}\"\n end\n mem = Life.find.username( username ).grab(:owner).go_first!\n\n # Check for Password_Reset\n raise Password_Reset::In_Reset, mem.inspect if mem.password_in_reset?\n\n # Check for too many failed attempts.\n # Raise Account::Reset if necessary.\n fail_count = Failed_Log_In_Attempt.for_today(mem).count\n if fail_count > 2\n mem.reset_password\n raise Password_Reset::In_Reset, mem.inspect\n end\n \n # See if password matches with correct password.\n correct_password = BCrypt::Password.new(mem.data.hashed_password) === (password + mem.data.salt)\n return mem if correct_password\n\n # Update failed count.\n new_count = fail_count + 1\n \n # Insert failed password.\n Failed_Log_In_Attempt.create(\n nil,\n :owner_id => mem.data._id, \n :ip_address => ip_addr,\n :user_agent => user_agent \n )\n\n raise Wrong_Password, \"Password is invalid for: #{username.inspect}\"\n end", "def login_attempt\n @user = User.where(email: params[:email]).first\n if @user && @user.password == params[:password]\n session[:user_id] = @user.id\n\n redirect_to root_path\n else\n flash[:notice] = \"Invalid Username or Password\"\n\n render \"login\"\n end\n end", "def login_attempt\n authorized_user = User.authenticate(params[:username], params[:login_password])\n if authorized_user\n session[:user_id] = authorized_user.id\n uname = authorized_user.username\n flash[:notice] = \"Welcome, #{authorized_user.username}!\"\n redirect_to(:action => 'home')\n else\n flash[:notice] = \"Invalid username!\"\n flash[:color] = \"invalid\"\n render \"login\"\n end\n end", "def authenticate_user!\n current_user.stamp! if current_user\n # return render(nothing: true, :status => :unauthorized) if !current_user\n render_error_messages(['Your session has been expired. Please authenticate again.'], :unauthorized) if !current_user\n render_error_messages(['Your account has been banned. Please contact to administrator.'], :unauthorized) if current_user && current_user.banned?\n end", "def note_failed_signin\n flash[:error] = \"Invalid user name or password\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Invalid user name or password\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def execute\n errors.add(:user, 'authentication failed!') unless logging_user.update(access_token: SecureRandom.hex(6))\n logging_user\n end", "def failure\n redirect_to login_path,\n alert: \"Authentication failed, please try again.\"\n end", "def authenticate account, salt, hash, platform\n end", "def retry_with_auth(response)\n @already_tried_with_auth = true\n logger.info(\"Authentication Required. Retrying with auth info\")\n accessor.auth_manager.associate_auth_info(response)\n add_credentials!\n @body.rewind if @body # Its a stringIO, and we already fed it to the adapter once, so rewind it when we try again\n response = fetch_response\n end", "def authenticate(controller, opts = {})\n msg = opts.delete(:message) || \"Could Not Log In\"\n user = nil \n # This one should find the first one that matches. It should not run antother\n Authentication.login_strategies.detect do |s|\n user = controller.instance_eval(&s)\n end\n raise Merb::Controller::Unauthenticated, msg unless user\n self.user = user\n end", "def authenticate(controller, opts = {})\n msg = opts.delete(:message) || \"Could Not Log In\"\n user = nil \n # This one should find the first one that matches. It should not run antother\n Authentication.login_strategies.detect do |s|\n user = controller.instance_eval(&s)\n end\n raise Merb::Controller::Unauthenticated, msg unless user\n self.user = user\n end", "def authenticate_client!\n unauthorized_error unless authenticated?\n end", "def partial_failure(&block)\n return (block_given?) ?\n run_with_temporary_flag(:@partial_failure, true, block) :\n @credential_handler.partial_failure\n end", "def auth(cl)\n\t\tuser = cl.find_by_login(params[:login])\n\t\tif user.try(:authenticate, params[:pass])\n\t\t\tres payload(user)\n\t\telse\n\t\t\terr 'invalid_credentials', 'Invalid Username/Password', :unauthorized\n\t\tend\n\tend", "def authenticate!\n # Do nothing yet\n end", "def no_auth\n puts 'Incorrect username or password!'.colorize(:red)\n sleep(1)\n if @count >= 3\n puts 'You have tried too many times! The application will now close..'.colorize(:light_red)\n exit\n end\n returning_user\n end", "def note_failed_signin\n message = \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now}\"\n errormark \"Couldn't log you in as '#{params[:login]}'\"\n warn message\n audit message\n end", "def failure\n\n\t\t# do a clever redirect here!\n\t\tredirect_to root_url, :notice => \"Failed Authentication\"\n\n\tend", "def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend", "def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend", "def note_failed_signin\n flash[:notice] = \"We could not log you in with the credentials supplied. Perhaps you mistyped them, or you have not yet activated your account by verifying your email address?\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend", "def test_auth_except_actually_logging_in\n test_auth_except\n login :secret_ferret_brigade, 'ferret', 'REVOLUTION'\n assert_response :success\n \n login :secret_ferret_brigade, 'ferret', 'WRONGPASSWORD!'\n assert_protected\n end", "def authenticate!(*args)\n defaults = {:action => :unauthenticated}\n if args.last.is_a? Hash\n args[-1] = defaults.merge(args.last)\n else\n args << defaults\n end\n warden.authenticate!(*args)\n end", "def authenticated?(username=nil, &block)\n auth = if username\n @access_token and authenticated_username == username\n else\n !!@access_token\n end\n\n if block_given?\n auth ? yield : raise_authentication_error\n else\n auth\n end\n end", "def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[:user_id] || decoded_auth_token[:id])\n fail NotAuthenticated if @current_user.blank?\n rescue JWT::ExpiredSignature, JWT::ImmatureSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError, ActiveRecord::RecordNotFound\n raise NotAuthenticatedError\n end", "def pass(msg) # :yields: password\n return \"530 Password is incorrect\" if msg != 'password'\n thread[:pass] = msg\n \"230 Logged in successfully\"\n end", "def authentication_succeed(oidresp)\n end", "def add_attempt(attempt, start_time)\n attempt+= 1\n p \"login attemps = #{attempt}\"\n if attempt >= 5\n p \"start time = #{start_time}\"\n timeout = true\n attempt = 0\n return [timeout, attempt]\n end\n return[false, attempt]\nend", "def note_failed_signin\n flash[:error] = t('labels.name_or_password_error')\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def failure\n puts \"----------error with sign in\"\n redirect_to root_path\n end", "def reauthenticate \n\t\t\tself.login(@email, @password)\n\t\tend", "def each_valid_attempt(&block)\n valid_attempts.each(&block)\n end", "def authenticate(&block)\n Logger.deprecated 'Wallaby will remove security.authenticate from 6.2.'\n if block_given?\n @authenticate = block\n else\n @authenticate ||= DEFAULT_AUTHENTICATE\n end\n end", "def authenticate!\n raise AuthenticationFailed if authentication.failed?\n raise AuthenticationRequired unless authentication.authenticated?\n end", "def each_invalid_attempt(&block)\n invalid_attempts.each(&block)\n end", "def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end", "def authenticate_user!\n raise NotAuthorizedError unless user_logged_in?\n end", "def login_attempt\n authorized_user = User.authenticate(params[:username_or_email],\n params[:login_password])\n puts('authorized_user')\n\n puts(authorized_user)\n puts('authorized_user')\n\n if authorized_user\n puts 'session[:user_id]'\n puts session[:user_id]\n session[:user_id] = authorized_user.id\n flash[:notice] = \"Välkommen åter, #{authorized_user.username}.\"\n # redirect_to(:action => 'home')\n redirect_to(controller: 'questionnaires', action: 'index')\n #render json: authorized_user\n\n else\n flash[:notice] = 'Felaktigt användarnamn eller lösenord.'\n flash[:color] = 'invalid'\n render json: authorized_user\n end\n\n # redirect_to(:controller => 'sessions', :action => 'home')\n # return false\n end", "def jwt_authenticate(*credentials)\n validate_jwt_configuration\n\n @current_user = nil\n\n user_class.authenticate(*credentials) do |user, failure_reason|\n if failure_reason\n after_failed_login!(credentials)\n\n yield(user, failure_reason) if block_given?\n\n break\n end\n\n # Identical to auto_login but doesn't touch session\n @current_user = user\n\n after_login!(user, credentials)\n\n yield(user, failure_reason) if block_given?\n\n # Return our own value, not the return_value from authentication_response\n break generate_jwt(user)\n end\n end", "def note_failed_signin\n flash[:error] = \"用户名或密码错误!\"\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def authentication_flow(params)\n if params.key?(:cognito_session_id)\n resp = respond_to_challenge(params)\n else\n resp = initiate_auth(email: params[:email], password: params[:password])\n end\n return process_response(cognito_response: resp, params: params) if resp.present?\n\n raise AuthenticationBackendException.new(\"No Response Back from Authentication Service to process\")\n end", "def note_failed_signin\r\n flash[:error] = \"Couldn't log you in as '#{params[:email]}'. Check your email or password.\"\r\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end", "def authenticate(password)\n return :expired if expired?\n return :invalid unless check_password(password)\n user.auth_bounce_reason(self) || user\n end", "def attempt(block)\n # Returning self will allow chaining calls\n return self unless block\n return block.call unless AttemptThis.enabled?\n\n apply_defaults\n\n # Retriable attempts require special error handling\n result = each_retriable_attempt do\n return attempt_with_reset(&block)\n end\n\n # Final attempt\n if (result != :empty)\n @delay_policy.call unless result == :skipped\n final_attempt(&block)\n end\n end", "def attempt(message, &block)\n perform_action(message, false, nil, false, &block)\nend", "def authentication_flow(params)\n if params.key?(:cognito_session_id)\n resp = respond_to_challenge(params)\n else\n resp = initiate_auth(email: params[:email], password: params[:password])\n end\n return process_response(cognito_response: resp, params: params) if resp.present?\n\n raise AuthenticationBackendException, \"No Response Back from Authentication Service to process\"\n end", "def authenticate!\n user_id = get_user_id_from_token\n if user_id\n @current_user = User.find(user_id)\n else\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end\n rescue JWT::ExpiredSignature\n render json: { errors: ['Authentication Timeout'] }, status: 419\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end" ]
[ "0.79108554", "0.58806264", "0.5812654", "0.5794389", "0.57523674", "0.56922996", "0.5638406", "0.55901074", "0.5588444", "0.5564731", "0.55596066", "0.55021936", "0.5465623", "0.5437874", "0.5423029", "0.5395928", "0.5385815", "0.538531", "0.5371494", "0.53482777", "0.5296396", "0.5295586", "0.5293384", "0.5290842", "0.5289961", "0.5289945", "0.52708966", "0.5263505", "0.5249508", "0.52335596", "0.5233186", "0.5230718", "0.52155054", "0.5213249", "0.520379", "0.5188838", "0.51862323", "0.51840436", "0.5181123", "0.51800627", "0.51697814", "0.5168035", "0.5136764", "0.5123128", "0.5110979", "0.5102115", "0.5089221", "0.5078549", "0.5072574", "0.5070387", "0.5061744", "0.50577474", "0.5057115", "0.50481606", "0.50215435", "0.49875557", "0.49875557", "0.4986933", "0.49786788", "0.49769953", "0.49768463", "0.4964002", "0.4964002", "0.49597993", "0.49497348", "0.49400416", "0.4932334", "0.4917341", "0.49170586", "0.49143782", "0.49095294", "0.49095294", "0.49064246", "0.49062327", "0.49023664", "0.4901482", "0.490112", "0.4900542", "0.4899914", "0.48995462", "0.48991543", "0.48964375", "0.48852056", "0.48750687", "0.4871831", "0.48668754", "0.48630422", "0.48626706", "0.48605973", "0.48584378", "0.4856612", "0.48518723", "0.4848451", "0.48473772", "0.484436", "0.48396137", "0.48357934", "0.48322257", "0.48227933", "0.48226118" ]
0.66621166
1
auth_fail(args, &blk) Registers a block to call when authentication succeeds.
def auth_ok(*args, &blk) block_given? ? @auth_ok_cbs << blk : @auth_oks.push(args) while (ok_data = @auth_oks.shift) @auth_ok_cbs.each { |cb| cb.call(*ok_data) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_fail(*args, &blk)\n block_given? ? @auth_fail_cbs << blk : @auth_fails.push(args)\n while (fail_data = @auth_fails.shift)\n @auth_fail_cbs.each { |cb| cb.call(*fail_data) }\n end\n end", "def auth_fail\n fail(Kankri::AuthenticationFailure)\n end", "def failure\n\n\t\t# do a clever redirect here!\n\t\tredirect_to root_url, :notice => \"Failed Authentication\"\n\n\tend", "def handle_failed_login\n Log.error(\"failure.\")\n end", "def authenticate( *args )\n\t\tself.log.error \"authentication failure (fallback method)\"\n\t\traise SecurityError, \"authentication failure\"\n\tend", "def on_failure(&block)\n apply_hook(:failure, &block)\n end", "def auth_attempt(*args, &blk)\n block_given? ? @auth_attempt_cbs << blk : @auth_attempts.push(args)\n while (auth_data = @auth_attempts.shift)\n @auth_attempt_cbs.each { |cb| cb.call(*auth_data) }\n end\n end", "def partial_failure(&block)\n return (block_given?) ?\n run_with_temporary_flag(:@partial_failure, true, block) :\n @credential_handler.partial_failure\n end", "def handle_errored_login(code)\n Log.error(\"error code #{code}.\")\n end", "def call_authorization_fail_api(ticket, reason)\n return call_api(\"/api/auth/authorization/fail\", {\n \"ticket\" => ticket,\n \"reason\" => reason\n })\nend", "def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend", "def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend", "def failed_auth(msg)\n log_to_rollbar(msg) if defined?(Rollbar)\n DeviseSamlAuthenticatable::Logger.send(msg)\n fail!(error_message.html_safe)\n Devise.saml_failed_callback.new.handle(@response, self) if Devise.saml_failed_callback # rubocop:disable Style/SafeNavigation\n end", "def failure_authentication(body = nil)\n api_header(\"1005\", \"Invalid token\", body)\n end", "def note_failed_signin\n error_status(true, :login_failure, {}, false)\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def failure\n redirect_to login_path,\n alert: \"Authentication failed, please try again.\"\n end", "def token_auth(*args, &block); end", "def on_failure(object, *args); end", "def failure\n msg_returned = request.params['message']\n login_failed msg_returned.nil? ? 'Auth0 login failed.' : msg_returned\n end", "def invalid_login_attempt\n warden.custom_failure!\n render :json => {success: false, message: \"Error with your email or password\"}, status: 401\n end", "def auth_failed(response)\n response && response.code == 401\n end", "def on_fail( &block )\n @on_fail_blocks ||= []\n @on_fail_blocks << block\n end", "def process_authorization(session)\n args = session.args\n\n if (session.reply.body.status_passadd?)\n args = session.reply.body.args\n session.pass_fail[:pass] = true\n session.pass_fail[:pass_type] = :add\n elsif (session.reply.body.status_passrepl?)\n args = session.reply.body.args\n session.pass_fail[:pass] = true\n session.pass_fail[:pass_type] = :repl\n end\n\n session.pass_fail[:server_msg] = session.reply.body.server_msg\n session.pass_fail[:data] = session.reply.body.data\n session.pass_fail[:args] = args\n session.terminate = true\n return(nil)\n end", "def failure\n puts \"----------error with sign in\"\n redirect_to root_path\n end", "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid email and token must be present.\"})\n end", "def failure\n render :json => {:success => false, :errors => {:reason => \"Login failed. Try again\"}}, :status => 401\n end", "def note_failed_signin\r\n flash[:error] = \" Invalid user/password combination.\"\r\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end", "def do_authorization_fail(ticket, reason)\n # Call Authlete's /auth/authorization/fail API.\n response = call_authorization_fail_api(ticket, reason)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # The ticket is no longer valid (deleted or expired)\n # and the reason of the invalidity was probably due\n # to the end-user's too-delayed response to the\n # authorization UI.\n return WebResponse.new(400, content).json.to_response\n\n when \"LOCATION\"\n # 302 Found\n # The authorization request was invalid and the error\n # is reported to the redirect URI using Location header.\n return WebResponse.new(302).location(content).to_response\n\n when \"FORM\"\n # 200 OK\n # The authorization request was invalid and the error\n # is reported to the redirect URI using HTML Form Post.\n return WebResponse.new(200, content).html.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend", "def basic_auth(*args, &block); end", "def auth_failure\n logger.warn \"[SESS] auth failure: #{params[:message]}\"\n redirect_to new_session_path\n end", "def on_failure(&block)\n @handlers[:failure] = block\n self\n end", "def do_failure; end", "def authorization(*args, &block); end", "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid username and token must be present.\"})\n end", "def invalid_login_attempt\n warden.custom_failure!\n json_response({ success: false, message: \"Username/Password incorrect.\" }, 400)\n end", "def auth_failed\n message = params.dig(\"message\") || \"incorrect username and/or password\"\n message = \"Login failed: #{message}\"\n if request.xhr?\n render plain: message, status: :unauthorized\n else\n flash['error'] = message\n redirect_to return_url, allow_other_host: true\n end\n end", "def fail\n render :text => request.env[\"omniauth.auth\"].to_yaml\n end", "def invalid_authentication\n Log.error(\"invalid_authentication\")\n render json: {error: 'Invalid authentication'}, status: :unauthorized\n end", "def invalid_login_attempt\n set_flash_message(:error, :invalid)\n render json: flash[:error], status: 401\n end", "def authentication_error\n # User's token is either invalid or not in the right format\n render 'api/v1/shared/failure', locals: { errors: [{ user: ['is unauthorized'] }] }, status: :unauthorized # Authentication timeout\n end", "def fail(*rest) end", "def invalid_authentication\n render_error 'Authentication failure', 'unauthorized', 401\n end", "def test_auth_except_actually_logging_in\n test_auth_except\n login :secret_ferret_brigade, 'ferret', 'REVOLUTION'\n assert_response :success\n \n login :secret_ferret_brigade, 'ferret', 'WRONGPASSWORD!'\n assert_protected\n end", "def status_fail!()\n @status = TAC_PLUS_AUTHEN_STATUS_FAIL\n end", "def note_failed_signin\n message = \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now}\"\n errormark \"Couldn't log you in as '#{params[:login]}'\"\n warn message\n audit message\n end", "def failure(result)\n logger.error \"Beetle: handler has finally failed\"\n end", "def on_failure( &block )\n @on_failure = block\n end", "def note_failed_signin\n flash[:error] = t('labels.name_or_password_error')\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def on_failure!(response)\n session.authentication.errors.clear!\n session.authentication.errors.add(:openid, 'OpenID verification failed, maybe the provider is down? Or the session timed out')\n nil\n end", "def failure\n flash[:error] = \"Could not authenticate with #{params[:strategy]}\"\n return redirect_to \"/\"\n end", "def note_failed_signin\n flash[:error] = \"Invalid user name or password\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Invalid user name or password\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def access_denied!\n render partial: 'errors/401', status: 401 && return\n end", "def note_failed_signin\n flash[:error] = \"用户名或密码错误!\"\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def auth_failure\n redirect_to '/', :alert => params[:message]\nend", "def override_failure_callback(&blk)\n @failure_callback = blk\n end", "def note_failed_signin\r\n flash[:error] = \"Couldn't log you in as '#{params[:email]}'. Check your email or password.\"\r\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end", "def may_fail # block\n begin\n yield\n rescue\n end\nend", "def call_token_fail_api(ticket, reason)\n return call_api(\"/api/auth/token/fail\", {\n \"ticket\" => ticket,\n \"reason\" => reason\n })\nend", "def failure(callable = nil, &block)\n direct(:failure, (callable || block))\n self\n end", "def authenticate_error\n render json: { error: t('devise.failure.unauthenticated') }, status: 401\n end", "def run_and_raise_on_failure\n # TODO ?\n end", "def authentication_failed\n authentication_failed_msg.text\n end", "def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend", "def invalid_authentication\n render json: { error: 'Not Authenticated' }, status: :unauthorized\n end", "def handle_login_error error\n logout_keeping_session!\n begin\n raise error\n rescue AccountNotActive => error\n log_failed_signin error\n redirect_back_or_default('/')\n rescue AccountNotFound, BadPassword => error\n log_failed_signin error\n try_again\n rescue AuthenticationError, SecurityError => error\n log_failed_signin error\n redirect_back_or_default('/')\n end\n # general exceptions are uncaught\n end", "def failure\n redirect_to root_url, alert: \"identity failed, please try again.\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:email]}'\"\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:email]}'\"\n logger.warn \"Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def execute_with_rescue(&block)\n begin\n yield block\n rescue Flickr::Error => ex\n self.error_messages ||= []\n self.error_messages << {:date => Time.now, :msg => ex.message}\n if ex.message.match(/(User not found|Invalid auth token)/)\n self.status = 'inactive'\n end\n self.save\n return\n end\n end", "def note_failed_signin\n flash[:error] = \"Vous ne pouvez pas vous connecter en tant que '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def authentication_succeed(oidresp)\n end", "def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end", "def do_token_fail(ticket, reason)\n # Call Authlete's /auth/token/fail API.\n response = call_token_fail_api(ticket, reason)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # Authlete successfully generated an error response\n # for the client application.\n return WebResponse.new(400, content).json.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend", "def note_failed_signin\n flash[:notice] = \"We could not log you in with the credentials supplied. Perhaps you mistyped them, or you have not yet activated your account by verifying your email address?\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def failed_login!\n @number_of_bad_logins = increment_bad_login_counter\n throttle_user if should_throttle?\n end", "def when_auth &block # :yields: abs_url, realm\n @get_auth_details = block\n end", "def raise_on_non_200(resp, expected_code=200)\n if resp.code == '401' && %r{rbac/user-unauthenticated}.match(resp.body)\n obj = JSON.parse(resp.body)\n msg = obj['msg'] || '401 User Unauthenticated Error'\n raise ApiAuthenticationError, msg\n else\n msg = \"Expected #{expected_code} response, got #{resp.code} \"\\\n \"body: #{resp.body}\"\n raise ApiError, msg\n end\n end", "def note_failed_signin\n flash[:error] = \"Login failed! Wrong username or password.\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end", "def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end", "def auth_exception(auth_exception)\n return @auth_exception unless auth_exception\n @auth_exception_response = 'Auth Exception'\n end", "def invalid_authentication\n render json: {errors: {code: 401, message: \"You need to sign in\"}}, status: :unauthorized\n end", "def failure\n return render json: {:message => \"Login Failed\" }, :status => :bad_request\n end", "def failure\n redirect_to root_url, alert: 'Twitter authentication denied.'\n end", "def fail\n # no-op\n end", "def note_failed_signin\n flash.now[:error] = \"Usuário ou senha inválida\"\n logger.warn \"Falha no login do usuario '#{params[:login]}' através do IP #{request.remote_ip} às #{Time.now.utc}\"\n end", "def authenticate(request, realm, &password_procedure); end", "def note_failed_signin\n flash[:error] = \"Usuário e/ou senha incorreto(s)\"\n #flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def invalid_login_attempt\n \n set_flash_message(:alert, :invalid)\n data = {:code => \"NOK\"}\n render json: data \n # render json: flash[:alert], status: 401\n end", "def note_failed_signin\n flash[:error] = \"Não foi possível fazer seu login. Redigite seu e-mail e sua senha. As senhas do Cidade Democrática distinguem maiúsculas de minúsculas.\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def fail\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end" ]
[ "0.80586606", "0.69103783", "0.6131274", "0.6081329", "0.6068126", "0.6051085", "0.59965783", "0.59359205", "0.5913045", "0.5900398", "0.58975923", "0.58975923", "0.58776444", "0.58609706", "0.5822489", "0.5763486", "0.5755156", "0.57269037", "0.57079226", "0.56912273", "0.56784135", "0.56171715", "0.5599439", "0.5591363", "0.55828047", "0.5556688", "0.55531245", "0.5540594", "0.55397105", "0.5528106", "0.55111796", "0.550892", "0.55012804", "0.54967874", "0.5485473", "0.54718274", "0.5470798", "0.54684985", "0.54079723", "0.5402812", "0.5400315", "0.5393228", "0.53920305", "0.53881794", "0.5377455", "0.53769", "0.53768206", "0.5370427", "0.5362086", "0.53459716", "0.534525", "0.534525", "0.5339976", "0.52914053", "0.5273287", "0.5269235", "0.5267818", "0.5263835", "0.52589303", "0.5255405", "0.52447844", "0.5241455", "0.52397746", "0.52346647", "0.5225845", "0.52250826", "0.52229434", "0.5207481", "0.5207481", "0.52019453", "0.52009654", "0.5197779", "0.5184978", "0.5183985", "0.5183326", "0.51776356", "0.51739514", "0.5169235", "0.51670164", "0.51548773", "0.51548773", "0.5154219", "0.5147963", "0.51320493", "0.5126771", "0.5121303", "0.5118151", "0.5114756", "0.5112074", "0.51118785", "0.5096057", "0.50958824", "0.50820696", "0.50820696", "0.50820696", "0.50820696", "0.50820696", "0.50820696", "0.50820696", "0.50820696" ]
0.58873034
12
auth_fail(args, &blk) Methods that make Server compatible with Pry
def readline(prompt) @last_prompt = prompt # FIXME, we're blocking prompt from being sent @auth_required ? @after_auth.push({:p => prompt}) : nil #send_data({:p => prompt}) return @lines.shift unless @lines.empty? @waiting = Fiber.current return Fiber.yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_fail(*args, &blk)\n block_given? ? @auth_fail_cbs << blk : @auth_fails.push(args)\n while (fail_data = @auth_fails.shift)\n @auth_fail_cbs.each { |cb| cb.call(*fail_data) }\n end\n end", "def auth_fail\n fail(Kankri::AuthenticationFailure)\n end", "def process_authorization(session)\n args = session.args\n\n if (session.reply.body.status_passadd?)\n args = session.reply.body.args\n session.pass_fail[:pass] = true\n session.pass_fail[:pass_type] = :add\n elsif (session.reply.body.status_passrepl?)\n args = session.reply.body.args\n session.pass_fail[:pass] = true\n session.pass_fail[:pass_type] = :repl\n end\n\n session.pass_fail[:server_msg] = session.reply.body.server_msg\n session.pass_fail[:data] = session.reply.body.data\n session.pass_fail[:args] = args\n session.terminate = true\n return(nil)\n end", "def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend", "def log_failure( reason )\n\t\tself.log.warn \"Auth failure: %s\" % [ reason ]\n\t\theader = \"Basic realm=%s\" % [ self.class.realm || self.app.conn.app_id ]\n\t\tfinish_with( HTTP::AUTH_REQUIRED, \"Requires authentication.\", www_authenticate: header )\n\tend", "def call_authorization_fail_api(ticket, reason)\n return call_api(\"/api/auth/authorization/fail\", {\n \"ticket\" => ticket,\n \"reason\" => reason\n })\nend", "def authenticate( *args )\n\t\tself.log.error \"authentication failure (fallback method)\"\n\t\traise SecurityError, \"authentication failure\"\n\tend", "def handle_errored_login(code)\n Log.error(\"error code #{code}.\")\n end", "def failure_authentication(body = nil)\n api_header(\"1005\", \"Invalid token\", body)\n end", "def handle_failed_login\n Log.error(\"failure.\")\n end", "def fail(*rest) end", "def protocol_failure(ctx, **)\n true\n end", "def failure\n\n\t\t# do a clever redirect here!\n\t\tredirect_to root_url, :notice => \"Failed Authentication\"\n\n\tend", "def do_authorization_fail(ticket, reason)\n # Call Authlete's /auth/authorization/fail API.\n response = call_authorization_fail_api(ticket, reason)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # The ticket is no longer valid (deleted or expired)\n # and the reason of the invalidity was probably due\n # to the end-user's too-delayed response to the\n # authorization UI.\n return WebResponse.new(400, content).json.to_response\n\n when \"LOCATION\"\n # 302 Found\n # The authorization request was invalid and the error\n # is reported to the redirect URI using Location header.\n return WebResponse.new(302).location(content).to_response\n\n when \"FORM\"\n # 200 OK\n # The authorization request was invalid and the error\n # is reported to the redirect URI using HTML Form Post.\n return WebResponse.new(200, content).html.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend", "def basic_auth(*args, &block); end", "def failure\n msg_returned = request.params['message']\n login_failed msg_returned.nil? ? 'Auth0 login failed.' : msg_returned\n end", "def do_token_fail(ticket, reason)\n # Call Authlete's /auth/token/fail API.\n response = call_token_fail_api(ticket, reason)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # Authlete successfully generated an error response\n # for the client application.\n return WebResponse.new(400, content).json.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend", "def no_auth\n puts 'Incorrect username or password!'.colorize(:red)\n sleep(1)\n if @count >= 3\n puts 'You have tried too many times! The application will now close..'.colorize(:light_red)\n exit\n end\n returning_user\n end", "def status_fail!()\n @status = TAC_PLUS_AUTHEN_STATUS_FAIL\n end", "def do_failure; end", "def call_token_fail_api(ticket, reason)\n return call_api(\"/api/auth/token/fail\", {\n \"ticket\" => ticket,\n \"reason\" => reason\n })\nend", "def invalid_authentication\n Log.error(\"invalid_authentication\")\n render json: {error: 'Invalid authentication'}, status: :unauthorized\n end", "def auth_failed(response)\n response && response.code == 401\n end", "def invalid_login_attempt\n warden.custom_failure!\n json_response({ success: false, message: \"Username/Password incorrect.\" }, 400)\n end", "def token_auth(*args, &block); end", "def on_failure(object, *args); end", "def invalid_login_attempt\n warden.custom_failure!\n render :json => {success: false, message: \"Error with your email or password\"}, status: 401\n end", "def authorization(*args, &block); end", "def failure\n render :json => {:success => false, :errors => {:reason => \"Login failed. Try again\"}}, :status => 401\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def authentication_error\n # User's token is either invalid or not in the right format\n render 'api/v1/shared/failure', locals: { errors: [{ user: ['is unauthorized'] }] }, status: :unauthorized # Authentication timeout\n end", "def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend", "def failure!\n end", "def fail\n end", "def test_login_attempt_bad_username_gives_login_screen\n post '/login', { :username => BAD_USERNAME, :password => BAD_PASSWORD }\n assert last_response.ok?\n assert last_response.body.include?('Unknown User/Password combination. Please try again') \n end", "def unauthorized\n end", "def post_fail_message; end", "def authentication_succeed(oidresp)\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def auth_failed\n message = params.dig(\"message\") || \"incorrect username and/or password\"\n message = \"Login failed: #{message}\"\n if request.xhr?\n render plain: message, status: :unauthorized\n else\n flash['error'] = message\n redirect_to return_url, allow_other_host: true\n end\n end", "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid username and token must be present.\"})\n end", "def fail\n render :text => request.env[\"omniauth.auth\"].to_yaml\n end", "def invalid_authentication\n render json: { error: 'Invalid request' }, status: 403\n end", "def auth_error(e)\n json_response({ message: e.message }, :unprocessable_entity)\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def failure\n return render json: {:message => \"Login Failed\" }, :status => :bad_request\n end", "def pass *args\n halt invoke *args\n end", "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid email and token must be present.\"})\n end", "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end", "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end", "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end", "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end", "def invalid_authentication\n render json: {message: 'Invalid Request'}, status: :unauthorized\n end", "def fail(reason)\n end", "def fail\n # no-op\n end", "def test_login_unsuccessful\n data = {\n username:\"viet-anh-mulodo\",\n password: \"wrong-password\"\n }\n expected = 1003\n resp = Net::HTTP.post_form(URI.parse('http://localhost:3000/v1/users/login'),data)\n actual = JSON.parse(resp.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def failure\n flash[:error] = \"Could not authenticate with #{params[:strategy]}\"\n return redirect_to \"/\"\n end", "def auth_failure\n logger.warn \"[SESS] auth failure: #{params[:message]}\"\n redirect_to new_session_path\n end", "def invalid_authentication\n render json: { error: 'Not Authenticated' }, status: :unauthorized\n end", "def authenticate(request, realm, &password_procedure); end", "def note_failed_signin\r\n flash[:error] = \" Invalid user/password combination.\"\r\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\r\n end", "def access_denied!\n render partial: 'errors/401', status: 401 && return\n end", "def render_failed_driver_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"User is not a driver.\"})\n end", "def failures=(_arg0); end", "def failures=(_arg0); end", "def access_denied\n {\n :html => 'Sorry, we cannot verify that you are a user. Please reinstall this Raplet.',\n :status => 401\n }\n end", "def invalid_authentication\n reject_unauthorized_connection\n end", "def admin_login_method\n prompt = TTY::Prompt.new\n password = \"offandon\"\n\tpasswordfailcount = 0\n\t# Password login loop\n while passwordfailcount < 3\n puts \"\"\n if prompt.mask(\"Welcome to the application. Please enter your password:\") != password\n passwordfailcount += 1\n puts \"Incorrect. Please try again. Attempt #{passwordfailcount} of 3.\"\n else\n main\n end\n end\nend", "def unauthenticated\n end", "def failed_auth(msg)\n log_to_rollbar(msg) if defined?(Rollbar)\n DeviseSamlAuthenticatable::Logger.send(msg)\n fail!(error_message.html_safe)\n Devise.saml_failed_callback.new.handle(@response, self) if Devise.saml_failed_callback # rubocop:disable Style/SafeNavigation\n end", "def pass\n throw :pass\n end", "def failure\n end", "def note_failed_signin\n error_status(true, :login_failure, {}, false)\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end", "def teardown\n # Reset the password\n @s.trustedauth = false\n admin2 = User.new(\"admin\",\"2admin2\")\n\t@s.switch_user(admin2)\n\t@log.info(\"401 is Ok\")\n\t@s.execute_get(@s.url_for(\"/var/cluster/user.json?performing_teardown\"))\n\t@log.info(\"401 is Ok\")\n\tadmin2.change_password(@s,\"admin\")\n\tsuper\n end", "def raise_on_non_200(resp, expected_code=200)\n if resp.code == '401' && %r{rbac/user-unauthenticated}.match(resp.body)\n obj = JSON.parse(resp.body)\n msg = obj['msg'] || '401 User Unauthenticated Error'\n raise ApiAuthenticationError, msg\n else\n msg = \"Expected #{expected_code} response, got #{resp.code} \"\\\n \"body: #{resp.body}\"\n raise ApiError, msg\n end\n end", "def test_wrong_password_login\n res = make_login Configuration.USER, Configuration.WRONG_PASSWORD\n puts \"\\nTester#test_wrong_password_login:\\n#{res}\" if Configuration.VERBOSE\n res == Constants.FAILURE_MESSAGE\n end", "def local_auth_error\n (@token ? nil : 'Not authenticated with TimeSync,'\\\n ' call authenticate first')\n end", "def error(*args); end", "def authenticate_request\n fail 'Sub-class to implement.'\n end", "def invalid_authentication\n render json: {error: 'Invalid request'}, status: :unauthorized\n end", "def authentication_failed\n authentication_failed_msg.text\n end", "def is_wrong_password? password\nuri = URI.parse 'http://rubyschool.us/router'\n#response = Net::HTTP.get uri\n#p response\nresponse = Net::HTTP.post_form(uri, :login => \"admin\", :password => password).body\np response.include? \"denied\" # Тело объекта, который мы получаем через запрос\nend", "def complain(*args)\n raise Failure, *args\n end", "def test_auth_except_actually_logging_in\n test_auth_except\n login :secret_ferret_brigade, 'ferret', 'REVOLUTION'\n assert_response :success\n \n login :secret_ferret_brigade, 'ferret', 'WRONGPASSWORD!'\n assert_protected\n end", "def invalid_authentication\n render_error 'Authentication failure', 'unauthorized', 401\n end", "def auth_failure\n redirect_to '/', :alert => params[:message]\nend", "def host_authorization=(_arg0); end", "def host_authorization=(_arg0); end", "def api_auth\n api_response(403, \"Invalid Authorization header\") unless api_user\n end", "def not_auth(status = :unauthorized)\n render json: {\n result: 'Error',\n message: 'Unauthorized Access',\n status: 'Unauthorized'\n }, status: status\n end", "def invalid_authentication\n #render json: {errors: ['Invalid Request']}, status: :unauthorized\n error!('Invalid Request', :unauthorized)\n end", "def pass\n end", "def invalid_login_attempt\n set_flash_message(:error, :invalid)\n render json: flash[:error], status: 401\n end", "def access_denied\n render status: 401, text: \"nice try\"\n end", "def capable_plain_auth?; end", "def unauthorized\n\n render_error( :unauthorized )\n\n end", "def failMission _args\n \"failMission _args;\" \n end" ]
[ "0.7346566", "0.72955227", "0.6634425", "0.65896666", "0.65896666", "0.64356595", "0.64251995", "0.640853", "0.63257074", "0.62805694", "0.6242272", "0.62215173", "0.61934114", "0.61055654", "0.6080478", "0.60166657", "0.6003669", "0.59989023", "0.59822273", "0.5981176", "0.59697944", "0.59599745", "0.594298", "0.59376425", "0.5923904", "0.591167", "0.587296", "0.58450323", "0.5841384", "0.5830484", "0.5819674", "0.58173937", "0.5814502", "0.58095706", "0.5802704", "0.5797202", "0.5786306", "0.5783562", "0.5778105", "0.5778105", "0.5778105", "0.5778105", "0.5778105", "0.57717484", "0.57643116", "0.5757943", "0.57505167", "0.57459563", "0.5742121", "0.5720369", "0.5717832", "0.57118493", "0.57116884", "0.57116884", "0.57116884", "0.57116884", "0.57087886", "0.5707541", "0.5687603", "0.56630147", "0.56610596", "0.5651315", "0.56466603", "0.5639042", "0.56383264", "0.5637593", "0.5636601", "0.5634122", "0.5634122", "0.5624961", "0.5624", "0.5617202", "0.5614174", "0.5613752", "0.5612837", "0.56056195", "0.560548", "0.5604353", "0.5599339", "0.5593098", "0.5592505", "0.55886436", "0.55866635", "0.55864435", "0.5580772", "0.55795795", "0.5577195", "0.5573737", "0.5567363", "0.55599624", "0.5558668", "0.5558668", "0.5553247", "0.5525813", "0.55256975", "0.5519824", "0.55194044", "0.55179185", "0.55124533", "0.551218", "0.55105895" ]
0.0
-1
Convert the json map to the Config object
def json_to_config(name, json_map={}) backend = { :name => name, :healthcheck => { :delay => 10000, :timeout => 2000, :failcount => 2, :send => "'GET #{json_map['healthcheck_path']} HTTP/1.0'" }, :hosts => json_map['backends'].collect! { |p| asg_hosts_objects(p['asg_name'], p['host_opts'], json_map['app_port']) }.flatten! } # build server list listen_ports = [80] listen_ports.push 443 if json_map['ssl'] matchers = json_map['endpoint_matchers'] ||= %w(/) locations = matchers.collect! { |m| { :matcher => m, :backend => name, :keepalive_timeout => '75s' } } cert_file = "/etc/nginx/config/#{SecureRandom.uuid.to_s}.crt" cert_key = "/etc/nginx/config/#{SecureRandom.uuid.to_s}.key" if json_map['ssl_cert'] && json_map['ssl_cert_key'] # download ssl certs and key File.open(cert_file, 'w') do |file| AWS::S3::S3Object.stream(json_map['ssl_cert'], @bucket) do |chunk| file.write(chunk) end end File.open(cert_key, 'w') do |file| AWS::S3::S3Object.stream(json_map['ssl_cert_key'], @bucket) do |chunk| file.write(chunk) end end end server = { :listen => listen_ports, :server_name => json_map['public_dns'], :ssl => { :certificate => cert_file, :certificate_key => cert_key, :ssl_session_timeout => '5m' }, :locations => locations } Config.new({ :name => name, # becomes the filename / app_name :backend => backend, # identifies the merged server set that handles the requests (gets load balanced) :server => server # locations that are being load balanced over the backend servers }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config\n self.config = JSON.load(self.data)\n end", "def load_config\n self.config = JSON.load(self.data)\n end", "def load_config\n self.config = JSON.load(self.data)\n end", "def set_json(json)\n @map = Oj.load(json)\n end", "def parsed_config\n @parsed_config ||= begin\n JSON.parse(config[:json_config], symbolize_names: true)\n rescue JSON::ParserError\n JSON.parse(File.read(config[:json_config]),\n symbolize_names: true)\n end\n end", "def config\n path = config_path\n @config ||= path.exist? ? JSON.parse(path.read) : {}\n end", "def parse_engine_config(raw)\n raw ? JSON.parse(raw) : {}\nend", "def config\n to_ret = as_json\n to_ret.delete('auto_publish')\n to_ret.delete('id')\n to_ret\n end", "def config\n to_ret = as_json\n to_ret.delete('auto_publish')\n to_ret.delete('id')\n to_ret\n end", "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "def get\n if File.exist?(@config_file)\n file = File.read(@config_file)\n @config = JSON.parse(file)\n end\n @config\n end", "def configfile_hash\n\n config = {}\n begin\n json = File.read(configfile)\n config = JSON.parse(json)\n rescue Errno::ENOENT\n # depending on whether the instance has been saved or not, we may not\n # yet have a configfile - allow to proceed\n @logger.debug \"#{configfile} does not exist\"\n @force_save = true\n rescue JSON::ParserError\n # swallow parse errors so that we can destroy and recreate automatically\n @logger.debug \"JSON parse error in #{configfile}\"\n @force_save = true\n end\n config\n end", "def from_json(json)\r\n json = json.transform_keys(&:to_sym)\r\n @files = Hash[json[:files].map { |file, file_info| [file, file_info.transform_keys(&:to_sym)] }]\r\n @files.default_proc = proc { |h, k| h[k] = {} }\r\n @dirs = Hash[json[:dirs].map { |dir, dir_info| [dir, dir_info.transform_keys(&:to_sym)] }]\r\n @dirs.default_proc = proc { |h, k| h[k] = {} }\r\n end", "def save_config\n self.data = JSON.dump(self.config)\n end", "def save_config\n self.data = JSON.dump(self.config)\n end", "def to_config\n HashWithIndifferentAccess.new({\n type: self.class.to_s,\n config: self.config,\n prices: self.prices,\n source_type: self.source\n })\n end", "def as_config\n Configureasy::Config.new self.parse\n end", "def json_config\n config = @node['gitlab']['gitlab_sshd'].dup\n\n find_host_keys!(config)\n find_host_certs!(config)\n\n config['listen'] = config.delete('listen_address')\n config['web_listen'] = config.delete('metrics_address')\n OMNIBUS_KEYS.each { |key| config.delete(key) }\n\n config\n end", "def to_h\n config\n end", "def load_config\n path = File.expand_path(@config_path)\n\n if File.exist?(path)\n file = File.new(path, \"r\")\n @config = MultiJson.decode(file.read)\n else\n load_default_config\n end\n end", "def convert(obj)\n case obj\n when ConfigNode\n obj\n when Hash\n ConfigNode.new convert_hash obj\n when Array\n obj.map { |o| convert o }\n else\n obj\n end\n end", "def config\n @config = ActiveSupport::HashWithIndifferentAccess.new(@config) if @config.is_a? Hash\n @config\n end", "def parse\n checkArguments\n configContent = File.read(ARGV[0])\n @config = JSON.parse(configContent)\n checkConfig\n end", "def json_to_yaml(input_json)\n require 'json'\n require 'yaml'\n begin\n output_yml = YAML.dump(JSON.parse(input_json))\n rescue\n logger.error 'Error parsing from JSON to YAML'\n end\n output_yml\n end", "def deserialize(config)\n config.present? ? YAML.safe_load(ERB.new(config).result, [], [], false, content_path) : {}\n end", "def parse_options(json_options)\n mapper = json_options['mapper'] || {}\n mapper_ulimits = mapper['ulimits'] || {}\n @mapper_options = {\n wait_time: mapper['wait_time'] || 60,\n vcpus: mapper['vcpus'] || 1, # logical processors\n ram: mapper['ram'] || 512, # megabytes\n swap: mapper['swap'] || 0, # megabytes\n logs: mapper['logs'] || 64, # megabytes\n ulimits: {\n cpu: mapper_ulimits['cpu'] || 60, # seconds\n }\n }\n\n reducer = json_options['reducer'] || {}\n reducer_ulimits = reducer['ulimits'] || {}\n @reducer_options = {\n wait_time: reducer['wait_time'] || 60,\n vcpus: reducer['vcpus'] || 1, # logical processors\n ram: reducer['ram'] || 512, # megabytes\n swap: reducer['swap'] || 0, # megabytes\n logs: reducer['logs'] || 64, # megabytes\n ulimits: {\n cpu: reducer_ulimits['cpu'] || 60,\n }\n }\n end", "def load_config\n if params[:config].given?\n @config = File.open(File.expand_path(params[:config].value)) { |f| JSON.load(f) }\n\n @config.each do |key, value|\n if params.has_key?(key) and params[key].values == params[key].defaults\n params[key].values = [*value]\n params[key].given = true\n end\n end\n\n end\n end", "def read_config_file\n config_hash = {}\n if File.file? @config_file\n begin\n config_hash = JSON.parse(File.read(@config_file))\n rescue StandardError => e\n raise ConfigError.new(\"parsing configuration file: #{e}\")\n end\n end\n config_hash\n end", "def init(config)\n config.each{|k, v|\n @config[k] = v\n }\n end", "def convert(map)\n valid?(map) ? map : map.map { |key, value| [key, subprop.convert(value)] }.to_h\n end", "def serialize_config\n final_conf = []\n config.each do |key, val|\n if val.respond_to?(:call)\n final_conf << Config.new(key, val.call)\n elsif val.is_a?(Array)\n final_conf += val.map { |v| Config.new(key, v) }\n\n # Hashes can have some inner nesting, but only to a certain point.\n elsif val.is_a?(Hash)\n val.each do |k, v|\n if v.is_a?(Array)\n final_conf += v.map { |e| Config.new(key, \"#{k}=#{e}\") }\n else\n final_conf << Config.new(key, \"#{k}=#{v}\")\n end\n end\n else\n final_conf << Config.new(key, val)\n end\n end\n final_conf\n end", "def parse_json str\n JSON.parse str rescue raise ConfigError, \"Invalid JSON\"\n end", "def mapping #:nodoc:\n @mapper.config\n end", "def to_hash\n ChefConfig::Config.save(true)\n end", "def init_jaxb_json_hash(_o)\n if !_o['userManagerImpls'].nil?\n @userManagerImpls = Array.new\n _oa = _o['userManagerImpls']\n _oa.each { | _item | @userManagerImpls.push String.from_json(_item) }\n end\n @ldapConfiguration = Org::Apache::Archiva::Admin::Model::Beans::LdapConfiguration.from_json(_o['ldapConfiguration']) unless _o['ldapConfiguration'].nil?\n @migratedFromRedbackConfiguration = Boolean.from_json(_o['migratedFromRedbackConfiguration']) unless _o['migratedFromRedbackConfiguration'].nil?\n @configurationProperties = Hash.from_json(_o['configurationProperties']) unless _o['configurationProperties'].nil?\n if !_o['configurationPropertiesEntries'].nil?\n @configurationPropertiesEntries = Array.new\n _oa = _o['configurationPropertiesEntries']\n _oa.each { | _item | @configurationPropertiesEntries.push Org::Apache::Archiva::Admin::Model::Beans::PropertyEntry.from_json(_item) }\n end\n @useUsersCache = Boolean.from_json(_o['useUsersCache']) unless _o['useUsersCache'].nil?\n @usersCacheConfiguration = Org::Apache::Archiva::Admin::Model::Beans::CacheConfiguration.from_json(_o['usersCacheConfiguration']) unless _o['usersCacheConfiguration'].nil?\n if !_o['rbacManagerImpls'].nil?\n @rbacManagerImpls = Array.new\n _oa = _o['rbacManagerImpls']\n _oa.each { | _item | @rbacManagerImpls.push String.from_json(_item) }\n end\n if !_o['ldapGroupMappings'].nil?\n @ldapGroupMappings = Array.new\n _oa = _o['ldapGroupMappings']\n _oa.each { | _item | @ldapGroupMappings.push Org::Apache::Archiva::Admin::Model::Beans::LdapGroupMapping.from_json(_item) }\n end\n end", "def for_json\n to_hash\n end", "def from_json(json:, klass:, use_alias: false)\n hash = JSON.load(json)\n from_hash(hash: hash, klass: klass, use_alias: use_alias)\n end", "def from_json(json)\n deserialize JSON.parse(json)\n end", "def config(args = { :target => nil, :format => :hash })\n case args[:format]\n when :hash\n self.config_to_hash\n when :yaml\n self.config_to_yaml(args[:target])\n end\n end", "def configuration_options\n json_config = \"\"\n\n if looks_like_s3_path? template\n bucket, key = parse_s3_path template\n json_config = s3.buckets[bucket].objects[key].read\n else\n json_config = File.read template\n end\n\n config = JSON.parse json_config\n config = fix_config_keys config\n\n config\n end", "def configuration\n JSON.parse @gapi.configuration.to_json\n end", "def init_jaxb_json_hash(_o)\n if !_o['entries'].nil?\n _oa = _o['entries']\n if(_oa.is_a? Hash)\n @entries = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @entries = Com::Hybris::Cis::Api::Model::AnnotationHashMapEntryType.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @entries = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @entries.push Com::Hybris::Cis::Api::Model::AnnotationHashMapEntryType.from_json(_item)\n else\n @entries.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @entries = _oa\n end\n end\n if !_o['map'].nil?\n _oa = _o['map']\n if(_oa.is_a? Hash)\n @map = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @map = Hash.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @map = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @map.push Hash.from_json(_item)\n else\n @map.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @map = _oa\n end\n end\n end", "def init_jaxb_json_hash(_o)\n if !_o['blackListPatterns'].nil?\n @blackListPatterns = Array.new\n _oa = _o['blackListPatterns']\n _oa.each { | _item | @blackListPatterns.push String.from_json(_item) }\n end\n @policies = Hash.from_json(_o['policies']) unless _o['policies'].nil?\n @properties = Hash.from_json(_o['properties']) unless _o['properties'].nil?\n @proxyId = String.from_json(_o['proxyId']) unless _o['proxyId'].nil?\n @sourceRepoId = String.from_json(_o['sourceRepoId']) unless _o['sourceRepoId'].nil?\n @targetRepoId = String.from_json(_o['targetRepoId']) unless _o['targetRepoId'].nil?\n if !_o['whiteListPatterns'].nil?\n @whiteListPatterns = Array.new\n _oa = _o['whiteListPatterns']\n _oa.each { | _item | @whiteListPatterns.push String.from_json(_item) }\n end\n @disabled = Boolean.from_json(_o['disabled']) unless _o['disabled'].nil?\n if !_o['policiesEntries'].nil?\n @policiesEntries = Array.new\n _oa = _o['policiesEntries']\n _oa.each { | _item | @policiesEntries.push Org::Apache::Archiva::Admin::Model::Beans::PropertyEntry.from_json(_item) }\n end\n if !_o['propertiesEntries'].nil?\n @propertiesEntries = Array.new\n _oa = _o['propertiesEntries']\n _oa.each { | _item | @propertiesEntries.push Org::Apache::Archiva::Admin::Model::Beans::PropertyEntry.from_json(_item) }\n end\n end", "def init_jaxb_json_hash(_o)\n @urlFailureCacheConfiguration = Org::Apache::Archiva::Admin::Model::Beans::CacheConfiguration.from_json(_o['urlFailureCacheConfiguration']) unless _o['urlFailureCacheConfiguration'].nil?\n @fileLockConfiguration = Org::Apache::Archiva::Admin::Model::Beans::FileLockConfiguration.from_json(_o['fileLockConfiguration']) unless _o['fileLockConfiguration'].nil?\n end", "def configure(config={})\n config.each do |(key, val)|\n self.config[key] = val\n end\n end", "def convert(map)\n return map if valid?(map)\n\n map.map { |key, value| [key, subprop.convert(value)] }.to_h\n end", "def initialize(configuration = Configuration.new, map = {})\n @configuration = configuration\n @converter_map = map.dup\n end", "def config_data\n {}\n end", "def to_hash\n self.config.to_hash\n end", "def from_options\n # don't do anything, unless options were provided\n return if not @config or @config.empty?\n @config.each { |key, value| update(key, value) }\n end", "def json_to_obj json_str\n hash_to_obj(parse_json(json_str))\n end", "def from_json(json:, klass:)\n hash = JSON.load(json)\n from_hash(hash: hash, klass: klass)\n end", "def get_config_infos\n configinfo =\n {\n :init_one_appointment_price => Settings.init_one_appointment_price,\n :income_call_number => Settings.income_call_number,\n :call_length => Settings.call_length,\n :tutor_online_time => Settings.tutor_online_time,\n :call_delay_time => Settings.call_delay_time,\n :tutor_single_price => Settings.tutor_single_price\n }\n render :json => configinfo.to_json(), :status => 200\n end", "def configuration_from_options(options); end", "def from_json(json, include_root=false)\n hash = ActiveSupport::JSON.decode(json)\n hash = hash.values.first if include_root\n self.all_attributes = hash\n end", "def to_config(key, options)\n return key if options.empty?\n\n {key => canonicalize_options(options)}\n end", "def map_to_rb_obj(json_obj)\n case json_obj\n when Hash\n mapped_hash = map_hash_to_rb_obj(json_obj)\n if json_obj.has_key?(JSON_CLAZ) && (class_to_inflate = class_for_json_class(json_obj[JSON_CLAZ]))\n class_to_inflate.json_create(mapped_hash)\n else\n mapped_hash\n end\n when Array\n json_obj.map { |e| map_to_rb_obj(e) }\n else\n json_obj\n end\n end", "def map_to_rb_obj(json_obj)\n case json_obj\n when Hash\n mapped_hash = map_hash_to_rb_obj(json_obj)\n if json_obj.has_key?(JSON_CLAZ) && (class_to_inflate = class_for_json_class(json_obj[JSON_CLAZ]))\n class_to_inflate.json_create(mapped_hash)\n else\n mapped_hash\n end\n when Array\n json_obj.map {|e| map_to_rb_obj(e) }\n else\n json_obj\n end\n end", "def hash_to_obj hash\n OpenStruct.new(hash) rescue raise ConfigError, \"Can't convert setup to object\"\n end", "def to_h\n @config\n end", "def to_h\n @config\n end", "def get_config_from_file(filename)\n # Try to load the file from disk\n begin\n # Determine the extension\n ext = File.extname(filename)\n # Use the correct loader\n if ext == \".yml\"\n data = YAML.load_file(filename)\n elsif ext == \".json\"\n json = File.read(filename)\n data = JSON.parse(json)\n end\n rescue Exception => e\n raise \"Error loading file: #{filename} #{e}\"\n end\n\n # Fix up empty files\n if data.nil? or data == false\n warn \"Could not load configuration from '#{Config.config_files}'; it might be empty or malformed.\"\n data = {}\n end\n return data\n end", "def load_config(path)\n json = JSON.parse( File.binread(path) )\n\n $SETTINGS = {}\n $SETTINGS[:SRCS] = json['SRCS'].collect { |src| File.expand_path(src) }\n $SETTINGS[:IMG_RESIZE] = json['IMG_RESIZE']\n $SETTINGS[:USERNAME] = json['USERNAME']\n $SETTINGS[:PASSWORD] = json['PASSWORD']\n $SETTINGS[:BIND] = json['BIND']\n $SETTINGS[:PORT] = json['PORT']\n $SETTINGS[:DEFAULT_IMAGE_QUALITY] = json['DEFAULT_IMAGE_QUALITY']\n $SETTINGS[:DEFAULT_IMAGE_WIDTH] = json['DEFAULT_IMAGE_WIDTH']\n $SETTINGS[:DEFAULT_IMAGE_HEIGHT] = json['DEFAULT_IMAGE_HEIGHT']\n $SETTINGS[:BOOKMARKS_FILE] = File.expand_path( json['BOOKMARKS_FILE'] )\nend", "def from_json(data)\n hash = Oj.load(data, symbol_keys: true)\n\n hash.each do |k, v|\n hash[k] = convert(v, k, :from_json)\n end\n\n from_h(hash)\n end", "def config\n fail(SlashDeploy::NoConfig) unless config?\n SlashDeploy::Config.from_yaml(raw_config)\n end", "def to_config\n {\n id: id,\n cron: cron,\n worker: worker,\n args: args,\n queue: queue\n }\n end", "def from_json(json)\n new JSON.parse(json)\n end", "def from_json\n JSON.parse(self)\n end", "def initialize json_hash\n @json = json_hash\n super\n end", "def map_to_rb_obj(json_obj)\n case json_obj\n when Hash\n mapped_hash = map_hash_to_rb_obj(json_obj)\n if json_obj.has_key?(JSON_CLASS) && (class_to_inflate = class_for_json_class(json_obj[JSON_CLASS]))\n class_to_inflate.json_create(mapped_hash)\n else\n mapped_hash\n end\n when Array\n json_obj.map {|e| map_to_rb_obj(e) }\n else\n json_obj\n end\n end", "def initialize(name, json = nil)\n @name = name\n if json\n @region = json[\"region\"]\n @tags = json[\"tags\"] || {}\n if json[\"permissions\"][\"cors\"]\n @cors = Loader.cors_policy(\n json[\"permissions\"][\"cors\"][\"template\"],\n json[\"permissions\"][\"cors\"][\"vars\"] || {}\n )\n end\n if json[\"permissions\"][\"policy\"]\n @policy = Loader.bucket_policy(\n json[\"permissions\"][\"policy\"][\"template\"],\n json[\"permissions\"][\"policy\"][\"vars\"] || {}\n )\n end\n if json[\"permissions\"][\"grants\"]\n @grants = Hash[json[\"permissions\"][\"grants\"].map do |g|\n [g[\"name\"], GrantConfig.new(g)]\n end]\n end\n if json[\"default_encryption\"]\n @default_encryption = DefaultEncryptionConfig.new(json[\"default_encryption\"])\n end\n @website = if json[\"website\"] then WebsiteConfig.new(json[\"website\"]) end\n @logging = if json[\"logging\"] then LoggingConfig.new(json[\"logging\"]) end\n @notifications = Hash[(json[\"notifications\"] || []).map { |n| [n[\"name\"], NotificationConfig.new(n)] }]\n @lifecycle = Hash[(json[\"lifecycle\"] || []).map { |l| [l[\"name\"], LifecycleConfig.new(l)] }]\n @versioning = json[\"versioning\"] || false\n @replication = if json[\"replication\"] then ReplicationConfig.new(json[\"replication\"]) end\n end\n end", "def config(name, items)\n self[:configMap] = {\n name: name,\n items: items.map do |key, path|\n { key: key, path: path }\n end\n }\n end", "def type_to_form_ready_hash_configstore\n {\n type: resource[:configstoretype],\n connectionString: resource[:configdir],\n move: true,\n runAsync: false,\n }\n end", "def config\n @payload.fetch('config')\n end", "def save_config\n self.config['scheduling_criteria'] = '' if self.config['scheduling_criteria'] == 'null'\n self.config['from_time'] = self.config['from_time'].gsub(I18n.t('time.am'), \"am\").gsub(I18n.t('time.pm'), \"pm\")\n self.config['to_time'] = self.config['to_time'].gsub(I18n.t('time.am'), \"am\").gsub(I18n.t('time.pm'), \"pm\")\n self.data = JSON.dump(self.config)\n end", "def config_options\n # config_file_path = File.join(ENV['SHARED_CONFIG_ROOT'] || \"#{Rails.root}/config\", \"college_mapper.yml\")\n # @config_options ||= YAML::load(ERB.new((IO.read(config_file_path))).result)[(Rails.env)].symbolize_keys \n @config_options ||= API_KEYS['collegemapper'][Rails.env].symbolize_keys\n end", "def initialize(json_hash = FileAccessor.local_config)\n @hash = json_hash # holds the config hash from which ever node of our\n # config file this instance represents...\n\n @hash.each_pair do |key, value|\n\n define_singleton_method key do |options = {}|\n interpolate = (options[:interpolate] != false) # set interpolate var\n # to true as long as it hasn't been set to false in an\n # options hash TODO PJ: make this \"raw\" for interp. &\n # referencing other vals...\n\n if value.is_a? Hash\n ConfigHash.new(value) # create a new instance for this node\n else\n if interpolate # return interpolated values...\n if value.is_a? Array\n value.map {|item| interpolate_commands_in item}\n else\n interpolate_commands_in value\n end\n else # return raw value, most often same as interpolated value\n value\n end\n end\n end\n\n if value.is_a? String\n define_singleton_method :\"#{key}=\" do |value|\n @hash[key] = value\n end\n end\n\n end\n end", "def configuration\n config = {}\n config[:colors] = @colors\n config[:color] = @color\n config[:setup] = @setup \n config[:lights] = @lights_array.map do |light|\n c = light.color\n \"red: #{c.red}, blue: #{c.blue}, green: #{c.green}\"\n end\n config.to_json\n end", "def to_hash\n configuration\n end", "def read_config(config_file)\n begin\n file = File.read(config_file)\n parsed_config = JSON.parse(file)\n rescue\n abort(\"ERROR: Error parsing configuration file #{config_file}. \" \\\n 'Does it exist and is it valid JSON?')\n end\n parsed_config\nend", "def export_config(format: :json)\n force_validations!\n\n export_migrations if Settings::AllowDynamicMigrations\n\n case format\n when :json\n JSON.pretty_generate(JSON.parse(to_json))\n when :yaml\n YAML.dump(JSON.parse(to_json))\n end\n end", "def configure_from_options\n if @options[:config]\n config = Configuration.new(@path, @options[:config])\n config.from_options\n end\n end", "def set_dict_config\n @dict_config = DictConfig.find(params[:id])\n end", "def load(json)\n require 'json'\n from_json(JSON.parse(json))\n end", "def populateSettingValuesFromConfigMap(parsedConfig)\n begin\n if !parsedConfig.nil? && !parsedConfig[:agent_settings].nil?\n if !parsedConfig[:agent_settings][:health_model].nil? && !parsedConfig[:agent_settings][:health_model][:enabled].nil?\n @enable_health_model = parsedConfig[:agent_settings][:health_model][:enabled]\n puts \"enable_health_model = #{@enable_health_model}\"\n end\n chunk_config = parsedConfig[:agent_settings][:chunk_config]\n if !chunk_config.nil?\n nodesChunkSize = chunk_config[:NODES_CHUNK_SIZE]\n if !nodesChunkSize.nil? && is_number?(nodesChunkSize) && (@nodesChunkSizeMin..@nodesChunkSizeMax) === nodesChunkSize.to_i\n @nodesChunkSize = nodesChunkSize.to_i\n puts \"Using config map value: NODES_CHUNK_SIZE = #{@nodesChunkSize}\"\n end\n\n podsChunkSize = chunk_config[:PODS_CHUNK_SIZE]\n if !podsChunkSize.nil? && is_number?(podsChunkSize) && (@podsChunkSizeMin..@podsChunkSizeMax) === podsChunkSize.to_i\n @podsChunkSize = podsChunkSize.to_i\n puts \"Using config map value: PODS_CHUNK_SIZE = #{@podsChunkSize}\"\n end\n\n eventsChunkSize = chunk_config[:EVENTS_CHUNK_SIZE]\n if !eventsChunkSize.nil? && is_number?(eventsChunkSize) && (@eventsChunkSizeMin..@eventsChunkSizeMax) === eventsChunkSize.to_i\n @eventsChunkSize = eventsChunkSize.to_i\n puts \"Using config map value: EVENTS_CHUNK_SIZE = #{@eventsChunkSize}\"\n end\n\n deploymentsChunkSize = chunk_config[:DEPLOYMENTS_CHUNK_SIZE]\n if !deploymentsChunkSize.nil? && is_number?(deploymentsChunkSize) && (@deploymentsChunkSizeMin..@deploymentsChunkSizeMax) === deploymentsChunkSize.to_i\n @deploymentsChunkSize = deploymentsChunkSize.to_i\n puts \"Using config map value: DEPLOYMENTS_CHUNK_SIZE = #{@deploymentsChunkSize}\"\n end\n\n hpaChunkSize = chunk_config[:HPA_CHUNK_SIZE]\n if !hpaChunkSize.nil? && is_number?(hpaChunkSize) && (@hpaChunkSizeMin..@hpaChunkSizeMax) === hpaChunkSize.to_i\n @hpaChunkSize = hpaChunkSize.to_i\n puts \"Using config map value: HPA_CHUNK_SIZE = #{@hpaChunkSize}\"\n end\n\n podsEmitStreamBatchSize = chunk_config[:PODS_EMIT_STREAM_BATCH_SIZE]\n if !podsEmitStreamBatchSize.nil? && is_number?(podsEmitStreamBatchSize) &&\n podsEmitStreamBatchSize.to_i <= @podsChunkSize && podsEmitStreamBatchSize.to_i >= @podsEmitStreamBatchSizeMin\n @podsEmitStreamBatchSize = podsEmitStreamBatchSize.to_i\n puts \"Using config map value: PODS_EMIT_STREAM_BATCH_SIZE = #{@podsEmitStreamBatchSize}\"\n end\n nodesEmitStreamBatchSize = chunk_config[:NODES_EMIT_STREAM_BATCH_SIZE]\n if !nodesEmitStreamBatchSize.nil? && is_number?(nodesEmitStreamBatchSize) &&\n nodesEmitStreamBatchSize.to_i <= @nodesChunkSize && nodesEmitStreamBatchSize.to_i >= @nodesEmitStreamBatchSizeMin\n @nodesEmitStreamBatchSize = nodesEmitStreamBatchSize.to_i\n puts \"Using config map value: NODES_EMIT_STREAM_BATCH_SIZE = #{@nodesEmitStreamBatchSize}\"\n end\n end\n # fbit config settings\n fbit_config = parsedConfig[:agent_settings][:fbit_config]\n if !fbit_config.nil?\n fbitFlushIntervalSecs = fbit_config[:log_flush_interval_secs]\n if !fbitFlushIntervalSecs.nil? && is_number?(fbitFlushIntervalSecs) && fbitFlushIntervalSecs.to_i > 0\n @fbitFlushIntervalSecs = fbitFlushIntervalSecs.to_i\n puts \"Using config map value: log_flush_interval_secs = #{@fbitFlushIntervalSecs}\"\n end\n\n fbitTailBufferChunkSizeMBs = fbit_config[:tail_buf_chunksize_megabytes]\n if !fbitTailBufferChunkSizeMBs.nil? && is_number?(fbitTailBufferChunkSizeMBs) && fbitTailBufferChunkSizeMBs.to_i > 0\n @fbitTailBufferChunkSizeMBs = fbitTailBufferChunkSizeMBs.to_i\n puts \"Using config map value: tail_buf_chunksize_megabytes = #{@fbitTailBufferChunkSizeMBs}\"\n end\n\n fbitTailBufferMaxSizeMBs = fbit_config[:tail_buf_maxsize_megabytes]\n if !fbitTailBufferMaxSizeMBs.nil? && is_number?(fbitTailBufferMaxSizeMBs) && fbitTailBufferMaxSizeMBs.to_i > 0 \n if fbitTailBufferMaxSizeMBs.to_i >= @fbitTailBufferChunkSizeMBs\n @fbitTailBufferMaxSizeMBs = fbitTailBufferMaxSizeMBs.to_i\n puts \"Using config map value: tail_buf_maxsize_megabytes = #{@fbitTailBufferMaxSizeMBs}\"\n else\n # tail_buf_maxsize_megabytes has to be greater or equal to tail_buf_chunksize_megabytes\n @fbitTailBufferMaxSizeMBs = @fbitTailBufferChunkSizeMBs\n puts \"config::warn: tail_buf_maxsize_megabytes must be greater or equal to value of tail_buf_chunksize_megabytes. Using tail_buf_maxsize_megabytes = #{@fbitTailBufferMaxSizeMBs} since provided config value not valid\"\n end\n end\n # in scenario - tail_buf_chunksize_megabytes provided but not tail_buf_maxsize_megabytes to prevent fbit crash\n if @fbitTailBufferChunkSizeMBs > 0 && @fbitTailBufferMaxSizeMBs == 0\n @fbitTailBufferMaxSizeMBs = @fbitTailBufferChunkSizeMBs\n puts \"config::warn: since tail_buf_maxsize_megabytes not provided hence using tail_buf_maxsize_megabytes=#{@fbitTailBufferMaxSizeMBs} which is same as the value of tail_buf_chunksize_megabytes\"\n end \n\n fbitTailMemBufLimitMBs = fbit_config[:tail_mem_buf_limit_megabytes]\n if !fbitTailMemBufLimitMBs.nil? && is_number?(fbitTailMemBufLimitMBs) && fbitTailMemBufLimitMBs.to_i > 0\n @fbitTailMemBufLimitMBs = fbitTailMemBufLimitMBs.to_i\n puts \"Using config map value: tail_mem_buf_limit_megabytes = #{@fbitTailMemBufLimitMBs}\"\n end\n end\n end\n rescue => errorStr\n puts \"config::error:Exception while reading config settings for agent configuration setting - #{errorStr}, using defaults\"\n @enable_health_model = false\n end\nend", "def initialize(json)\n @info = json if json.is_a? Hash\n @info ||= JSON.parse(json)\n end", "def new_from_json(json)\n params = {}\n\n # set each attribute based on the mapping\n self.attribute_mapping.each do |o,n|\n # if o is a string, parse it\n if n.is_a?(String)\n # check if data type is specified (using @@ symbol)\n if n.include?(\"@@\")\n if n.split(\"@@\").last.downcase == 'time'\n data = Time.new(n.split(\"@@\").first)\n elsif n.split(\"@@\").last.downcase == 'float'\n data = n.split(\"@@\").first.to_f\n else\n data = n.split(\"@@\").first\n end\n params[n.split(\"@@\").first] = data\n else\n # puts \"parsing value: #{n} => #{json[o]}\"\n params[n] = json[o.to_s]\n # puts \"parsed value (#{params[n]})\"\n end\n\n \n # assign boolean value\n elsif [FalseClass, TrueClass].include?(n.class)\n # puts \"Parsing boolean value: #{n} = #{json[o]}\"\n params[n] = json[o]\n # puts \"#{n} => #{o}\"\n # else, o is a class. Call the 'parse_children' method on it\n else\n # puts \"n is a #{n.class.name}\"\n # loop through all the children (for example: 'regels' on 'arrangementen')\n if json[o]\n children = []\n for item in json[o]\n children << n.new_from_json(item)\n end\n params[n.plural_name] = children\n end\n end\n\n end\n params['json'] = json\n self.new(params)\n end", "def to_yaml\n require 'yaml'\n self.config.to_hash.to_yaml\n end", "def convert_json(json)\n\n return JSON.parse(json)\n\nend", "def from_json(filename)\n require \"json\" unless defined?(JSON)\n from_hash(JSON.parse(IO.read(filename)))\n end", "def initialize(name, json = nil)\n @name = name\n if !json.nil?\n @inbound = (json[\"inbound\"] || []).map { |entry| AclEntryConfig.new(entry) }\n @outbound = (json[\"outbound\"] || []).map { |entry| AclEntryConfig.new(entry) }\n @tags = json[\"tags\"] || {}\n end\n end", "def create_config\n self.config = {} if !self.config\n end", "def create_config\n self.config = {} if !self.config\n end", "def to_hash\n JSON.parse(properties).to_h\n end", "def load_json(json)\n @raw = JSON.load(json)\n\n load_hash(@raw)\n end", "def initialize(name, json = nil)\n @name = name\n if !json.nil?\n @id = json[\"id\"]\n @aliases = json[\"aliases\"] || []\n @origins = json[\"origins\"].map { |o| OriginConfig.new(o) }\n @default_cache_behavior = CacheBehaviorConfig.new(json[\"default-cache-behavior\"], true)\n @cache_behaviors = (json[\"cache-behaviors\"] || []).map { |cb| CacheBehaviorConfig.new(cb) }\n @comment = json[\"comment\"]\n @enabled = json[\"enabled\"]\n end\n end", "def from_hash(json, client: nil)\n res = self.new\n\n json.each do |k, v|\n # TODO: Better way to do this?\n attr = @attributes.find{|a| a.json_field == k.to_s}\n raise InvalidAttribute.new(\n \"`#{self.name.split('::').last}` did not define a `#{k}`.\"\n ) if attr.nil?\n\n # TODO: Better way to do this?\n case attr.type.to_s\n when Integer.to_s\n maybe_raise_invalid_value(attr, k, v) unless v.is_a?(Fixnum)\n value = v.to_i\n when Float.to_s\n maybe_raise_invalid_value(attr, k, v) unless v.is_a?(Float)\n value = v.to_f\n when String.to_s\n maybe_raise_invalid_value(attr, k, v) unless v.is_a?(String)\n value = v\n when Hash.to_s\n maybe_raise_invalid_value(attr, k, v) unless v.is_a?(Hash)\n value = v\n end\n\n # Lurk, there is probably a better way to do this.\n if !attr.expand_method.nil?\n client ||= Unchained::Client.new\n value = client.send(attr.expand_method, value)\n end\n\n res.send(\"#{attr.name}=\", value)\n end\n\n res\n end", "def config\n info['Config']\n end", "def init_jaxb_json_hash(_o)\n @hostName = String.from_json(_o['hostName']) unless _o['hostName'].nil?\n @port = Fixnum.from_json(_o['port']) unless _o['port'].nil?\n @ssl = Boolean.from_json(_o['ssl']) unless _o['ssl'].nil?\n @baseDn = String.from_json(_o['baseDn']) unless _o['baseDn'].nil?\n @contextFactory = String.from_json(_o['contextFactory']) unless _o['contextFactory'].nil?\n @bindDn = String.from_json(_o['bindDn']) unless _o['bindDn'].nil?\n @password = String.from_json(_o['password']) unless _o['password'].nil?\n @authenticationMethod = String.from_json(_o['authenticationMethod']) unless _o['authenticationMethod'].nil?\n @extraProperties = Hash.from_json(_o['extraProperties']) unless _o['extraProperties'].nil?\n @bindAuthenticatorEnabled = Boolean.from_json(_o['bindAuthenticatorEnabled']) unless _o['bindAuthenticatorEnabled'].nil?\n if !_o['extraPropertiesEntries'].nil?\n @extraPropertiesEntries = Array.new\n _oa = _o['extraPropertiesEntries']\n _oa.each { | _item | @extraPropertiesEntries.push Org::Apache::Archiva::Admin::Model::Beans::PropertyEntry.from_json(_item) }\n end\n @baseGroupsDn = String.from_json(_o['baseGroupsDn']) unless _o['baseGroupsDn'].nil?\n @writable = Boolean.from_json(_o['writable']) unless _o['writable'].nil?\n @useRoleNameAsGroup = Boolean.from_json(_o['useRoleNameAsGroup']) unless _o['useRoleNameAsGroup'].nil?\n end" ]
[ "0.6605796", "0.6605796", "0.6541631", "0.6215872", "0.5877206", "0.5875126", "0.58186215", "0.5814737", "0.5814737", "0.55717707", "0.55717707", "0.5550272", "0.55458", "0.55438673", "0.55374646", "0.55374646", "0.5505102", "0.5490747", "0.54509175", "0.5397277", "0.5394319", "0.53917503", "0.53822994", "0.53366077", "0.5317261", "0.53128386", "0.5279528", "0.5275376", "0.5243741", "0.52432585", "0.52170867", "0.52109444", "0.5210122", "0.5209635", "0.5198336", "0.51930016", "0.5192517", "0.5192191", "0.51897424", "0.5184822", "0.5181582", "0.5179099", "0.5169841", "0.51668775", "0.51658446", "0.5138729", "0.5132792", "0.5120942", "0.5117151", "0.5116533", "0.51157624", "0.5110672", "0.5104472", "0.510314", "0.50996536", "0.50908506", "0.50806195", "0.5067426", "0.5065886", "0.5061609", "0.5061165", "0.5061165", "0.505768", "0.50521225", "0.50496984", "0.50409585", "0.5032114", "0.5030552", "0.50255394", "0.5022343", "0.5022279", "0.5021136", "0.50036", "0.5001624", "0.5000329", "0.4995999", "0.4989948", "0.4988689", "0.49842307", "0.49799347", "0.49764156", "0.49731722", "0.49638996", "0.4963258", "0.49621004", "0.49609396", "0.49583802", "0.4939244", "0.4938863", "0.49373996", "0.49371818", "0.49308288", "0.49273318", "0.49273318", "0.49205536", "0.49186975", "0.49174348", "0.49152577", "0.49125522", "0.49054676" ]
0.6248806
3
Determine the list(with properties) of the running instances in the given autoscaling group if asg_name is nil it returns nil
def running_hosts_in_asg(asg_name) return nil unless asg_name asg = @auto_scaling.groups[asg_name] return nil unless asg # return a lost of maps having the list of running instances asg.auto_scaling_instances.collect { |i| if i.health_status != 'Healthly' ec2instance = i.ec2_instance.dns_name { :instance_id => ec2instance.id, :health_status => i.health_status, :public_dns => ec2instance.dns_name, :ip => ec2instance.ip_address } else nil end }.compact!.sort { |x,y| x.instance_id <=> y.instance_id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end", "def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end", "def list_asgs\n # collect the list of running instances in this zone\n ec2 = AWS::EC2.new\n region = ec2.regions[AMI_REGION]\n instances = region.instances.select { |i| i.tags.to_h[\"server\"] == APP_NAME }\n\n # now find the list of running asgs\n format = \"%-32s %s\"\n puts\n puts format % [\"Instance Groups\", \"Tags\"]\n puts format % [\"-\" * 32, \"-\" * 60]\n auto_scaling = new_auto_scaling\n count = 0\n auto_scaling.groups.each do |group|\n count = count + 1\n puts format % [group.name, tag_value(group.tags, \"env\")]\n\n instances.each do |i|\n if i.tags.to_h[\"env\"] == tag_value(group.tags, \"env\")\n puts \"\\t%s %-13s %s\" % [i.id, i.status, i.dns_name]\n end\n end\n puts\n end\n puts format % [\"-\" * 32, \"-\" * 60]\n puts \"Found #{count} ASGs\"\n puts\nend", "def description\n client.describe_auto_scaling_groups(auto_scaling_group_names: [asg_name])&.auto_scaling_groups.first\n end", "def getAsgs()\n options = Hash.new\n asgs = []\n next_token = 0\n while next_token != nil\n options[:next_token] = next_token unless next_token == 0\n resp = @asg.describe_auto_scaling_groups(options)\n asgs.concat(resp.data[:auto_scaling_groups])\n next_token = resp.data[:next_token]\n end\n asgs\n end", "def get_running_instances(group)\n get_instances(group).select{ |instance| instance.ready? }\n end", "def get_instances(incl_stopped=false)\n \n instances = @ec2.describe_instances\n instances = instances.select { |x| x[:aws_groups].include? @group_name }\n \n if(instances.length == 0)\n raise CaTPAWS::EC2::Error::InstanceRetrieval, \"No instances found in this group\"\n end \n \n unless (incl_stopped)\n instances = instances.select {|x| x[:aws_state_code].to_i <= 16}\n end\n @instances = instances\n end", "def print_instances_details(only_running=true)\n @groups.values.each_with_index do |instances, i|\n instances.each do |instance|\n if only_running and (not instance.ready?)\n next\n end\n puts sprintf \"%02d: %-20s %-20s %-20s %-20s %-25s %-20s (%s) (%s) (%s)\",\n i, (instance.tags[\"Name\"] || \"\").green,instance.private_dns_name ,instance.id.red, instance.flavor_id.cyan,\n instance.dns_name.blue, instance.availability_zone.magenta, (instance.tags[\"role\"] || \"\").yellow,\n (instance.tags[\"group\"] || \"\").yellow, (instance.tags[\"app\"] || \"\").green\n end\n end\n end", "def start\n if !autoscaling_group.exists?\n @task.warn { \"Autoscaling group #{@name} doesn't exist\" }\n return\n end\n\n if autoscaling_group.suspended_processes.empty?\n @task.debug { \"Scaling group #{@name} already running\" }\n else\n start_instances\n\n @task.unsafe(\"Resuming #{@name} processes\") do\n autoscaling_group.resume_all_processes\n end\n end\n end", "def start\n if !autoscaling_group.exists?\n @task.warn { \"Autoscaling group #{@name} doesn't exist\" }\n return\n end\n \n suspended = load_from_s3(@task.bucket)\n\n # FIXME: This won't work if we reinstate suspended processes...\n #if autoscaling_group.suspended_processes.empty?\n #@task.debug { \"Scaling group #{@name} already running\" }\n #else\n start_instances\n\n @task.unsafe(\"Resuming #{@name} processes\") do\n autoscaling_group.resume_all_processes\n autoscaling_group.suspend_processes suspended.keys\n end\n #end\n end", "def autoscale(instance_id)\n metadata = @ec2.describe_instances(instance_ids: [\"#{instance_id}\"])\n tags = metadata.reservations.first.instances.first\n # covert to hash to make this easier\n tags = tags.to_h\n tags = tags[:tags]\n # quick check to avoid having to iterate through all the tags to see if the one we need is there.\n temp_tags = tags.to_s\n if temp_tags.include?(\"aws:autoscaling:groupName\")\n tags.each do |curtag|\n if curtag[:key] == \"aws:autoscaling:groupName\"\n @autoscaling = curtag[:value]\n end\n end\n else\n @autoscaling = \"false\"\n end\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def init_groups\n @@client.describe_auto_scaling_groups.auto_scaling_groups\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def auto_scaling_group(group_name)\n AutoScalingGroup.new(group_name)\n end", "def get_instances\n all_instances = Array.new()\n @groups.values.each do |instances|\n instances.each do |instance|\n all_instances << instance\n end\n end\n all_instances\n end", "def auto_scaling_group_name\n data.auto_scaling_group_name\n end", "def ec2_instances\n instances = EC2::InstanceCollection.new(:config => config)\n instances.tagged('aws:autoscaling:groupName').tagged_values(name)\n end", "def delete_old_asg config, launch_config_name\n auto_scaling = new_auto_scaling\n auto_scaling.groups.each do |group|\n server = tag_value(group.tags, \"server\")\n if server != config[\"server\"]\n next \n end\n\n env = tag_value(group.tags, \"env\")\n if env != config[\"env\"]\n next \n end\n\n if group.name != launch_config_name.name\n puts \"deleting instance group, #{group.name} => #{launch_config_name.name}\"\n delete_asg group.name\n end\n end\nend", "def get_instances_description\n instances\n end", "def describe_auto_scaling_groups(options = {})\n if auto_scaling_group_names = options.delete('AutoScalingGroupNames')\n options.merge!(AWS.indexed_param('AutoScalingGroupNames.member.%d', [*auto_scaling_group_names]))\n end\n request({\n 'Action' => 'DescribeAutoScalingGroups',\n :parser => Fog::Parsers::AWS::AutoScaling::DescribeAutoScalingGroups.new\n }.merge!(options))\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end", "def delete_asg name\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n raise \"unable to delete asg, #{name}. asg not found!\" if groups[name].nil? \n\n asg = groups[name]\n\n puts \"deleting asg, #{asg.name}\"\n asg.delete({:force => true})\n delete_launch_configs\nend", "def autoscaling_group_exists?\n Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.describe.nil? ? false : true\n end", "def start_instances\n started = 0\n autoscaling_instances.each do |instance|\n ec2_instance = instance.ec2_instance\n next if !ec2_instance.exists?\n\n if ec2_instance.status == :stopped\n @task.unsafe(\"Starting instance #{instance.instance_id}\") do\n ec2_instance.start\n load_balancers.each do |elb|\n elb.instances.register(instance.instance_id)\n end\n started += 1\n end\n else\n @task.debug { \"Instance #{instance.instance_id} already running\" }\n end\n end\n\n # FIXME\n # This is to give instances a little more time to start up and become\n # healthy before restarting autoscaling processes.\n # If an instance isn't started and healthy in time, the autoscale will kill\n # it for being unhealthy.\n #\n # The \"right\" way to do it would be to actually poll the instances until\n # they are healthy (or a timeout is reached). With the current task model,\n # other actions are blocked while this is waiting, so I can't afford to\n # wait too long.\n sleep(@grace_period) if started > 0\n end", "def start_instances\n started = 0\n autoscaling_instances.each do |instance|\n ec2_instance = instance.ec2_instance\n next if !ec2_instance.exists?\n\n if ec2_instance.status == :stopped\n @task.unsafe(\"Starting instance #{instance.instance_id}\") do\n ec2_instance.start\n load_balancers.each do |elb|\n elb.instances.register(instance.instance_id)\n end\n started += 1\n end\n else\n @task.debug { \"Instance #{instance.instance_id} already running\" }\n end\n end\n\n # FIXME\n # This is to give instances a little more time to start up and become\n # healthy before restarting autoscaling processes.\n # If an instance isn't started and healthy in time, the autoscale will kill\n # it for being unhealthy.\n #\n # The \"right\" way to do it would be to actually poll the instances until\n # they are healthy (or a timeout is reached). With the current task model,\n # other actions are blocked while this is waiting, so I can't afford to\n # wait too long.\n sleep(@grace_period) if started > 0\n end", "def get_app_scaling_limits\n web_cart = get_framework_cartridge\n component_instance = self.component_instances.find_by(cartridge_name: web_cart.name)\n group_instance = group_instances_with_scale.select{ |go| go.all_component_instances.include? component_instance }[0]\n [group_instance.min, group_instance.max]\n end", "def instances_names_list\n return [] unless configured?\n\n aws_instances_ids = instances_list || []\n aws_instances_ids.map { |instance| instance[:node_name] }\n end", "def arn\n cloud_desc.auto_scaling_group_arn\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def active_instances; end", "def get_instances_by_role(group, role)\n get_instances(group).select do |instance|\n if not instance.tags['role'].nil? and instance.ready?\n instance.tags.fetch('role', '').split(',').include? role\n end\n end\n end", "def available_instances\n @available_instances ||= {}\n end", "def list_instances()\n response = dbreq(\"GET\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def dynamic_scaling_instance_count(test_value=nil)\n # return current instance count unless we're dynamic\n # >>///====/WHOOOSH/===//DYNAMISM!//>\n #\n return self.instances unless self.scaling.get(:mode) == 'dynamic'\n\n begin\n check_type = self.scaling.get('config.type')\n raise LoadError.new if check_type.nil?\n require \"harbormaster/lib/autoscaling/#{check_type}\"\n klass = (Harbormaster::Autoscaling.const_get(check_type.camelize) rescue nil)\n raise LoadError.new unless klass\n\n rv = klass.instance_count(self, test_value)\n self.last_checked_at = Time.now\n\n return (rv.nil? ? self.instances : rv)\n\n rescue LoadError\n Onering::Logger.error(\"Unable to find dynamic scaling check for type #{check_type}\")\n return self.instances\n end\n end", "def instanceinfo(compute,name)\n\t\tresp = compute.describe_instances\t\n\t\tif (resp.status == 200)\n\t\t\t# check through the instances looking for one with a matching Name tag\n\t\t\tresp.body['reservationSet'].each { |x|\n\t\t\t\tx['instancesSet'].each { |y| \n\t\t\t\t\tif ( y['tagSet']['Name'] == name)\n\t\t\t\t\t\treturn y\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\traise \"ebsvol[aws]->instanceinfo: I couldn't list the instances\"\n\t\tend\n\t\tnil\n\tend", "def fetch_instance(shortname = :all, options = {})\n return instances if instances && !options[:force]\n\n fetch_stack\n unless instance_list\n self.instance_list = self.instances =\n aws_client.describe_instances(stack_id: stack[:stack_id])[:instances]\n end\n\n if shortname != :all\n fetch_layer(shortname, force: true)\n self.instances = []\n\n layers.each do |layer|\n instance = aws_client.describe_instances(\n layer_id: layer[:layer_id])\n self.instances << instance[:instances]\n end\n\n self.instances.flatten!\n end\n end", "def get_app_dns_gear\n self.group_instances.each do |group_instance|\n if group_instance.gears.where(app_dns: true).count > 0\n return group_instance.gears.find_by(app_dns: true)\n end\n end\n raise OpenShift::UserException.new(\"Gear containing application dns not found\")\n end", "def instance_count\n @group.instances.length\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def autoscaling_group_launchconfig(value, args={})\n ['resource', value]\n end", "def instance_list(next_token=nil)\n self.ec2_client.describe_instances(\n {\n filters: [\n {\n name: \"tag:Branch\",\n values: [\"*\"],\n },\n {\n name: \"instance-state-name\",\n values: [\"running\"],\n }\n ],\n next_token: next_token\n })\n end", "def delete_launch_configs\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n auto_scaling.launch_configurations.each do |config|\n if groups[config.name].nil?\n puts \"deleting asg launch configuration, #{config.name}\"\n config.delete()\n end\n end\nend", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def describe_all_instances\n @os_aws.describe_all_instances\n end", "def pause_scaling_events\n client.suspend_processes(auto_scaling_group_name: asg_name,\n scaling_processes:\n %w[ReplaceUnhealthy AlarmNotification ScheduledActions AZRebalance])\n end", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def update_auto_scaling_group(auto_scaling_group_name, options = {})\n if availability_zones = options.delete('AvailabilityZones')\n options.merge!(AWS.indexed_param('AvailabilityZones.member.%d', [*availability_zones]))\n end\n request({\n 'Action' => 'UpdateAutoScalingGroup',\n 'AutoScalingGroupName' => auto_scaling_group_name,\n :parser => Fog::Parsers::AWS::AutoScaling::Basic.new\n }.merge!(options))\n end", "def scaling_policies\n @aws.describe_policies(\n auto_scaling_group_name: @group_name\n ).scaling_policies\n end", "def startup(group)\n cfmstartup = AWS::CloudFormation.new # call cloudformation\n ec2startup = AWS::EC2.new # call ec2\n # long running method\n puts \"XXXXXXXXXX DAILY CHECKING HERE STARUP XXXXXXXXXXXX\"\n puts group.name\n puts \"Start up Job is working now\"\n if group.users.length > 0\n allinstanceids = []\n group.users.each do |user|\n if user.stacks.length > 0\n user.stacks.each do |stack|\n if stack.ec2instance_ids.length > 0 \n allinstanceids.concat stack.ec2instance_ids # concatinate all instance ids with ec2 instance ids of stack\n end\n end\n end\n end\n p allinstanceids = allinstanceids.uniq\n if allinstanceids.length > 0\n $ec2_resource.instances({instance_ids: allinstanceids}).batch_start # start the jobs\n end\n end \n puts \"XXXXXXXXXXXXXXXXXXXXXX\"\n end", "def instances_status\n @instances.each do |i_id, meta|\n status = AWS::CLI_Interface.ec2_instance_status(i_id)\n output = \"#{meta['name']} (#{i_id})\".colorize(color: :white, background: :blue) +\n \" : \".colorize(:yellow) +\n \"#{status[:label]}\".colorize(color: :white, background: status[:color])\n\n if meta.has_key? 'timeout'\n output += \" : \".colorize(:yellow)\n output += \"Timeout: #{meta['timeout']}\".colorize(color: :black, background: :light_yellow)\n end\n\n Logging.log output\n end\n end", "def quota_active_provisions_by_group(options)\n quota_provision_stats(:quota_find_active_prov_request_by_group, options.merge(:nil_vm_id_only => true))\n end", "def get_gears_ssh_endpoint(exclude_app_dns=false) \n gears_endpoint = []\n self.group_instances.each do |group_instance|\n group_instance.gears.each do |gear|\n gears_endpoint << \"#{gear.uuid}@#{gear.server_identity}\" unless gear.app_dns and exclude_app_dns\n end\n end\n gears_endpoint\n end", "def instance_ids\n @instance_ids ||= groups.map { |gr| gr.instances.map { |i| i.instance_id } }.flatten\n end", "def to_s\n \"AutoScaling Group: #{@group_name}\"\n end", "def existing_instances(filter=\"\")\r\n instances_raw = `ps xao pid,pgid,command | grep '#{process_name} #{name_grep_string} #{filter}' | grep -iv #{Process.pid} | awk '{print $1 \"\\t\" $2 \"\\t\" $3}'`\r\n instances_raw.split(\"\\n\").map do |row|\r\n pid, group, command = row.split(\"\\t\")\r\n ProcessInfo.new(pid.to_i, group.to_i, command)\r\n end\r\n end", "def lookup_security_group_names(instance_info)\n group_names = []\n # puts \"lookup_security_group_names(#{instance_info.inspect})\"\n instance_info['groupSet']['item'].each() {|group_info|\n group_name = group_info['groupName'] || group_info['groupId']\n group_names << group_name\n }\n group_names\n end", "def aws_instance_status(opts)\n opts[:instance].status\n end", "def instances_action(action)\n opts = {}\n opts[:group] = @option.group if @option.group\n opts[:id] = @argv.instid if @argv.instid\n opts[:id] &&= [opts[:id]].flatten\n \n instances = Rudy::AWS::EC2::Instances.list_group(opts[:group], :running, opts[:id])\n raise \"No matching instances running\" if instances.nil?\n \n inst_names = instances.collect { |inst| inst.dns_public || inst.awsid }\n inst_ids = instances.collect { |inst| inst.awsid }\n \n instance_count = (instances.size == 1) ? '1 instance' : \"#{instances.size} instances\"\n \n print \"#{action.to_s.capitalize} #{instance_count} (#{inst_names.join(', ')}) \"\n print \"in #{opts[:group]}\" if opts[:group]\n li\n execute_check(:medium)\n \n execute_action(\"#{action.to_s.capitalize} Failed\") { \n Rudy::AWS::EC2::Instances.send(action, inst_ids)\n }\n status\n end", "def stop_instances\n @task.unsafe(\"Stopping #{@name} processes\") do\n autoscaling_group.suspend_all_processes\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Stopping instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.stop\n end\n end\n end", "def get_gce_prefix# {{{\n\t group = last_component @property_hash[:name]\n \"#{get_gce_area_prefix}/instanceGroupManagers/#{group}\"\n end", "def instance_by_name_running?(instance_name)\n return false unless configured?\n\n instance_running?(get_aws_instance_id_by_node_name(instance_name))\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def remove_auto_scaling_group_properties\n properties = []\n properties << :AvailabilityZones\n properties << :HealthCheckGracePeriod\n properties << :HealthCheckType\n add_patch Patches::RemoveProperty.new 'AWS::AutoScaling::AutoScalingGroup', properties\n end", "def get_instance_by_name(group, name)\n get_instances(group).each {|instance|\n return instance if (instance.tags['name_s'] || \"\").casecmp(name) == 0\n return instance if (instance.tags['Name'] || \"\").casecmp(name) == 0\n }\n raise \"unknown instance: #{name} in group #{group} \"\n end", "def status_of(instance)\n description.instances.select{ |e| e.instance_id == instance}\n end", "def create_new_asg config\n delete_launch_configs\n\n auto_scaling = new_auto_scaling\n\n #\n # 1. create the launh configuration\n #\n options = {\n :security_groups => [AMI_SECURITY_GROUP],\n :key_pair => AMI_KEY_PAIR,\n :user_data => user_data\n }\n\n launch_config = auto_scaling.launch_configurations.create(\n launch_config_name, \n config[\"ami\"],\n AMI_INSTANCE_TYPE,\n options\n )\n\n #\n # now create the asg\n #\n\n tags = [\n {:key => \"server\", :value => APP_NAME},\n {:key => \"build\", :value => VERSION},\n {:key => \"env\", :value => APP_ENV}\n ]\n\n options = {\n :load_balancers => [AMI_ELB],\n :launch_configuration => launch_config,\n :availability_zones => [AMI_AZ],\n :min_size => 1,\n :max_size => 1,\n :tags => tags\n }\n\n puts \"creating asg\"\n puts \"\\toptions => #{options}\"\n puts \"\\ttags => #{tags}\"\n auto_scaling.groups.create(launch_config_name, options)\nend", "def get_instance_data\n JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records_retrieved = next_token.nil? || next_token.empty?\n instances << response.reservations.map { |r| r.instances }\n end\n\n instances.flatten\n end", "def get_instances(role: nil, username: nil, bastion: nil)\n puts \"Getting instances for role: #{role}\"\n servers = []\n instances_for_role(role).each do |res|\n res[:instances].each do |inst|\n servers << \"#{username}@#{inst[:private_ip_address]}\"\n end\n end\n\n puts \" - #{servers.join(', ')}\"\n servers\n end", "def get_instances(group)\n raise \"unknown group: #{group}\" if !@groups.key? group\n @groups[group].dup\n end", "def instances(arg)\n case arg\n when Range\n minimum_instances arg.first\n maximum_instances arg.last\n when Fixnum\n minimum_instances arg\n maximum_instances arg\n when Hash\n nodes(arg)\n else\n raise SpecException.new(\"Don't know how to handle instances cloud input #{arg}\")\n end\n end", "def summary\n res = description\n\n {\n in_service: res.instances.all?{ |e| e[:lifecycle_state] == 'InService' },\n healthy: res.instances.all?{ |e| e[:health_status] == 'Healthy' },\n size: res.instances.select { |e| e[:lifecycle_state] == 'InService' }.length\n }\n end", "def launch_configuration(asg, sg_tcp_80_priv, sg_tcp_22_priv, instance_type, ami)\n asg.create_launch_configuration(launch_configuration_name: 'lc-nginx_auto',\n associate_public_ip_address: false,\n # key_name: 'UbuntuKeyPair', # TODO: Change/Remove\n image_id: ami, # Ubuntu base AMI from ubuntu.com\n instance_type: instance_type,\n security_groups: [sg_tcp_80_priv], # sg_tcp_22_priv\n instance_monitoring: { enabled: true }, # true=CloudWatch monitoring (60sec)\n user_data: Base64.encode64(\"#!/bin/bash -ex\\n\"\\\n \"export DEBIAN_FRONTEND=noninteractive\\n\"\\\n \"apt-get -q=2 update && apt-get -q=2 upgrade\\n\"\\\n \"apt-get -q=2 install nginx\\n\"\\\n \"URL=http://169.254.169.254/latest/meta-data\\n\"\\\n \"cat >> /var/www/html/index.html <<EOF\\n\"\\\n \"<meta http-equiv=refresh content=2 /><br>\\n\"\\\n \"FROM: Launch Configuration / ASG<br>\\n\"\\\n \"INSTANCE ID: $(curl $URL/instance-id)<br>\\n\"\\\n \"PUBLIC IP: [NONE], using NAT instances<br>\\n\"\\\n \"INTERNAL IP: $(curl $URL/local-ipv4)<br>\\n\"\\\n 'EOF'))\n sleep 5\nend", "def stop_instances\n @task.unsafe(\"Stopping #{@name} processes\") do\n save_to_s3(@task.bucket)\n autoscaling_group.suspend_all_processes\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Stopping instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.stop\n end\n end\n end", "def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n run_result = JSON.parse(make_call(request, uri))\n Djinn.log_debug(\"[IM] Run instances info says [#{run_result}]\")\n operation_id = run_result['operation_id']\n\n vm_info = {}\n loop {\n begin\n describe_result = describe_operation(operation_id)\n rescue Djinn::FailedNodeException => error\n Djinn.log_warn(\n \"[IM] Error describing run instances operation #{operation_id}. \" \\\n \"Error: #{error.message}\")\n next\n end\n Djinn.log_debug(\"[IM] Describe run operation has vm_info \" \\\n \"#{describe_result['vm_info'].inspect}.\")\n\n if describe_result['state'] == 'success'\n vm_info = describe_result['vm_info']\n break\n elsif describe_result['state'] == 'failed'\n raise AppScaleException.new(describe_result['reason'])\n end\n Kernel.sleep(SMALL_WAIT)\n }\n\n # ip:role:instance-id\n instances_created = []\n vm_info['public_ips'].each_index { |index|\n tmp_roles = roles[index]\n tmp_roles = 'open' if roles[index].nil?\n instances_created << {\n 'public_ip' => vm_info['public_ips'][index],\n 'private_ip' => vm_info['private_ips'][index],\n 'roles' => tmp_roles,\n 'instance_id' => vm_info['instance_ids'][index],\n 'disk' => disks[index],\n 'instance_type' => options['instance_type']\n }\n }\n\n instances_created\n end", "def aws_instance_get(opts)\n AWS::EC2.new.instances[opts[:instance_id]]\n end", "def instance\n node = 'AWS_EC2_INSTANCE'\n q = []\n\n # instance node\n q.push(_upsert({ node: node, id: @name }))\n\n # vpc node and relationship\n if @data.vpc_id\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_VPC',\n child_name: @data.vpc_id,\n relationship: 'MEMBER_OF_VPC'\n }\n\n q.push(_upsert_and_link(opts))\n end\n\n # network_interfaces and relationship\n @data.network_interfaces.each do |ni|\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_NETWORK_INTERFACE',\n child_name: ni.network_interface_id,\n relationship: 'ATTACHED_TO_INSTANCE'\n }\n\n q.push(_upsert_and_link(opts))\n end\n\n # security_groups and relationship\n @data.security_groups.each do |sg|\n opts = {\n child_node: 'AWS_SECURITY_GROUP',\n child_name: sg.group_id,\n parent_node: node,\n parent_name: @name,\n relationship: 'IN_SECURITY_GROUP'\n }\n\n q.push(_upsert_and_link(opts))\n end\n\n # subnet and relationship\n if @data.subnet_id\n opts = {\n parent_node: node,\n parent_name: @name,\n child_node: 'AWS_SUBNET',\n # child_name: \"arn:aws:ec2:#{@region}:#{@account}:subnet/#{@data.subnet_id}\",\n child_name: @data.subnet_id,\n relationship: 'IN_SUBNET'\n }\n\n q.push(_upsert_and_link(opts))\n end\n\n if @data.iam_instance_profile\n opts = {\n node: 'AWS_EC2_IAM_PROFILE',\n id: @data.iam_instance_profile.arn\n }\n\n q.push(_merge(opts))\n\n opts = {\n from_node: node,\n from_name: @name,\n to_node: 'AWS_EC2_IAM_PROFILE',\n to_name: @data.iam_instance_profile.arn,\n relationship: 'HAS_IAM_PROFILE'\n }\n\n q.push(_link(opts))\n end\n\n if @data.metadata_options\n metadata_options = \"#{@name}-metadata-options\"\n\n opts = {\n node: 'AWS_EC2_INSTANCE_METADATA_OPTIONS',\n id: metadata_options\n }\n\n q.push(_merge(opts))\n\n opts = {\n from_node: node,\n from_name: @name,\n to_node: 'AWS_EC2_INSTANCE_METADATA_OPTIONS',\n to_name: metadata_options,\n relationship: 'HAS_METADATA_OPTIONS',\n relationship_attributes: @data.metadata_options.to_h\n }\n\n q.push(_link(opts))\n end\n\n q\n end", "def manifestations_launched\n find_related_frbr_objects( :launches, :which_manifestations?) \n end", "def stop_instances_by_group_id(group_id)\n instances = @os_aws.describe_running_instances(group_id)\n ids = instances.map { |k, _| k[:instance_id] }\n\n puts \"Stoping the following instances #{ids}\"\n resp = []\n resp = @os_aws.stop_instances(ids).to_hash unless ids.empty?\n resp\n end", "def terminate_instances\n @task.unsafe(\"Stopping #{@name} Launch process\") do\n autoscaling_group.suspend_processes('Launch')\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Terminating instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.terminate\n end\n end\n end", "def terminate_instances\n @task.unsafe(\"Stopping #{@name} Launch process\") do\n autoscaling_group.suspend_processes('Launch')\n end\n autoscaling_instances.each do |instance|\n @task.unsafe(\"Terminating instance #{instance.instance_id}\") do\n load_balancers.each do |elb|\n elb.instances.deregister(instance.instance_id)\n end\n instance.ec2_instance.terminate\n end\n end\n end", "def cleanup(vpc_id, client, asg, elbv1, elbv2, region)\n begin\n response = client.describe_vpcs(vpc_ids: [vpc_id])\n rescue Aws::EC2::Errors::InvalidVpcIDNotFound => e\n puts \"Error: vpc_id [#{vpc_id}] does not exist... exiting.\"\n puts \"Make sure you passed the correct region on the command-line if it's not in the default us-west-2\"\n exit 0\n end\n\n # 1) Delete Auto Scaling group\n begin\n asg.delete_auto_scaling_group(auto_scaling_group_name: 'asg-nginx_auto', force_delete: true)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n sleep 2\n # TODO: properly wait here until ASG is fully deleted before proceeding...\n begin\n asg.delete_launch_configuration(launch_configuration_name: 'lc-nginx_auto')\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n sleep 2\n\n # 2) instance handling\n term_error = 0\n instances_to_term = []\n terminate_states = %w[pending running shutting-down stopping stopped]\n puts 'Checking for nginx and nat instances, of all states...'\n begin\n response = client.describe_instances(filters: [{name: 'tag:Name', values: ['autoASG nginx server',\n 'nat instance']}])\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n response.reservations.each do |reservation|\n reservation.instances.each do |instance|\n puts \"Check #1: instance-id=[#{instance.instance_id}] AMI=[#{instance.image_id}] state=[#{instance.state.name}]\"\n instances_to_term.push(instance.instance_id) if terminate_states.include? instance.state.name\n end\n end\n\n if instances_to_term.any? # If array has content, proceed.\n term_error = 0\n instance_cnt = instances_to_term.length # TODO: Check before/after termination attempts and ensure = 0\n before_terminate = Time.now\n begin\n client.wait_until(:instance_terminated,instance_ids: instances_to_term) do |wait|\n wait.interval = 8 # Seconds between polling attempts. Same as wait.delay\n wait.max_attempts = 15 # Polling attempts before giving up. Wait time is 15*8=120 seconds.\n puts \"Attempting to terminate [#{instance_cnt}] instance(s), please wait up to 120 seconds...\"\n begin\n client.terminate_instances(instance_ids: instances_to_term)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n end\n rescue Aws::Waiters::Errors::WaiterFailed => error\n term_error = 1 # TODO: Do something more reliable if this ever occurs.\n puts \"Exception: failed waiting for instance running: #{error.message}\"\n end\n puts \"#{Time.now - before_terminate.to_time} seconds elapsed while terminating.\" if term_error.zero?\n end\n\n if term_error.zero?\n # Debug with final instance check... this shouldn't print anything aside from terminated instances.\n begin\n response = client.describe_instances(filters: [{name: 'tag:Name', values: ['autoASG nginx server',\n 'nat instance']}])\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n response.reservations.each do |reservation|\n reservation.instances.each do |instance|\n puts \"Check #2: instance-id=[#{instance.instance_id}] AMI=[#{instance.image_id}] state=[#{instance.state.name}]\"\n end\n end\n end\n\n puts 'Sleeping for 5 seconds...'\n sleep 5\n\n # 3) Delete listeners\n printf 'Deleting ALB listeners... '\n begin\n response = elbv2.describe_load_balancers(names: ['AutoALB'])\n alb_arn = response.load_balancers[0].load_balancer_arn\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n sleep 2\n begin\n response = elbv2.describe_listeners(load_balancer_arn: alb_arn)\n listener_arn = response.listeners[0].listener_arn\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n begin\n elbv2.delete_listener(listener_arn: listener_arn)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n sleep 2\n puts 'done.'\n\n # 4) Delete target groups\n printf 'Deleting ALB target groups... '\n begin\n response = elbv2.describe_target_groups(names: ['AutoALBTargetGroup'])\n target_group_arn = response.target_groups[0].target_group_arn\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n begin\n elbv2.delete_target_group(target_group_arn: target_group_arn)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n sleep 5\n puts 'done.'\n\n # 5) Delete load balancers\n printf 'Deleting application and classic load balancers... '\n begin\n elbv1.delete_load_balancer(load_balancer_name: 'AutoCLB')\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n begin\n elbv2.delete_load_balancer(load_balancer_arn: alb_arn)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n puts 'done.'\n\n puts 'Sleeping for 120 seconds, enough time for the ASG to fully disappear before deleting subnets.'\n sleep 120\n\n # 6) subnets\n begin\n response = client.describe_subnets(filters: [{name: 'vpc-id', values: [vpc_id]}])\n response.subnets.each do |sn|\n printf \"Removing subnet: #{sn.subnet_id}, #{sn.vpc_id}, #{sn.cidr_block}, #{sn.availability_zone}; \"\n client.delete_subnet(subnet_id: sn.subnet_id)\n puts 'Done.'\n end\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n # 7) security groups\n begin\n response = client.describe_security_groups(filters: [{name: 'vpc-id', values: [vpc_id]}])\n response.security_groups.each do |sg|\n next if sg.group_name == 'default' # This name is reserved by aws and cannot be removed.\n printf \"Removing security group: #{sg.group_id}, #{sg.vpc_id}, #{sg.group_name}, Desc='#{sg.description}'; \"\n client.delete_security_group(group_id: sg.group_id)\n puts 'Done.'\n end\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n # 8) Internet gateway\n begin\n response = client.describe_internet_gateways(filters: [{name: 'attachment.vpc-id', values: [vpc_id]}])\n response.internet_gateways.each do |igw|\n printf \"Detaching Internet gateway: #{igw.internet_gateway_id} <-> #{igw.attachments[0].vpc_id}; \"\n client.detach_internet_gateway(internet_gateway_id: igw.internet_gateway_id, vpc_id: igw.attachments[0].vpc_id)\n printf \"Removing Internet gateway: #{igw.internet_gateway_id} <-> #{igw.attachments[0].vpc_id}; \"\n client.delete_internet_gateway(internet_gateway_id: igw.internet_gateway_id)\n puts 'Done.'\n end\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n # 9) Route tables\n begin\n response = client.describe_route_tables(filters: [{name: 'vpc-id', values: [vpc_id]}])\n response.route_tables.each do |rtl|\n if rtl.associations[0] != nil\n if rtl.associations[0].route_table_association_id != nil\n puts \"Skipping #{rtl.associations[0].route_table_association_id}, causes exception.\"\n end\n next\n end\n printf \"Removing route table: #{rtl.route_table_id}, #{rtl.vpc_id}; \"\n client.delete_route_table(route_table_id: rtl.route_table_id)\n puts 'Done.'\n end\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n # 10) Delete VPC\n begin\n puts \"Attempting to delete VPC [#{vpc_id}]\"\n client.delete_vpc(vpc_id: vpc_id)\n rescue StandardError => e\n puts \"Exception caught: #{e}, attempting to complete.\"\n end\n\n begin\n response = client.describe_vpcs(vpc_ids: [vpc_id])\n rescue Aws::EC2::Errors::InvalidVpcIDNotFound => e\n puts \"Deletion of vpc_id=[#{vpc_id}] was a success.\"\n exit 0\n end\n\n # Shouldn't get here, but sometimes does due to the ASG taking too long to\n # release subnet dependencies, or if running a cleanup before a launch has\n # fully completed, etc.\n puts 'Oops. Termination sometimes fails for various reasons.'\n puts 'Note: running this twice usually clears up any lingering dependencies.'\n puts ' With that said, there is still work to be done. Execute again.'\n exit 0\nend", "def collect_group_details\n cmd = 'lsgroup -a ALL' # get all group names\n result ||= inspec.backend.run_command(cmd)\n return [] if result.exit_status.to_i != 0\n names = result.stdout.split(\"\\n\")\n groups_cache = []\n names.sort.uniq.each do |n|\n groups_cache << AixGroup(inspec, n)\n end\n groups_cache\n end", "def monitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_generator(:action => \"MonitorInstances\", :params => params)\n end", "def replace_instances\n log_options\n\n unless stack_exists?(name)\n raise StackDoesNotExistError, \"Stack #{name} does not exist.\"\n end\n\n stack = cfn.stacks[name]\n unless stack_was_just_updated?(stack)\n logger.info \"stack was not updated recently, not replacing instances.\"\n return\n end\n\n ex = WaitTimedOutError.new \"Timed out waiting to replace instances.\"\n wait_until(ex) do\n ok_to_replace_instances?(stack.status, stack.last_updated_time)\n end\n\n logger.info \"replacing all auto-scaling instances in #{name}\"\n\n if stack_asg.nil?\n raise MissingAutoScalingGroupError, \"No ASG found for stack #{name}\"\n end\n\n stack_asg.ec2_instances.each do |i|\n if i.status == :running\n logger.info \"terminating instance #{i.id}\"\n i.terminate\n else\n logger.info \"Not terminating #{i.id} due to status: #{i.status}\"\n end\n end\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def db_instance_automated_backups_replications\n data[:db_instance_automated_backups_replications]\n end", "def stop(action)\n if !autoscaling_group.exists?\n @task.warn { \"Autoscaling group #{@name} doesn't exist\" }\n return\n end\n\n if autoscaling_group.suspended_processes.empty?\n case action\n when :default, :terminate\n terminate_instances\n when :stop\n stop_instances\n else\n raise Cloud::Cycler::TaskFailure.new(\"Unrecognised autoscaling action #{action}\")\n end\n else\n @task.debug { \"Scaling group #{@name} already suspended\" }\n end\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def instances\n @instances ||= aws_client.instances(filters: instance_filters).map do |instance|\n OpenStruct.new(\n with_tags(instance, private_ip: instance.private_ip_address,\n public_ip: instance.public_ip_address,\n instance: instance.instance_id)\n )\n end\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def stop(action)\n if !autoscaling_group.exists?\n @task.warn { \"Autoscaling group #{@name} doesn't exist\" }\n return\n end\n\n # FIXME: This won't work if we reinstate suspended processes...\n #if autoscaling_group.suspended_processes.empty?\n case action\n when :default, :terminate\n terminate_instances\n when :stop\n stop_instances\n else\n raise Cloud::Cycler::TaskFailure.new(\"Unrecognised autoscaling action #{action}\")\n end\n #else\n #@task.debug { \"Scaling group #{@name} already suspended\" }\n #end\n end", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def instance_tags\n return ['allow-all-traffic'] unless use_existing_network?\n\n @gcp_config['tags']\n end", "def servergroups\n return @resource[:servergroups] unless @resource[:runasdomain]\n return @servergroups unless @servergroups.nil?\n state = execute(\"deployment-info --name=#{@resource[:name]}\")\n return [] unless state.success?\n @servergroups = read_groups_from_output(state.output)\n end", "def stop\n puts \"Stoping any instance with group ID: #{@os_aws.group_uuid}\"\n\n stop_instances_by_group_id(@os_aws.group_uuid)\n end", "def suspend_processes(auto_scaling_group_name, options = {})\n if scaling_processes = options.delete('ScalingProcesses')\n options.merge!(AWS.indexed_param('ScalingProcesses.member.%d', [*scaling_processes]))\n end\n request({\n 'Action' => 'SuspendProcesses',\n 'AutoScalingGroupName' => auto_scaling_group_name,\n :parser => Fog::Parsers::AWS::AutoScaling::Basic.new\n }.merge!(options))\n end", "def in_frontend_groups\n # groups = []\n # xrefs = self.racc_route_destination_xrefs\n \n # vlabels = self.racc_routes.map {|rr| rr.vlabel_map }\n # vlabels.compact!\n # vlabels.delete_if {|v| v.group.category != \"f\" || v.group.group_default == false}\n # groups = vlabels.map {|v| Operation.first(:conditions => {:app_id => v.app_id, :newop_rec => v.vlabel}).group }\n Group.all(:conditions => [\"name IN \n (SELECT vlabel_group FROM racc_op WHERE newop_rec IN \n (SELECT vlabel FROM racc_vlabel_map WHERE vlabel IN \n (SELECT route_name FROM racc_route WHERE route_id IN \n (SELECT route_id FROM racc_route_destination_xref WHERE app_id = :app_id AND destination_id = :id)\n AND app_id = :app_id)\n AND app_id = :app_id)\n AND app_id = :app_id)\n AND app_id = :app_id AND category = :category AND group_default = :group_default\", {:id => self.id, :app_id => self.app_id, :category => 'f', :group_default => false}])\n end" ]
[ "0.7375907", "0.7375907", "0.70902634", "0.6642567", "0.64987755", "0.6257543", "0.61650634", "0.60263926", "0.596555", "0.5959928", "0.5895302", "0.58703625", "0.58542144", "0.5844213", "0.5843603", "0.5732009", "0.5724304", "0.5686478", "0.5668869", "0.55124885", "0.5493279", "0.5437196", "0.5428103", "0.5414437", "0.54024523", "0.5393529", "0.5393529", "0.5372182", "0.5367014", "0.53614795", "0.5345749", "0.528844", "0.5285251", "0.5274438", "0.52700883", "0.5260315", "0.5245256", "0.5239632", "0.52367944", "0.52298033", "0.52154624", "0.5198029", "0.519374", "0.51615065", "0.5156431", "0.51114684", "0.5100935", "0.50500214", "0.504938", "0.50452167", "0.50330275", "0.50287795", "0.50281787", "0.50279456", "0.5023727", "0.5008421", "0.4985208", "0.49713445", "0.4969204", "0.4969074", "0.49656612", "0.4959873", "0.4951138", "0.49274066", "0.49251235", "0.49238425", "0.49171883", "0.49125606", "0.49122953", "0.49096745", "0.48962483", "0.48877665", "0.48816362", "0.4877261", "0.48739618", "0.48625818", "0.48624808", "0.4855835", "0.48448175", "0.48296577", "0.48264462", "0.48160177", "0.48160177", "0.48112157", "0.48029074", "0.47988158", "0.47929248", "0.47714505", "0.47699454", "0.47691944", "0.47691065", "0.47558418", "0.47530147", "0.47470105", "0.47447124", "0.47326526", "0.47165275", "0.471312", "0.47093555", "0.47073695" ]
0.77462995
0
If the Elastic IP is unhealthy/unreachable, we will try to assign the Elastic IP to this instance
def try_steal_eip unless eip_healthy? # try to steal the eip eip_instance = @ec2.elastic_ips[@eip] raise "cannot find #{@eip} in list of elastic IPs" unless eip_instance instance = @ec2.instances[my_instance_id] instance.associate_elastic_ip(eip_instance) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws_instance_elastic_ip_create(instance)\n log \"AWS: creating ElasticIP for Instance '#{instance.id}'\"\n # get elastic ip object\n elastic_ip = aws_call('aws_elastic_ip_create')\n log \"AWS: created ElasticIP '#{elastic_ip.public_ip}'\"\n\n # this is interesting, perhaps elastic ips dont have statuses like other resources, or else why not use our helper fn?\n log \"AWS: waiting for ElasticIP '#{elastic_ip.public_ip}' to exist\"\n Timeout.timeout(360) { sleep 1 while not aws_call('aws_obj_exists?', obj: elastic_ip) }\n\n # give our NAT vm its elastic IP!\n log \"AWS: associating ElastipIP '#{elastic_ip.public_ip}' with Instance '#{instance.id}'\"\n aws_call(\n 'aws_instance_elastic_ip_associate',\n instance: instance,\n elastic_ip: elastic_ip,\n errs: { AWS::EC2::Errors::InvalidAllocationID::NotFound => 60 }\n )\n \n # update ip_address_public attribute\n self.update_attribute(:ip_address_public, elastic_ip.public_ip)\n end", "def associate_address(instance_id)\n new_ip = next_unused_elastic_ip\n vputs(\"Assigning #{new_ip} to the ec2 instance #{instance_id}\")\n ec2.associate_address(instance_id, new_ip)\n loop do\n if describe_instance(:instance_id => instance_id).public_ip == new_ip\n return new_ip\n end\n sleep 1\n end\n end", "def aws_instance_elastic_ip_associate(opts)\n opts[:instance].associate_elastic_ip(opts[:elastic_ip])\n end", "def set_aws_elastic_ip\n @aws_elastic_ip = AwsElasticIp.find(params[:id])\n end", "def assign(ip, _external, opts = {})\n instcs = @ec2.describe_instances({ :instance_ids => [@deploy_id] })\n inst = instcs[0][0].instances[0]\n\n # find NIC to which the IP belongs (avoid Ceph network)\n nic_id = nil\n inst.network_interfaces.each do |ec2_nic|\n ec2_subnet = @ec2.describe_subnets(\n { :subnet_ids => [ec2_nic.subnet_id] }\n )[0][0]\n ip_range = IPAddr.new(ec2_subnet.cidr_block)\n\n if ip_range.include?(ip)\n nic_id = ec2_nic.network_interface_id\n end\n end\n\n if nic_id\n @ec2.assign_private_ip_addresses(\n { :network_interface_id => nic_id,\n :private_ip_addresses => [ip] }\n )\n\n @ec2.associate_address(\n { :network_interface_id => nic_id,\n :allocation_id => opts[:alloc_id],\n :private_ip_address => ip }\n )\n else\n OpenNebula.log_error(\"Can not find any interface to assign #{ip}\")\n exit 1\n end\n\n 0\n rescue StandardError => e\n OpenNebula.log_error(\"Error assiging #{ip}:#{e.message}\")\n 1\n end", "def disassociate_elastic_ip\n if ip = self.elastic_ip\n ip.disassociate\n else\n raise \"instance #{id} does not have an associated elastic ip\"\n end\n end", "def allocate_elastic_ip_address(ec2_client)\n response = ec2_client.allocate_address(domain: \"vpc\")\n return response.allocation_id\nrescue StandardError => e\n puts \"Error allocating Elastic IP address: #{e.message}\"\n return \"Error\"\nend", "def configure(ec2, instance)\n if @vip_network\n configure_vip(ec2, instance)\n else\n # If there is no vip network we should disassociate any elastic IP\n # currently held by instance (as it might have had elastic IP before)\n elastic_ip = instance.elastic_ip\n\n if elastic_ip\n @logger.info(\"Disassociating elastic IP `#{elastic_ip}' \" \\\n \"from instance `#{instance.id}'\")\n instance.disassociate_elastic_ip\n end\n end\n end", "def server_ip_assign(server_name)\n server = find_match(@compute.servers, server_name)\n if server != nil\n addresses = server.addresses\n if addresses != nil\n network_name = server.addresses.keys.reduce\n else\n Puppet.warning \"falling back to default network\"\n network_name = 0 # HACK HACK HACK\n end\n if addresses[network_name].count < 2\n # check if already assigned\n new_ip = nil\n ip = get_free_floating_ip(server)\n if ip != nil\n begin\n new_ip = @compute.associate_address(server.id, ip)\n Puppet.notice \"#{server_name} assigned ip => #{ip}\"\n rescue Exception => e\n Puppet.err e\n raise Puppet::Error, \"associate_address Error : #{e}\"\n end\n else\n Puppet.warning \"unable to assign server an ip : #{server_name}\"\n return nil\n end\n end\n else\n Puppet.warning \"unable to find server to assign new ip #{server_name}\"\n return nil\n end\n return ip\n end", "def associate_elastic_ip_address_with_instance(\n ec2_client,\n allocation_id,\n instance_id\n)\n response = ec2_client.associate_address(\n allocation_id: allocation_id,\n instance_id: instance_id,\n )\n return response.association_id\nrescue StandardError => e\n puts \"Error associating Elastic IP address with instance: #{e.message}\"\n return \"Error\"\nend", "def ass_ip(instance_id, ip)\n @connection.get 'AssociateEip', {\n eip: ip,\n instance: instance_id,\n zone: 'sh1a'\n }\n end", "def get_available_host\n @hosts.each do |host|\n return host if ws_running?([host]) < @ws_limit\n end\n puts \"No host available! Providing a new one on aws\"\n json = `aws ec2 run-instances --image-id ami-689cc908 --instance-type t2.medium --key-name mior --security-group-id sg-5bb3af3f`\n json = JSON.parse(json)\n internal_ip = json[\"Instances\"][0][\"NetworkInterfaces\"][0][\"PrivateIpAddress\"]\n public_ip = nil\n while public_ip.nil?\n cmd = \"aws ec2 describe-instances --filter \\\"Name=private-ip-address, Values=#{internal_ip}\\\"\"\n json = JSON.parse(`#{cmd}`)\n public_ip = json[\"Reservations\"][0][\"Instances\"][0][\"NetworkInterfaces\"][0][\"Association\"][\"PublicIp\"]\n end\n puts \"New instance on aws: #{public_ip}\"\n @hosts.push(public_ip)\n puts 'Waiting the host powers up..'\n sleep 30\n public_ip\n # The elegant way should be instantiate a new host to receive more requests\n end", "def reserve_ip(hostname, network, dns_view, aliases = nil, start_ip = nil, end_ip = nil)\n begin\n log(:info, \"Running reserve_ip...\")\n\n # set function call based on network or range\n if network.nil?\n raise \"start_ip parameter not found for range\" if start_ip.nil?\n raise \"end_ip parameter not found for range\" if end_ip.nil?\n function_call = \"func:nextavailableip:#{start_ip}-#{end_ip}\"\n else\n function_call = \"func:nextavailableip:#{network}\"\n end\n\n # set body for connection\n body = {\n :ipv4addrs => [\n :ipv4addr => function_call\n ],\n :name => hostname,\n :view => dns_view,\n :configure_for_dns => true,\n :comment => \"Added by CFME\"\n }\n\n # add aliases if we have them\n body[:aliases] = aliases unless aliases.nil?\n\n # call infoblox to reserve ip\n host_response = call_infoblox(:post, 'record:host', :json, :json, body, 'ipv4addr')\n log(:info, \"Inspecting host: #{host_response.inspect}\")\n\n # pull the ip from the host object\n host_hash = parse_json_response(host_response)\n ip_addr = host_hash['ipv4addrs'].first['ipv4addr']\n rescue Exception => error\n log(:info, error.inspect)\n return false\n end\n end", "def assoc(private_ip, public_ip=nil)\n\n\t\t\t# check that the private ip exists within our internal model and infer the\n\t\t\t# interface from that, throw exception otherwise\n\n\t\t\t# if the public_ip parameter is specified use the AWS api to find an\n\t\t\t# existing \"elastic ip\" in this account and throw exception if it does not\n\t\t\t# exist or is otherwise unavailable (if already associated with another\n\t\t\t# instance or interface). if parameter not provided, create a new elastic\n\t\t\t# ip using the AWS api\n\n\t\t\t# associate this EIP with the provided private ip and the eni device we\n\t\t\t# inferred from it using the AWS api\n\n\t\t\t# return the public ip\n\t\tend", "def update_kvm_ip(name)\n new_ip = (available_ips - used_ips).pop\n raise 'no ips available' unless new_ip\n update_network_interfaces(name, new_ip)\n new_ip\nend", "def elastic_ip_address_released?(ec2_client, allocation_id)\n ec2_client.release_address(allocation_id: allocation_id)\n return true\nrescue StandardError => e\n puts(\"Error releasing Elastic IP address: #{e.message}\")\n return false\nend", "def provision\n @logger.notify \"Provisioning OpenStack\"\n\n @hosts.each do |host|\n host[:vmhostname] = generate_host_name\n @logger.debug \"Provisioning #{host.name} (#{host[:vmhostname]})\"\n options = {\n :flavor_ref => flavor(host[:flavor]).id,\n :image_ref => image(host[:image]).id,\n :nics => [ {'net_id' => network(@options[:openstack_network]).id } ],\n :name => host[:vmhostname],\n :user_data => \"#cloud-config\\nmanage_etc_hosts: true\\n\",\n }\n options[:key_name] = key_name(host)\n vm = @compute_client.servers.create(options)\n\n #wait for the new instance to start up\n start = Time.now\n try = 1\n attempts = @options[:timeout].to_i / SLEEPWAIT\n\n while try <= attempts\n begin\n vm.wait_for(5) { ready? }\n break\n rescue Fog::Errors::TimeoutError => e\n if try >= attempts\n @logger.debug \"Failed to connect to new OpenStack instance #{host.name} (#{host[:vmhostname]})\"\n raise e\n end\n @logger.debug \"Timeout connecting to instance #{host.name} (#{host[:vmhostname]}), trying again...\"\n end\n sleep SLEEPWAIT\n try += 1\n end\n\n # Associate a public IP to the server\n # Create if there are no floating ips available\n #\n # Do we already have an address?\n @logger.debug vm.addresses\n address=nil\n begin\n # Here we try and assign an address from a floating IP pool\n # This seems to fail on some implementations (FloatingIpPoolNotFound)\n ip = @compute_client.addresses.find { |ip| ip.instance_id.nil? }\n if ip.nil?\n @logger.debug \"Creating IP for #{host.name} (#{host[:vmhostname]})\"\n ip = @compute_client.addresses.create\n end\n ip.server = vm\n address = ip.ip\n\n rescue Fog::Compute::OpenStack::NotFound\n # Here, we fail to just trying to use an address that's already assigned if there is one\n # There may be better logic, but this worked in the original implementation\n # There might be an argument for checking whether an address is reachable a la\n # port_open? logic in host.rb but maybe race conditions\n\n begin\n if vm.addresses[@options[:openstack_network]]\n address = vm.addresses[@options[:openstack_network]].map{ |network| network['addr'] }.first\n end\n rescue NoMethodError\n @logger.debug \"No current address retrievable from OpenStack data\"\n end\n\n end\n\n raise 'Could not find or assign an address to the instance' unless address\n host[:ip] = address\n\n @logger.debug \"OpenStack host #{host.name} (#{host[:vmhostname]}) assigned ip: #{host[:ip]}\"\n\n #set metadata\n vm.metadata.update({:jenkins_build_url => @options[:jenkins_build_url].to_s,\n :department => @options[:department].to_s,\n :project => @options[:project].to_s })\n @vms << vm\n\n #enable root if user is not root\n enable_root(host)\n\n provision_storage(host, vm)\n end\n\n hack_etc_hosts @hosts, @options\n\n end", "def aws_elastic_ip_create(opts)\n AWS::EC2::ElasticIpCollection.new.create(vpc: true)\n end", "def associate_public_ip(c)\n associate_address_with(Application.public_ip, @instance_id) if master? && Application.public_ip && !Application.public_ip.empty?\n end", "def attempt_ip(machine_options, action_handler, vm, machine_spec)\n vm_ip = ip_to_bootstrap(machine_options[:bootstrap_options], vm)\n machine_spec.location['ipaddress'] = vm_ip\n\n wait_for_ip(vm, machine_options, machine_spec, action_handler)\n\n unless has_ip?(vm_ip, vm)\n action_handler.report_progress 'rebooting...'\n if vm.guest.toolsRunningStatus != 'guestToolsRunning'\n msg = 'tools have stopped. current power state is '\n msg << vm.runtime.powerState\n msg << ' and tools state is '\n msg << vm.guest.toolsRunningStatus\n msg << '. powering up server...'\n action_handler.report_progress(msg)\n vsphere_helper.start_vm(vm)\n else\n restart_server(action_handler, machine_spec, machine_options)\n end\n wait_for_ip(vm, machine_options, machine_spec, action_handler)\n end\n end", "def aws_instance_elastic_ip_disassociate(opts)\n opts[:instance].disassociate_elastic_ip\n end", "def set_ip_address\n @ip_address = IpAddress.find(params[:id])\n end", "def newserver_ip_assign(server)\n if server != nil\n addresses = server.addresses\n if addresses != nil\n network_name = server.addresses.keys.reduce\n else\n raise Puppet::Error, \"Server has no network connections\"\n end\n if addresses[network_name].count < 2\n # check if already assigned\n new_ip = nil\n ip = get_free_floating_ip(server)\n if ip != nil\n begin\n new_ip = @compute.associate_address(server.id, ip)\n Puppet.notice \"#{server.name} assigned ip => #{ip}\"\n rescue Exception => e\n Puppet.err e\n raise Puppet::Error, \"associate_address Error : #{e}\"\n end\n else\n Puppet.warning \"unable to assign server an ip : #{server.name}\"\n return nil\n end\n end\n else\n Puppet.warning \"unable to find server to assign new ip #{server.name}\"\n return nil\n end\n return ip\n end", "def aws_instance_elastic_ip_get(opts)\n opts[:instance].elastic_ip\n end", "def assign(_, _, opts = {})\n rc = @client.attach_nic(@deploy_id, opts[:vultr_id])\n\n if VultrError.error?(rc)\n return 0 if rc.message == 'IP is already attached to a server'\n\n OpenNebula.log_error(\"Error assiging #{rc.message}\")\n return 1\n end\n\n 0\n end", "def next_unused_elastic_ip\n if unused_elastic_ips.empty?\n nil\n else\n vputs(\"Found an unused elastic ip: #{unused_elastic_ips.first}\")\n unused_elastic_ips.first\n end\n end", "def update_ip\n ip = ip_from_request_env\n logger.debug \"Built notice from #{ip}, current host ip is #{@host.ip}, updating\" if @host.ip != ip\n\n # @host has been changed even if the save fails, so we have to change it back\n old_ip = @host.ip\n @host.ip = old_ip unless @host.update_attributes({'ip' => ip})\n end", "def acquire_ip_address\n unless public_ip = provider.provision_public_ip_address(vpc: vpc?)\n say \"Unable to acquire a public IP. Please check your account for capacity or service issues.\".red\n exit 1\n end\n public_ip\n end", "def check_ip; end", "def ssh_ip\n 5.times do\n ip = read_guest_ip_dhcp\n return ip unless ip.empty?\n\n ip = read_guest_ip_prlctl\n return ip unless ip.empty?\n\n sleep 2\n end\n\n # We didn't manage to determine IP - return nil and\n # expect SSH client to do a retry\n return nil\n end", "def create_update(resource_group_name, public_ip_name, public_ip_address)\n OOLog.info(\"Creating/Updating public IP '#{public_ip_name}' from '#{resource_group_name}' \")\n @location = public_ip_address.location\n start_time = Time.now.to_i\n begin\n response = @network_client.public_ips.create(name: public_ip_name, resource_group: resource_group_name, location: @location, public_ip_allocation_method: public_ip_address.public_ip_allocation_method, domain_name_label: public_ip_address.domain_name_label, idle_timeout_in_minutes: public_ip_address.idle_timeout_in_minutes)\n rescue MsRestAzure::AzureOperationError => ex\n OOLog.fatal(\"Exception trying to create/update public ip #{public_ip_address.name} from resource group: #{resource_group_name}. Exception: #{ex.body}\")\n rescue => e\n OOLog.fatal(\"Exception trying to create/update public ip #{public_ip_address.name} from resource group: #{resource_group_name}. Exception: #{e.message}\")\n end\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"operation took #{duration} seconds\")\n response\n end", "def ip\n unless @vm\n warn 'No Vm assigned to locate IP'\n return\n end\n @ip ||= detect_ip\n end", "def eip_healthy?(retries=5)\n # try to ping elastic IP with eip\n uri_str = \"http://#{@eip}:#{@loadbalancer_healthcheck_port}#{@loadbalancer_healthcheck_path}\"\n uri = URI(uri_str)\n result = false\n retries.times.each do\n case Net::HTTP.get_response(uri)\n when Net::HTTPSuccess then\n result = true\n break\n else\n result = false\n end\n end\n result\n end", "def rescue_action_in_public!\n @request.remote_addr = '208.77.188.166' # example.com\n end", "def create_ec2_elastic_ip opts\n Ec2ElasticIp.create opts.merge :account => self\n end", "def create\n @aws_elastic_ip = AwsElasticIp.new(aws_elastic_ip_params)\n\n respond_to do |format|\n if @aws_elastic_ip.save\n format.html { redirect_to @aws_elastic_ip, notice: 'Aws elastic ip was successfully created.' }\n format.json { render :show, status: :created, location: @aws_elastic_ip }\n else\n format.html { render :new }\n format.json { render json: @aws_elastic_ip.errors, status: :unprocessable_entity }\n end\n end\n end", "def when_all_assigned_ips(&block)\n reset!\n if list_of_nonterminated_instances.select {|a| a.ip == \"not.assigned\" }.empty? \n block.call if block\n else\n vprint \".\"\n wait \"5.seconds\"\n when_all_assigned_ips(&block)\n end\n end", "def associate!(address_or_ip)\n @@ec2.associate_address(id, address_or_ip)\n @address = nil\n end", "def ip\n container.json['NetworkSettings']['IPAddress'] || 'N/A'\n rescue NoMethodError\n 'N/A'\n end", "def allocate_ip(range, node, suggestion = nil)\n logger.debug(\"Entering Network#{BarclampNetwork::NetworkUtils.log_name(self)}.allocate_ip(range: #{range}, node: #{BarclampNetwork::NetworkUtils.log_name(node)}, suggestion: #{suggestion}\")\n\n # Validate inputs\n return [400, \"No range specified\"] if range.nil?\n return [400, \"No node specified\"] if node.nil?\n\n # If the node already has an IP on this network then just return success\n results = BarclampNetwork::AllocatedIpAddress.where(:node_id => node.id).where(:network_id => id)\n if results.length > 0\n allocated_ip = results.first.ip\n logger.info(\"Network.allocate_ip: node #{BarclampNetwork::NetworkUtils.log_name(node)} already has address #{allocated_ip} on network #{BarclampNetwork::NetworkUtils.log_name(self)}, range #{range}\")\n net_info = build_net_info(node)\n net_info[\"address\"] = allocated_ip\n return [200, net_info]\n end\n\n subnet_addr = IPAddr.new(subnet.cidr)\n netmask_addr = subnet.get_netmask()\n\n # Find the ip range\n ip_range = ip_ranges.where(:name => range).first\n return [404, \"IP range not found\"] if ip_range.nil?\n\n index = IPAddr.new(ip_range.start_address.get_ip) & ~netmask_addr\n index = index.to_i\n stop_address = IPAddr.new(ip_range.end_address.get_ip) & ~netmask_addr\n stop_address = subnet_addr | (stop_address.to_i + 1)\n address = subnet_addr | index\n\n logger.debug(\"Starting address: #{address.to_s}\")\n\n if suggestion\n logger.info(\"Allocating with suggestion: #{suggestion}\")\n subsug = IPAddr.new(suggestion) & netmask_addr\n if subnet_addr == subsug\n if allocated_ips.where(:ip => suggestion).length == 0\n logger.info(\"Using suggestion: node #{BarclampNetwork::NetworkUtils.log_name(node)}, network #{BarclampNetwork::NetworkUtils.log_name(self)} #{suggestion}\")\n address = suggestion\n found = true\n end\n end\n end\n\n allocation_successful = false\n tries=5\n while !allocation_successful and tries>0\n if !found\n # Snag all the allocated IPs for this network and convert to a hash\n ips={}\n for allocated_ip in allocated_ips(true) do\n ips[allocated_ip.ip] = true\n end\n\n while !found do\n unless ips.key?(address.to_s)\n found = true\n break\n end\n index = index + 1\n address = subnet_addr | index\n break if address == stop_address\n end\n end\n\n if found\n begin\n BarclampNetwork::AllocatedIpAddress.transaction do\n ip_addr = BarclampNetwork::AllocatedIpAddress.new( :ip => address.to_s )\n ip_addr.node = node\n ip_addr.network = self\n ip_addr.save!\n\n node_ref = BarclampNetwork::NodeRef.new()\n node_ref.node = node\n node_ref.network = self\n node_ref.save!\n\n node.set_attrib(\"ip_address\", nil, 0, BarclampNetwork::AttribIpAddress)\n end\n\n allocation_successful = true\n net_info = build_net_info(node)\n net_info[\"address\"] = address.to_s\n rescue ActiveRecord::RecordNotUnique => ex\n found = false\n tries -= 1\n logger.warn(\"#{address.to_s} has already been allocated. Retrying...\")\n end\n else\n logger.info(\"Network.allocate_ip: no addresses available: node #{node.id}, network #{id}, range #{range}\")\n return [404, \"No addresses available\"]\n end\n end\n\n if !found and tries == 0\n logger.error(\"Network.allocate_ip: retries exceeded while allocating IP address for node #{BarclampNetwork::NetworkUtils.log_name(node)} network #{BarclampNetwork::NetworkUtils.log_name(self)} range #{range}\")\n return [404, \"Unable to allocate IP address due to retries exceeded\"]\n end\n\n logger.info(\"Network.allocate_ip: Assigned: node #{node.id}, network #{id}, range #{range}, ip #{address}\")\n [200, net_info]\n end", "def associate_address(instance_id, public_ip)\n link = generate_request(\"AssociateAddress\", \n \"InstanceId\" => instance_id.to_s,\n \"PublicIp\" => public_ip.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def associate_address(instance_id, public_ip)\n link = generate_request(\"AssociateAddress\", \n \"InstanceId\" => instance_id.to_s,\n \"PublicIp\" => public_ip.to_s)\n request_info(link, RightBoolResponseParser.new(:logger => @logger))\n rescue Exception\n on_exception\n end", "def ip_to_bootstrap(bootstrap_options, vm)\n @vm_helper.find_port?(vm, bootstrap_options) unless vm_helper.port?\n vm_ip = nil\n if has_static_ip(bootstrap_options)\n if bootstrap_options[:customization_spec].is_a?(String)\n spec = vsphere_helper.find_customization_spec(bootstrap_options[:customization_spec])\n vm_ip = spec.nicSettingMap[0].adapter.ip.ipAddress\n else\n ## Check if true available\n vm_ip = bootstrap_options[:customization_spec][:ipsettings][:ip] unless vm_helper.ip?\n Chef::Log.info(\n \"Checking to see if ip is reachable #{vm_ip}...\"\n )\n if vm_ip.is_a?(Array)\n Chef::Log.info(\n 'Multiple IPs provided. So considering the external facing IP'\n )\n vm_ip = vm_ip[0].to_s\n end\n nb_attempts = 0\n until @vm_helper.open_port?(vm_ip, @vm_helper.port, 1) || nb_attempts > bootstrap_options[:ready_timeout]\n print '.'\n nb_attempts += 1\n end\n end\n else\n if use_ipv4_during_bootstrap?(bootstrap_options)\n until @vm_helper.open_port?(vm_ip, @vm_helper.port, 1)\n wait_for_ipv4(bootstrap_ip_timeout(bootstrap_options), vm)\n end\n end\n vm_ip = vm.guest.ipAddress until vm_guest_ip?(vm) && @vm_helper.open_port?(vm_ip, @vm_helper.port, 1) # Don't set empty ip\n end\n vm_ip.to_s\n end", "def eaddrnotavail?() EADDRNOTAVAIL == @error_code; end", "def ipaddress(node)\n @use_private_ip_for_ssh ? node['ec2']['local_ipv4'] : node['ec2']['public_ipv4']\n end", "def configure_instance(node, i)\n node.vm.hostname = fqdn(i)\n network_ports node, i\nend", "def pod_ip=(value)\n @pod_ip = value\n end", "def configure_private_network_ip(config, ip, vm_name)\n if ip\n config.vm.network :private_network, :ip => ip, :netmask => \"255.255.255.0\"\n else\n puts \" NO HOSTONLY IP defined for VM #{vm_name}.\"\n end\n end", "def reset_external_host()\n instances = $ec2.describe_instances([self.id])\n if instances.length == 0\n raise UserError, \"Instance was not found when resetting external_host\"\n end\n self.external_host = instances[0][:dns_name]\n self.save()\n end", "def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end", "def eip\n @eip ||= EC2.find_eip(interface.id)\n end", "def setIp(nodeList)\n puts \"Defining ip...\"\n threads = []\n nodeList.each do |node|\n threads << Thread.new {\n node.installAt\n node.writeConf(node.genConfInterfaces)\n node.restartIpService\n }\n end\n threads.each { |thr| thr.join }\n sleepingThread = Thread.new {\n sleep 70\n puts \"Networking service restarted on each node\" if $verbose\n }\n return sleepingThread\n end", "def run_me\n instance_id = \"\"\n region = \"\"\n # Print usage information and then stop.\n if ARGV[0] == \"--help\" || ARGV[0] == \"-h\"\n puts \"Usage: ruby ec2-ruby-example-elastic-ips.rb \" \\\n \"INSTANCE_ID REGION\"\n # Replace us-west-2 with the AWS Region you're using for Amazon EC2.\n puts \"Example: ruby ec2-ruby-example-elastic-ips.rb \" \\\n \"i-033c48ef067af3dEX us-west-2\"\n exit 1\n # If no values are specified at the command prompt, use these default values.\n elsif ARGV.count.zero?\n instance_id = \"i-033c48ef067af3dEX\"\n # Replace us-west-2 with the AWS Region you're using for Amazon EC2.\n region = \"us-west-2\"\n # Otherwise, use the values as specified at the command prompt.\n else\n instance_id = ARGV[0]\n region = ARGV[1]\n end\n\n ec2_client = Aws::EC2::Client.new(region: region)\n\n unless instance_exists?(ec2_client, instance_id)\n puts \"Cannot find instance with ID '#{instance_id}'. Stopping program.\"\n exit 1\n end\n\n puts \"Addresses for instance with ID '#{instance_id}' before allocating \" \\\n \"Elastic IP address:\"\n describe_addresses_for_instance(ec2_client, instance_id)\n\n puts \"Allocating Elastic IP address...\"\n allocation_id = allocate_elastic_ip_address(ec2_client)\n if allocation_id.start_with?(\"Error\")\n puts \"Stopping program.\"\n exit 1\n else\n puts \"Elastic IP address created with allocation ID '#{allocation_id}'.\"\n end\n\n puts \"Associating Elastic IP address with instance...\"\n association_id = associate_elastic_ip_address_with_instance(\n ec2_client,\n allocation_id,\n instance_id\n )\n if association_id.start_with?(\"Error\")\n puts \"Stopping program. You must associate the Elastic IP address yourself.\"\n exit 1\n else\n puts \"Elastic IP address associated with instance with association ID \" \\\n \"'#{association_id}'.\"\n end\n\n puts \"Addresses for instance after allocating Elastic IP address:\"\n describe_addresses_for_instance(ec2_client, instance_id)\n\n puts \"Releasing the Elastic IP address from the instance...\"\n if elastic_ip_address_released?(ec2_client, allocation_id) == false\n puts \"Stopping program. You must release the Elastic IP address yourself.\"\n exit 1\n else\n puts \"Address released.\"\n end\n\n puts \"Addresses for instance after releasing Elastic IP address:\"\n describe_addresses_for_instance(ec2_client, instance_id)\nend", "def get_ipaddress(asset_tag=asset_tag, pool)\n @connection.ipaddress_allocate!(asset_tag, pool, count = 1)\n end", "def replace_administrative_ip(opts)\n opts = check_params(opts,[:old_ips,:new_ips,:netmasks])\n super(opts)\n end", "def get_public_ip\n case host_hash[:hypervisor]\n when /^(ec2|openstack)$/\n if self[:hypervisor] == 'ec2' && self[:instance]\n return self[:instance].ip_address\n elsif self[:hypervisor] == 'openstack' && self[:ip]\n return self[:ip]\n elsif self.instance_of?(Windows::Host)\n # In the case of using ec2 instances with the --no-provision flag, the ec2\n # instance object does not exist and we should just use the curl endpoint\n # specified here:\n # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html\n execute(\"wget http://169.254.169.254/latest/meta-data/public-ipv4\").strip\n else\n execute(\"curl http://169.254.169.254/latest/meta-data/public-ipv4\").strip\n end\n end\n end", "def instance_ips(instance_id)\n # If we get an Unauthorized error, it could mean that the OpenStack auth token has expired, so we are\n # going renew the fog connection one time to make sure that we get a new non-expired token.\n retried = false\n begin\n instance = openstack.servers.find { |s| s.name == instance_id }\n rescue Excon::Errors::Unauthorized => e\n unless retried\n retried = true\n @openstack = nil\n retry\n end\n raise ConnectionError, \"Unable to connect to OpenStack API: #{e.message}\"\n end\n raise InstanceNotFound, \"Instance '#{instance_id}' not found\" unless instance\n return instance.ip_addresses\n end", "def set_ip\n @ip = get_ip(request.remote_ip.to_s)\n end", "def update_state_with_new_local_ip\n # First, find out this machine's private IP address. If multiple eth devices\n # are present, use the same one we used last time.\n all_local_ips = HelperFunctions.get_all_local_ips()\n new_private_ip = all_local_ips[@eth_interface]\n\n # Next, find out this machine's public IP address. In a cloud deployment, we\n # have to rely on the metadata server, while in a cluster deployment, it's\n # the same as the private IP.\n if [\"ec2\", \"euca\"].include?(@creds[\"infrastructure\"])\n new_public_ip = HelperFunctions.get_public_ip_from_aws_metadata_service()\n elsif @creds[\"infrastructure\"] == \"gce\"\n new_public_ip = HelperFunctions.get_public_ip_from_gce_metadata_service()\n else\n new_public_ip = new_private_ip\n end\n\n # Finally, replace anywhere that the old public or private IP addresses were\n # used with the new one.\n old_public_ip = @my_public_ip\n old_private_ip = @my_private_ip\n\n if @userappserver_public_ip == old_public_ip\n @userappserver_public_ip = new_public_ip\n end\n\n if @userappserver_private_ip == old_private_ip\n @userappserver_private_ip = new_private_ip\n end\n\n @nodes.each { |node|\n if node.public_ip == old_public_ip\n node.public_ip = new_public_ip\n end\n\n if node.private_ip == old_private_ip\n node.private_ip = new_private_ip\n end\n }\n\n if @creds[\"hostname\"] == old_public_ip\n @creds[\"hostname\"] = new_public_ip\n end\n\n if !is_cloud?\n nodes = JSON.load(@creds[\"ips\"])\n nodes.each { |node|\n if node['ip'] == old_private_ip\n node['ip'] == new_private_ip\n end\n }\n @creds[\"ips\"] = JSON.dump(nodes)\n end\n\n @app_info_map.each { |appid, app_info|\n if app_info['appengine'].nil?\n next\n end\n\n changed = false\n new_app_info = []\n app_info['appengine'].each { |location|\n host, port = location.split(\":\")\n if host == old_private_ip\n host = new_private_ip\n changed = true\n end\n new_app_info << \"#{host}:#{port}\"\n\n if changed\n app_info['appengine'] = new_app_info\n end\n }\n }\n\n @all_stats = []\n\n @my_public_ip = new_public_ip\n @my_private_ip = new_private_ip\n end", "def raise_ip_err(ip, node)\n raise ErrorAndExit, \"host ip #{ip} on node #{node} \" \\\n 'is a duplicate. IP addresses must be unique. Check .rizzo.json ' \\\n 'files in each control repository for duplicate ip entries'\n end", "def getMasterIp(num)\n return \"172.17.4.#{num+100}\"\nend", "def set_ip_or_hostname(opts)\n opts = check_params(opts,[:ip_or_hostnames])\n super(opts)\n end", "def eaddrinuse?() EADDRINUSE == @error_code; end", "def get_ip(ip)\n\n #Recorremos todas las reservaciones del usuario\n Reservation.all.each do |reservation|\n #Si la ip de la reservacion es igual a la ip solicitante y tiene un asiento reservado\n # entonces le asigna una ip\n if reservation.ip == ip && (reservation.seat.reserved)\n #se le asigna una nueva ip\n ip = get_ip(add_number(ip))\n end\n end\n return ip\n end", "def set_ip_adress\n @ip_adress = IpAddress.find(params[:id])\n end", "def release_address(public_ip)\n address = address(public_ip)\n\n if address.instance_id.nil?\n action = 'ReleaseAddress'\n params = {\n 'Action' => action,\n 'PublicIp' => public_ip\n }\n\n response = send_query_request(params)\n response.is_a?(Net::HTTPSuccess)\n else\n raise 'Address is currently allocated' #FIXME: Add a proper Awsum error here\n end\n end", "def setDefaults\n ips = []\n if $IN_AWS\n [\"public-ipv4\", \"local-ipv4\"].each { |addr|\n begin\n Timeout.timeout(2) do\n ip = URI.open(\"http://169.254.169.254/latest/meta-data/#{addr}\").read\n ips << ip if !ip.nil? and ip.size > 0\n end\n rescue OpenURI::HTTPError, Timeout::Error, SocketError\n # these are ok to ignore\n end\n }\n elsif $IN_GOOGLE\n base_url = \"http://metadata.google.internal/computeMetadata/v1\"\n begin\n Timeout.timeout(2) do\n # TODO iterate across multiple interfaces/access-configs\n ip = URI.open(\"#{base_url}/instance/network-interfaces/0/ip\", \"Metadata-Flavor\" => \"Google\").read\n ips << ip if !ip.nil? and ip.size > 0\n ip = URI.open(\"#{base_url}/instance/network-interfaces/0/access-configs/0/external-ip\", \"Metadata-Flavor\" => \"Google\").read\n ips << ip if !ip.nil? and ip.size > 0\n end\n rescue OpenURI::HTTPError, Timeout::Error, SocketError => e\n # This is fairly normal, just handle it gracefully\n end\n end\n\n\n $CONFIGURABLES[\"allow_invade_foreign_vpcs\"][\"default\"] = false\n $CONFIGURABLES[\"public_address\"][\"default\"] = $possible_addresses.first\n $CONFIGURABLES[\"hostname\"][\"default\"] = Socket.gethostname\n $CONFIGURABLES[\"banner\"][\"default\"] = \"Mu Master at #{$CONFIGURABLES[\"public_address\"][\"default\"]}\"\n if $IN_AWS\n # XXX move this crap to a callback hook for puttering around in the AWS submenu\n aws = JSON.parse(URI.open(\"http://169.254.169.254/latest/dynamic/instance-identity/document\").read)\n iam = nil\n begin\n iam = URI.open(\"http://169.254.169.254/latest/meta-data/iam/security-credentials\").read\n rescue OpenURI::HTTPError, SocketError\n end\n # $CONFIGURABLES[\"aws\"][\"subtree\"][\"account_number\"][\"default\"] = aws[\"accountId\"]\n $CONFIGURABLES[\"aws\"][\"subtree\"][\"region\"][\"default\"] = aws[\"region\"]\n if iam and iam.size > 0\n # XXX can we think of a good way to test our permission set?\n $CONFIGURABLES[\"aws\"][\"subtree\"][\"access_key\"][\"desc\"] = $CONFIGURABLES[\"aws\"][\"subtree\"][\"access_key\"][\"desc\"] + \". Not necessary if IAM Profile #{iam.bold} has sufficient API access.\"\n $CONFIGURABLES[\"aws\"][\"subtree\"][\"access_secret\"][\"desc\"] = $CONFIGURABLES[\"aws\"][\"subtree\"][\"access_key\"][\"desc\"] + \". Not necessary if IAM Profile #{iam.bold} has sufficient API access.\"\n end\n end\n $CONFIGURABLES[\"aws\"][\"subtree\"][\"log_bucket_name\"][\"default\"] = $CONFIGURABLES[\"hostname\"][\"default\"]\n $CONFIGURABLES[\"google\"][\"subtree\"][\"log_bucket_name\"][\"default\"] = $CONFIGURABLES[\"hostname\"][\"default\"]\n end", "def replace_cluster_ip(opts)\n opts = check_params(opts,[:old_ips,:new_ips,:netmasks])\n super(opts)\n end", "def after_provision\n puts \"TODO: After terraform apply, write instance IP to devops/ansible/inventory/#{infra.type}\"\n end", "def get_ip(node)\n provisioning.ipaddress(node)\n end", "def handle_hostip(bridge_name, hostip)\n # we should have a bridge with that name.\n hostip_resource = Wire::Resource::ResourceFactory\n .instance.create(:bridgeip, hostip, bridge_name)\n\n default_handle_resource(hostip_resource, :hostip,\n \"IP \\'#{hostip}\\' on bridge \\'#{bridge_name}\\'\", :up)\n rescue => e\n $log.error \"processing host ip: #{e}\"\n end", "def ip\n self['ip'] = get_public_ip || get_ip\n end", "def hostname_to_ip hostname\n begin \n ip = Resolv.getaddress(config[:host])\n rescue Resolv::ResolvError => resolv_err\n raise Exception.new(\"Resolver error: #{resolv_err}\")\n end\n return ip\n end", "def ip_address\n @ip_address ||= nil\n end", "def ip_exist?\n return false if current_resource.addresses.nil?\n current_resource.addresses.include?(new_resource.address)\n end", "def with_public_ip_on_launch?\n @subnet.map_public_ip_on_launch\n end", "def SetIp(node)\n \tnode.GetInterfaces().each do |ifn|\n\t self.GetGroupInterface(node, ifn).ip=\"1.1.1.1\"\n \t #self.GetGroupInterface(node, ifn).up\n\tend\n end", "def get_tester_ip_addr\n if File.exists?(\"/var/spool/ec2/meta-data.rb\")\n require \"/var/spool/ec2/meta-data-cache\" \n else\n ENV['EC2_PUBLIC_HOSTNAME'] = \"127.0.0.1\"\n end\n my_ip_input = \"text:\" \n my_ip_input += ENV['EC2_PUBLIC_HOSTNAME']\n my_ip_input\n end", "def alert\n unless self.healthy?\n # Do not send the alert when there are name resolution problems. Most of\n # the time, this is simply due to the DNS server being unavailable.\n unless self.error =~ /Couldn't resolve host name/i\n ip_relay.alert({\n :environment => {\n :id => self.environment.id,\n :name => self.environment.name,\n :url => self.environment.url\n },\n :site => self.environment.site.name,\n :commands => self.environment.ip_relay_commands,\n :url => \"#{Settings.checkups[:url]}#{self.id}\"\n })\n end\n end\n end", "def update\n respond_to do |format|\n if @aws_elastic_ip.update(aws_elastic_ip_params)\n format.html { redirect_to @aws_elastic_ip, notice: 'Aws elastic ip was successfully updated.' }\n format.json { render :show, status: :ok, location: @aws_elastic_ip }\n else\n format.html { render :edit }\n format.json { render json: @aws_elastic_ip.errors, status: :unprocessable_entity }\n end\n end\n end", "def instance_external_ip(instance_id)\n return nil unless instance_id && !instance_id.empty?\n capistrano.logger.info(\"Getting Vagrant instance external IP\")\n get_ips_cmd = \"'ifconfig | awk \\\"/inet addr/{print substr(\\\\$2,6)}\\\"'\"\n run_vagrant_command('ssh', instance_id, \"-c #{get_ips_cmd} 2> /dev/null\") do |ips|\n ips = ips.split(/\\r?\\n/) # split on CRLF or LF\n if ips.empty?\n capistrano.logger.error(\"Unable to retrieve IP addresses from Vagrant instance\")\n nil\n else\n original_ips = ips.dup\n ips.delete_if { |x| /^127\\./.match(x) } # Delete the loopback address\n ips.delete_if { |x| /^192\\.168\\.12/.match(x) } # Delete the internally assigned Vagrant address: 192.168.12X.X\n if ips.empty?\n capistrano.logger.error(\"Vagrant instance doesn't appear to have an external IP address. IPs found are: #{original_ips.join(', ')}\")\n nil\n else\n capistrano.logger.info(\"The vagrant instance 'external' IP is #{ips.first}\")\n ips.first\n end\n end\n end\n end", "def used_ips\n @used_ips ||= Host.used_ips\n end", "def check_ip_integrity\n\t\tif @arry_ips.length == 0\n\t\t\t@arry_ips = Connections::SERVER_IP\n\t\telsif @arry_ips.length != Connections::SERVER_IP.length && @ip_integrity != \"m\"\n\t\t\t@arry_ips = Connections::SERVER_IP\n\t\tend\n\tend", "def get_tester_ip_addr\n if File.exists?(\"/var/spool/ec2/meta-data.rb\")\n require \"/var/spool/ec2/meta-data-cache\" \n else\n ENV['EC2_PUBLIC_HOSTNAME'] = \"127.0.0.1\"\n end\n my_ip_input = \"text:\" \n my_ip_input += ENV['EC2_PUBLIC_HOSTNAME']\n my_ip_input\n end", "def get_tester_ip_addr\n if File.exists?(\"/var/spool/ec2/meta-data.rb\")\n require \"/var/spool/ec2/meta-data-cache\" \n else\n ENV['EC2_PUBLIC_HOSTNAME'] = \"127.0.0.1\"\n end\n my_ip_input = \"text:\" \n my_ip_input += ENV['EC2_PUBLIC_HOSTNAME']\n my_ip_input\n end", "def set_ip_name\n @ip_name = IpName.find(params[:id])\n end", "def assign(virtual_machine_id, options = {})\n response = request(:post, \"/virtual_machines/#{virtual_machine_id}/ip_addresses.json\", default_params(options))\n response['ip_address_join']\n end", "def release_address(env,eip)\n h = JSON.parse(eip)\n # Use association_id and allocation_id for VPC, use public IP for EC2\n if h['association_id']\n env[:aws_compute].disassociate_address(nil,h['association_id'])\n env[:aws_compute].release_address(h['allocation_id'])\n else\n env[:aws_compute].disassociate_address(h['public_ip'])\n env[:aws_compute].release_address(h['public_ip'])\n end\n end", "def release_address(env,eip)\n h = JSON.parse(eip)\n # Use association_id and allocation_id for VPC, use public IP for EC2\n if h['association_id']\n env[:aws_compute].disassociate_address(nil,h['association_id'])\n env[:aws_compute].release_address(h['allocation_id'])\n else\n env[:aws_compute].disassociate_address(h['public_ip'])\n env[:aws_compute].release_address(h['public_ip'])\n end\n end", "def kvm_ip(name)\n addr = ip_by_mac(node_mac(name))\n addr.empty? ? ip_by_mount(name) : addr\nend", "def get_aws_ip(n)\n if node['delivery-cluster']['aws']['use_private_ip_for_ssh']\n n['ec2']['local_ipv4']\n else\n n['ec2']['public_ipv4']\n end\n end", "def ip_address=(val)\n if val.nil?\n self.errors.add(:ip_address, :invalid)\n return\n end\n\n if val.is_a?(IPAddr)\n write_attribute(:ip_address, val)\n return\n end\n\n v = IPAddr.handle_wildcards(val)\n\n if v.nil?\n self.errors.add(:ip_address, :invalid)\n return\n end\n\n write_attribute(:ip_address, v)\n\n # this gets even messier, Ruby 1.9.2 raised a different exception to Ruby 2.0.0\n # handle both exceptions\n rescue ArgumentError, IPAddr::InvalidAddressError\n self.errors.add(:ip_address, :invalid)\n end", "def ip_reachable?(ip)\n external = Net::Ping::External.new(ip)\n\n log_info %(attempting to contact host \"#{ip}\")\n reachable = external.ping || external.ping6\n if reachable\n log_success %(host \"#{ip}\" is reachable)\n else\n log_error %(unable to contact host \"#{ip}\")\n end\n\n reachable\n end", "def unused_ip args = {}\n # first check if we already have a record for this host\n # if we do, we can simply reuse the same ip address.\n if args[:mac] and r=has_mac?(args[:mac], :all) and valid_range(args).include?(r.ip)\n logger.debug \"Found an existing dhcp record #{r}, reusing...\"\n return r.ip\n end\n\n free_ips = valid_range(args) - records.collect{|r| r.ip}\n if free_ips.empty?\n logger.warn \"No free IPs at #{to_s}\"\n return nil\n else\n @index = 0\n begin\n # Read and lock the storage file\n stored_index = get_index_and_lock(\"foreman-proxy_#{network}_#{cidr}.tmp\")\n\n free_ips.rotate(stored_index).each do |ip|\n logger.debug \"Searching for free IP - pinging #{ip}\"\n if tcp_pingable?(ip) or icmp_pingable?(ip)\n logger.info \"Found a pingable IP(#{ip}) address which does not have a Proxy::DHCP record\"\n else\n logger.debug \"Found free IP #{ip} out of a total of #{free_ips.size} free IPs\"\n @index = free_ips.index(ip)+1\n return ip\n end\n end\n logger.warn \"No free IPs at #{to_s}\"\n rescue Exception => e\n logger.debug e.message\n ensure\n # ensure we unlock the storage file\n set_index_and_unlock @index\n end\n nil\n end\n end", "def determine_public_ip\n # 169.254.169.254 is the address of the AWS instance metadata service\n # See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html\n `curl --silent -XGET http://169.254.169.254/latest/meta-data/public-ipv4`\n end", "def check_server\n raise Exception.new(\"Could not reach Apocalypse server please check the address and port and try again.\") unless server_reachable?\n end", "def manage_address\n enable_dhcp if new_resource.bootproto == 'dhcp' && current_resource.bootproto != 'dhcp'\n return unless new_resource.bootproto == 'static'\n\n config_static unless new_resource.address.nil? || (current_resource.bootproto == 'static' && ip_subnet_exist?)\n config_gateway unless new_resource.gateway.nil? || (current_resource.bootproto == 'static' && current_resource.gateway == new_resource.gateway)\n end", "def public_ip_of(server)\n server[:cloud][:public_ips].first rescue server[:ipaddress]\n end", "def nodeIP(num)\n return \"10.17.4.#{num+200}\"\nend", "def create\n @ipaddress = Ipaddress.new(ipaddress_params)\n @vmIPjoin_res = @ipobject.addIp(@virtualmachine.RemoteID,params)\n unless @vmIPjoin_res.has_key?(\"errors\")\n respond_to do |format|\n\n format.html { redirect_to virtualmachine_ipaddresses_url, notice: 'Ipaddress was successfully created.' }\n end\n else\n flash.keep[:notice] = \"Errors are #{@vmIPjoin_res[\"errors\"]}\"\n redirect_to action: :new\n end\n end" ]
[ "0.73278844", "0.6686053", "0.6594199", "0.6590179", "0.6534397", "0.6395143", "0.6360093", "0.63496107", "0.6334051", "0.6249226", "0.6174922", "0.61516446", "0.6123249", "0.60844904", "0.60332716", "0.601612", "0.5988108", "0.59795195", "0.5958159", "0.5946782", "0.5938979", "0.58944494", "0.5877551", "0.5875032", "0.58343065", "0.58153635", "0.58059233", "0.57964027", "0.5775042", "0.5773608", "0.5718643", "0.57128674", "0.56939965", "0.5659066", "0.56455684", "0.56450814", "0.5632753", "0.5631506", "0.56195396", "0.5617699", "0.56152666", "0.56152666", "0.56110173", "0.5598166", "0.55960894", "0.5587039", "0.5585858", "0.5566756", "0.5545632", "0.55079275", "0.5479547", "0.5472607", "0.54659283", "0.5459763", "0.54588515", "0.5454702", "0.54375124", "0.54319215", "0.5425505", "0.54133695", "0.5412026", "0.54061383", "0.5403685", "0.5398994", "0.5385495", "0.5379379", "0.53777075", "0.5376882", "0.537643", "0.5366927", "0.53266805", "0.5325794", "0.53247327", "0.53177017", "0.5316143", "0.5312173", "0.53116316", "0.52990496", "0.52970374", "0.529332", "0.5290462", "0.527958", "0.52771205", "0.52744216", "0.52744216", "0.5262393", "0.5242462", "0.52372754", "0.52372754", "0.5236451", "0.5222774", "0.521905", "0.52186596", "0.5215709", "0.52120125", "0.52043426", "0.5201739", "0.5201552", "0.5200665", "0.51968193" ]
0.73130995
1
Fetches the instance id for the current machine
def my_instance_id Net::HTTP.get(URI('http://169.254.169.254/1.0/meta-data/instance-id')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup_instance_id\n metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'\n instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )\n end", "def instance_id\n data[:instance_id]\n end", "def instance_id\n `curl --connect-timeout 1 #{aws_url} 2>&1`.chomp\n end", "def get_instance_id(instance_info)\n # puts \"look up instanceId in #{instance_info.inspect}\"\n instance_info['instancesSet']['item'][0]['instanceId']\n end", "def current_vm_id\n @metadata_lock.synchronize do\n return @current_vm_id if @current_vm_id\n\n http_client = HTTPClient.new\n http_client.connect_timeout = METADATA_TIMEOUT\n # Using 169.254.169.254 is an EC2 convention for getting\n # instance metadata\n uri = \"http://169.254.169.254/latest/meta-data/instance-id/\"\n\n response = http_client.get(uri)\n unless response.status == 200\n cloud_error(\"Instance metadata endpoint returned \" \\\n \"HTTP #{response.status}\")\n end\n\n @current_vm_id = response.body\n end\n\n rescue HTTPClient::TimeoutError\n cloud_error(\"Timed out reading instance metadata, \" \\\n \"please make sure CPI is running on EC2 instance\")\n end", "def current_vm_id\n @metadata_lock.synchronize do\n return @current_vm_id if @current_vm_id\n\n http_client = HTTPClient.new\n http_client.connect_timeout = METADATA_TIMEOUT\n # Using 169.254.169.254 is an EC2 convention for getting\n # instance metadata\n uri = \"http://169.254.169.254/latest/meta-data/instance-id/\"\n\n response = http_client.get(uri)\n unless response.status == 200\n cloud_error(\"Instance metadata endpoint returned \" \\\n \"HTTP #{response.status}\")\n end\n\n @current_vm_id = response.body\n end\n\n rescue HTTPClient::TimeoutError\n cloud_error(\"Timed out reading instance metadata, \" \\\n \"please make sure CPI is running on EC2 instance\")\n end", "def instance_id\n return ec2_meta_data('instance-id')\n end", "def me\n require 'open-uri'\n begin\n instance_id = open('http://169.254.169.254/latest/meta-data/instance-id').read\n instance instance_id\n rescue OpenURI::HTTPError => e\n nil\n end\n end", "def current_vm_id\n # xxxx = coreCloud.current_vm_id()\n # process xxxx based on version\n # return based on version\n\n return @current_vm_id if @current_vm_id\n\n http_client = HTTPClient.new\n http_client.connect_timeout = METADATA_TIMEOUT\n headers = {}\n\n # Using 169.254.169.254 is an EC2 convention for getting\n # instance metadata\n response = http_client.put('http://169.254.169.254/latest/api/token', nil, { 'X-aws-ec2-metadata-token-ttl-seconds' => '300' })\n if response.status == 200\n headers['X-aws-ec2-metadata-token'] = response.body #body consists of the token\n end\n\n response = http_client.get('http://169.254.169.254/latest/meta-data/instance-id/', nil, headers)\n unless response.status == 200\n cloud_error('Instance metadata endpoint returned ' \\\n \"HTTP #{response.status}\")\n end\n\n @current_vm_id = response.body\n rescue HTTPClient::TimeoutError\n cloud_error('Timed out reading instance metadata, ' \\\n 'please make sure CPI is running on EC2 instance')\n end", "def current_vm_id\n @metadata_lock.synchronize do\n instance_manager.instance_id\n end\n end", "def get_instance instance_id\n instances.get_instance name: instance_path(instance_id)\n end", "def current_instance_number\n sql_select_one 'SELECT Instance_Number FROM v$Instance'\n end", "def get_instance instance_id\n execute do\n instances.get_instance(\n instance_path(instance_id)\n )\n end\n end", "def get_instance_id\n MUTEX.synchronize do\n @instance_index = 0 if @instance_index == 10000\n @instance_index += 1\n end\n end", "def ostack_get_instance_id ()\n # The instance id is kept in @passthrough[:instance] or\n # can be obtained from @instance_data which has all instance\n # details.\n if ! @instance_data.nil? and ! @instance_data.id.nil?\n return @instance_data.id # we already know the id\n elsif @passthrough.has_key?(:instance)\n return @passthrough[:instance] # we know the id we want\n else\n @logger.debug(sprintf('unable to determine id from instance_data[%s] or passthrough specification[%s]', @instance_data, @passthrough))\n return nil # we don't have an id yet, likely a up() call\n end\n end", "def id\n @instance.id\n end", "def instance_id\n @grpc.name.split(\"/\")[3]\n end", "def instance_id\n @grpc.name.split(\"/\")[3]\n end", "def instance_id\n @grpc.name.split(\"/\")[3]\n end", "def instance_id\n @grpc.name.split(\"/\")[3]\n end", "def instance_id\n @grpc.name.split(\"/\")[3]\n end", "def instance_id\n @grpc.name.split(\"/\")[3]\n end", "def instance_id\n @grpc.name.split(\"/\")[3]\n end", "def id( )\n return @instances.map{ |i| i[:aws_instance_id] }\n end", "def get_machine_id()\n machine_id_filepath = \".vagrant/machines/default/virtualbox/id\"\n\n if not File.exists? machine_id_filepath\n # VM hasn't been created yet.\n return false\n end\n\n # This is probably not a great way to do this: shell out to the cat command.\n # It seems likely that ruby has a get-file-contents function somewhere,\n # but I'm definitely not a ruby dev right now.\n machine_id = `cat #{machine_id_filepath}`\nend", "def server_id\n @host.id\n end", "def instance(instance_id)\n instances([instance_id])[0]\n end", "def get_instance_by_id(id)\n get_instances_description.select {|a| a.instance_id == id}[0] rescue nil\n end", "def instance_profile_id\n data.instance_profile_id\n end", "def id\n vm_info['VM']['ID'].to_i\n end", "def get_pcloud_instance\n get(\"cloud-instances/#{guid}\")\n end", "def get_pvm_instance(instance_id)\n get(\"cloud-instances/#{guid}/pvm-instances/#{instance_id}\")\n end", "def aws_instance_get(opts)\n AWS::EC2.new.instances[opts[:instance_id]]\n end", "def get_instance_data\n JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def instance instance_id\n ensure_service!\n grpc = service.get_instance instance_id\n Instance.from_grpc grpc, service\n rescue Google::Cloud::NotFoundError\n nil\n end", "def random_instance_id # TODO: don't count on this for security; migrate to a proper instance id, in a cookie, at least twice as long, and with verified randomness\n \"%08x\" % rand( 1 << 32 ) + \"%08x\" % rand( 1 << 32 ) # rand has 52 bits of randomness; call twice to get 64 bits\n end", "def spot_instance_request_id\n data[:spot_instance_request_id]\n end", "def machine_id(timeout=nil)\n request = Packet.create_request(COMMAND_ID_CORE_MACHINE_ID)\n\n args = [request]\n args << timeout if timeout\n\n response = client.send_request(*args)\n\n mid = response.get_tlv_value(TLV_TYPE_MACHINE_ID)\n\n # Normalise the format of the incoming machine id so that it's consistent\n # regardless of case and leading/trailing spaces. This means that the\n # individual meterpreters don't have to care.\n\n # Note that the machine ID may be blank or nil and that is OK\n Rex::Text.md5(mid.to_s.downcase.strip)\n end", "def sc_guid()\n # We only need to fetch the remote GUID once since it never changes for a given instance\n @guid = @driver.get_sc_guid(abs_path) if @guid.nil?\n return @guid\n end", "def get_aws_instance_id_by_node_name(node_name)\n return nil unless configured?\n\n found_instance = instances_list.find { |instance| instance[:node_name] == node_name }\n found_instance.nil? ? nil : found_instance[:instance_id]\n end", "def generate_machine_id()\n \n end", "def get_instance_of_cloud(cloud_id, instance_of_cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}/instances/#{instance_of_cloud_id}\") \n end", "def id\n ChefPlatformSpec.id_from(chef_server, name)\n end", "def instance_data\n @instance_data ||= JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def current_vm_id\n @logger.info('current_vm_id')\n raise Bosh::Clouds::NotSupported\n end", "def vm_instance(name)\n @conn.vminstances.get(name)\n end", "def machine_id_changed\n id = @machine.id\n\n begin\n @logger.debug(\"Instantiating the driver for machine ID: #{@machine.id.inspect}\")\n @driver = VagrantPlugins::Parallels::Driver::Meta.new(id)\n rescue VagrantPlugins::Parallels::Driver::Meta::VMNotFound\n # The virtual machine doesn't exist, so we probably have a stale\n # ID. Just clear the id out of the machine and reload it.\n @logger.debug('VM not found! Clearing saved machine ID and reloading.')\n id = nil\n retry\n end\n end", "def machine_index\n @machine_index ||= env[:machine].env.machine_index\n end", "def getAWSInfo\n begin\n Timeout::timeout(10) do\n aws_metadata = open('http://169.254.169.254/2014-11-05/dynamic/instance-identity/document'){ |io| data = io.read }\n aws_JSON_Information = JSON.parse(aws_metadata)\n return \"#{aws_JSON_Information['instanceId']}_#{aws_JSON_Information['region']}_#{aws_JSON_Information['accountId']}\"\n end\n rescue\n Chef::Log.warn('Unable to get AWS instance ID, Timeout while reading') \n return ''\n end\nend", "def get_id\n id = Thread.current[:id] \n id = 1 if @java_flag\n id\n end", "def get_instance_by_number(i=0, list = remote_instances_list) \n name = ((i.nil? || i.zero?) ? \"master\" : \"node#{i}\")\n list.select {|i| i.name == name }.first\n end", "def get_instance_by_number(i=0, list = remote_instances_list)\n name = (i.zero? ? \"master\" : \"node#{i}\")\n list.select {|i| i.name == name }.first\n end", "def get_id()\n return @id\n end", "def id\n return unless class_variable_defined? :@@id\n class_variable_get :@@id\n end", "def reserved_instance(reserved_instance_id)\n reserved_instances(reserved_instance_id)[0]\n end", "def to_param\n self.instance_id\n end", "def reload\n old_id = @id\n @id = nil\n\n if @data_dir\n # Read the id file from the data directory if it exists as the\n # ID for the pre-existing physical representation of this machine.\n id_file = @data_dir.join(\"id\")\n id_content = id_file.read.strip if id_file.file?\n if !id_content.to_s.empty?\n @id = id_content\n end\n end\n\n if @id != old_id && @provider\n # It changed, notify the provider\n @provider.machine_id_changed\n end\n\n @id\n end", "def id=(value)\n @logger.info(\"New machine ID: #{value.inspect}\")\n\n id_file = nil\n if @data_dir\n # The file that will store the id if we have one. This allows the\n # ID to persist across Vagrant runs. Also, store the UUID for the\n # machine index.\n id_file = @data_dir.join(\"id\")\n end\n\n if value\n if id_file\n # Write the \"id\" file with the id given.\n id_file.open(\"w+\") do |f|\n f.write(value)\n end\n end\n\n if uid_file\n # Write the user id that created this machine\n uid_file.open(\"w+\") do |f|\n f.write(Process.uid.to_s)\n end\n end\n\n # If we don't have a UUID, then create one\n if index_uuid.nil?\n # Create the index entry and save it\n entry = MachineIndex::Entry.new\n entry.local_data_path = @env.local_data_path\n entry.name = @name.to_s\n entry.provider = @provider_name.to_s\n entry.state = \"preparing\"\n entry.vagrantfile_path = @env.root_path\n entry.vagrantfile_name = @env.vagrantfile_name\n\n if @box\n entry.extra_data[\"box\"] = {\n \"name\" => @box.name,\n \"provider\" => @box.provider.to_s,\n \"version\" => @box.version.to_s,\n }\n end\n\n entry = @env.machine_index.set(entry)\n @env.machine_index.release(entry)\n\n # Store our UUID so we can access it later\n if @index_uuid_file\n @index_uuid_file.open(\"w+\") do |f|\n f.write(entry.id)\n end\n end\n end\n else\n # Delete the file, since the machine is now destroyed\n id_file.delete if id_file && id_file.file?\n uid_file.delete if uid_file && uid_file.file?\n\n # If we have a UUID associated with the index, remove it\n uuid = index_uuid\n if uuid\n entry = @env.machine_index.get(uuid)\n @env.machine_index.delete(entry) if entry\n end\n\n if @data_dir\n # Delete the entire data directory contents since all state\n # associated with the VM is now gone.\n @data_dir.children.each do |child|\n begin\n child.rmtree\n rescue Errno::EACCES\n @logger.info(\"EACCESS deleting file: #{child}\")\n end\n end\n end\n end\n\n # Store the ID locally\n @id = value.nil? ? nil : value.to_s\n\n # Notify the provider that the ID changed in case it needs to do\n # any accounting from it.\n @provider.machine_id_changed\n end", "def get_server_id\n return nil\n end", "def db_instance_arn\n data[:db_instance_arn]\n end", "def get_instance_href\n @instance_href ||= @api_client.get_instance.href\n end", "def get_by_id(id)\n self.class.get(\"/aldebaran-instances/instances/#{id}\", :basic_auth => @auth)\n end", "def get_vm_info()\n promise = @compute_client.virtual_machines.get(@rg_name, @instance_name)\n result = promise.value!\n OOLog.info(\"vm info :\"+result.body.inspect)\n return result.body\n end", "def obtain_online_id\n r = execute('getOnlineID')\n return r.to_i\n end", "def current_id(refresh = false)\n @current_id = nil if refresh\n @current_id ||= @redis.get(key).to_i\n end", "def id\n self[:ip_id]\n end", "def get_id()\n return @id\n end", "def server_id(server_name)\n Puppet.warning \"[DEPRICATED]: Use find_match in common.rb\"\n @compute.servers.each do |server|\n return server.id if server.name == server_name\n end\n return nil\n end", "def ip_address_id(env)\n ip_address_record(env)[:id]\n end", "def get_id \n part_number = PartNumber.get_part_number(self)\n part_number.id if part_number\n end", "def id\n @id ||= scgi.session_id\n end", "def get_id()\n @id\n end", "def get_id()\n @id\n end", "def set_instance_eni\n @instance_eni = InstanceEni.find(params[:id])\n end", "def id\n begin\n if self.class == Piwik::Site\n self.idsite\n else\n attributes.send(:\"id#{self.class.to_s.gsub('Piwik::','')}\")\n end\n rescue Exception => e\n $stderr.puts e\n end\n end", "def read_machine_ip\n @machine.provider.driver.read_machine_ip\n end", "def id\n case self.service\n when :youtube then parse_video_id_for_youtube\n when :vimeo then parse_video_id_for_vimeo\n end\n end", "def set_instance\n @instance = @workflow.instances.find(params[:instance_id])\n end", "def custom_extension_stage_instance_id\n return @custom_extension_stage_instance_id\n end", "def id\n `$q(this.__native__.id||nil)`\n end", "def pid()\n #This is a stub, used for indexing\n end", "def id\n @attributes[\"#{self.class.to_s.split('::').last.underscore.downcase}_id\".to_sym]\n end", "def get_id_from_model(model_instance)\n model_instance[foreign_key_column_name]\n end", "def describe_instance(id=nil)\n describe_instances.select {|a| a[:name] == id}[0] rescue nil\n end", "def get_next_id\n id = java.lang.System.nanoTime.to_s\n $log.info(\"*** get_next_id: \" + id)\n return id\n end", "def get_instance_system(code)\n return code[1][1]\n end", "def get_instance(id)\n begin\n instance = @ec2.instance(id)\n if instance.exists?\n return instance\n else\n raise RuntimeError.new(\"Instance #{id} does not exist\")\n end\n rescue => e\n raise e\n end\n end", "def server_id\n @server_id ||= Gititback::Support.hostname\n end", "def set_host_machine\n @host_machine = HostMachine.find(params[:id])\n end", "def get_parallels_vm_uuid(options)\n message = \"Information:\\tDetermining UUID for Parallels VM \"+options['name']\n command = \"prlctl list --info \\\"#{options['name']}\\\" |grep '^ID' |cut -f2 -d:\"\n vm_uuid = vm_uuid.chomp.gsub(/^\\s+/,\"\")\n vm_uuid = execute_command(options,message,command)\n return vm_uuid\nend", "def id\n read_attribute(self.class.primary_key)\n end", "def id\n read_attribute(self.class.primary_key)\n end", "def current\n if global_id = @cursor_instance.get_value\n global_id = global_id.to_i\n end\n # return ID\n return global_id\n end", "def load_instance_test_data()\n # todo: cache this , maybe Thread.current for now...\n @id = nil\n\n test_instance_id = ENV['TEST_INSTANCE_ID']\n if test_instance_id\n # use the first container in our test instance\n @instance = client.instances.get(test_instance_id.to_i)['instance']\n # rescue ::RestClient::Exception => e on 404\n assert_not_nil @instance, \"Test instance #{test_instance_id} was not found!\"\n @container = client.containers.get(@instance['containers'].first)['container']\n @id = @instance['id']\n end\n assert_not_nil @id, \"A test instance must be specified to run this test.\\nTry setting environment variable TEST_CONTAINER_ID=42 or TEST_INSTANCE_ID=99\"\n end", "def set_machine_info\n @machine_info = MachineInfo.find(params[:id])\n end", "def lastID\r\n self.conn_exec do |driver|\r\n return driver.lastID\r\n end\r\n end", "def id\n __id\n end", "def set_machine\n @machine = Machine.find(params[:id])\n end", "def set_machine\n @machine = Machine.find(params[:id])\n end", "def get_next_id\r\n id = java.lang.System.nanoTime.to_s\r\n $log.info(\"*** get_next_id: \" + id)\r\n return id\r\n end" ]
[ "0.7857428", "0.7545339", "0.7476348", "0.7406198", "0.73788303", "0.73788303", "0.73735946", "0.72641224", "0.726", "0.7204595", "0.7121513", "0.6947031", "0.6941511", "0.6844466", "0.6708967", "0.6573709", "0.6555427", "0.6555427", "0.6555427", "0.6555427", "0.6555427", "0.6555427", "0.6555427", "0.642165", "0.6345369", "0.62912184", "0.6280921", "0.6268486", "0.625387", "0.6253139", "0.6211898", "0.6209061", "0.6202824", "0.6181403", "0.6180044", "0.6154636", "0.61154133", "0.60839933", "0.5958348", "0.5919766", "0.5902904", "0.589608", "0.5894667", "0.58823127", "0.58557063", "0.5795283", "0.57830554", "0.577069", "0.57644945", "0.57436186", "0.57216746", "0.5717035", "0.5694817", "0.5679554", "0.5663053", "0.56574005", "0.56523806", "0.5649716", "0.56336945", "0.5616705", "0.56154007", "0.5615171", "0.5566736", "0.5552414", "0.5539804", "0.5535726", "0.55316985", "0.55292606", "0.55260265", "0.5512177", "0.55028206", "0.54986656", "0.54986656", "0.5498492", "0.54974353", "0.549733", "0.54958177", "0.5495466", "0.548533", "0.54792845", "0.5469909", "0.5458687", "0.54576534", "0.54506737", "0.5450134", "0.5448659", "0.54433864", "0.5440329", "0.5432195", "0.5431708", "0.5426676", "0.5426676", "0.54253554", "0.5413304", "0.5408331", "0.5404208", "0.5401039", "0.53981763", "0.53981763", "0.5398018" ]
0.80713713
0