query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Open current file or directory with the editor. | def edit
execute_external_command do
editor = ENV['EDITOR'] || 'vim'
unless in_zip?
system %Q[#{editor} "#{current_item.path}"]
else
begin
tmpdir, tmpfile_name = nil
Zip::File.open(current_zip) do |zip|
tmpdir = Dir.mktmpdir
FileUtils.mkdir_p File.join(tmpdir, File.dirname(current_item.name))
tmpfile_name = File.join(tmpdir, current_item.name)
File.open(tmpfile_name, 'w') {|f| f.puts zip.file.read(current_item.name)}
system %Q[#{editor} "#{tmpfile_name}"]
zip.add(current_item.name, tmpfile_name) { true }
end
ls
ensure
FileUtils.remove_entry_secure tmpdir if tmpdir
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_in_editor(file)\n if (ENV['EDITOR'])\n system (\"#{ENV['EDITOR']} #{file}\")\n end\nend",
"def open_in_editor(file)\n if (ENV['EDITOR'])\n system (\"#{ENV['EDITOR']} #{file}\")\n end\nend",
"def open\n ensure!\n open_in_editor\n end",
"def open(file = nil, editor: nil, command: nil)\n Editor.new(edit_command(editor, command), file).open\n end",
"def open\n system(ENV['EDITOR'], NIKKI_FILE)\n end",
"def open_sourcefile\n editor.open RubyEdit::SOURCE_FILE_LOCATION, command: @config.editor\n end",
"def open_editor\n return if ENV['EDITOR'].nil?\n\n file = Tempfile.new('cocoapods')\n File.chmod(0777, file.path)\n file.close\n\n system(\"#{ENV['EDITOR']} #{file.path}\")\n @message = File.read file.path\n end",
"def launch_editor(path)\n unless File.exists?(path)\n raise Errno::ENOENT, \"Unable to open #{path}\"\n end\n\n # Allow for \"other\" editors\n if File.exists?(\"/usr/bin/editor\")\n editor = \"/usr/bin/editor\"\n else\n editor = \"vim\"\n end\n\n system(\"#{editor} #{path}\")\n end",
"def edit(*args)\n open_with ENV['EDITOR'], *args\n end",
"def cmd_edit(*args)\n\t\t\tprint_line (\"Launching editor...\")\n\n\t\t\te = Rex::Compat.getenv(\"EDITOR\") || \"vi\"\n\n\t\t\tif (not active_module) or (not (path = active_module.file_path))\n\t\t\t\t$stderr.puts \"no active module selected\"\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\tsystem(e + \" \" + path)\n\t\tend",
"def open_editor(editor_invocation)\n # Note we dont want to use Pry.config.system here as that\n # may be invoked non-interactively (i.e via Open4), whereas we want to\n # ensure the editor is always interactive\n system(*Shellwords.split(editor_invocation)) ||\n raise(\n CommandError,\n \"`#{editor_invocation}` gave exit status: #{$CHILD_STATUS.exitstatus}\"\n )\n end",
"def edit(content, editor: nil, command: nil)\n Editor.new(edit_command(editor, command), content: content).open\n end",
"def editor(path)\n OodAppkit.editor.edit(path: path).to_s\n end",
"def my_edit(args)\n path = args[0]\n return if editing_forbidden_files(path)\n\n system(\"#{ENV['EDITOR_PATH']} #{path}\")\n end",
"def edit_current\n command = ENV['EDITOR'] || ENV['VISUAL'] || 'vim'\n run_on_current command\n @visited_files.insert(0, expand_path(current_file))\nend",
"def edit(file)\n editor_command = find_editor\n unless editor_command\n message(\"Can not find $VISUAL, $EDITOR, vim, or vi on your path\")\n return\n end\n\n cmd = \"#{editor_command} #{file}\"\n @pm.debug(cmd)\n system(cmd)\n load(file)\n @loaded_file = file\n end",
"def open_file f\n return unless f\n unless File.exist? f\n # this happens if we use (T) in place of (M) \n # it places a space after normal files and @ and * which borks commands\n last = f[-1]\n if last == \" \" || last == \"@\" || last == '*'\n f = f.chop\n end\n end\n if File.directory? f\n change_dir f\n elsif File.readable? f\n system(\"$EDITOR #{Shellwords.escape(f)}\")\n f = Dir.pwd + \"/\" + f if f[0] != '/'\n $visited_files.insert(0, f)\n push_used_dirs Dir.pwd\n else\n perror \"open_file: (#{f}) not found\"\n # could check home dir or CDPATH env variable DO\n end\nend",
"def edit( filename )\n\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\tsystem editor, filename.to_s\n\t\tunless $?.success? || editor =~ /vim/i\n\t\t\traise \"Editor exited with an error status (%d)\" % [ $?.exitstatus ]\n\t\tend\n\tend",
"def call_editor\n self.class.call_editor(@repo)\n end",
"def browse (dir, file)\n if dir != \".\"\n file=\"#{dir}/#{file}\"\n if File.isdirectory? file\n system \"browse #{file} &\"\n else\n if File.isfile? file\n\tif ENV['EDITOR']\n\t system format(\"%s %s&\", ENV['EDITOR'], file)\n\telse\n\t sysmte \"xedit #{file}&\"\n\tend\n else\n\tSTDERR.print \"\\\"#{file}\\\" isn't a directory or regular file\"\n end\n end\n end\nend",
"def invoke_editor(file, line = 1, blocking = true)\n fail 'Please export $VISUAL or $EDITOR' unless default_editor\n\n editor_invocation = build_editor_invocation_string(file, line, blocking)\n return nil unless editor_invocation\n\n if jruby?\n open_editor_on_jruby(editor_invocation)\n else\n open_editor(editor_invocation)\n end\n end",
"def open_file_in_editor(index)\n # get the selected filename\n filename=@filtered_files[index]\n\n # launch the vim executable\n task=NSTask.new\n task.setLaunchPath(MAC_VIM_EXECUTABLE)\n task.setArguments(['-g','--remote-tab-silent',filename])\n task.launch\n\n # that's it for ourself, let's go home.\n NSApp.stop(self)\n true\n end",
"def open_mx_source\n `open -a \"TextMate.app\" \"#{src}\";`\n end",
"def edit( filename )\n\t\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\t\tsystem editor, filename\n\t\t\tunless $?.success? || editor =~ /vim/i\n\t\t\t\tfail \"Editor exited uncleanly.\"\n\t\t\tend\n\t\tend",
"def edit_file(filename, editor, initial_text)\n File.open(filename, 'wb') { |f| f.write initial_text }\n\n editor_thread = open_editor nil, editor, filename\n\n trap(\"INT\") { on_signal filename, editor_thread, nil }\n trap(\"ABRT\") { on_signal filename, editor_thread, nil }\n trap(\"QUIT\") { on_signal filename, editor_thread, nil } unless @on_windows\n\n editor_thread.join\n\n text = File.open(filename, 'rb') { |f| f.read }\n cleanup filename\n\n text\n end",
"def open_editor_on_jruby(editor_invocation)\n require 'spoon'\n pid = Spoon.spawnp(*Shellwords.split(editor_invocation))\n Process.waitpid(pid)\n rescue FFI::NotFoundError\n system(editor_invocation)\n end",
"def open_editor_on_jruby(editor_invocation)\n require 'spoon'\n pid = Spoon.spawnp(*Shellwords.split(editor_invocation))\n Process.waitpid(pid)\n rescue FFI::NotFoundError\n system(editor_invocation)\n end",
"def open_document(filename)\n case RUBY_PLATFORM\n when /darwin/\n system(\"open\", filename)\n when /linux/\n system(\"xdg-open\", filename)\n when /windows/\n system(\"cmd\", \"/c\", \"\\\"start #{filename}\\\"\")\n else\n Output.warning(:dont_know_how_to_open_resume)\n end\n end",
"def open(path, kind = :open)\n start\n path = path.gsub \"'\", \"\\\\'\"\n case kind\n when :split\n remote_send '<ESC><ESC><ESC>:split<CR>'\n exec_gvim \"--remote '#{path}'\"\n when :open, :split\n exec_gvim \"--remote '#{path}'\"\n when :tab\n exec_gvim \"--remote-tab '#{path}'\"\n else\n raise \"Unknow open kind: #{kind}\"\n end\n remote_send \"<ESC><ESC><ESC>:buffer #{path}<CR>\"\n focus!\n #Signal.emit_file_opened(path)\n self\n end",
"def editor(files)\n files = remove_binaries(files)\n command = \"$EDITOR #{files.map{|f| \"'#{f.strip}'\"}.join(\" \")}\"\n exec(command)\nend",
"def open_project(path)\n UI.puts \"Opening '#{path}'\"\n `open \"#{path}\"`\n end",
"def ask_editor(input = nil, preferred_editor = nil)\n editor = available_editor preferred_editor\n program = Commander::Runner.instance.program(:name).downcase rescue 'commander'\n tmpfile = Tempfile.new program\n begin\n tmpfile.write input if input\n tmpfile.close\n system(\"#{editor} #{tmpfile.path.shellescape}\") ? IO.read(tmpfile.path) : nil\n ensure\n tmpfile.unlink\n end\n end",
"def editor(buffer_name = 'edit', &block)\n require 'tempfile'\n buffer = Tempfile.new(buffer_name + '-')\n buffer << yield\n buffer.flush\n system(\"$EDITOR #{buffer.path}\")\n buffer.rewind\n output = buffer.read.split(\"\\n\")\n .reject { |line| line =~ /^\\s*#.*$/ }\n .reject { |line| line.empty? }\n buffer.unlink\n output.join(\"\\n\")\n end",
"def open_file f\n return unless f\n\n f = File.expand_path(f) if f.start_with?(\"~/\")\n unless File.exist? f\n # this happens if we use (T) in place of (M)\n # it places a space after normal files and @ and * which borks commands\n last = f[-1]\n f = f.chop if last == ' ' || last == '@' || last == '*'\n end\n\n # could be a bookmark with position attached to it\n f, _nextpos = f.split(':') if f.index(':')\n if File.directory? f\n save_dir_pos\n change_dir f # , nextpos\n elsif File.readable? f\n comm = opener_for f\n # '%%' will be substituted with the filename. See zip\n comm = if comm.index('%%')\n comm.gsub('%%', Shellwords.escape(f))\n else\n comm + \" #{Shellwords.escape(f)}\"\n end\n clear_screen\n reset_terminal\n system(comm.to_s)\n setup_terminal\n # XXX maybe use absolute_path instead of hardcoding\n f = expand_path(f)\n @visited_files.insert(0, f)\n push_used_dirs @current_dir\n else\n perror \"open_file: (#{f}) not found\"\n # could check home dir or CDPATH env variable DO\n end\n redraw_required\nend",
"def open_in_viewer\n fork { exec \"#{Seee::Config.application_paths[:pdf_viewer]} \\\"#{current_path}\\\"\" }\n end",
"def open_editor(writer, editor, filename)\n return Thread.new do\n if writer\n dbg 'Wait for writer thread to sleep (open fifo for writing)...'\n sleep 0.1 while writer.status != 'sleep'\n end\n\n dbg 'Starting editor...'\n ret = system \"#{editor} #{filename}\"\n dbg \"Editor exited with #{ret}\"\n\n raise \"Couldn't run editor!\" unless ret\n end\n end",
"def open(path)\n @last_path = path\n @gtk_menu.popup(nil, nil, 0, 0)\n end",
"def current_editor=(editor)\n @current_editor = editor\n end",
"def open_files *o\n activate\n end",
"def open(file, mode='r', &block)\n if @default == :open_file\n open_file file, mode, &block\n else\n open_hg file, mode, &block\n end\n end",
"def find_editor\n @editor ||= [ENV['VISUAL'], ENV['EDITOR'], 'vim', 'vi', 'notepad.exe'].compact.detect do |cmd|\n system('which', cmd) || File.exist?(cmd)\n end\n end",
"def edit_file( path)\n\t\tVim::command(\"edit #{path}\")\n\tend",
"def editor\n require \"tty-editor\"\n TTY::Editor\n end",
"def edit_file(opts = {})\n File.open(opts[:file]) do |f|\n invoke_editor(f.path, opts[:line], opts[:blocking])\n @content = File.read(f.path)\n end\n end",
"def editor\n require 'tty-editor'\n TTY::Editor\n end",
"def current_file\n @view[@cursor]\nend",
"def current_editor\n @current_editor || creator\n end",
"def open(sender)\n open = NSOpenPanel.openPanel\n open.setAllowsMultipleSelection(true)\n open.setCanChooseDirectories(true)\n open.beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo(\n nil, nil, MOVIE_EXTS, @mainWindow, self,\n 'openPanelDidEnd:returnCode:contextInfo:', nil\n )\n end",
"def launch(package, editor=nil)\n editor ||= @editor || ENV['VISUAL'] || ENV['EDITOR']\n \n if (!editor) || (editor =~ /^\\s*$/) # if the editor is not set, or is blank, exit with a message:\n puts \"Please either set EDITOR or pass in an editor to use\"\n exit 1\n end\n \n paths = package.is_a?(String) ? [package] : package.paths\n # Editors may have options, 'mate -w' for instance\n editor_and_options = editor.strip.split(/\\s+/)\n \n # Launch the editor with its options and any paths that we have been passed\n system(*(editor_and_options + paths))\n end",
"def edit (filename, *data_and_options)\n data, options = *parse_data_and_options(data_and_options)\n editor =\n ENV.has_key?('VISUAL') ? ENV['VISUAL'] :\n ENV.has_key?('EDITOR') ? ENV['EDITOR'] : 'vi'\n\n file_stat = File.stat(filename)\n file_checksum = SHA1.file(filename)\n system(editor, filename, options)\n proc_status = $?\n\n if options[:noop]\n return true\n\n elsif proc_status.success?\n return nil if file_stat == File.stat(filename)\n return false if file_checksum == SHA1.file(filename)\n return true\n\n elsif proc_status.signaled?\n raise AdvFileUtils::CommandError.new(\"editor terminated on signal #{proc_status.termsig}\")\n\n else\n raise AdvFileUtils::CommandError.new(\"editor had non-zero exit code #{proc_status.exitstatus}\")\n end\n end",
"def set_editor\n @editor = Editor.find(params[:id])\n end",
"def open(*args)\n cmd = RUBY_PLATFORM.match(/darwin/) ? 'open' : 'xdg-open'\n open_with(cmd, *args)\n end",
"def default_editor\n # Visual = Advanced editor\n return ENV['VISUAL'] if ENV['VISUAL'] && !ENV['VISUAL'].empty?\n # Editor = basic editor\n return ENV['EDITOR'] if ENV['EDITOR'] && !ENV['EDITOR'].empty?\n if windows?\n 'notepad'\n else\n %w(editor nano vi).find do |editor|\n system(\"which #{editor} > /dev/null 2>&1\")\n end\n end\n end",
"def open\n\t \texec 'open '+@params[0]\n\t end",
"def mercury_edit_path(path = nil)\n mercury_editor_path(path.nil? ? request.path.gsub(/^\\/\\/?(editor)?/, '') : path)\n end",
"def open path, mode=\"r\", &blk\n end",
"def edit(filename)\n file_path = Path.new(filename)\n command \"edit #{file_path}\"\n self\n end",
"def launch(package, editor=nil)\n editor ||= @editor || ENV['QWANDRY_EDITOR'] || ENV['VISUAL'] || ENV['EDITOR']\n \n if (!editor) || (editor =~ /^\\s*$/) # if the editor is not set, or is blank, exit with a message:\n puts \"Please set QWANDRY_EDITOR, VISUAL or EDITOR, or pass in an editor to use (-e editor)\"\n if STDOUT.tty?\n print \"Or, select an editor now: \"\n editor = gets \n else\n exit 1\n end\n end\n \n paths = package.is_a?(String) ? [package] : package.paths\n # Editors may have options, 'mate -w' for instance\n editor_and_options = editor.strip.split(/\\s+/)\n \n Dir.chdir(File.dirname paths.first) do\n # Launch the editor with its options and any paths that we have been passed\n system(*(editor_and_options + paths))\n end\n end",
"def gh_open(path)\n url = url_base + path.chomp\n # use open if on OSX\n if RUBY_PLATFORM.downcase.include?(\"darwin\")\n %x{open #{url}}\n else\n puts url\n end\nend",
"def open_in_file(filepath)\n File.open(filepath, 'rb')\n end",
"def open_related_file\n ensure_file!(framework.related_file)\n VIM.command \"silent :e #{framework.related_file}\"\n rescue RelatedError => e\n VIM.message e.message\n end",
"def open\n raise NotImplementedError.new(\"Method 'open' not implemented by '#{self.class.name}'\")\n end",
"def open path, mode=\"r\", &blk\n end",
"def edit!(filename)\n file_path = Path.new(filename)\n command \"edit! #{file_path}\"\n self\n end",
"def code_browse path\n dr = ruby_renderer\n view(path, :close_key => 'q', :title => $0) do |t|\n t.renderer dr\n t.bind_key([?\\\\,?\\\\,?o],'choose file') { \n str = choose_file \"**/*\"\n if str and str != \"\"\n t.add_content str\n t.buffer_last\n else\n alert \"nothing chosen\"\n end\n }\n end\n end",
"def load_file\n fc = JFileChooser.new\n fc.setDialogTitle(\"Choose Ruby Script File\")\n if fc.showOpenDialog(@frame) == JFileChooser::APPROVE_OPTION\n @ruby_main.file fc.getSelectedFile.absolute_path\n else\n STDERR.puts \"Unrecognized Ruby Script File\"\n end\n end",
"def open_file_dialog(caption, dir = '', options = {})\n Qt::FileDialog.getOpenFileName(options[:parent], caption, dir,\n options[:filter] || '',\n options[:selected_filter] || '')\n end",
"def editor?\n self.editor\n end",
"def open_file(file_name = file_path, options = 'rb')\n # chek if the file name really exists, otherwise raise an exception\n if !File.exists?(file_name)\n raise(IOError, \"File #{file_name} could not be opened.\", caller)\n end\n \n # try to open the specified file if is not already open\n if @file_handle == nil\n @file_handle = File.open(file_name, options)\n \n # check and set the initial position of the reading cursors.\n # It's necessary to do this thing because we don't know if the user\n # has specified the initial reading cursors befort starting working on file\n @position ||= @file_handle.pos\n \n @file_handle.pos = @position\n end\n end",
"def open_file(file_name = file_path, options = 'rb')\n # chek if the file name really exists, otherwise raise an exception\n if !File.exists?(file_name)\n raise(IOError, \"File #{file_name} could not be opened.\", caller)\n end\n \n # try to open the specified file if is not already open\n if @file_handle == nil\n @file_handle = File.open(file_name, options)\n \n # check and set the initial position of the reading cursors.\n # It's necessary to do this thing because we don't know if the user\n # has specified the initial reading cursors befort starting working on file\n @position ||= @file_handle.pos\n \n @file_handle.pos = @position\n end\n end",
"def open(filename, line_number = nil, column_number = nil)\n filename = filename.filepath if filename.is_a? RailsPath\n options = []\n options << \"url=file://#{filename}\"\n options << \"line=#{line_number + 1}\" if line_number\n options << \"column=#{column_number + 1}\" if column_number\n open_url \"txmt://open?\" + options.join(\"&\")\n end",
"def editor_name\n File.basename(pry_instance.config.editor).split(\" \").first\n end",
"def open(file_path)\n raise NotImplementedError.new 'This is only a function body for documentation'\n end",
"def open\n if os_x?\n 'open'\n elsif linux?\n 'xdg-open'\n else\n raise \"Platform #{RUBY_PLATFORM} not supported\"\n end\n end",
"def openFile path, mode\n\t\tFile.open(path, mode)\n\tend",
"def open_file(filename)\n File.open(filename, 'r')\n end",
"def open_command\n if darwin?\n 'open'\n elsif windows?\n 'start'\n else\n 'xdg-open'\n end\n end",
"def open(path, &block)\n File.open(File.join(self.path, path), \"r\", &block)\n end",
"def open\n @is_running = true\n run_interpreter\n end",
"def vi\n system \"vim ~/.scratchvim.rb\"\nend",
"def cmd_edit(*args)\n\t\tif (args.length == 0)\n\t\t\tprint_line(\"Usage: edit file\")\n\t\t\treturn true\n\t\tend\n\n\t\t# Get a temporary file path\n\t\tmeterp_temp = Tempfile.new('metassh')\n\t\tmeterp_temp.binmode\n\t\ttemp_path = meterp_temp.path\n\n\t\tbegin\n\t\t\t# Download the remote file to the temporary file\n\t\t\tclient.fs.file.download_file(temp_path, args[0])\n\t\trescue RequestError => re\n\t\t\t# If the file doesn't exist, then it's okay. Otherwise, throw the\n\t\t\t# error.\n\t\t\tif re.result != 2\n\t\t\t\traise $!\n\t\t\tend\n\t\tend\n\n\t\t# Spawn the editor (default to vi)\n\t\teditor = Rex::Compat.getenv('EDITOR') || 'vi'\n\n\t\t# If it succeeds, upload it to the remote side.\n\t\tif (system(\"#{editor} #{temp_path}\") == true)\n\t\t\tclient.fs.file.upload_file(args[0], temp_path)\n\t\tend\n\n\t\t# Get rid of that pesky temporary file\n\t\ttemp_path.close(true)\n\tend",
"def open_command\n darwin? ? 'open' : 'xdg-open'\n end",
"def click_open_openas_popup(title, open_file_path)\n click_button_saveas_or_openas_popup(title, open_file_path, \"&Open\")\nend",
"def open_in_browser\n puts url\n `#{open} #{url}`\n end",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def on_entry_activation(sender)\n [email protected]\n open_file_in_editor(idx)\n end",
"def os_open(*args)\n cmd = RUBY_PLATFORM.end_with?('linux') ? 'xdg-open' : 'open'\n system(cmd, *args)\n end",
"def open(path)\n document = parse(File.read(path))\n document.path = path\n document\n end",
"def open_browser\n `open #{@report_file.path}`\n end",
"def click_open_file_dialog_popup(title)\n click_button_popup(title, \"&Open\")\nend",
"def ed\n \tAas::Application.DocumentManager.MdiActiveDocument.Editor\n end",
"def open( *args, &block ) # :yield: file\n File.open( expand_tilde, *args, &block )\n end",
"def current_file\n @path || @parent.current_file rescue nil\n end",
"def open\n object.open\n end",
"def is_editor?\n redirect_to root_path if !@is_editor\n end",
"def open(filename, mode = 'r', &block)\n raise NotImplementedError\n end",
"def editor?\n true\n end",
"def open\n system \"open #{@output}\"\n end",
"def open(_filename, _mode = 'r')\n raise NotImplementedError\n end",
"def open_file f, ch = nil\n location = $files.index(f)\n fullrow = $full_data[location]\n ch = column_menu fullrow unless ch\n return if ch.to_i > fullrow.size\n url = fullrow[ch.to_i]\n system \"#{$open_command} #{url}\"\n return # 2014-07-25 - 22:43 \n return unless f\nend"
] | [
"0.7969313",
"0.7969313",
"0.7921218",
"0.77874136",
"0.7464126",
"0.73881567",
"0.7286962",
"0.7279407",
"0.7226133",
"0.704737",
"0.6853889",
"0.6805099",
"0.68046224",
"0.6772369",
"0.6739086",
"0.6689621",
"0.65286225",
"0.6495167",
"0.6491517",
"0.6440104",
"0.63972884",
"0.6362203",
"0.6341816",
"0.63177687",
"0.6254268",
"0.62162554",
"0.61820805",
"0.61407423",
"0.61303157",
"0.6065077",
"0.6035969",
"0.59985864",
"0.59675646",
"0.5948241",
"0.59214216",
"0.5909799",
"0.59089977",
"0.5902929",
"0.58997285",
"0.58885205",
"0.5877951",
"0.5861389",
"0.5841733",
"0.5825354",
"0.57862496",
"0.57232445",
"0.57194805",
"0.5661695",
"0.5661098",
"0.5655052",
"0.56368655",
"0.5629921",
"0.5622997",
"0.5619917",
"0.55603755",
"0.5552028",
"0.55312276",
"0.55251706",
"0.5522839",
"0.5515129",
"0.550521",
"0.5504708",
"0.54987115",
"0.5425055",
"0.53999096",
"0.53874147",
"0.53855664",
"0.53755504",
"0.53750867",
"0.53750867",
"0.5345136",
"0.5340354",
"0.5338853",
"0.53351045",
"0.53317356",
"0.53295696",
"0.53259075",
"0.53243077",
"0.53226805",
"0.5321032",
"0.5314894",
"0.5310209",
"0.5306602",
"0.5300404",
"0.52883124",
"0.52753705",
"0.5248824",
"0.5230094",
"0.52201056",
"0.52142924",
"0.5211715",
"0.5209531",
"0.5190074",
"0.5179733",
"0.5174379",
"0.5168776",
"0.5164396",
"0.5160579",
"0.5145564",
"0.51383895"
] | 0.585707 | 42 |
Open current file or directory with the viewer. | def view
pager = ENV['PAGER'] || 'less'
execute_external_command do
unless in_zip?
system %Q[#{pager} "#{current_item.path}"]
else
begin
tmpdir, tmpfile_name = nil
Zip::File.open(current_zip) do |zip|
tmpdir = Dir.mktmpdir
FileUtils.mkdir_p File.join(tmpdir, File.dirname(current_item.name))
tmpfile_name = File.join(tmpdir, current_item.name)
File.open(tmpfile_name, 'w') {|f| f.puts zip.file.read(current_item.name)}
end
system %Q[#{pager} "#{tmpfile_name}"]
ensure
FileUtils.remove_entry_secure tmpdir if tmpdir
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_in_viewer\n fork { exec \"#{Seee::Config.application_paths[:pdf_viewer]} \\\"#{current_path}\\\"\" }\n end",
"def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end",
"def open(sender)\n open = NSOpenPanel.openPanel\n open.setAllowsMultipleSelection(true)\n open.setCanChooseDirectories(true)\n open.beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo(\n nil, nil, MOVIE_EXTS, @mainWindow, self,\n 'openPanelDidEnd:returnCode:contextInfo:', nil\n )\n end",
"def view(file_or_dir, options)\n device = options[:device]\n viewer = ImageViewer.new(device, options)\n\n if File.directory?(file_or_dir)\n files = Dir.glob(\"#{file_or_dir}/*\")\n\n if options[:interactive]\n viewer.interactive(files)\n else\n viewer.slideshow(files)\n end\n else\n viewer.view(file_or_dir)\n sleep\n end\n end",
"def view(file_or_dir, options)\n device = options[:device]\n password = options[:password]\n url = options[:url]\n\n if url\n Airplay.configure { |c| c.autodiscover = false }\n device = Airplay.devices.add(\"Apple TV\", url)\n end\n device.password = password if password\n\n viewer = ImageViewer.new(device, options)\n\n if File.directory?(file_or_dir)\n files = Dir.glob(\"#{file_or_dir}/*\")\n\n if options[:interactive]\n viewer.interactive(files)\n else\n viewer.slideshow(files)\n end\n else\n viewer.view(file_or_dir)\n sleep\n end\n end",
"def open_browser\n `open #{@report_file.path}`\n end",
"def show_preview path\n @windows.load_preview path\n end",
"def open_document(filename)\n case RUBY_PLATFORM\n when /darwin/\n system(\"open\", filename)\n when /linux/\n system(\"xdg-open\", filename)\n when /windows/\n system(\"cmd\", \"/c\", \"\\\"start #{filename}\\\"\")\n else\n Output.warning(:dont_know_how_to_open_resume)\n end\n end",
"def open\n system(ENV['EDITOR'], NIKKI_FILE)\n end",
"def open\n ensure!\n open_in_editor\n end",
"def open(path, kind = :open)\n start\n path = path.gsub \"'\", \"\\\\'\"\n case kind\n when :split\n remote_send '<ESC><ESC><ESC>:split<CR>'\n exec_gvim \"--remote '#{path}'\"\n when :open, :split\n exec_gvim \"--remote '#{path}'\"\n when :tab\n exec_gvim \"--remote-tab '#{path}'\"\n else\n raise \"Unknow open kind: #{kind}\"\n end\n remote_send \"<ESC><ESC><ESC>:buffer #{path}<CR>\"\n focus!\n #Signal.emit_file_opened(path)\n self\n end",
"def browse (dir, file)\n if dir != \".\"\n file=\"#{dir}/#{file}\"\n if File.isdirectory? file\n system \"browse #{file} &\"\n else\n if File.isfile? file\n\tif ENV['EDITOR']\n\t system format(\"%s %s&\", ENV['EDITOR'], file)\n\telse\n\t sysmte \"xedit #{file}&\"\n\tend\n else\n\tSTDERR.print \"\\\"#{file}\\\" isn't a directory or regular file\"\n end\n end\n end\nend",
"def open(path)\n @last_path = path\n @gtk_menu.popup(nil, nil, 0, 0)\n end",
"def open_in_browser\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n url = todo_data.get_trac_url(task_index)\n Launchy.open(url)\n end\n end",
"def show(path = @path) \n write(path)\n file = path + @filename + '.png'\n if windows?\n system %{cmd /c \"start #{file}\"}\n elsif mac?\n file_to_open = \"/path/to/file.txt\"\n system %{open \"#{file}\"}\n elsif linux?\n begin \n system %{xdg-open \"#{file}\"}\n system %{cmd.exe /c \"start #{file}\"}\n rescue \n system %{cmd.exe /c \"start #{file}\"}\n end\n end\n end",
"def current_file\n @view[@cursor]\nend",
"def open(file = nil, editor: nil, command: nil)\n Editor.new(edit_command(editor, command), file).open\n end",
"def open_files *o\n activate\n end",
"def open_project(path)\n UI.puts \"Opening '#{path}'\"\n `open \"#{path}\"`\n end",
"def open\n\t \texec 'open '+@params[0]\n\t end",
"def open_viewer(urn,access_token)\n path = File.expand_path(File.dirname(__FILE__))\n url = \"file://#{path}/viewer.html?token=#{access_token}&urn=#{urn}\"\n text_to_print_in_color = \"Please open the following url in your favorite browser:\\n#{url}\"\n puts(\"\\e[7m#{text_to_print_in_color}\\e[27m\")\n\nend",
"def open(*args)\n cmd = RUBY_PLATFORM.match(/darwin/) ? 'open' : 'xdg-open'\n open_with(cmd, *args)\n end",
"def open_file_in_editor(index)\n # get the selected filename\n filename=@filtered_files[index]\n\n # launch the vim executable\n task=NSTask.new\n task.setLaunchPath(MAC_VIM_EXECUTABLE)\n task.setArguments(['-g','--remote-tab-silent',filename])\n task.launch\n\n # that's it for ourself, let's go home.\n NSApp.stop(self)\n true\n end",
"def open_file_dialog(caption, dir = '', options = {})\n Qt::FileDialog.getOpenFileName(options[:parent], caption, dir,\n options[:filter] || '',\n options[:selected_filter] || '')\n end",
"def open_in_browser\n puts url\n `#{open} #{url}`\n end",
"def open_sourcefile\n editor.open RubyEdit::SOURCE_FILE_LOCATION, command: @config.editor\n end",
"def show\n\t\tsend_file(params[:path])\n end",
"def open(file, mode='r', &block)\n if @default == :open_file\n open_file file, mode, &block\n else\n open_hg file, mode, &block\n end\n end",
"def open_file\n fileName = Qt::FileDialog.getOpenFileName(self, tr(\"Open file\"), \"\", \"DICOM-files (*)\")\n load_dicom(fileName) unless fileName.nil?\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def browse(number)\n request = get_request_by_number(number)\n Launchy.open(request.html_url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def open\n annotation = Annotation.find(params[\"id\"])\n redirect_to :controller => :viewer,\n :annotation => annotation.name,\n :username => annotation.user.username\n end",
"def open_file f\n return unless f\n\n f = File.expand_path(f) if f.start_with?(\"~/\")\n unless File.exist? f\n # this happens if we use (T) in place of (M)\n # it places a space after normal files and @ and * which borks commands\n last = f[-1]\n f = f.chop if last == ' ' || last == '@' || last == '*'\n end\n\n # could be a bookmark with position attached to it\n f, _nextpos = f.split(':') if f.index(':')\n if File.directory? f\n save_dir_pos\n change_dir f # , nextpos\n elsif File.readable? f\n comm = opener_for f\n # '%%' will be substituted with the filename. See zip\n comm = if comm.index('%%')\n comm.gsub('%%', Shellwords.escape(f))\n else\n comm + \" #{Shellwords.escape(f)}\"\n end\n clear_screen\n reset_terminal\n system(comm.to_s)\n setup_terminal\n # XXX maybe use absolute_path instead of hardcoding\n f = expand_path(f)\n @visited_files.insert(0, f)\n push_used_dirs @current_dir\n else\n perror \"open_file: (#{f}) not found\"\n # could check home dir or CDPATH env variable DO\n end\n redraw_required\nend",
"def open_in_editor(file)\n if (ENV['EDITOR'])\n system (\"#{ENV['EDITOR']} #{file}\")\n end\nend",
"def open_in_editor(file)\n if (ENV['EDITOR'])\n system (\"#{ENV['EDITOR']} #{file}\")\n end\nend",
"def viewer( pdf )\n\tProcess.fork do\n\t\tENV['DISPLAY'] = ':0.1'\n\t\texec \"evince #{pdf}\"\n\tend if `lsof #{pdf}`.empty?\nend",
"def click_open_file_dialog_popup(title)\n click_button_popup(title, \"&Open\")\nend",
"def open(filename, line_number = nil, column_number = nil)\n filename = filename.filepath if filename.is_a? RailsPath\n options = []\n options << \"url=file://#{filename}\"\n options << \"line=#{line_number + 1}\" if line_number\n options << \"column=#{column_number + 1}\" if column_number\n open_url \"txmt://open?\" + options.join(\"&\")\n end",
"def openFile path, mode\n\t\tFile.open(path, mode)\n\tend",
"def switch_to_view\n unless ( name = path_matcher.controller_name )\n return\n end\n # figure out what the name of def we are in is\n action = find_function_under_cursor\n view = File.join(project_root, \"/app/views/#{name}/#{action}\")\n\n # open the according view (most likely non existant)\n if !File.exists?(view)\n %w(erb html.erb haml html.haml js.erb xml.erb).each do |try|\n if File.exists?(\"#{view}.#{try}\")\n view += \".#{try}\"\n break\n end\n end\n end\n\n open_file view\n end",
"def visit(file)\n @path ||= 'Safari.app'\n `open #{file} -a #{@path} -g`\n end",
"def browse_file(p, file)\n File.join(p.path, 'browse', file)\n end",
"def prompt_open_file(initial_directory=nil,filters=nil,title=\"Open CSV File\")\r\n\tfc = JFileChooser.new\r\n\tfc.setDialogTitle(title)\r\n\tif !filters.nil?\r\n\t\tfnef = nil\r\n\t\tfilters.each do |k,v|\r\n\t\t\tfnef = FileNameExtensionFilter.new(k,*v)\r\n\t\t\tfc.addChoosableFileFilter(fnef)\r\n\t\tend\r\n\t\tfc.setFileFilter(fnef)\r\n\tend\r\n\r\n\tif !initial_directory.nil?\r\n\t\tfc.setCurrentDirectory(java.io.File.new(initial_directory))\r\n\tend\r\n\r\n\tif fc.showOpenDialog(nil) == JFileChooser::APPROVE_OPTION\r\n\t\treturn fc.getSelectedFile\r\n\telse\r\n\t\treturn java.io.File.new(\"\")\r\n\tend\r\nend",
"def open_file f, ch = nil\n location = $files.index(f)\n fullrow = $full_data[location]\n ch = column_menu fullrow unless ch\n return if ch.to_i > fullrow.size\n url = fullrow[ch.to_i]\n system \"#{$open_command} #{url}\"\n return # 2014-07-25 - 22:43 \n return unless f\nend",
"def view_selected_files\n fname = write_selected_files\n\n unless fname\n message 'No file selected. '\n return\n end\n\n system \"$PAGER #{fname}\"\n setup_terminal\nend",
"def view_file\n @document = Document.find(params[:id])\n @folder = @document.folder\n display_collaborators\n end",
"def open(filename, index_path: nil)\n @logfile = DRoby::Logfile::Reader.open(filename, index_path: index_path)\n self.window_title = \"roby-display: #{filename}\"\n emit sourceChanged\n analyze\n unless history.empty?\n apply(history[history.keys.min][1])\n end\n end",
"def code_browse path\n dr = ruby_renderer\n view(path, :close_key => 'q', :title => $0) do |t|\n t.renderer dr\n t.bind_key([?\\\\,?\\\\,?o],'choose file') { \n str = choose_file \"**/*\"\n if str and str != \"\"\n t.add_content str\n t.buffer_last\n else\n alert \"nothing chosen\"\n end\n }\n end\n end",
"def edit_current\n command = ENV['EDITOR'] || ENV['VISUAL'] || 'vim'\n run_on_current command\n @visited_files.insert(0, expand_path(current_file))\nend",
"def open\n raise NotImplementedError.new(\"Method 'open' not implemented by '#{self.class.name}'\")\n end",
"def open\n system \"open #{@output}\"\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def open\n object.open\n end",
"def click_open_openas_popup(title, open_file_path)\n click_button_saveas_or_openas_popup(title, open_file_path, \"&Open\")\nend",
"def gh_open(path)\n url = url_base + path.chomp\n # use open if on OSX\n if RUBY_PLATFORM.downcase.include?(\"darwin\")\n %x{open #{url}}\n else\n puts url\n end\nend",
"def open\n @is_running = true\n run_interpreter\n end",
"def open\n require \"launchy\"\n\n Launchy.open(BASE_URL)\n end",
"def show(filename)\n File.read File.join(@base_path, filename)\n end",
"def open_file f\n return unless f\n unless File.exist? f\n # this happens if we use (T) in place of (M) \n # it places a space after normal files and @ and * which borks commands\n last = f[-1]\n if last == \" \" || last == \"@\" || last == '*'\n f = f.chop\n end\n end\n if File.directory? f\n change_dir f\n elsif File.readable? f\n system(\"$EDITOR #{Shellwords.escape(f)}\")\n f = Dir.pwd + \"/\" + f if f[0] != '/'\n $visited_files.insert(0, f)\n push_used_dirs Dir.pwd\n else\n perror \"open_file: (#{f}) not found\"\n # could check home dir or CDPATH env variable DO\n end\nend",
"def choose_file_and_view glob=nil, startdir=\".\"\n glob ||= \"**/*.rb\"\n str = choose_file glob, :title => \"Select a file\", \n :directory => startdir,\n :help_text => \"Enter pattern, use UP DOWN to traverse, Backspace to delete, ENTER to select. Esc-Esc to quit\"\n if str and str != \"\"\n code_browse str\n end\n end",
"def open_report_in_browser(device=nil)\n if device.nil?\n path = File.expand_path('./reports')\n else\n path = File.expand_path(\"./reports/#{device}\")\n end\n\n unless File.exists?(path)\n @log.fatal{ 'required directory is missing - see $ briar help cucumber-reports' }\n @log.fatal{ \"expected directory at '#{path}'\" }\n exit 1\n end\n\n open_path = Dir[\"#{path}/*.html\"].sort_by { |file_name|\n File.stat(file_name).mtime\n }.last\n\n if open_path.nil?\n @log.warn{ 'there are no reports to open' }\n @log.warn{ \"checked in #{path}\" }\n exit 0\n end\n\n system \"open #{open_path}\"\nend",
"def os_open(*args)\n cmd = RUBY_PLATFORM.end_with?('linux') ? 'xdg-open' : 'open'\n system(cmd, *args)\n end",
"def open_project(widget)\n # Filter for the file chooser\n filter = Gtk::FileFilter.new\n filter.name = '.cproj'\n filter.add_pattern('*.cproj')\n\n # File chooser dialog\n chooser = create_chooser filter, Gtk::Stock::OPEN,\"Choose a .cproj file\" \n\n # Check the user input\n chooser.run do |r|\n if r == Gtk::Dialog::RESPONSE_ACCEPT\n @project.open chooser.filename\n @treeView.create_tree @project\n end\n chooser.destroy\n end\n end",
"def open_file(filename, line_number = nil, column_number = nil)\n options = []\n options << \"url=file://#{URI.escape(filename)}\"\n options << \"line=#{line_number + 1}\" if line_number\n options << \"column=#{column_number + 1}\" if column_number\n open_url \"txmt://open?\" + options.join(\"&\")\n end",
"def method_missing(name, *args, &block)\n send :open, name\n end",
"def open_film(film_path)\n\t\tprint \"* J'ouvre le film, merci de patienter…\".bleu\n\t\tvlc(<<-CODE)\nactivate\nfullscreen\nset fullscreen mode to false\nopen \"#{film_path}\"\nif not playing then\n\tplay\nend if\nset bounds of front window to {0, 23, 960, 489}\nplay -- pour arrêter\n\t\tCODE\n\t\tputs \"\\r= Film ouvert, tu peux commencer la collecte.\".vert\n\tend",
"def load_file\n panel = NSOpenPanel.new\n panel.setCanChooseFiles(true)\n panel.setCanChooseDirectories(false)\n panel.runModalForTypes([\"qif\"])\n @file = panel.filename\n unless @file.nil?\n @file_label.text = \"File: #{@file}\"\n log(\"File successfully loaded\")\n end\n end",
"def open(file_path)\n raise NotImplementedError.new 'This is only a function body for documentation'\n end",
"def open_mx_source\n `open -a \"TextMate.app\" \"#{src}\";`\n end",
"def open path, mode=\"r\", &blk\n end",
"def open(*args, &block) # :yield: file\n File.open(path, *args, &block)\n end",
"def open_command\n darwin? ? 'open' : 'xdg-open'\n end",
"def request_file(options = Hash.new,&block)\n _options = default_options_for_cocoa_dialog(options)\n _options[\"title\"] = options[:title] || \"Select File\"\n _options[\"informative-text\"] = options[:prompt] || \"\"\n _options[\"text\"] = options[:default] || \"\"\n _options[\"select-only-directories\"] = \"\" if options[:only_directories]\n _options[\"with-directory\"] = options[:directory] if options[:directory]\n cocoa_dialog(\"fileselect\", _options,&block)\n end",
"def open\r\n visit \"/\"\r\n end",
"def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end",
"def open\n html_url = url.sub('.json?', '?')\n Launchy.open(html_url)\n end",
"def open_related_file\n ensure_file!(framework.related_file)\n VIM.command \"silent :e #{framework.related_file}\"\n rescue RelatedError => e\n VIM.message e.message\n end",
"def open(browser, url=\"\")\n case browser\n when 'chrome'\n `open -a '/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome' #{url}`\n when 'firefox'\n `open -a 'Firefox' #{url}`\n when 'safari'\n `open -a 'Safari' #{url}`\n end\nend",
"def my_edit(args)\n path = args[0]\n return if editing_forbidden_files(path)\n\n system(\"#{ENV['EDITOR_PATH']} #{path}\")\n end",
"def select_current\n ## vp is local there, so i can do $vp[0]\n #open_file $view[$sta] if $view[$sta]\n if $mode == \"forum\"\n display_forum $view[$cursor]\n else\n on_enter get_current_title\n end\nend",
"def open_html\n console_message(J2R.open_file_command(@report.temp_html))\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end",
"def open_feed_file(test=false)\n open_file(self.link, test)\n end",
"def launch_editor(path)\n unless File.exists?(path)\n raise Errno::ENOENT, \"Unable to open #{path}\"\n end\n\n # Allow for \"other\" editors\n if File.exists?(\"/usr/bin/editor\")\n editor = \"/usr/bin/editor\"\n else\n editor = \"vim\"\n end\n\n system(\"#{editor} #{path}\")\n end",
"def open path, mode=\"r\", &blk\n end",
"def open(path, &block)\n File.open(File.join(self.path, path), \"r\", &block)\n end",
"def open(path)\n document = parse(File.read(path))\n document.path = path\n document\n end",
"def show_browse_form(p_starting_path = nil)\n\t\t\n\t\t\t# If available as argument, select the path within the Tree View\n\t\t\t@dir_browse_ui.select_path(p_starting_path) unless p_starting_path.nil?\n\t\t\n\t\t\t# Show Browse form\n\t\t\t@dir_browse_form.show\n\t\t\t@dir_browse_form.activateWindow\t\t\n\t\tend",
"def open_in_file(filepath)\n File.open(filepath, 'rb')\n end",
"def opened\n end",
"def open()\n \n #note we would want to check for the browser being open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://store.mage.dev/admin\") #note this should be from setting file\n event(\"Post\")\n end",
"def set_viewer\n @viewer = Viewer.find(params[:id])\n end",
"def open(*args, &block)\n end",
"def open_editor\n return if ENV['EDITOR'].nil?\n\n file = Tempfile.new('cocoapods')\n File.chmod(0777, file.path)\n file.close\n\n system(\"#{ENV['EDITOR']} #{file.path}\")\n @message = File.read file.path\n end",
"def get_view(filename)\n full_file = File.join(options.views, filename)\n if File.exists?(full_file)\n view_file = full_file \n else\n view_directory = File.join(File.dirname(__FILE__),'views')\n view_file = File.join(view_directory,filename)\n end\n open(view_file,'r') { |file| file.read }\n end",
"def get_view(filename)\n full_file = File.join(options.views, filename)\n if File.exists?(full_file)\n view_file = full_file \n else\n view_directory = File.join(File.dirname(__FILE__),'views')\n view_file = File.join(view_directory,filename)\n end\n open(view_file,'r') { |file| file.read }\n end",
"def browser_open_linux(url)\n system(\"xdg-open\", url)\n end"
] | [
"0.781872",
"0.6997111",
"0.67266864",
"0.67022246",
"0.6667257",
"0.6482035",
"0.6454375",
"0.64361364",
"0.6367363",
"0.6297417",
"0.6258015",
"0.6227832",
"0.6223393",
"0.6219053",
"0.6166791",
"0.61420774",
"0.6094677",
"0.606768",
"0.6066725",
"0.60534966",
"0.60240424",
"0.6004777",
"0.59696716",
"0.59657323",
"0.5962764",
"0.58013237",
"0.57911235",
"0.5786789",
"0.5760605",
"0.57274",
"0.57274",
"0.5710031",
"0.5690221",
"0.56688726",
"0.56666684",
"0.5664607",
"0.5664607",
"0.5653496",
"0.5641306",
"0.56325334",
"0.56239974",
"0.5603741",
"0.5593102",
"0.55916446",
"0.5587464",
"0.55863756",
"0.5582875",
"0.5567314",
"0.5546014",
"0.554119",
"0.55382764",
"0.5537233",
"0.55371207",
"0.5536204",
"0.5532794",
"0.55152345",
"0.55084723",
"0.5472169",
"0.5467587",
"0.54529166",
"0.5445506",
"0.5398638",
"0.539542",
"0.5377782",
"0.5367331",
"0.536669",
"0.5364803",
"0.53458446",
"0.53330165",
"0.5317398",
"0.53097266",
"0.52914923",
"0.5289616",
"0.52791077",
"0.5273218",
"0.5265646",
"0.5261749",
"0.5261303",
"0.5260734",
"0.52592736",
"0.5254365",
"0.52504337",
"0.523897",
"0.5238463",
"0.5238463",
"0.52290595",
"0.5220162",
"0.5214556",
"0.52145183",
"0.5207823",
"0.5207308",
"0.52043825",
"0.5196412",
"0.51916957",
"0.5178094",
"0.51730543",
"0.51691824",
"0.5167493",
"0.5167493",
"0.5162969"
] | 0.5240972 | 82 |
GET /events GET /events.json | def index
@events = Event.all
respond_to do |format|
format.html
format.json do
render :json => {events: @events}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def events(project_id, options = {})\n get \"projects/#{project_id}/events\", options\n end",
"def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end",
"def events\n data[\"events\"]\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n @events = @category.events\n render json: @events \n end",
"def index\n\t\t@events = current_user.events\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end",
"def index\n render json: Event.all, status: :ok\n end",
"def show\n render json: @event, status: :ok\n end",
"def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_with(@events)\n end",
"def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end",
"def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def events\n collection(\"events\")\n end",
"def event(event, options = {})\n get \"events/#{event}\", options\n end",
"def past_events\n @events = Event.past\n render json: @events, include: :talks\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def index\n begin\n events = Event.all\n render :json => {events: ActiveModel::ArraySerializer.new(events, each_serializer: EventsSerializer), :code => 200}, status: :ok\n rescue Exception => e\n logger.error {\"Error while populating list of events. ErrorMessage: #{e.message}, Params: #{params.inspect}\"}\n render json: {error: e.message, code: 500}\n end\n end",
"def show\n \trender json: @event\n end",
"def show\n @events = fetch_events\n end",
"def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end",
"def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end",
"def index\n if params[:query].present?\n @events = GroupEvent.send(params[:query])\n else\n @events = GroupEvent.published\n end\n\n render json: @events\n end",
"def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end",
"def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def details\n get(\"v1/event/#{@id}\")\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end",
"def show\n render json: format_event(@event)\n end",
"def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end"
] | [
"0.8337294",
"0.82393",
"0.7943906",
"0.7928331",
"0.77682066",
"0.77408546",
"0.76701826",
"0.7665501",
"0.76581633",
"0.7642472",
"0.76212007",
"0.7615658",
"0.7615658",
"0.7612881",
"0.75687",
"0.7488667",
"0.74813455",
"0.74698067",
"0.7441679",
"0.74408287",
"0.7439104",
"0.7438",
"0.7410777",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74091715",
"0.74001324",
"0.73986024",
"0.73760885",
"0.7367902",
"0.7366312",
"0.7364237",
"0.7363436",
"0.73616976",
"0.73616976",
"0.73616976",
"0.73616976",
"0.73616976",
"0.73592705",
"0.7352217",
"0.7334486",
"0.73247266",
"0.7320335",
"0.72969604",
"0.72951084",
"0.7288287",
"0.7282072",
"0.72735256",
"0.72733235",
"0.72477293",
"0.7245006",
"0.7228475",
"0.7228475",
"0.72234964",
"0.72129667",
"0.72124153",
"0.7182632",
"0.71820146",
"0.71711934",
"0.71332264",
"0.712864",
"0.7123786",
"0.7122708",
"0.7114666",
"0.7110134",
"0.7110134",
"0.7104194",
"0.71022034",
"0.7101582",
"0.7101437",
"0.7099895",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326",
"0.70996326"
] | 0.7522498 | 15 |
GET /events/1 GET /events/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def details\n get(\"v1/event/#{@id}\")\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def show\n\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myevent }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end",
"def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def show\n render json: @event, status: :ok\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end",
"def event(event, options = {})\n get \"events/#{event}\", options\n end",
"def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"def index\n render json: Event.all, status: :ok\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def event(id, options = {})\n get \"events/#{id}\", options\n end",
"def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end",
"def show\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event_type = EventType.find(@event.event_type_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def index\n @event = Event.find(params[:event_id])\n\n end",
"def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def show\n \trender json: @event\n end",
"def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_with(@events)\n end",
"def show\n render json: format_event(@event)\n end",
"def show\n @current_event = CurrentEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_event }\n end\n end",
"def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def show\n begin\n @event = Event.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to show invalid event #{params[:id]}\"\n redirect_to events_path, notice: 'Invalid event ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end\n end",
"def index\n @events = @category.events\n render json: @events \n end",
"def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event, methods: [:talks] }\n end\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end",
"def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end",
"def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n @events = Event.find(@calendar.event_ids)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @calendar }\n end\n end"
] | [
"0.75029767",
"0.74019474",
"0.7361382",
"0.7348975",
"0.73475033",
"0.7338018",
"0.7317425",
"0.72875094",
"0.72813755",
"0.7246173",
"0.72317284",
"0.7219172",
"0.7219172",
"0.7218839",
"0.7218839",
"0.721464",
"0.7204848",
"0.71989256",
"0.7196662",
"0.71925515",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7192214",
"0.7190171",
"0.7189989",
"0.71858066",
"0.71843475",
"0.71817815",
"0.7178166",
"0.716525",
"0.71637964",
"0.7158998",
"0.71580267",
"0.7120116",
"0.7120116",
"0.7120116",
"0.7120116",
"0.7120116",
"0.7104676",
"0.7098543",
"0.70866513",
"0.7075021",
"0.7071629",
"0.70692325",
"0.70692325",
"0.7067004",
"0.70606047",
"0.70606047",
"0.70606047",
"0.70606047",
"0.70606047",
"0.70606047",
"0.70606047",
"0.70606047",
"0.70606047",
"0.70606047",
"0.7050251",
"0.7043129",
"0.70385677",
"0.70330113",
"0.7027942",
"0.7025206",
"0.70196456",
"0.6993209",
"0.69843143",
"0.69733816",
"0.69682246",
"0.69497913",
"0.6949218",
"0.6943893",
"0.6929541",
"0.69259447",
"0.6922537",
"0.69194067",
"0.6912311",
"0.6893206",
"0.689077",
"0.687633",
"0.6853893",
"0.6851784"
] | 0.0 | -1 |
POST /events POST /events.json | def create
@event = Event.new(event_params)
respond_to do |format|
if @event.save
format.html { redirect_to @event, notice: 'Event was successfully created.' }
format.json { render :show, status: :created, location: @event }
else
format.html { render :new }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n megam_rest.post_event(to_hash)\n end",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @event = Event.new.from_json(params[:event])\n @event.user_id = @user.id\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.organizer = current_user\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_created) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params['user_id'] = current_user.id if current_user\n @event = Event.new(event_params)\n\n if @event.save\n render json: { location: format_event(@event) }, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to \"/#{@event.url}\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end",
"def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n render :show, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event = Events::Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: \"Event #{@event} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: events_path(@event) }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, event: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end",
"def create\n \n @event = Event.new(event_params)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_event = Event::Event.new(params[:event_event])\n\n respond_to do |format|\n if @event_event.save\n format.html { redirect_to @event_event, notice: 'Event was successfully created.' }\n format.json { render json: @event_event, status: :created, location: @event_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to dashboard_home_path }\n format.json { render 'event', status: :created, event: @event }\n else\n format.html { render dashboard_home_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n logger.debug @event.errors.inspect\n format.html { redirect_to @event, notice: 'データが新規作成されました。' }\n format.json { render :show, status: :created, location: @event }\n else\n logger.debug @event.errors.to_hash(true)\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_event_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, flash: {success: 'Event was successfully created.'} }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, success: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'El evento fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Event was successfully created.\"\n format.html { redirect_to @event }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end",
"def create\n @event = current_user.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_success) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_events\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Aula cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to action: :index, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_user_event_path(current_user), notice: 'event was successfully created.' }\n format.json\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n @event.url = BASE_URL + @event.name.gsub(' ', '_')\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = @calendar.events.new(event_params)\n respond_to do |format|\n if @event.save\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Wydarzenie zostało utworzone.\"\n format.html {redirect_to @event}\n format.json {render :show, status: :created, location: @event}\n else\n format.html {render :new}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_registration_path(id: @event.id), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end",
"def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event, status: 201\n @user_event = UserEvent.create(admin: true, event_id: @event.id, user_id: current_user.id)\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @myevent = Myevent.new(params[:myevent])\n\n respond_to do |format|\n if @myevent.save\n format.html { redirect_to @myevent, notice: 'Myevent was successfully created.' }\n format.json { render json: @myevent, status: :created, location: @myevent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036",
"0.7081109",
"0.7080767",
"0.7071589",
"0.7057984",
"0.70422375",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7018503",
"0.7016941",
"0.70167124",
"0.70091015",
"0.70081246",
"0.6989661",
"0.6987218",
"0.6970633",
"0.6970633",
"0.6966775",
"0.6948742",
"0.6942416",
"0.6936477",
"0.69359535",
"0.69359535",
"0.69318086",
"0.69268054",
"0.6907236",
"0.6905569",
"0.69051725",
"0.6904514",
"0.6902843",
"0.69011873",
"0.6899826",
"0.68961006",
"0.68811166",
"0.68746495",
"0.68642014",
"0.68642014",
"0.6843213",
"0.68419445",
"0.6836244",
"0.68352246",
"0.6820027",
"0.68000513",
"0.6791519"
] | 0.6948119 | 71 |
PATCH/PUT /events/1 PATCH/PUT /events/1.json | def update
respond_to do |format|
if @event.update(event_params)
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
format.json { render :show, status: :ok, location: @event }
else
format.html { render :edit }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end",
"def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end",
"def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html {redirect_to @event, notice: 'Event was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: 'edit'}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n @event.save!\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #require \"pry\"; binding.pry\n\n update_users\n\n respond_to do |format|\n if @event.update(event_params)\n sync_update @event\n format.html { redirect_to @event, notice: t(\"successfully_updated\", :model => t(\"models.event\")) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: events_path(@event) }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to '/', notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @event.update(event_params)\n\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n event_id = params[:id]\n if event_id.present? && params[:event].present? && @user.uuid.present? && @user.uuid != \"guest\"\n event_params = params[:event]\n @event = Com::Nbos::Events::Event.where(id: params[:id], user_id: @user.id ).first\n if @event.present?\n @event.update(event_params.permit!)\n if @event.save\n render :json => @event\n else\n data = add_error_messages(@event)\n render :json => data\n end\n else\n render :json => {\"messageCode\": \"module.user.unauthorized\", \"message\": \"Unauthorized to update others Event\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def update\r\n respond_to do |format|\r\n if @event.update(event_params)\r\n format.html { redirect_to @event, notice: 'Event 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: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n if @event_event.update_attributes(params[:event_event])\n format.html { redirect_to @event_event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n \tdata = { data: @event, status: :ok, message: \"Event was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to edit_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.752944",
"0.73721",
"0.71765804",
"0.7171193",
"0.71704644",
"0.7142285",
"0.7095896",
"0.70823616",
"0.70823616",
"0.705728",
"0.70204586",
"0.6989217",
"0.6982309",
"0.69782525",
"0.69601846",
"0.69542354",
"0.69542354",
"0.6952027",
"0.6920712",
"0.6920712",
"0.6920712",
"0.6920712",
"0.6920712",
"0.6920712",
"0.6920712",
"0.6920712",
"0.6920712",
"0.6915535",
"0.68934184",
"0.688265",
"0.68786705",
"0.68630475",
"0.68576723",
"0.6855425",
"0.6852446",
"0.68460387",
"0.68460387",
"0.68460387",
"0.6839253",
"0.6839072",
"0.68350476",
"0.68242496",
"0.6815937",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6813682",
"0.6811495",
"0.6806997",
"0.6792617",
"0.6792617",
"0.6792617",
"0.6792617",
"0.6792617",
"0.6792617",
"0.6792617",
"0.6792617",
"0.67886126",
"0.6780958",
"0.677533"
] | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.json | def destroy
@event.destroy
respond_to do |format|
format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end",
"def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @events = Event.where(event_id: params[:id])\n @events.each.destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @myevent = Myevent.find(params[:id])\n @myevent.destroy\n\n respond_to do |format|\n format.html { redirect_to myevents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n\n sync_destroy @event\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html {redirect_to events_url}\n format.json {head :no_content}\n end\n end",
"def destroy\n @calevent = Calevent.find(params[:id])\n @calevent.destroy\n\n respond_to do |format|\n format.html { redirect_to calevents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n render :nothing => true, :status => 200, :content_type => 'text/plain'\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: t(:event_deleted) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_events_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end",
"def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_to_client_path(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_request = EventRequest.find(params[:id])\n @event_request.destroy\n\n respond_to do |format|\n format.html { redirect_to event_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Мероприятие успешно удалено.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = current_user.events.find_by_url(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_event.destroy\n respond_to do |format|\n format.html { redirect_to post_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = @current_account.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to eventos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eventtype.events.each do |e|\n e.destroy\n end\n @eventtype.destroy\n respond_to do |format|\n format.html { redirect_to eventtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n @event.destroy \n respond_to do |format|\n format.html { redirect_to events_url, success: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.mobile { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @create_event = CreateEvent.find(params[:id])\n @create_event.destroy\n\n respond_to do |format|\n format.html { redirect_to create_events_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.76929694",
"0.7688217",
"0.7688217",
"0.7688217",
"0.7681325",
"0.7585923",
"0.75685203",
"0.7560765",
"0.7541314",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75410026",
"0.75407314",
"0.7538618",
"0.7537845",
"0.75270605",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7519828",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7515053",
"0.7495719",
"0.74660254",
"0.7460513",
"0.7453805",
"0.7447235",
"0.7440681",
"0.7440677",
"0.74352366",
"0.7433521",
"0.7402055",
"0.73883057",
"0.7378132",
"0.7372413",
"0.73654723",
"0.7338665",
"0.73354304",
"0.73354304",
"0.73233044",
"0.73011655",
"0.7297207",
"0.7291023",
"0.72906876",
"0.72897285",
"0.72883385",
"0.7285439",
"0.7284677",
"0.7282717",
"0.7272616",
"0.7270284"
] | 0.0 | -1 |
convert angle into radian | def to_rad(angle)
angle * Math::PI / 180
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def deg2rad(angle)\n angle * (Math::PI / 180.0)\n end",
"def rad2rad(rad)\r\n remt(rad, PI2)\r\n end",
"def to_rad\n self * Math::PI / 180\n end",
"def grados2radianes(alfa)\n\t\treturn ((alfa*Math::PI)/180)\n\tend",
"def deg2rad\n self * (Math::PI/180)\n end",
"def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def sec_to_rad(x)\n x*Math::PI/(180*3600)\n end",
"def angle\n rad / Math::PI * 180\n end",
"def degree_to_radian(d)\n d * DEG2RAD\n end",
"def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend",
"def deg2rad(deg)\n deg*Math::PI/180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def convertToRadians(val)\n return val * PIx / 180\n end",
"def deg_to_rads(deg)\n deg * Math::PI / 180.0\n end",
"def g2r(n)\n\tn*(Math::PI/180)\nend",
"def deg_to_rad(deg)\n return (2 * Math::PI) * deg / 360\n end",
"def norm_angle(angle)\n while angle < 0; angle += Const::PI2; end\n while angle > Const::PI2; angle -= Const::PI2; end\n return angle\n rescue => e\n raise\n end",
"def to_rad(n_decimals = nil)\n include Math unless defined?(Math)\n radians = self * PI / 180.0\n return radians if n_decimals.nil?\n radians.round(n_decimals)\n end",
"def convert_to_radians(degrees)\n degrees * PI / 180\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def conv_degree_to_radian(aNum)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n return (aNum * Degree_to_radian_mult)\r\nend",
"def to_radians\n self * Math::PI.fdiv(180)\n end",
"def rad2deg\n self * (180/Math::PI)\n end",
"def radians\n self * 180 / Math::PI\n end",
"def to_radians(n)\n r = n * (Math::PI / 180)\n return r\n end",
"def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end",
"def radians\n Science::Angle.new(self, :radians)\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def convert_and_normalize_radians(angle)\n @radians = normalize_angle(angle, (2 * Math::PI))\n @degrees = rad_to_deg(@radians)\n end",
"def declination_rad\n if @declination_rad.nil?\n @declination_rad = inclination_rad - PI / 2\n @declination_rad -= PI / 2 while @declination_rad > PI / 2\n end\n @declination_rad\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def reduce_angle(a)\n modtwopi(a)\n end",
"def to_radians(mod = false)\n if mod\n (self * Math::PI / 180) % Math::PI\n else\n self * Math::PI / 180\n end\n end",
"def toRadians(degree)\n return degree*Math::PI/180\nend",
"def deg2rad(deg, wrap = true)\r\n rad = DR * deg\r\n rad = rad2rad(rad) if wrap\r\n rad\r\n end",
"def calculate_rad_angle_between(target)\n Math.atan2(target.y - y, target.x - x)\n end",
"def radians(deg)\n deg * Math::PI / 180\n end",
"def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend",
"def angle\n @angle\n end",
"def angular_velocity_rad_s\n 2 * PI / period_s\n end",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def to_radians(mod = false)\n return self.to_dec_degrees.to_radians(mod)\n end",
"def radianToDegre( radian )\n return radian / RADIAN_TO_DEGREE\n end",
"def to_rad(n_decimals = nil)\n map { |e| e.to_rad(n_decimals) }\n end",
"def turn_right(angle)\n @angle = @angle -angle*Math::PI / 180\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def conv_radian_to_degree(aNum)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n return (aNum * Radian_to_degree_mult)\r\nend",
"def to_radians(deg)\n deg * Math::PI / 180\n end",
"def grad2rad(grad, wrap = true)\r\n rad = GR * grad\r\n rad = rad2rad(rad) if wrap\r\n rad\r\n end",
"def other_angle(a, b)\n 180 - (a + b)\nend",
"def rad_to_deg(rad)\n return 360 * rad / (2 * Math::PI)\n end",
"def degrees_to_radians degrees\n # The :: operator is much like the scope\n # resolution operator in C++\n degrees * Math::PI / 180.0\nend",
"def convert_and_normalize_degrees(angle)\n @degrees = normalize_angle(angle, 360)\n @radians = deg_to_rad(@degrees)\n end",
"def to_radians(degrees)\n degrees * (Math::PI / 180)\n end",
"def radians(deg)\n deg * DEG_TO_RAD\n end",
"def degrees_to_radians(degrees)\n degrees * DEG_TO_RAD\n end",
"def rotate( angle_rad )\n dup.rotate!( angle_rad )\n end",
"def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend",
"def angles_diff(a1, a2)\n diff = a2 - a1\n while diff > Math::PI\n diff -= 2.0 * Math::PI\n end\n while diff < -Math::PI\n diff += 2.0 * Math::PI\n end\n diff\n end",
"def /(other)\n return self.class.radians(@angle / other)\n end",
"def angle()\n a, c = @view__.angle, @context__\n c ? c.fromDegrees__(a) : a * Processing::GraphicsContext::DEG2RAD__\n end",
"def round_radians(rads)\n #p \"round rad\"\n new_num = (rads/(Math::PI/NUM_SEGMENTS)).round(0)*(Math::PI/NUM_SEGMENTS)\n diff = (new_num - Math::PI).abs\n diff_2_pi =(new_num - Math::PI*2).abs\n if diff < 0.0001 and rads > Math::PI\n new_num = Math::PI + Math::PI/180\n elsif new_num == 0 or diff_2_pi < 0.0001\n if rads < 1\n new_num = (Math::PI/NUM_SEGMENTS)\n else\n new_num = Math::PI*2 - (Math::PI/NUM_SEGMENTS)\n end\n end\n #puts \"PIE: \" + Math::PI.to_s\n #puts \"Radians rounded: \" + new_num.to_s\n new_num\n end",
"def rotate\n @angle += Math::PI / 16\n @angle = @angle % (Math::PI * 2)\n end",
"def rad2deg(rad, wrap = true)\r\n deg = RD * rad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end",
"def to_r\n Number.rationalize(value)\n end",
"def rotate!( angle_rad )\n self.angle += angle_rad\n self\n end",
"def tri_angle(ang1, ang2, ang3)\n angles = [ang1, ang2, ang3]\n return :invalid unless valid_angles?(angles)\n return :right if angles.include?(90)\n return :acute if angles.all? { |ang| ang < 90 }\n return :obtuse\nend",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def degreesToRadians(deg)\n\treturn deg * (Math::PI/180)\nend",
"def rt_ascen\n radian_to_degree(bigdecimal_atan2(bigdecimal_cos(degree_to_radian(obliquity)) * bigdecimal_sin(degree_to_radian(ec_lon)), bigdecimal_cos(degree_to_radian(ec_lon))))\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end",
"def anglecw\n 360 - angle\n end",
"def calcuradio\r\n\t\tradio = (@perimetro)/(@pi)/(@dos)\r\n\t\treturn radio\r\n\tend",
"def theta_deg\n theta_rad / DEG2RAD\n end",
"def polar\n return abs, arg\n end",
"def determind_sight_angles(angle)\n case direction\n when 2; value = [270 + angle, 270 - angle]\n when 4; value = [180 + angle, 180 - angle]\n when 6; value = [ 0 + angle, 0 - angle]\n when 8; value = [ 90 + angle, 90 - angle]\n end\n value[0] = (value[0] + 360) % 360\n value[1] = (value[1] + 360) % 360\n return value\n end",
"def angle\n Math.atan2(@y, @x)\n end",
"def angle\n v = to_vec\n if v[1] == 0.0\n nil\n else\n v.angle\n end\n end",
"def to_radians(coordinates)\n coordinates.to_f * (Math::PI / 180)\n end",
"def polar\n [abs, arg]\n end",
"def polar(x,y)\n theta = Math.atan2(y,x) # Compute the angle\n r = Math.hypot(x,y) # Compute the distance\n [r, theta] # The last expression is the return value\nend",
"def test_correcto\n\t\tassert_equal(12, @circle.rad(75.36) )\n\tend",
"def to_r\n Rational(@val, @div)\n end",
"def to_foorth_r\r\n self.rationalize\r\n end",
"def degrees\n self * Math::PI / 180\n end",
"def polar(x,y)\n theta = Math.atan2(y,x) # Compute the angle\n r = Math.hypot(x,y) # Compute the distance\n [r, theta] # The last expression is the return value\nend",
"def to_r\n return Rational(numerator,denominator)\n end",
"def r\n Math::sqrt(r2)\n end",
"def r t90\n t90 >= 0 ?\n r0*(1 + a*t90 + b*t90**2) :\n r0*(1 + a*t90 + b*t90**2 - 100*c*t90**3 + c*t90**4)\n end",
"def return_rational(numerator)\n\t\tnumerator/36.to_r\n\tend",
"def angle_direction(a,b)\n magnitude = angle_difference(a,b)\n if angle_difference(a + 1, b) < magnitude\n magnitude\n else\n -magnitude\n end\n end",
"def toR\n if @unit == 'F' then\n @unit = 'R'\n @value += 459.67\n elsif @unit == 'C' then\n @unit = 'R'\n @value = 1.8 * @value + 491.67\n elsif @unit == 'K' then\n @unit = 'R'\n @value *= 1.8\n end\n self\n end",
"def iralmidon\n vag=(almidon * 100) / 90\n vag.round(2)\n end",
"def turn_right\n @angle += ROTATION_SPEED\n end"
] | [
"0.8188487",
"0.81217587",
"0.80756223",
"0.79066086",
"0.7888177",
"0.7733667",
"0.7690215",
"0.7642279",
"0.7455517",
"0.7417873",
"0.7374782",
"0.73061264",
"0.72938514",
"0.72599244",
"0.70856446",
"0.70856446",
"0.70626193",
"0.7046213",
"0.7024125",
"0.70218194",
"0.70045155",
"0.69863516",
"0.69357276",
"0.69357276",
"0.69244105",
"0.6911483",
"0.6907112",
"0.68460685",
"0.6820203",
"0.6765304",
"0.6758245",
"0.6730201",
"0.6655119",
"0.66226506",
"0.66156155",
"0.6552967",
"0.65472585",
"0.6543502",
"0.6538538",
"0.64549893",
"0.6450399",
"0.64294416",
"0.6423482",
"0.64118516",
"0.6379142",
"0.6356456",
"0.6354112",
"0.6354081",
"0.6316485",
"0.6295705",
"0.62946075",
"0.62943244",
"0.62758464",
"0.6271109",
"0.62681204",
"0.6234801",
"0.62319404",
"0.6231843",
"0.6210038",
"0.6202878",
"0.6195379",
"0.61638415",
"0.6138361",
"0.60880035",
"0.60626036",
"0.6046137",
"0.60045433",
"0.59701306",
"0.5949378",
"0.59343046",
"0.5933458",
"0.5924396",
"0.5913666",
"0.5904528",
"0.58922815",
"0.5891407",
"0.58900344",
"0.5889363",
"0.58868486",
"0.5882449",
"0.5871131",
"0.5867282",
"0.5833774",
"0.5831441",
"0.5803236",
"0.5793416",
"0.5791009",
"0.5790234",
"0.57475317",
"0.57473695",
"0.57388777",
"0.5734307",
"0.57176685",
"0.57116616",
"0.57085586",
"0.5706887",
"0.57057774",
"0.570182",
"0.5689121",
"0.56884724"
] | 0.842279 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_event
@event = Event.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 event_params
params.require(:event).permit(:name, :description, :event_image, :venue, :location_lati, :location_long, :category, :subcategories, :cost, :date, :time, :address)
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 valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\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 origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.62905645",
"0.6289235",
"0.6283876",
"0.62425834",
"0.62410337",
"0.6218672",
"0.62151134",
"0.62096137",
"0.6192354",
"0.6178057",
"0.6177618",
"0.61727077",
"0.6162073",
"0.6152049",
"0.61515594",
"0.61458135",
"0.6122875",
"0.61165285",
"0.6107696",
"0.6104097",
"0.6091097",
"0.6080201",
"0.60699946",
"0.6063739",
"0.60206395",
"0.60169303",
"0.60134894",
"0.601003",
"0.6007347",
"0.6007347",
"0.6001054",
"0.59997267",
"0.5997844",
"0.5991826",
"0.5991213",
"0.59911627",
"0.5980111",
"0.5967009",
"0.59597385",
"0.5958542",
"0.595787",
"0.5957425",
"0.59522784",
"0.5951228",
"0.59423685",
"0.5939385",
"0.5939122",
"0.5939122",
"0.59325653",
"0.5930178",
"0.59248054",
"0.59243476",
"0.59164625",
"0.59106",
"0.59101933",
"0.59084356",
"0.5905666",
"0.58975077",
"0.58974737",
"0.5895128",
"0.58946574",
"0.589308",
"0.58916",
"0.5885987",
"0.58838505",
"0.58792",
"0.58723736",
"0.58684355",
"0.58677715",
"0.5865701",
"0.5865538",
"0.5865288",
"0.586385",
"0.5862139",
"0.58614355",
"0.58593005",
"0.5857459",
"0.58541363",
"0.58536613",
"0.58520085",
"0.585011"
] | 0.0 | -1 |
Unshift this log_hash to the top of the session_info array | def to_hash
log_hash = {
'date' => @date,
'duration' => @duration,
'contents' => @contents,
'notes' => {
'q1' => @q1,
'q2' => @q2,
'q3' => @q3
}
}
return log_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_info_to_payload(payload)\n super\n payload.merge!(Logstasher.payload_from_request( request ))\n payload.merge!( { session: session } )\n if logged_in?\n payload.merge!(Logstasher.payload_from_user( current_user ))\n end\n end",
"def prepend(hash_stack)\n @stack.unshift *hash_stack.stack\n self\n end",
"def restore\n GLOBAL_HASH_TABLE[@session_id]\n end",
"def unshift(hash, value = nil)\n hash = { hash => value } unless hash.is_a?(Hash)\n replace(hash.merge(self).merge(hash))\n end",
"def append_info_to_payload(payload)\n super\n payload[:referrer] = request&.referrer\n payload[:session_id] = request&.session&.id\n payload[:user_agent] = request&.user_agent\n end",
"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 pop_unshift(target)\n conn.rpoplpush key, target.to_s\n end",
"def append_info_to_payload(payload) #:nodoc:\n LogStasher.add_default_fields_to_payload(payload, request)\n if respond_to?(:logstasher_add_custom_fields_to_request_context)\n logstasher_add_custom_fields_to_request_context(LogStasher.request_context)\n end\n\n if respond_to?(:logstasher_add_custom_fields_to_payload)\n before_keys = payload.keys.clone\n logstasher_add_custom_fields_to_payload(payload)\n after_keys = payload.keys\n # Store all extra keys added to payload hash in payload itself. This is a thread safe way\n LogStasher::CustomFields.add(*(after_keys - before_keys))\n end\n\n payload[:status] = response.status\n super(payload)\n\n LogStasher.store.each do |key, value|\n payload[key] = value\n end\n\n LogStasher.request_context.each do |key, value|\n payload[key] = value\n end\n end",
"def cookie_hash_offset\n super\n end",
"def append_info_to_payload(payload)\n super(payload)\n payload[:ip] = request.remote_ip\n payload[:admin_user_id] = current_admin_user.id if current_admin_user.present?\n payload[:user_id] = current_user.id if current_user.present?\n end",
"def append_info_to_payload(payload)\n super\n\n # Use the request ID generated by the aamzon ALB, if available\n payload[:request_id] = request.headers.fetch(\"X-Amzn-Trace-Id\", request.request_id)\n payload[:remote_ip] = request.remote_ip\n payload[:user_agent] = request.user_agent\n end",
"def puts_top\n g.dup\n g.push_self\n g.swap\n g.send :p, 1, true\n g.pop\n end",
"def serialize_into_session(record)\n [record.serializable_hash.transform_keys(&:to_s), nil]\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 serialize_into_session(record)\n [record.serializable_hash.stringify_keys, nil]\n end",
"def inject!(hash); end",
"def compress_history()\n if self.counts[actor][\"requests\"].length > self.history_length\n to_delete = self.counts[actor][\"requests\"].length - self.history_length\n self.counts[actor][\"requests\"].slice!(0..to_delete-1)\n end\n end",
"def initialize(hash)\n @sessions = []\n @users = []\n\t@users = hash\n end",
"def merge(log)\n @entryList.concat(log.entryList) ;\n end",
"def add_identity_to_log\n RequestLocals.store[:identity] = {\n vendor_api_token_id: @current_vendor_api_token&.id,\n provider_id: current_provider&.id,\n }\n end",
"def imprimir_hash\n p @array_hash\n end",
"def mongo_fix_session_keys(session = {})\n new_session = Hash.new\n session.to_hash.each do |i, j|\n new_session[i.gsub(/\\./i, \"|\")] = j.inspect\n end unless session.empty?\n new_session\n end",
"def strip_hash( hash, cloned=true )\n\t\tnewhash = cloned ? hash.dup : hash\n\t\tnewhash.default = nil if newhash.default_proc\n\t\tnewhash.each_key {|key|\n\t\t\tcase newhash[ key ]\n\t\t\twhen Hash\n\t\t\t\tnewhash[ key ] = strip_hash( newhash[key], false )\n\n\t\t\twhen Proc, Method, UnboundMethod, IO\n\t\t\t\tself.log.warning \"Stripping unserializable object from session \" \\\n\t\t\t\t\t\"hash: %p\" % newhash[ key ]\n\t\t\t\tnewhash[ key ] = \"[Can't serialize a %s]\" % newhash[ key ].class\n\t\t\tend\n\t\t}\n\n\t\treturn newhash\n\tend",
"def log str\n $logger_array.unshift str\nend",
"def append_info_to_payload(payload)\n super\n payload[:remote_ip] = request.remote_ip\n payload[:request_id] = request.uuid\n end",
"def add_to_search_history(search)\n h = session[:history]\n h = h ? h.reject(&:blank?).unshift(search.id).uniq : [search.id]\n session[:history] = h.first(blacklight_config.search_history_window)\n end",
"def append_info_to_payload(payload)\n super\n payload[:remote_ip] = request.remote_ip\n end",
"def append_info_to_payload(payload)\n super\n payload[:uid] = current_user.id if logged_in?\n end",
"def sessionsbutthis(ses)\n\t\[email protected]{ \n\t\t\tcopy=Array.new @sessions\n\t\t\tcopy.delete ses\n\t\t\tcopy\n\t\t}\n\tend",
"def copy_session_variables!; end",
"def headers=(hash); end",
"def headers=(hash); end",
"def append_info_to_payload(payload)\n super\n request_logging_context_data.each do |key, value|\n payload[key] = BlackSquareLoggingRails.format_value(value)\n end\n\n # Add request parameters to lograge output when the logger is in DEBUG mode\n if BlackSquareLoggingRails.enable_request_parameter_logging\n parameters = request.filtered_parameters.except(*ActionController::LogSubscriber::INTERNAL_PARAMS)\n payload[:request_params] = BlackSquareLoggingRails.format_value(parameters) if parameters.any?\n end\n end",
"def prepend(entry=SymMap.new)\r\n @list.insert(0, entry)\r\n end",
"def logs\n @logs.dup\n end",
"def append(log_record)\r\n self.log_records << log_record\r\n log_record.identifiers.each do |id|\r\n self.identifiers << id if not self.identifiers.include? id\r\n end\r\n end",
"def append_info_to_payload(payload)\n super\n payload[:request_id] = request.uuid\n payload[:user_id] = current_user.id if current_user\n payload[:account_id] = current_account.cname if current_account\n end",
"def add_to_hash(hash)\n super\n contact.add_to_hash(hash)\n hash['user_over_13'] = @user_over_13 || !@new_user\n hash['last_logged_in'] = fmt_date_time(@data_object.user_last_logged_in)\n hash['first_logged_in'] = fmt_date_time(@data_object.user_first_logged_in)\n# aff_opts = Affiliate.options\n\n hash\n end",
"def shift\n\t\titem = @h.shift\n\t\tif item.nil?\n\t\t\treturn nil\n\t\tend\n\t\treturn [item.k, item.v]\n\tend",
"def unshift(item)\n conn.lpush key, item\n self\n end",
"def populate_session(aPlayer)\n\t\tsession[:email] = @player.email\n\t\tsession[:player_id] = @player.id \n\t\tsession[:admin] = @player.admin\n\t\tsession[:login_time] = Time.now.to_i \n\tend",
"def hijacked; end",
"def reset_log_data\n without_logging { update_all(log_data: nil) }\n end",
"def copy_object_to_session(hash)\n flash['session'] ||= {}\n hash.is_a?(Hash) && hash.each { |k,v| flash['session'][k] = v }\n persist_session!\n nil\n end",
"def previous_events(event)\n # Initialise the hash to use an empty array as default value\n @dups ||= Hash.new { |h, k| h[k] = [] }\n one_hour_earlier = event.start.advance(:hours => -1)\n @dups[one_hour_earlier]\n end",
"def hash_offset\n super\n end",
"def inject(hash); end",
"def top_level_row row\n @top_level[row[:key]] = row[:value]\n track_row_print row, 1\n end",
"def unaltered(hash)\n hash\n end",
"def log_notes\n session[:log_notes]||[]\n end",
"def insert_unlogged_uid\n \"Set-Cookie: uid=#{@unlogged_info[0][1]}\"\n end",
"def getOrderedArray()\n\t\tary = Array.new\n\t\[email protected]{ |k,v|\n\t\t\tif @log[k] != nil\n\t\t\t\t@log[k].each{ |x|\n\t\t\t\t\tary.push(x)\n\t\t\t\t}\n\t\t\tend\n\t\t}\n\t\tary.sort!\n\t\treturn ary\n\n\tend",
"def initialize(session)\n @now = session || Hash.new\n @next = Hash.new\n super(@now)\n end",
"def log_source\n\t\t\"session_#{name.to_s}\"\n\tend",
"def rewind_to(tag)\n log.rewind_to(self, tag)\n end",
"def history_log_attributes\n {}\n end",
"def reset_log_data\n self.class.without_logging { update_column(:log_data, nil) }\n end",
"def phi_log_keys\n @__phi_log_id = persisted? ? \"Key: #{attributes[self.class.primary_key]}\" : \"Object: #{object_id}\"\n @__phi_log_keys = [PHI_ACCESS_LOG_TAG, self.class.name, @__phi_log_id]\n end",
"def process_log_output(output)\n in_message = false\n hsh_array = []\n hsh = nil\n\n output.each_line do |line|\n line = line.chomp\n\n if line[0].nil?\n in_message = !in_message\n next\n end\n\n if in_message\n hsh[\"message\"] << \"#{line[4..]}\\n\"\n next\n end\n\n key, *value = line.split\n key = key.sub(\":\", \"\").downcase\n value = value.join(\" \")\n\n case key\n when \"commit\"\n hsh_array << hsh if hsh\n hsh = {\"sha\" => value, \"message\" => +\"\", \"parent\" => []}\n when \"parent\"\n hsh[\"parent\"] << value\n when \"author\"\n tmp = value.split(\"<\")\n hsh[\"author\"] = tmp[0].strip\n hsh[\"email\"] = tmp[1].sub(\">\", \"\").strip\n when \"date\"\n hsh[\"date\"] = DateTime.parse(value)\n else\n hsh[key] = value\n end\n end\n hsh_array << hsh if hsh\n hsh_array\n end",
"def push_dup; end",
"def merge_log_weasel_header(headers)\n if LogWeasel::Transaction.id\n headers.merge(LogWeasel::Middleware::KEY_HEADER => LogWeasel::Transaction.id)\n else\n headers\n end\n end",
"def replace_history_entry (which, line, data)\r\n if (which < 0 || which >= @history_length)\r\n return nil\r\n end\r\n temp = Struct.new(:line,:timestamp,:data).new\r\n old_value = @the_history[which]\r\n temp.line = line.delete(0.chr)\r\n temp.data = data\r\n temp.timestamp = old_value.timestamp.dup\r\n @the_history[which] = temp\r\n old_value\r\n end",
"def hsub!(hash)\n self.class.hsub(self, hash)\n end",
"def query_log_entry\n @top_query_log_entry\n end",
"def append_info_to_payload(payload)\n super\n payload[:host] = @user_domain\n end",
"def writeHistory()\n\t\t$target_stats.each do |k,v|\n\t\t\[email protected]({k=>v})\n\t\tend\n\tend",
"def set_previous_audit_log_data\n @previous_object = @product_section || ProductSection.find_by_id(params[:id])\n end",
"def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n end",
"def prev_hash\n return nil unless out_point\n out_point.tx_hash\n end",
"def log_source\n\t\t\"session_#{name}\"\n\tend",
"def rewind\n @seen.clear\n super\n end",
"def push_line(timestamp, logline)\n lines << [timestamp, logline]\n stats[logline.method] += 1\n stats[:requests] += 1\n end",
"def set_last_request(info_request)\n session[:last_request_id] = info_request.id\n session[:last_body_id] = nil\n end",
"def stack_push_hash(h)\n\n Lib.lua_createtable(@pointer, 0, h.size)\n # since we already know the size of the table...\n\n h.each do |k, v|\n stack_push(k)\n stack_push(v)\n Lib.lua_settable(@pointer, -3)\n end\n end",
"def concat(hash_stack)\n @stack.concat hash_stack.stack\n self\n end",
"def unshift(line)\n @lines.unshift(line) if line\n nil\n end",
"def add_to_search_history(*args)\n super\n\n session[:history_counter] ||= 0\n session[:history_counter] += 1\n end",
"def header(hash)\n self._headers.merge!(hash)\n end",
"def log_hash_ins(hash_obj)\n #Sort out fileuploads - it would simply bee too big to log this.\n hash_obj = self.log_hash_safe(hash_obj)\n\n inserts_links = []\n ret = {}\n [:keys, :values].each do |type|\n if type == :keys\n hash = Knj::ArrayExt.hash_keys_hash(hash_obj)\n else\n hash = Knj::ArrayExt.hash_values_hash(hash_obj)\n end\n\n data_id = @db.single(:Log_data, {\"id_hash\" => hash})\n data_id = data_id[:id] if data_id\n\n if !data_id\n data_id = @db.insert(:Log_data, {\"id_hash\" => hash}, {:return_id => true})\n\n link_count = 0\n hash_obj.keys.sort.each do |key|\n if type == :keys\n ins_data = \"#{key.to_s}\"\n else\n ins_data = \"#{hash_obj[key].to_s}\"\n end\n\n ins_data = ins_data.force_encoding(\"UTF-8\") if ins_data.respond_to?(:force_encoding)\n data_value_id = @ob.static(:Log_data_value, :force_id, ins_data)\n inserts_links << {:no => link_count, :data_id => data_id, :value_id => data_value_id}\n link_count += 1\n end\n end\n\n if type == :keys\n ret[:keys_data_id] = data_id\n else\n ret[:values_data_id] = data_id\n end\n end\n\n @db.insert_multi(:Log_data_link, inserts_links)\n\n return ret\n end",
"def add_identity_to_log\n RequestLocals.store[:identity] = { candidate_id: current_candidate&.id }\n end",
"def fix_first_index\n # This makes me feel *so* dirty :/\n sub_arr = @subtitles.to_a\n idx1 = sub_arr[0][0]\n idx2 = sub_arr[1][0]\n\n @subtitles[idx2 - 1] = @subtitles.delete idx1 # At least I learnt this trick :) How to rename a hash key\n end",
"def gather_ip\n\tip=[]\n\t@ip=[] #hold our unique IP found in logs\n\t@ipz=Hash.new #create new hash for storage of ip with associated number of occurances\n\tif not @bin_logz.empty?\n\t\t@bin_logz.each do |log| #Check Binary Logs\n\t\t\tooo = File.stat(file)\n\t\t\toatime=foo.atime #atime before edit\n\t\t\tomtime=foo.mtime #mtime before edit\n\t\t\tf=File.open(log, 'rb')\n\t\t\tfoo = f.readlines\n\t\t\tf.close\n\t\t\tip << foo.to_s.scan(/([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})/).uniq #Each uniq IP found is captured in our @ip array for further enumeration later....\n\t\t\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\n\t\tend\n\tend\n\tif not @logz.empty?\n\t\[email protected] do |log| #Non-Binary Logs\n\t\t\tooo = File.stat(file)\n\t\t\toatime=foo.atime #atime before edit\n\t\t\tomtime=foo.mtime #mtime before edit\n\t\t\tf=File.open(log)\n\t\t\tfoo = f.readlines\n\t\t\tf.close\n\t\t\tip << foo.to_s.scan(/([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})/).uniq #Each uniq IP found is captured and added into our @ip array for further enumeration later....\n\t\t\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\n\t\tend\n\tend\n\tip.each do |i|\n\t\tif not i.nil?\n\t\t\ti.each do |p|\n\t\t\t\t@ip << p\n\t\t\tend\n\t\tend\n\tend\n\tif @ip.empty?\n\t\tputs \"#{HC}#{FRED}No Unique IP Found in Logs Files#{FWHT}?#{RS}\"\n\telse\n\t\t@ip = @ip.uniq #Make sure we remove duplicate entries since we combined logs, etc\n\t\[email protected] #Array size should equal the number of matches found\n\t\tif isize.to_i < 25\n\t\t\tputs \"#{HC}#{FGRN}Only found #{FWHT}#{isize}#{FGRN} unique IP in Log Files#{FWHT}!#{RS}\"\n\t\t\[email protected] do |ip|\n\t\t\t\tputs \"#{HC}#{FGRN}IP#{FWHT}: #{ip}#{RS}\" \n\t\t\tend\n\t\telse\n\t\t\tputs \"#{HC}#{FGRN}Found #{FWHT}#{isize}#{FGRN} unique IP in Log Files#{FWHT}!#{RS}\"\n\t\t\tputs \"#{HC}#{FGRN}Checking which occur the most, might take a sec#{FWHT}.....#{RS}\\n\"\n\t\t\t#Now that we have unique IP, lets see which ones have the highest occurance in the log files we already found....\n\t\t\[email protected] do |ip|\n\t\t\t\tocc=0\n\t\t\t\tif not @bin_logz.empty?\n\t\t\t\t\t@bin_logz.each do |log| #Binary log\n\t\t\t\t\t\tooo = File.stat(file)\n\t\t\t\t\t\toatime=foo.atime #atime before edit\n\t\t\t\t\t\tomtime=foo.mtime #mtime before edit\n\t\t\t\t\t\tf=File.open(log)\n\t\t\t\t\t\tfoo = f.readlines\n\t\t\t\t\t\tf.close\n\t\t\t\t\t\tocc = occ.to_i + foo.to_s.scan(/(#{ip[0]})/).count #increase our occurances variable by the number of times it was found\n\t\t\t\t\t\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif not @logz.empty?\n\t\t\t\t\[email protected] do |log| #Non-Binary Log\n\t\t\t\t\t\tooo = File.stat(file)\n\t\t\t\t\t\toatime=foo.atime #atime before edit\n\t\t\t\t\t\tomtime=foo.mtime #mtime before edit\n\t\t\t\t\t\tf=File.open(log)\n\t\t\t\t\t\tfoo = f.readlines\n\t\t\t\t\t\tf.close\n\t\t\t\t\t\tocc = occ.to_i + foo.to_s.scan(/(#{ip[0]})/).count #increase our occurances variable by the number of times it was found\n\t\t\t\t\t\tFile.utime(oatime, omtime, file) #Keep timestamp preserved\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\[email protected](ip[0], occ) #Add each value after searching into our hash\n\t\t\tend\n\t\t\[email protected]_by { |key, value| value } #Sorts them by count value (i.e. 1,2,3,4,5) \n\t\t\ttop = Hash[@ipz.sort_by { |key, value| -value }.first 25] #Now that they have been sorted, pop off the top 5 found\n\t\t\tputs \"#{HC}#{FGRN}Top 25 Unique IP in Log Files#{FWHT}: #{RS}\"\n\t\t\ttop.each do |key, value|\n\t\t\t\tif not key.nil?\n\t\t\t\t\tputs \"#{HC}#{FGRN}The IP '#{FWHT}#{key}#{FGRN}' was found #{FWHT}#{value}#{FGRN} times#{FWHT}!#{RS}\" #Print the IP associated with each value for Top 5 Found\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tputs\n\tend\nend",
"def sso_logging_info\n { user_uuid: @current_user&.uuid,\n sso_cookie_contents: sso_cookie_content,\n request_host: request.host }\n end",
"def remember(base)\n base.session[:last_visited_blog_id] = self.id\n base.session[:last_visited_blog_seo] = self.seo_id\n end",
"def reset!\n @sess_hash = {}\n end",
"def log=(log); end",
"def add_session(session)\n iter = @model.append\n iter[ID_SESSION] = session.sid.to_s\n iter[PEER] = session.tunnel_peer\n iter[TYPE] = session.type ? session.type : nil\n #iter[PAYLOAD] = session.via_payload ? session.via_payload : nil\n iter[O_SESSION] = session\n iter[O_BUFFER] = nil\n end",
"def log_without_unused_attrs(log)\n log.select! { |k| k == 'code' }\n end",
"def remove\n\t\tself.log.debug \"Removing session data for key %s\" % @id\n\t\t@new = true\n\tend",
"def history\n @history.dup\n end",
"def initialize()\n @log = {}\n end",
"def clear_log\n @output = []\n end",
"def first_sessions(outfile)\n log_hashes = []\n\n user_id = \"member_via_google\"\n current_time = time_starts_at.to_i + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000, true, nil, {:referrer => 'http://google.com'})\n log_hashes = log_hashes + become_member(user_id, current_time + 100)\n\n user_id = \"eunknown\"\n current_time = time_starts_at.to_i + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000, true, nil, {:referrer => ''})\n\n user_id = \"hatchery_references\"\n current_time = time_starts_at.to_i + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 1000, true, nil, {:referrer => 'http://hatchery.cc'})\n\n user_id = \"bot\"\n current_time = time_starts_at.to_i + rand(86400)\n log_hashes = log_hashes + make_session_logs(user_id, current_time, 0, true, nil, {:userAgent => 'GoogleBot'})\n\n write_logs(outfile, log_hashes)\n end",
"def reset_session_counts\n self.session_count = 0\n end",
"def append_info_to_payload(payload)\n super\n payload[:remote_ip] = request.remote_ip\n payload[:user_id] = if current_spree_user.present? && current_spree_user.admin?\n \"admin(#{current_spree_user.try(:id)})\"\n elsif current_spree_user.present?\n current_spree_user.try(:id)\n else\n :guest\n end\n end",
"def initialize prev=nil\n @prev_logger = prev\n super(nil)\n end",
"def chop() end",
"def chop() end",
"def rebuild_stats_details( parse_result_hash )\n parse_result_hash[:stats_details] = [] if parse_result_hash[ :stats_details ].nil?\n # Find out which stat page is used:\n old_stats_row = parse_result_hash[:stats_details_1].first ||\n parse_result_hash[:stats_details_2].first\n return unless old_stats_row.instance_of?(Hash)\n # Do a field-by-field conversion:\n parse_result_hash[:stats_details] << {\n id: nil,\n fields: {\n teams_tot: old_stats_row[:fields][ :teams_tot ],\n teams_presence: old_stats_row[:fields][ :teams_presence ],\n swimmer_tot: old_stats_row[:fields][ :swimmer_tot ],\n swimmer_presence: old_stats_row[:fields][ :swimmer_presence ],\n entries_tot: old_stats_row[:fields][ :entries_tot ],\n entries_presence: old_stats_row[:fields][ :entries_presence ],\n disqual_tot: old_stats_row[:fields][ :disqual_tot ],\n withdrawals_tot: old_stats_row[:fields][ :withdrawals_tot ]\n },\n import_text: old_stats_row[:import_text]\n }\n end",
"def push_session\n session[:players].each do |player|\n params[player] = Hash.new()\n [:left_hand, :right_hand].each do |hand|\n params[player][hand] = session[player][hand]\n end\n end\n end",
"def initialize(hash)\n @sessions = []\n @users = hash.keys\n @passwords = hash.values\n end"
] | [
"0.5581232",
"0.52753687",
"0.52623487",
"0.51862454",
"0.51808614",
"0.5158661",
"0.50765455",
"0.5012979",
"0.5009293",
"0.4991338",
"0.49580652",
"0.49547216",
"0.49088234",
"0.48754597",
"0.4873559",
"0.4868562",
"0.4861445",
"0.4838951",
"0.4821234",
"0.4819764",
"0.47960702",
"0.4757204",
"0.47554308",
"0.47509527",
"0.4749486",
"0.47391328",
"0.47210878",
"0.47065362",
"0.47053578",
"0.47011983",
"0.4699401",
"0.4699401",
"0.46907952",
"0.46747306",
"0.4658711",
"0.4640935",
"0.46263885",
"0.4616873",
"0.46127686",
"0.4592537",
"0.45887613",
"0.45825785",
"0.45796615",
"0.4567669",
"0.4561042",
"0.45555565",
"0.45497057",
"0.4544913",
"0.45417598",
"0.45172572",
"0.45128775",
"0.4509314",
"0.4508981",
"0.45080385",
"0.45074975",
"0.44997233",
"0.44885698",
"0.44883212",
"0.447883",
"0.44762215",
"0.4472761",
"0.44717395",
"0.44687012",
"0.44598576",
"0.44546452",
"0.445198",
"0.44477236",
"0.4442321",
"0.44343048",
"0.443237",
"0.44271094",
"0.442693",
"0.44206297",
"0.44205073",
"0.44177994",
"0.44101626",
"0.44096518",
"0.44082385",
"0.44071388",
"0.4402758",
"0.43960527",
"0.43893063",
"0.4385406",
"0.43834278",
"0.43825376",
"0.43813318",
"0.43775502",
"0.43651992",
"0.43587285",
"0.43586737",
"0.4337319",
"0.4336398",
"0.43279913",
"0.43199378",
"0.43132222",
"0.4304542",
"0.4297715",
"0.4297715",
"0.42965516",
"0.42962235",
"0.4289107"
] | 0.0 | -1 |
It is meant to answer exercise 2 question of Week 10, Prof. Kakimura's Information class. In the interest of not plagarizing, I would like to say that in my confusion I looked up this topic on StackOverflow and came across this page ( with rather inspiring code. | def min_index(a,i)
minimum = 0
for i in 1..(a.length())
if array[i]<array[0]
minimum = i
end
end
return minimum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exercise_119 (number)\n end",
"def input_students\n # Exercise 7 - Ask for both name and cohort and check conditions\n def enter_info(instruction)\n # Do a loop until user inputs correct value\n while true do\n puts instruction\n # Exercise 10 - Use another method to get rid of last character\n input = gets.gsub(\"\\n\", \"\")\n # If input contains numbers (strings default to 0)\n if input.to_i != 0\n puts \"Letters only\"\n next\n end\n # Break loop if user has entered a valid value\n break unless input.empty?\n puts \"No value entered\"\n end\n input\n end\n # Create method for enter_age\n def enter_age(age)\n # Do a loop until user inputs correct value\n while true do\n puts \"Please enter age\"\n age = gets.chomp.to_i\n age < 18 || age > 99 ? \"Not valid\" : break\n end\n age\n end\n\n puts \"Enter student information as prompted\"\n # Create and empty array\n students = []\n # Loop through adding students\n while true do\n # Get the first name\n name = enter_info(\"Please enter name\")\n # Exercise 5 - Add more information\n # Get cohort\n cohort = enter_info(\"Please enter month of cohort you are attending\")\n # Get the age\n age = enter_age(\"Please enter age\")\n # Get the country of birth\n country = enter_info(\"Please enter country of birth\")\n # Add the student hash to the array\n students << {name: name, cohort: cohort, age: age, country: country}\n # Exercise 9 - Use singular or plural when appropiate\n puts \"Now we have #{students.count} #{one_or_more?(students)}\"\n # Prompt user if they want to add more students, otherwise break\n puts \"Continue adding students? y/n (anything other than y will default to n)\"\n break if gets.chomp.downcase != \"y\"\n\n end\n students\nend",
"def scientist; end",
"def explanation\n end",
"def p15\n\t\nend",
"def most_interesting_man_in_the_world; end",
"def king_richard_iii; end",
"def proof_of_stake\n title(\"Proof of Stake\")\n\n eco_scale = \"https://en.wikipedia.org/wiki/Economies_of_scale\"\n pros1 = \"Energy efficient\"\n pros2 = \"More expensive to attack for attackers\"\n pros3 = \"Not susceptible to ecnomies of scale \\n\\t (for more details about this topic click on this link:\\n\\t #{eco_scale}).\"\n\n pros = [pros1, pros2, pros3]\n\n nothing_at_stake = \"https://medium.com/coinmonks/understanding-proof-of-stake-the-nothing-at-stake-theory-1f0d71bc027\"\n cons = \"nothing-at-stake problem \\n(for more details click on this link:\\n#{nothing_at_stake})\"\n\n\n ppc = {name: \"Peercoin\", website: \"https://peercoin.net/\"}\n pivx = {name: \"Pivx\", website: \"https://pivx.org/\"}\n rdd = {name: \"Reddcoin\", website: \"https://reddcoin.com/\"}\n\n used_by = [ppc, pivx, rdd]\n\n consensus_type = \"Competitive consensus\"\n\n\n explanation = \"\"\"\n The proof of stake was created as an alternative to the proof of work (PoW),\n to tackle inherent issues in the latter. Here instead of using mining, you\n have to have some stake(coins) in the system. So, if you own 10% of the\n stake(coins), then your probability of mining next block will be 10%.\n \"\"\"\n\n further_reading = \"https://en.wikipedia.org/wiki/Proof_of_stake\"\n\n p_o_s = {\n \"pros\" => pros,\n \"cons\" => cons,\n \"used_by\" => used_by,\n \"consensus_type\" => consensus_type,\n \"explanation\" => explanation,\n \"further_reading\" => further_reading\n }\n\n choice = \"0\"\n\n while !choice.include?(\"Q\") && !choice.include?(\"q\")\n choice = consensus_features\n if choice.include?(\"1\")\n puts \"Pros:\"\n p_o_s[\"pros\"].each_with_index { |val, index| puts \"\\t#{index+1}) #{val}\" }\n\n cons = p_o_s[\"cons\"]\n puts \"Cons: #{cons}\"\n elsif choice.include?(\"2\")\n puts \"Used by:\"\n p_o_s[\"used_by\"].each_with_index do\n |valeur, index|\n puts \"#{index+1})\"\n valeur.each do\n |key, value| puts \" #{key}: #{value}\"\n end\n end\n puts \"And others.\"\n elsif choice.include?(\"3\")\n consensus_type = p_o_s[\"consensus_type\"]\n puts \"Type: #{consensus_type}\"\n elsif choice.include?(\"4\")\n explanation = p_o_s[\"explanation\"]\n puts \"Explanation: #{explanation}\"\n elsif choice.include?(\"5\")\n further_reading = p_o_s[\"further_reading\"]\n puts \"Further Reading: #{further_reading}\"\n elsif choice.include?(\"Q\") || choice.include?(\"q\")\n break\n else\n puts \"Error\"\n end\n end\n\nend",
"def problem_8\nend",
"def print_students_list\n # sorting the students by their cohort (exercise 8)\n # students = students.sort_by {|name, cohort| cohort}\n number = 0\n # sorts the students by cohort (exercise 8)\n @students = @students.sort_by {|student| student[:cohort]}\n #Replacement for the each() method using a while loop (exercise 4)\n while number < @students.length\n #students.each do |student|\n # tracks the number of times the do loop has been run (exercise 1 & 4)\n student = @students[number]\n number = number + 1\n # sets the variable to the letter being look for at the start of the names (exercise 2)\n #letter = \"D\"\n # checks to see if the current name being checked in the students array starts with the letter from the line before this one (exercise 2)\n #if student[:name][0] == letter\n # only prints the students info if their name is shorter than 12 characters (exercise 3)\n #if student[:name].length <= 12\n # Some changes from exercise 5 printing out the extra information (exercise 5)\n puts \"#{number}. #{student[:name]} (#{student[:cohort]} cohort).\"# Hobbies: #{student[:hobbies]}, Place of Birth: #{student[:country]}, Height: #{student[:height]}\"\n #end\n #end\n end\nend",
"def essay_writer(title, name, major_accomplishment, year_of_accomplishment, thesis, pronoun)\n\tputs \"Final Assignment Essay:\\n #{title}\n\t\\n\n\t#{year_of_accomplishment} was the year of #{name}. #{major_accomplishment},\n\tdoes that ring a bell? That was all thanks to #{name}. #{thesis} \n\t\\n\n\tMuch more could be said of #{name}, but I believe in brevity. #{pronoun.capitalize} is somebody worth remembering. \n\t\"\n\t\nend",
"def essay_writer(title, name, major_accomplishment, year_of_accomplishment, thesis, pronoun)\n\tputs \"Final Assignment Essay:\\n #{title}\n\t\\n\n\t#{date_of_accomplishment} was the year of #{name}. #{major_accomplishment.capitalize},\n\tdoes that ring a bell? That was all thanks to #{name}. \\n \n\t#{thesis} \\n\n\tMuch more could be said of #{name}. #{pronoun.capitalize} is somebody worth remembering. \n\t\"\n\t\nend",
"def problem_14\nend",
"def solution4(input)\n end",
"def q3_page\n\"\n\n\n\n\n\n\n\n\n\n What is your Food Mood?\n\n *-------------------* *-------------------* *-------------------*\n | | | | | |\n | | | | | |\n | | | | | |\n | Old Faves | | Surprise Me! | | Craving |\n | | | | | |\n | | | | | |\n | | | | | |\n *-------------------* *-------------------* *-------------------*\n\n 1: 2: Input your Craving:\n\nAnswer: \"\nend",
"def print(names)\n# exercise 6 - added in center to print option 1 to align all fields into the center\n# exercise 8 - added in option to print by cohort, can print out each cohort in one go, or specific cohort.\n# exercise 9 - fixed printing statments for singular/plural of student/students\n\n puts \"Do you want: \nThe full list of names (enter 1) \nNames beginning with a specific letter (enter 2)\nNames with less than 12 characters (enter 3)\nPrint by cohort (enter 4)\"\nchoice_possibilities = [1, 2, 3, 4]\n choice = gets.chomp.to_i\n while !choice_possibilities.include?(choice) \n puts \"Please select #{choice_possibilities}.\"\n choice = gets.chomp.to_i\n end\n\n print_header\n\n if choice == 1\n counter = 0\n while counter < names.length\n print_array = \"\"\n\tnames[counter].map{ |y, z| print_array << \"#{y}: #{z}, \"} \n\tputs \"#{counter + 1}. #{print_array.to_s}\".center(100) \n\tcounter += 1\n end\n\n elsif choice == 2\n puts \"what letter would you like?\"\n letter = gets.chomp.downcase\n while letter.length != 1\n puts \"Please enter a single letter\"\n letter = gets.chomp.downcase\n end\n counter = 0\n names.each_with_index do |name, index|\n if name[:name][0].downcase == letter\n\tputs \"#{index + 1}. #{name[:name]} (#{name[:cohort]} cohort)\"\n counter += 1\n end\n end\n puts \"We have #{counter} #{counter == 1 ? \"student\" : \"students\"} with a name starting with #{letter.upcase}.\"\n\n elsif choice == 3\n counter = 0\n names.each_with_index do |name, index|\n if name[:name].length < 12\n puts \"#{index + 1}. #{name[:name]} (#{name[:cohort]} cohort)\"\n counter += 1\n end\n end\n puts \"We have #{counter} #{counter == 1 ? \"student\" : \"students\"}} with a name of less than 12 character.\"\n \n elsif choice == 4\n puts \"Do you want to print all cohorts or a specific cohort? Type all or specific\"\n choice_poss = ['all', 'specific']\n choice = gets.chomp.downcase\n while !choice_poss.include?(choice)\n\tputs \"please enter all or specific\"\n choice = gets.chomp.downcase\n end\n cohorts = []\n names.each do |name|\n cohorts << name[:cohort]\n end\n cohorts.uniq!\n if choice == 'all'\n cohorts.each do |cohort|\n puts \"Cohort: #{cohort}\"\n names.each_with_index { |name, index| puts \"#{index + 1}. Name: #{name[:name]}, Age: #{name[:age]}, Hobby: #{name[:hobby]}\" if name[:cohort] == cohort}\n end \n elsif choice == 'specific'\n puts \"Please choose a cohort\"\n cohorts.each {|x| puts x }\n choice = gets.chomp.to_sym\n while !cohorts.include?(choice)\n\tputs \"Please type an available cohort\"\n\tcohorts.each {|x| puts x}\n\tchoice = gets.chomp.to_sym\n end\n puts \"Cohort: #{choice}\"\n names.each_with_index { |name, index| puts \"#{index + 1}. Name: #{name[:name]}, Age: #{name[:age]}, Hobby: #{name[:hobby]}\" if name[:cohort] == choice}\n end\n end\nend",
"def explain_the_situation(hand, who)\n v = value_of_hand(hand)\n puts \"#{who}'s cards are: #{hand.join(\", \")}\"\n puts \"They add up to: #{v}\"\nend",
"def proof_of_work\n # inputs for the class method\n\n # pros\n pros = \"It has been tested in the wild since 2009 and stands steady today as well.\"\n pros = [pros]\n\n # cons\n eco_scale = \"https://en.wikipedia.org/wiki/Economies_of_scale\"\n cons1 = \"It's slow.\"\n cons2 = \"Uses a lot of energy.\"\n cons3 = \"Susceptible to ecnomies of scale \\n\\t (for more details about this topic click on this link:\\n\\t #{eco_scale}).\"\n\n cons = [cons1, cons2, cons3]\n\n # sample coins that use PoW algorithm\n btc = {name: \"Bitcoin\", website: \"https://bitcoin.org/en/\"}\n eth = {name: \"Ethereum\", website: \"https://ethereum.org/\"}\n ltc = {name: \"Litecoin\", website: \"https://litecoin.org/\"}\n\n used_by = [btc, eth, ltc]\n\n consensus_type = \"Competitive consensus\"\n\n whitepaper = \"https://bitcoin.org/bitcoin.pdf\"\n\n explanation = \"\"\"\n It is the first consensus algorithm (proposed by Satoshi Nakamoto introduced\n in his article #{whitepaper}) to create distributed trustless\n consensus and solves the double-spend problem. POW is not a new idea, but the\n way Satoshi combined this and other existing concepts — cryptographic signatures,\n merkle chains, and P2P networks — into a viable distributed consensus system, of\n which cryptocurrency is the first and basic application, was quite innovative.\n \"\"\"\n\n further_reading = \"https://en.bitcoin.it/wiki/Proof_of_work\"\n\n # instantiation\n pow = ConsensusAlgorithm.new('Proof of Work', pros, cons, used_by, consensus_type, explanation, further_reading)\n title = ConsensusAlgorithm.title('Proof of Work')\n presentation = \"\"\"\n #{pow.name} is the first #{pow.function}\n used for the first time with the first blockchain technology created at the\n same time as the first cryptocurrency called Bitcoin!\n \"\"\"\n p_o_w = instantiation(pow, title, presentation)\n\n\n choice = \"0\"\n\n # main loop\n while !choice.include?(\"Q\") && !choice.include?(\"q\")\n choice = consensus_features\n if choice.include?(\"1\")\n # display pros and cons\n puts \"Pros:\"\n p_o_w[:pros].each_with_index { |val, index| puts \"\\t#{index+1}) #{val}\" }\n\n puts \"Cons:\"\n p_o_w[:cons].each_with_index { |val, index| puts \"\\t#{index+1}) #{val}\" }\n elsif choice.include?(\"2\")\n puts \"Used by:\"\n p_o_w[:used_by].each_with_index do\n |valeur, index|\n puts \"#{index+1})\"\n valeur.each do\n |key, value| puts \" #{key}: #{value}\"\n end\n end\n puts \"And others.\"\n elsif choice.include?(\"3\")\n consensus_type = p_o_w[:consensus_type]\n puts \"Type: #{consensus_type}\"\n elsif choice.include?(\"4\")\n explanation = p_o_w[:explanation]\n puts \"Explanation: #{explanation}\"\n elsif choice.include?(\"5\")\n further_reading = p_o_w[:further_reading]\n puts \"Further Reading: #{further_reading}\"\n elsif choice.include?(\"Q\") || choice.include?(\"q\")\n break\n else\n puts \"Error\"\n end\n end\nend",
"def pens_and_notebooks(pens, notebooks)\n puts \"You have #{pens} pens!\"\n puts \"You have #{notebooks} notebooks!\"\n puts \"You have #{pens} pens and #{notebooks} notebooks, you're ready for school!\"\nend",
"def exercise_1113 (matrix)\n end",
"def homework(title, topic, date, thesis_statement, pronoun)\n\tparagraph = \"#{title}/n The #{topic} was an interesting topic. It happened in #{date}. \n\tI feel that #{topic} was a very important part of #{date} because \n\t#{pronoun}. #{thesis_statement}. This is what made #{topic} really \n\tinteresting part of #{date} and an important part of history.\"\n\treturn paragraph\nend",
"def beauty_hidden(honest_beauty, trust_beauty)\n puts honest_beauty\n puts trust_beauty\nend",
"def explain\n \n end",
"def tell_fortune()\r\n\t\tprint \"The answer is \" + $predicition + \". \\n\\n: \"\r\n\tend",
"def challenge; end",
"def kids_musical; end",
"def stylish_chef\n best_hairstyle = \"Guy Fieri\"\n return \"Martha Stewart\"\n \"Guy Fieri\"\nend",
"def dictator_Iraq\n puts \"Saddam formally rose to power in 1979, although he had been the de facto head\n of Iraq for several years prior. Within his own country, he suppressed\n his own citizens, particularly the Shi'a and Kurdish people. He also maintained\n power during the Iran–Iraq War and the Gulf War, and was accused of using\n chemical weapons. To alleviate the threat of revolution, Saddam afforded\n certain benefits to the potentially hostile population. Membership in the\n Ba'ath Party remained open to all Iraqi citizens regardless of background.\n However, repressive measures were taken against its opponents. The major\n instruments for accomplishing this control were the paramilitary and police\n organizations. Saddam was notable for using terror against his own people.\n Saddam's regime was responsible for the deaths of at least 250,000\n Iraqis and committed war crimes in Iran, Kuwait, and Saudi Arabia. Human\n Rights Watch and Amnesty International issued regular reports of widespread\n imprisonment and torture.\"\n\n crazy_acts\n\nend",
"def how_it_works\r\n end",
"def learn_it\n interviews = \"https://www.youtube.com/playlist?list=PLUJNJAesbJGVGDiZJ8WvcEC3e1O5cDb5r\"\n puts \"If you want to learn from the IT pros, check out this playlist #{interviews}\"\n superprof_it = \"http://bit.ly/superprof-info\"\n puts \"If you want private lessons, checkout my profile here: #{superprof_it}\"\n podia\nend",
"def learn_math\n puts \"If you need some basic maths lessons.\"\n prglump = \"https://www.youtube.com/channel/UCLxVJHhqaLMuyTcbUsoCrFg/videos?view=0&sort=p&flow=grid\"\n puts \"Perhaps you can learn something on this YouTube channel #{prglump}\"\n superprof_math = \"https://bit.ly/2wlBbF9\"\n puts \"If you want more advance math private lessons, checkout my profile here: #{superprof_math}\"\n podia\nend",
"def exercise1_gets_puts\n puts \"Hey, What is your name?\"\n name = gets.chomp\n puts \"Cool, #{name}\"\n puts \"How old are you?\"\n age = gets.chomp\n puts \"Your name is #{name} and you are #{age} years old.\"\n time = Time.now\n\n puts \"What is your current address?\"\n address = gets.chomp\n\n puts \"Please enter your city\"\n city = gets.chomp\n\n puts \"Please enter your state abbreviation\"\n state = gets.chomp\n\n if state.length != 2 \n\n puts \"Please enter a code that is only two characters long. /n\"\n puts \"Please enter your state abbreviation\"\n state = gets.chomp\n end\n puts \"Please enter your zip code\"\n zip_code = gets.chomp\n if zip_code.length != 5\n puts \"Please enter a zip code that is only five characters long. /n\"\n end\n\n mailing_adrs = address + \"/n\" + city + \", \" + state + \" \" + \"zipcode\" \n puts \"Your address is /n\" + mailing_adrs\n\n current_year = time.year\n puts \"The current year is #{current_year}\"\n\n puts \"What year were you born?\"\n birth_year = gets.chomp.to_i\n puts \"You are #{current_year - birth_year} years old.\"\nend",
"def ask_question\n qna = {\"who was the superbowl halftime show lady in 2015?\" => \"katy perry\", \"who dat?\" => \"we dat\",\n \"kurt cobain is the lead in which band?\"=> \"nirvana\",\n \"beyonce's daughter is named...?\"=> \"blue ivy\",\n \"who is the first black president?\"=> \"obama\"\n }\n data = qna.to_a.sample\n current_question = data.first\n current_answer = data.last\n\n puts current_question\n answer = gets.chomp\n data.delete(current_question)\n\n if answer.downcase == current_answer\n puts \"That is correct!\"\n else \n puts \"#{answer}!!!! REALLY?! The answer was #{current_answer}\"\n end\n\n if current_question\nend \n\n\n4.times do \n ask_question\nend\n\n\n\n# puts questions.sample\n\n# hash = {\"item\" => \"bread\", \"quantity\" => 1, \"brand\" => \"treehouse\"}\n# puts \"Hash: #{hash.inspect}\"\n\n# print \"hash.length: \"\n# puts hash.length\n\n# print \"hash.invert: \"\n# puts hash.invert\n\n# print \"hash.shift: \"\n# puts hash.shift\n\n# print \"hash: \"\n# puts hash.inspect\n\n# hash[\"item\"] = \"bread\"\n# puts \"Hash merging: \"\n\n# print \"original hash: \"\n# puts hash.inspect\n\n# print \"Merged with {'calories' => 100}\"\n# puts hash.merge({'calories' => 100})\n\n# print \"original hash: \"\n# puts hash.inspect\n\n# puts \"merged with {'item' => 'eggs'}\"\n# puts hash.merge({'item' => 'eggs'})\n# # grocery_list = [\"milk\", \"eggs\", \"bread\"]\n# # grocery_list << \"carrots\"\n\n# # grocery_list.push(\"potatoes\")\n# # grocery_list.unshift(\"celery\")\n\n# # grocery_list+= [\"ice cream\", \"pie\"]\n\n# # puts grocery_list.inspect",
"def anatomy; end",
"def herald; end",
"def prescription_1\n\tputs \"*** Prescription 1 ***\"\n\tputs \"Use the TDD process to create and adjust your code's design in small, incremental steps.\\n\\n\"\nend",
"def print_student something_else, blah, info={}\r\n\tputs something_else + \" \" + blah\r\n\tputs \"#{info['name']} is #{info['age']} old and has a gpa of #{info['gpa']}\"\r\nend",
"def best_homework_ever(title, person, date, thesis)\n\ttemplate = \"#{title}. #{person} was an influential part of the epic space battle of #{date}, which was later covered up by the government in #{date+2}. Additionally, #{thesis}. In fact, without the contributions of #{person}, humanity would not have survived to the present day.\"\n\tputs template\nend",
"def best_homework_ever(title, person, date, thesis)\n\ttemplate = \"#{title}. #{person} was an influential part of the epic space battle of #{date}, which was later covered up by the government in #{date+2}. Additionally, #{thesis}. In fact, without the contributions of #{person}, humanity would not have survived to the present day.\"\n\tputs template\nend",
"def print_rhyme(verse_total, is_gender_neutral)\n\n # This array 'num_names' contains English names for\n # numbers from zero to twenty.\n #\n # Though numbers 0 & 1 are not used in the current application,\n # they are included for clarity so that array indexes will\n # correspond to their English names.\n #\n # English names are un-capitalized to give this array\n # general application. Any required\n # capitalization must be accomplised in the code\n num_names = ['zero', 'one', 'two', 'three', 'four', 'five',\n 'six', 'seven', 'eight', 'nine', 'ten',\n 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen',\n 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty']\n\n #Print verses greater than 1 in descending order\n verse_counter = verse_total\n until verse_counter == 1 do\n if verse_counter <= 20 #Use my own names array for values up to 20\n puts \"#{num_names[verse_counter].capitalize} little monkeys jumping on the bed,\"\n else #Use a ruby gem to get number names for higher values\n puts \"#{NumbersInWords.in_words(verse_counter).capitalize} little monkeys jumping on the bed,\"\n end\n is_gender_neutral ? (puts 'One fell off and bumped zir head') :\n (puts 'One fell off and bumped his head')\n puts 'Mama called the doctor and the doctor said,'\n puts '\"No more monkeys jumping on the bed!\"'\n puts\n verse_counter -= 1\n end\n\n #Print the final verse\n puts 'One little monkey jumping on the bed,'\n is_gender_neutral ? (puts 'Ze fell off and bumped zir head,') :\n (puts 'He fell off and bumped his head,')\n puts 'Mama called the doctor and the doctor said,'\n puts '\"Get those monkeys right to bed!\"'\n puts\nend",
"def generate_dummy_data_for_presentation(pt1,user)\n\n#generate the exercises:\n# For the legs session type\n legs1 = Exercise.new(\"Full Squat\", \"Legs\", true, 10, 5, 1.2,4,3) \n legs2 = Exercise.new(\"Barbell Lunge\", \"Legs\", false, 15, 5, 1.1,4,2) \n legs3 = Exercise.new(\"Deadlift\", \"Legs\", true, 15, 5, 1.3,2,4) \n legs4 = Exercise.new(\"Leg Press\", \"Legs\", false, 20, 5, 1.25,6,5) \n legs5 = Exercise.new(\"Ham String Curl\", \"Legs\", true, 12, 5, 1.15,4,4) \n # For the Biceps, Triceps, Forearms and Abs (aka BTFA) session type \n btfa1 = Exercise.new(\"Bicep Curls\", \"BTFA\",true, 10, 5, 1.2,4,3) \n btfa2 = Exercise.new(\"Shoulder Press\", \"BTFA\", false, 10, 5, 1.2,4,3) \n btfa3 = Exercise.new(\"Bench Press\", \"BTFA\", true, 10, 5, 1.2,4,3) \n btfa4 = Exercise.new(\"Triceps Extension\", \"BTFA\", false, 10, 5, 1.2,4,3) \n btfa5 = Exercise.new(\"Sit Up\", \"BTFA\", true, 10, 5, 1.2,4,3) \n # For the Shoulders and Traps session type\n shoulders_traps1 = Exercise.new(\"Dumbell Shoulder Press\", \"Shoulders and Traps\",true, 10, 5, 1.2,4,3) \n shoulders_traps2 = Exercise.new(\"Upright Barbell Row\", \"Shoulders and Traps\", false, 10, 5, 1.2,4,3) \n shoulders_traps3 = Exercise.new(\"Seated Bent-over Rear Delt Raise\", \"Shoulders and Traps\", true, 10, 5, 1.2,4,3) \n shoulders_traps4 = Exercise.new(\"Side Lateral Raise\", \"Shoulders and Traps\", false, 10, 5, 1.2,4,3) \n shoulders_traps5 = Exercise.new(\"Barbell Shrug\", \"Shoulders and Traps\", true, 10, 5, 1.2,4,3) \n # For the Back session type\n back1 = Exercise.new(\"Barbell Deadlift\", \"Back\", true, 10, 5, 1.2,4,3) \n back2 = Exercise.new(\"Wide-Grip Pull Up\", \"Back\", false, 10, 5, 1.2,4,3) \n back3 = Exercise.new(\"Bent-Over Barbell Deadlift\", \"Back\", true, 10, 5, 1.2,4,3) \n back4 = Exercise.new(\"Standing T-Bar Row\", \"Back\", false, 10, 5, 1.2,4,3) \n # For the Chest session type\n chest1 = Exercise.new(\"Barbell Bench Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n chest2 = Exercise.new(\"Flat Bench Dumbbell Press\", \"Chest\", false, 10, 5, 1.2,4,3) \n chest3 = Exercise.new(\"Seated Machine Chest Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n chest4 = Exercise.new(\"Incline Dumbbell Press\", \"Chest\", false, 10, 5, 1.2,4,3) \n chest5 = Exercise.new(\"Machine Decline Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n\n# add exercises to the PT object so that it's aware of them\n pt1.add_exercises(legs1)\n pt1.add_exercises(legs2)\n pt1.add_exercises(legs3)\n pt1.add_exercises(legs4)\n pt1.add_exercises(legs5)\n pt1.add_exercises(btfa1)\n pt1.add_exercises(btfa2)\n pt1.add_exercises(btfa3)\n pt1.add_exercises(btfa4)\n pt1.add_exercises(btfa5)\n pt1.add_exercises(shoulders_traps1)\n pt1.add_exercises(shoulders_traps2)\n pt1.add_exercises(shoulders_traps3)\n pt1.add_exercises(shoulders_traps4)\n pt1.add_exercises(shoulders_traps5)\n pt1.add_exercises(back1)\n pt1.add_exercises(back2)\n pt1.add_exercises(back3)\n pt1.add_exercises(back4)\n pt1.add_exercises(chest1)\n pt1.add_exercises(chest2)\n pt1.add_exercises(chest3)\n pt1.add_exercises(chest4)\n pt1.add_exercises(chest5)\n\n\n # establish id for user\n user.username = \"jim\"\n user.password = \"password\"\n user.first_name = \"Jimmy\"\n user.last_name = \"Coder\"\n user.gender = \"Male\"\n user.body_type = \"Mesomorph\"\n user.goal = \"musclebuild\"\n user.disclaimer = \"accept\"\n user.date_of_birth = Date.new(1990,9,9)\n # binding.pry\n user.weight = 56\n user.goal_weight = 75\n\n#establish some dummy workout history for our user:\n # (weight, completed_reps, exercise_performed, duration, date, session_number, session_type)\n workout_history_for_user = ExerciseInput.new(10, 8, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 9, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 10, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 11, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 9, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 9, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 5, chest1.name, 10, Date.new(2017,8,5), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,6), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(20, 8, chest1.name, 10, Date.new(2017,8,7), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(20, 10, chest1.name, 10, Date.new(2017,8,8), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 7, chest1.name, 10, Date.new(2017,8,9), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 8, chest1.name, 10, Date.new(2017,8,10), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 9, chest1.name, 10, Date.new(2017,8,11), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 10, chest1.name, 10, Date.new(2017,8,12), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n\n\nend",
"def schumann; end",
"def science_and_math\n puts \" | .-.\"\n puts \" | / \\\\ .-.\"\n puts \" | / \\\\ / \\\\ .-. .-. _ _\"\n puts \" +--/-------\\\\-----/-----\\\\-----/---\\\\---/---\\\\---/-\\\\-/-\\\\/\\\\/---\"\n puts \" | / \\\\ / \\\\ / '-' '-'\"\n puts \" |/ '-' '-'\"\n\nend",
"def essay_writer(title, topic, date, thesis_statement, pronoun)\r\n\tputs \"#{title}\"\r\n\tputs \"\"\r\n\tif \"#{pronoun}\" == \"male\"\r\n\t\tputs \"#{topic} was an important person in #{date}. He did a lot. #{thesis_statement}\"\r\n\telsif pronoun == \"female\"\r\n\t\tputs \"#{topic} was an important person in #{date}. She did a lot. #{thesis_statement}\"\r\n\telsif pronoun == \"thing\"\r\n\t\tputs\"#{topic} was an important object in #{date}. One of the most important discoveries to date. #{thesis_statement}\"\r\n\telse pronoun == \"place\"\r\n\t\tputs\"#{topic} was an important place in #{date}. An important place in our world of history. #{thesis_statement}\"\r\nend\r\n\r\nend",
"def informational?; end",
"def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend",
"def jack_handey; end",
"def oh_crap_i_forgot(title, person, location, date, thesis, major_accomplishment, pronoun)\n pronoun = 'male' ? p_use = 'he' : p_use = 'she'\n date < 1000 ? e_or_l = 'early era' : e_or_l = 'late era'\n\n puts \"#{title} : The Story of #{person}\"\n puts \" \"\n puts \"In #{e_or_l} #{location}, #{person} was a pretty big deal. #{thesis}. #{pronoun.capitalize} changed the very fabric of #{location} when #{pronoun} #{major_accomplishment}.\"\n puts \" \"\n puts \"All in all, #{e_or_l} #{location} would not have been so successful without #{person}, nor would #{location} be the way it is today without those contributions.\"\n puts \"By Mikee.\"\nend",
"def add_name(array)\n # Write code inside this add_name method to add the string \"Danny\" to the array\n array<<\"Danny\"\nend\n\ndef print_items(array)\n # Iterate over each element in the array and puts it\n array.each do |item|\n puts item\n end\nend\n\ndef first_item(array)\n array[0]\nend\n\ndef third_item(array)\n array[2]\nend\n\n# Level 2: Hashes\n# This is the hash that rspec will be using to call and test each of the methods below: \n# {:name => \"Danny\", :age => 55}\n\ndef name(hash)\n # Return the value of :name from the hash\n hash[:name]\nend\n\ndef add_location(hash)\n # Add a key :location to the hash with a value of \"NYC\" \n hash[:location]= \"NYC\"\n\nend\n\ndef print_key_value_pairs(hash)\n # Iterate over the hash and puts each key value pair. Make sure to use string interpolation and pay attention to punctuation!\n hash.each do |k, v|\n puts \"Key is #{k}. Value is #{v}.\"\n end\n\nend\n\n# Level 3: Nested Data Structures\n\n# This is the hash that rspec will be using to call and test each of the methods below: \n# school = { \n# :name => \"Happy Funtime School\",\n# :location => \"NYC\",\n# :instructors => [ \n# {:name=>\"Steph\", :subject=>\"Violin\" },\n# {:name=>\"Victoria\", :subject=>\"Field Hockey\"},\n# {:name=>\"Vanessa\", :subject=>\"Karaoke\"}\n# ],\n# :students => [ \n# {:name => \"Marissa\", :grade => \"B\"},\n# {:name=>\"Billy\", :grade => \"F\"},\n# {:name => \"Frank\", :grade => \"A\"},\n# {:name => \"Sophie\", :grade => \"C\"}\n# ]\n# }\n\ndef modify_hash(nested_hash)\n # Add a key :founded_in with a value of 2013.\n nested_hash[:founded_in]=2013\n\nend\n\ndef return_first_student(nested_hash)\n # Return the first student in the students array\n nested_hash[:students][0]\nend\n\ndef add_student(nested_hash)\n # Add a student to the end of the nested_hash's students array. Make sure to give the student a name and grade.\n nested_hash[:students]<<{:name => \"Bob\", :grade => \"B\"}\n\nend\n\ndef add_semester(nested_hash)\n # Iterate through the students array and add a key :semester to every student with the value of \"Summer\".\n nested_hash[:students].each do |student|\n student[:semester]=\"Summer\"\n end\n\nend\n\ndef find_student_by_grade(nested_hash)\n # Use the .find method (it works similar to .each) to iterate through the students array and look for a student with :grade == \"B\".\n nested_hash[:students].find do |student|\n student[:grade]==\"B\"\n end\nend\n\ndef find_student_by_name(nested_hash)\n # Use the .find method to look for the student named \"Frank. This time return only Frank's grade (not all of his info.)\n nested_hash[:students].find do |student|\n student[:name]==\"Frank\"\n end[:grade]\nend\n\ndef change_frank_grade(nested_hash)\n # Use the .find method to find \"Frank\" and change his grade from \"A\" to \"F\".\n nested_hash[:students].find do |student|\n student[:name]==\"Frank\"\n end[:grade]=\"F\"\nend\n\ndef delete_student(nested_hash)\n # Delete the student named \"Billy\" from the hash\n nested_hash[:students].each do |student|\n if student[:name]==\"Billy\"\n nested_hash[:students].delete(student)\n end\n end\nend\n\n# Bonus!\n\ndef print_all_items(nested_hash)\n # Write out the code to puts all the values in the school. NOTE: If this takes too long, skip it!\n nested_hash.each_value do |item|\n if item.is_a?(Array)\n print_all_array(item)\n elsif item.is_a?(Hash)\n print_all_items(item)\n else\n puts item\n end\n end\nend\n\ndef print_all_array(array)\n array.each do |item|\n if item.is_a?(Array)\n print_all_array(item)\n elsif item.is_a?(Hash)\n print_all_items(item)\n else\n puts item\n end\n end\nend\n\n\n",
"def who_we_are\r\n end",
"def designer_questionnaire\n\tputs \"Please provide the following information so that we can provide you with the interior design for your home that your love to live in.\"\n\tputs \"What is your name?\"\n\t\tname = gets.chomp\n\t\t\ndesigner_intake = {\n\tname: \"Maggie Dorsey\",\n\taddress: \"5 123 Way\",\n\tnumber_children: 5,\n\temail: \"[email protected]\",\n\tphone: \"510-555-1212\",\n\tfav_shade_blue: \"Indigo\",\n\twallpaper_preference: \"Paisley\",\n\tombre: \"So last season\",\n\tdecor_theme: \"Country\"\n}\n\ndesigner_intake.each {|key, value| puts \"#{key}: #{value}\"}\n\nend",
"def alg; end",
"def get_user_input\n puts \"\n What is your weekly income after tax?\n This can be pay from a job or even rent\n from a rental property you own\n Please enter a number.\".colorize(:light_blue)\n income = gets.chomp.to_f\n puts \"\n What is your weekly rent or morgage repayments? Please enter a number.\".colorize(:light_blue)\n rent = gets.chomp.to_f\n puts \"\n How much do you spend on groceries each week? Please enter a number.\".colorize(:light_blue)\n groceries = gets.chomp.to_f\n puts \"\n How much do you spend on insurance?\n Such as health insurance or pet \n insurance.\n Please enter a number.\".colorize(:light_blue)\n insurance = gets.chomp.to_f\n puts \"\n How much do you spend on recreation weekly?\n This can include going to the movies,\n having beers, getting a coffee in the\n morning and also subscriptions such as\n Netflix, Stan or Amazon Prime.\n Please enter a number.\".colorize(:light_blue)\n recreation = gets.chomp.to_f\n puts \"\n How much do you spend on utilities each week?\n utilities include Gas and Electricity, internet and\n phone bills.\n Please enter a number.\".colorize(:light_blue)\n utilities = gets.chomp.to_f\n puts \"\n How much do you spend on transport each week?\n some examples are public transport fees or\n petrol for the car.\n Please enter a number.\".colorize(:light_blue)\n transport = gets.chomp.to_f\n puts \"\n How much do you spend on fitness each week?\n This refers to gym memberships or even the\n purchase of protein powder and shakes.\n Please enter a number.\".colorize(:light_blue)\n fitness = gets.chomp.to_f\n puts \"\n How much do you spend on your children each week?\n Most of your childrens expenses will be included in\n the other categories, but this section is for extras.\n Such as, excursion fees.\n Please enter a number.\".colorize(:light_blue)\n children = gets.chomp.to_f\n return income, rent, groceries, insurance, recreation, utilities, transport, fitness, children\nend",
"def about\n\t\tputs \"Your gender is #{@gender}!\"\n\t\tputs \"Your ethnicity is #{@ethnicity}!\"\n\t\tputs \"Here is the #{@reindeer_ranking}!\"\n\t\tputs \"Santa is #{age} year(s) old!\"\n\tend",
"def first_puzzle a\n # write down your solution to puzzle 1 here\nend",
"def print_instructions\n puts \"Type 'find 1' to display candidate with id 1.\"\n puts \"Type 'all' to see all candidates.\"\n puts \"Type 'qualified' to print only qualified candidates.\"\n puts \"Type 'quit' to exit.\"\n puts \"Type 'help' to see these instructions again.\"\nend",
"def intelligenceTest()\r\n puts \"Your intelligence is about to tested, let's see how you can do!\"\r\n if(@charPlaying.smarts == 5)\r\n puts\"Evaluate the expression: \"\r\n puts \"1^2 + 1^2 = \"\r\n @answer = gets()\r\n if (@answer.chomp == '2')\r\n @points += 1\r\n puts \"Good job smarty pants!\"\r\n else\r\n puts \"Really you don't know what 1 + 1 is!\"\r\n end\r\n elsif @charPlaying.smarts == 4\r\n puts\"Evaluate the expression: \"\r\n puts \"pi/0 = \"\r\n @answer = gets()\r\n if(@answer.chomp == '0')\r\n @points += 1\r\n puts \"Wow! You are smart!\"\r\n else\r\n puts \"You probably are not smarter than a 5th grader.\"\r\n end\r\n elsif @charPlaying.smarts == 3\r\n puts \"What is the square root of 4 * 16 = \"\r\n @answer = gets()\r\n if(@answer.chomp == '8')\r\n @points += 1\r\n puts \"Thats correct! One point for you!\"\r\n else\r\n puts \"Better luck next time!\"\r\n end\r\n elsif @charPlaying.smarts == 2\r\n puts \"How many minutes are in one year?\"\r\n @answer = gets()\r\n if(@answer.chomp == '525600')\r\n @points += 1\r\n puts \"That is a lot of minutes! 1 point for you #{@charPlaying.name}\"\r\n else\r\n puts \"I guess there's too many for you to count.\"\r\n end\r\n else\r\n puts \"What is the 50th digit of pi?\"\r\n @answer = gets()\r\n if(@answer.chomp == '1')\r\n @points += 1\r\n puts \"Thats correct and a point for you!\"\r\n else\r\n puts \"Well you only had a 1/10 chance to guess the right answer!\"\r\n end\r\n end\r\n end",
"def test_dsl_8\n #-------------------------------------------------\n show((Rock + Paper) - (Scissors + Lizard) + Spock)\n #-------------------------------------------------\n assert_equal \\\n \"Paper covers Rock (winner Paper)\\n\" \\\n \"Scissors decapitate Lizard (winner Scissors)\\n\" \\\n \"Scissors cut Paper (loser Paper)\\n\" \\\n \"Paper disproves Spock (winner Paper)\\n\" \\\n \"Result = Paper\\n\", \\\n @out.string\n end",
"def question_type\n Exercise::Q_CODING\n end",
"def challenge5\n\tputs \"Challenge #5 solution: \"\n\t##@tree.getRoot is @rootNode\n\tputs \"Average length of text values: \" + (@tree.getRoot.totalTextLength / (@size*2).to_f).truncate(2).to_s\n\tputs \"-----------------------------------\"\nend",
"def schubert; end",
"def camp\n puts \"You're at your camp #{$name}what will you do?\n \\n1: cook\\n2: rest\\n3: stare into the sky\\n4: quit the game\\n5: venture into the forest\"\n answer1 = (gets).to_i\n\n#cook option\n if answer1 == 1\n puts \"Are you Vegan?\\n1: yes\\n2: no\"\n vegan = (gets).to_i\n if vegan == 1\n puts \"There are only animals around\\nyou find the idea detestable.\"\n are_vegan = true\n elsif vegan == 2\n puts \"You cook up a raspberry.\"\n else\n puts \"yes was the only real option.\"\n are_vegan = true\n end\n\n#rest option\n elsif answer1 == 2\n if $day_time == true\n puts \"it's too bright out to sleep.\"\n else\n puts \"you're too distracted by your thoughts\\nit's daytime before you know it.\"\n $day_time = true\n end\n\n#stare option\n elsif answer1 == 3\n if $day_time == true\n puts \"You're eyes hurt\"\n elsif $day_time == false\n puts \"The stars look lovely tonight.\"\n else\n puts \"You decided against it in the end.\"\n end\n\n#quit option\n elsif answer1 == 4\n puts \"Are you sure?\\n1: yes\\n2: no\"\n @answer = (gets).to_i\n if @answer == 1\n $in_campt = false\n exit(0)\n elsif @answe == 2\n puts \"all right\"\n else\n puts \"all right\"\n end\n\n#forest option\n elsif answer1 == 5\n puts \"Off you go.\"\n $in_camp = false\n $in_forest = true\n forest\n#default to forest\n else\n puts \"off you go then.\"\n $in_camp = false\n $in_forest = true\n forest\n end\n\nend",
"def essay_writer(title, topic, date, thesis_statement, pronoun)\n if pronoun == \"male\"\n who = \"He\" \n whose = \"His\"\n whom = \"Him\"\n \n elsif pronoun == \"female\"\n who = \"She\"\n whose = \"Her\"\n whom = \"Her\"\n \n else\n who = \"It\"\n whose = \"Its\"\n whom = \"Its\"\n end\n \n return who + \" was an important person in \" + date.to_s + \". \" + who + \" did a lot. I want to learn more about him. \" + thesis_statement + \" \" + topic.to_s + \"'s contribution is important.\"\n \nend",
"def silly_adjective; end",
"def design_info\n\tdesign_info = {age: nil, numberofchildren: nil, decortheme: \"\", dogpreference: \"\"}\n\tdesign_info.each do |key,value| \n\t\tputs \"What is the #{key.to_s}?\"\n\t\tif value.is_a?(String)\n\t\t\tdesign_info[key] = gets.chomp\n\t\telse\n\t\t\tdesign_info[key] = gets.chomp.to_i\n\t\tend\n\tend\n\t\t\n\t\n\tp design_info\n\tresponse = nil\n\tuntil response == \"nope\"\n\tputs \"Would you like to revise any responses? If so type the data type you need to revise; if not, type --nope--\"\n\tresponse = gets.chomp\n\t\tif response == \"nope\"\n\t\t\tbreak\n\t\telse\n\t\t\tputs \"what new value do you want to put in #{response}??\"\n\t\t\tdesign_info[response.to_sym] = gets.chomp\n\t\tend\n\t\n\tend\n\tp design_info\nend",
"def calculator_1(operator, num1, num2)\n # See exercise 36\nend",
"def exams_statistics\n end",
"def main\r\n\r\n\tname = read_string('What is your name?')\r\n\tputs 'Your name is ' + name + '!'\r\n\tfamily_name = read_string('What is your family name?')\r\n\tputs 'Your family name is: ' + family_name + '!'\r\n\tyear_born = read_integer('What year were you born?')\r\n\tage = Date.today.year - year_born\r\n\tputs 'So you are ' + age.to_s + ' years old'\r\n\tvalue = read_float('Enter your height in metres (i.e as a float): ')\r\n\tvalue = value * INCHES\r\n\tputs 'Your height in inches is: '\r\n\tputs value.to_s\r\n\tputs 'Finished'\r\n\tcontinue = read_boolean('Do you want to continue?')\r\n\tif (continue)\r\n\t\tputs 'Ok, lets continue'\r\n\telse\r\n\t\tputs 'ok, goodbye'\r\n\tend\r\nend",
"def tongue_twister; end",
"def dish; end",
"def corrections; end",
"def solution1(input)\n return \"Not implemented!\"\nend",
"def essay_writer( title, thing, year, thesis, type )\n \n if type.thing == \"male\" or type.thing == \"female\"\n \tword1 = type.single.capitalize + \" did a lot. \"\n \tname = thing.split\n \tword2 = name[0]\n else\n \tword1 = \"I find \" + type.single + \" facinating. \"\n \tword2 = thing\n end \n\n # title\n puts title\n\n # blank line\n puts\n\n # first sentence\n print thing + \" was an important \" + type.thing + \" in \" + year.to_s + \". \"\n\n # second sentence\n print word1\n\n # third sentence\n print \"I want to learn more about \" + type.object + \". \"\n\n # thesis\n print thesis + \" \"\n\n # last sentence\n puts word2 + \"'s contribution is important.\"\n\nend",
"def essay_template(title, author, date, thesis, character, quality, moment, pronoun)\n\tif pronoun == \"male\"\n\t\tpossessive = \"his\"\n\t\tsubject = \"he\"\n\t\tobject = \"him\"\n\telsif pronoun == \"female\"\n\t\tpossessive = \"her\"\n\t\tsubject = \"she\"\n\t\tobject = \"her\"\n\telse\n\t\tpossessive = \"its\"\n\t\tsubject = \"it\"\n\t\tobject = \"it\"\n\tend\n\tcap_title = title.split.map(&:capitalize).join(' ')\n\tlast_name = character.split.last\n\tputs \"Recently, for class, we read #{cap_title}. #{cap_title} was written by #{author.split.map(&:capitalize).join(' ')} and published on #{date}. #{thesis.capitalize}. The quality of the main character, #{author.split.map(&:capitalize).join(' ')}, that I found most endearing was #{possessive} quality of #{quality}. #{last_name.capitalize} had shown a good example of #{possessive} #{quality} when #{subject} #{moment}. I appreciated #{object} and #{possessive} #{quality}.\"\nend",
"def print_results(num_1, num_2)\n puts \"addition #{num_1 + num_2}\"\n puts \"subtraction #{num_1 - num_2}\"\n puts \"product #{num_1 * num_2}\"\n puts \"remainder #{num_1 % num_2}\"\n puts \"quotient #{num_1 / num_2}\"\n puts \"power #{num_1 ** num_2}\"\n\nend",
"def america(question)\n puts question + \"Only in America\"\nend",
"def questionOne(frustration)\n if frustration == \"Yes\"\n return 3\n end \n \n if frustration == \"Not at all\"\n return 1\n end \n \n if frustration == \"I can't tell\"\n return 2\n end\nend",
"def checkMagazine(magazine, note)\n hash = magazine.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total}\n str = 'Yes'\n note.each do |char|\n if hash[char] > 0\n hash[char] -= 1\n else\n str = 'No'\n end\n end\n puts str\nend",
"def bizet; end",
"def therapist_quest; end",
"def new_info(interior_design)\nputs \"What item do you want to change, otherwise type 'no changes'\"\nnew_data = gets.chomp.downcase\nif new_data != \"no changes\"\nputs \"What is the correct information?\"\nanswer = new_data.chomp\ninterior_design[answer] = gets.chomp\nelse\nputs interior_design\nend\nputs \"\"\nreturn interior_design\nend",
"def describe_problem(p)\n return p[0].to_s+\"-\"+p[1]\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n food_quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n \n#Determine whether fav_food is a key in my_list\n# if you type in a food that isn't on the list, it raises an argument error\n\nunless my_list.has_key?(fav_food)\n raise ArgumentError.new(\"You can't make that food\")\nend\n\n# takes the value of the favorite food\n fav_food_qty = my_list[fav_food]\n#checks whether the number of people is divisible by that value \n if num_of_people % fav_food_qty == 0\n \n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n#if there is a remainder...\n else num_of_people % fav_food_qty != 0\n food_quantity[fav_food] = num_of_people / fav_food_qty\n remaining_people=num_of_people%fav_food_qty\n my_list.each do |k,v|\n if remaining_people / my_list[k] > 0\n food_quantity[k] += remaining_people / my_list[k]\n remaining_people = remaining_people % my_list[k]\n end\n end\n # returns the number of pies, cakes, and cookie that can be made\n return \"You need to make #{food_quantity['pie']} pie(s), #{food_quantity['cake']} cake(s), and #{food_quantity['cookie']} cookie(s).\"\n end\n end",
"def qs_about()\n total_arr = cat_count\n randnums = rand_numbers(total_arr)\n $nums = valid_nums(randnums)\n subjects = get_subjects($nums)\nend",
"def assess_situation(number, announcement, excuse)\n if number == 99\n puts \"#{excuse}\"\n elsif number == 21\n puts \"#{announcement}\"\n else number == 3\n puts \"Meh. Hard Pass\"\n end\nend",
"def readme\n puts\n puts \"Usage of machine_age.rb\"\n puts \"=======================\"\n puts\n puts \"1. Machine analysis\"\n puts \"-------------------\"\n puts \"1.0 clean_ib_source (INFILE EUNA download)\"\n puts \"1.1 copy_column\"\n puts \"1.2 abc_analysis (INFILE: EUNA download)\"\n puts \"1.3 machine_age (INFILE: EUNA downlaod\"\n puts \"1.4 machine_count_top (INFILE: see note)\"\n puts \" Note: use the resulting file from 'machine_age'\"\n puts\n puts \"2. Spares and Repairs analysis\"\n puts \"------------------------------\"\n puts \"2.1 extract_regional_data (INFILE: DWH download)\"\n puts \" Note: Only if you want to analyze a specific country and extract \"\n puts \" it from a world file\"\n puts \"2.2 insert_customer_data (INFILE: result from 2.1 or DWH download\"\n puts \"2.3 region_revenue (INFILE: result from 2.2 or DWH download)\"\n puts \"2.4 customer_revenue (INFILE: result from 2.2)\" \n puts\n puts \"3. Conduct complete analysis in one swoop\"\n puts \"-----------------------------------------\"\n puts \"3.1 machine_analysis (includes 1.1 - 1.3, INFILE: EUNA downlaod)\"\n puts \"3.2 spares_and_repairs_analysis_complete (includes 2.1 - 2.4,\"\n puts \" INFILE: DWH download)\"\n puts \"3.3 spares_and_repairs_analysis (includes 2.3 - 2.4,\"\n puts \" INFILE: DWH downlaod)\"\nend",
"def biome; end",
"def school; end",
"def setup\n size 200, 200\n count = 0 # count gets assigned 0, an integer (Fixnum)\n letter = 'a' # letter gets the letter 'a', a String\n d = 132.32 # d gets the decimal 132.32, a Float (floating-point number)\n happy = false # happy gets false, a Boolean (true or false)\n x = 4.0 # x gets 4.0, another Float\n y = nil # y gets nil, which stands for nothing\n y = x + 5.2 # assign the value of x plus 5.2 to y\n z = x * y + 15.0 # z gets the value of x times y plus 15.0 (or 51.8)\nend",
"def day_2_part_2\n noun = 0\n verb = 0\n\n while noun < 100\n while verb < 100\n if compute(noun, verb) == 19690720\n return (100 * noun) + verb\n end\n verb += 1\n end\n noun += 1\n verb = 0\n end\nend",
"def assert_equal(actual, expected)\n\tif actual == expected\n\t\tputs \"pass\"\n\telse\n\t\tputs \"fail\"\nend\n \nassert_equal(1,1) #=> pass\nassert_equal(2,1) #=> fail\n \n# Use assert to test the following:\n \n# define a method to sum the values of an array. Make this method defend against nils and\n# other errors\n \ndef sum(numbers)\n\tresult = 0\n\tnumbers.collect do |i|\n\tresult += i if i.is_a? Integer\n\tend\n\tresult\nend\n \nassert_equal sum([]), 0\nassert_equal sum([1,2]), 3\nassert_equal sum([1,nil,2]), 3\nassert_equal sum([1, \"2\", 2]), 3\n \n# define a method that returns comfortable for temps between 60-80, cold for below and hot\n# for above.\n \ndef temperature_bot(temp)\n\tif temp >=60 && temp <=80\n\t\tputs \"comfortable\"\n\telsif temp < 60\n\t\tputs \"cold\"\n\telse\n\t\tputs \"hot\"\n\tend\nend\n \nassert_equal temperature_bot(65), \"comfortable\"\nassert_equal temperature_bot(70), \"comfortable\"\nassert_equal temperature_bot(85), \"hot\"\nassert_equal temperature_bot(30), \"cold\"\n \n# define an object, Person, that has a birthdate and a name. Define a method for a person\n# that returns their age.\n\nclass Person\n\tattr_accessor :birthday, :name\n\n\tdef age\n\t\tbirth_year = @birthday.split(\"/\").last.to_i\n\t\tTime.now.year - birth_year\n\tend\nend\n\n\nbegin\n person = Person.new\n person.name = \"Alan Turing\"\n person.birthday = \"06/23/1912\"\n \n assert_equal person.name, \"Alan Turing\"\n assert_equal person.birthday, \"06/23/1912\"\n assert_equal person.age, 101\n \nrescue => e\n puts \"Fail: #{e}\"\nend",
"def help_ExamplePoints\n puts \" Throw Score\"\n puts \"--------- ------------------\"\n puts \"5 1 3 4 1 50 + 2 * 100 = 250\"\n puts \"1 1 1 3 1 1000 + 100 = 1100\"\n puts \"2 4 4 5 4 400 + 50 = 450\"\n pressToContinue\n end",
"def info() quiz_question.info end",
"def questions_explanation\n puts \"Time to do the quiz!.\"\n puts \"\"\n puts \"Each question will be printed to the screen.\"\n puts \"Once you see it, simply type in your answer and hit the enter/return key.\"\n puts \"If you can't think of an answer right away, you can skip the question and return to it at the end.\"\n puts \"\"\n puts \"Ok, let's go! (Hit enter/return when you're ready)\"\n gets\n end",
"def prime_mutation_determination(roll)\n case roll\n when 1..9\n @@primary_mutations << \"Acid Blood\"\n @@attacks << {:attack_mode => \"Acid blood spray\", :SV => 20, :rate => 1, :range => 2, :damage => \"d12\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"60\", :notes => \"automatic on melee or point-blank puncturing attack\"}\n\n when 10..20\n @@primary_mutations << \"Acid Spit\"\n @@attacks << {:attack_mode => \"Acid Spit\", :SV => 6, :rate => 1, :range => 6, :damage => \"d6 + 2 per dround for d6 rounds\", :ammo => \"2/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"60\", :notes => \"does same damage to ropes, bars, locks, etc.\"}\n when 21..32\n @@primary_mutations << \"Advanced Mind\"\n @@intelligence += (d(10 + d(10) + d(10)))\n @@character_notes << \"character gains two hazard checks against insanity and mental attacks that require hazard checks\"\n\n when 33..36\n @@primary_mutations << \"Agony Sphere\"\n @@attacks << {:attack_mode => \"Agony Sphere\", :SV => \"auto\", :rate => 1, :range => (@@willpower/2), :damage => \"d6 + +10DV to targets\", :ammo => \"1/day per user rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"60\", :notes => \"requires 3 full rounds of concentration to unleash; can be sustained for 1 rd/willpower point\"}\n\n when 37..44\n @@primary_mutations << \"Amphibian\"\n @@character_notes << \"Can breathe as well in water as air\"\n @@character_notes << \"Suffers d3 dmg per day in arid environments\"\n\n when 45..52\n @@primary_mutations << \"Amplification\"\n @@character_notes << \"Doubles daily/rank-based rate of limited-use mutations\"\n\n when 53..59\n @@primary_mutations << \"Aquatic Adaptation\"\n @@character_notes << \"Webbed hands and feet\"\n @@character_notes << \"Withstands cold 2x vs. humans\"\n @@character_notes << \"Must be fully immersed in water 1hr per day or suffer d3 dmg; d6 in desert areas\"\n\n when 60..71\n @@primary_mutations << \"Arid Adaptation\"\n @@dv -= 3\n @@appearance = [@@appearance - d(8), 1].max\n @@character_notes << \"Needs 1/10th as much water as pure stock human\"\n @@character_notes << \"Specialized organ holds 2 liters drinking water (can yak up in 250 or 500ml portions)\"\n\n when 72..79\n @@primary_mutations << \"Asphyxiation Zone\"\n @@attacks << {:attack_mode => \"Asphyxiation Zone\", :SV => \"auto\", :rate => 1, :range => (@@willpower * 2), :damage => \"d10\", :ammo => \"2/day per user rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"61\", :notes => \"lasts 2 rounds per rank\"}\n\n when 80..89\n @@primary_mutations << \"Aura of Protection\"\n @@character_notes << \"2 uses / rank / day; DV -10 + 10 pt force field dmg soak per round; duration willpower rounds; 2 rounds to activate\"\n\n when 90..102\n @@primary_mutations << \"Ballistic Hide\"\n @@dv -= 4\n @@appearance = [@@appearance - d(4), 1].max\n @@character_notes << \"Additional -20DV vs. blunt/crushing attacks including non-AP bullets\"\n\n when 103..109\n @@primary_mutations << \"Beak\"\n @@appearance = [@@appearance - (d(6) + d(6)), 1].max\n @@attacks << {:attack_mode => \"Beak\", :SV => 10, :rate => 1, :range => 1, :damage => \"d12\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"61\", :notes => \"\"}\n @@character_notes << \"Character cannot speak clearly\"\n\n when 110..127\n @@primary_mutations << \"Beam Eyes\"\n @@attacks << {:attack_mode => \"Beam Eyes\", :SV => 15, :rate => 1, :range => (@@willpower + @@perception), :damage => \"10 + d6/rank\", :ammo => \"2 / rank / day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"61\", :notes => \"\"}\n\n when 128..134\n @@primary_mutations << \"Berserker Rage\"\n @@character_notes << \"Berserker Rage: 2/day/rank usage; duration 1 battle; -5DV, +10SV, +10dmg (melee weapons only); +20 strength; can fight on for d6 rounds after suffering fatal damage\"\n when 135..144\n @@primary_mutations << \"Bladed Limbs\"\n def bladed_limbs_location(roll)\n case roll\n when 1 then result = \"Shoulder\"\n when 2 then result = \"Back\"\n when 3 then result = \"Chest\"\n when 4 then result = \"Side\"\n when 5 then result = \"Hip\"\n when 6 then result = \"Abdomen\"\n end\n end\n\n d(4).times do\n bladed_limbs_location(d(6))\n @@character_notes << \"Sword-like bone blade protruding from #{result}\"\n @@appearance = [@@appearance - 2, 1].max\n @@character_weight += 5\n end\n\n @@attacks << {:attack_mode => \"Bladed limb(s)\", :SV => 5, :rate => \"1 per bladed limb\", :range => 0, :damage => \"d12 + 2\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"62\", :notes => \"\"}\n\n\n when 145..149\n @@primary_mutations << \"Blurred Movement\"\n @@character_notes << \"Blurred Movement: -20DV; willpower rounds/day; can be used to blur entire body or only parts\"\n\n when 150..179\n @@character_notes << \"Due to body disporportion, no relic shell armor can be worn, but other types can be modified to fit\"\n def body_disproportion_location(roll)\n case roll\n when 1\n @@primary_mutations << \"Body Disproportion: Dominant arm is massive!\"\n @@character_notes << \"Dominant arm has strength of #{(@@strength + @@strength + d(20) + d(20))} which applies to all 1- and 2-handed melee weapons character wields\"\n @@appearance = [@@appearance - d(4), 1].max\n @@move -= 0.5\n @@character_weight += (20 + d(20))\n when 2\n @@primary_mutations << \"Body Disproportion: Character's head is massive!\"\n @@intelligence += (d(20) + 20)\n @@move -= 1\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@character_notes << \"TWO intelligence-based hazard checks, when called for\"\n @@character_weight += (20 + d(10))\n when 3\n @@primary_mutations << \"Body Disproportion: Upper body incredibly over-muscled!\"\n @@strength += (20 + d(20))\n @@endurance += (20 + d(20))\n @@move -= 1\n @@agility = [@@agility - d(10), 1].max\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@character_weight += (20 + d(20) + d(20))\n when 4\n @@primary_mutations << \"Body Disproportion: hips and legs are twice normal length!\"\n @@move += @@move\n @@character_height += 100\n @@appearance = [@@appearance - d(4), 1].max\n @@attacks << {:attack_mode => \"Wicked kick\", :SV => 0, :rate => \"1\", :range => 0, :damage => \"2d10\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"62\", :notes => \"\"}\n @@character_weight += (30 + d(20) + d(20))\n when 5\n @@primary_mutations << \"Body Disproportion: comically giant hands and feet!\"\n @@attacks << {:attack_mode => \"Punch or kick\", :SV => 0, :rate => \"1\", :range => 0, :damage => \"2d12\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"62\", :notes => \"\"}\n @@character_notes << \"Weapons with triggers, keyboards, or other items requiring normal human hands are unusable without modifying item.\"\n @@appearance = [@@appearance - (d(6) + 1), 1].max\n @@character_weight += (d(6) + d(6) + d(6) + d(6))\n when 6\n @@primary_mutations << \"Body Disproportion: extra long arms!\"\n @@character_notes << \"+5 SV in melee combat\"\n @@character_notes << \"+5 thrown weapon DMG\"\n @@appearance = [@@appearance - (d(4) + 1), 1].max\n when 7\n @@primary_mutations << \"Body Disproportion: greatly elongated torso!\"\n @@character_notes << \"If pregnant, gives birth to a litter of d4 + 1 offspring.\"\n @@endurance += (d(10) + d(10))\n @@appearance = [@@appearance - d(6), 1].max\n @@character_height += (20 + d(20))\n @@character_weight += (10 + d(20))\n def elongated_torso_bonus(roll1, roll2, roll3, roll4) # need to add actual mutation results via primary_mutations_roll(xx)\n case roll1\n when 1..50\n @@primary_mutations << \"Reserve heart\"\n end\n case roll2\n when 1..65\n @@primary_mutations << \"Radiation absorption\"\n end\n case roll3\n when 1..37\n @@primary_mutations << \"Breath holding\"\n end\n case roll4\n when 1..72\n @@primary_mutations << \"Nutriment cache\"\n end\n\n end\n elongated_torso_bonus(d(100),d(100),d(100),d(100))\n when 8\n 2.times do\n elongated_torso_bonus(d(7))\n end\n end\n\n end\n body_disproportion_location(d(8))\n\n when 180..195\n def body_regeneration_rate(roll)\n case roll\n when 1..12\n @@endurance_healing_rate += 4\n when 13..32\n @@endurance_healing_rate += 7\n when 33..40\n @@endurance_healing_rate += 10\n when 41..64\n @@endurance_healing_rate = 15\n when 65..87\n @@endurance_healing_rate = \"1 pt per hour\"\n when 88..93\n @@endurance_healing_rate = \"2 pts per hour\"\n when 94..96\n @@endurance_healing_rate = \"4 pts per hour\"\n when 97..98\n @@endurance_healing_rate = \"6 pts per hour\"\n when 99\n @@endurance_healing_rate = \"10 pts per hour\"\n when 100\n @@endurance_healing_rate = \"1 pt per round\"\n end\n end\n body_regeneration_rate(d(100))\n @@primary_mutations << \"Body Regeneration: #{@@endurance_healing_rate} healing rate bonus\"\n\n when 196..201\n @@primary_mutations << \"Breath Holding: triple base endurance rate + regular breath holding rate (Hub Rules p. 122)\"\n when 202..224\n @@primary_mutations << \"Claws: don’t hinder her from using bows, crossbows, or weapons that use a trigger, but disallow her from using keyboards or doing fne electronics work\"\n @@attacks << {:attack_mode => \"Claw\", :SV => 7, :rate => \"1 per hand\", :range => 0, :damage => \"d12 each\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"62-63\", :notes => \"\"}\n @@character_notes << \"Thanks to claws, character climbs as though she has 2 points in Climbing skill\"\n when 225..230\n @@primary_mutations << \"Climbing Suckers: like a gecko, character can climb on anything at 1/2 move\"\n @@character_notes << \"When falling, type A agility based hazard check to catch side of building/pit and stop fall\"\n when 231..239\n @@primary_mutations << \"Coma Inducement\"\n @@attacks << {:attack_mode => \"Coma inducement\", :SV => 0, :rate => \"\", :range => @@willpower + @@willpower, :damage => \"coma\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"victim gets tybe B willpower based hazard check; see p. 63 for details\"}\n when 240..253\n number_of_pincers = 0\n arms_too = \"True\"\n pincer_size = \"Small\"\n def pincer_formation_on_mutant(roll)\n case roll\n when 1..2\n @@primary_mutations << \"Crab Pincers: 1 pincer replacing 1 arm\"\n number_of_pincers += 1\n @@character_weight -= 15\n when 3..6\n @@primary_mutations << \"Crab Pincers: 2 pincers replacing both human arms\"\n number_of_pincers += 2\n @@character_weight -= 30\n when 7\n @@primary_mutations << \"Crab Pincers: 1 pincer growing from shoulder, both human arms intact\"\n number_of_pincers += 1\n when 8..9\n @@primary_mutations << \"Crab Pincers: 2 pincers in addition to human arms\"\n number_of_pincers += 2\n when 10\n number_of_pincers = (2 + d(2))\n def arms_too(roll)\n case roll\n when 79..100\n arms_too = \"False\"\n @@character_weight -= 30\n end\n end\n @@primary_mutations << \"Crab Pincers: #{number_of_pincers} total\"\n arms_too(d(100))\n end\n end\n def pincer_size(roll)\n case roll\n when 1..3\n pincer_size = \"Small\"\n @@character_weight += (number_of_pincers * 15)\n @@attacks << {:attack_mode => \"Pincer\", :SV => 2, :rate => \"#{number_of_pincers}\", :range => 0, :damage => \"d10 + 1\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"\"}\n when 4..6\n pincer_size = \"Medium\"\n @@movement_rate_base -= (0.25 * number_of_pincers)\n @@character_weight += (number_of_pincers * 20)\n @@attacks << {:attack_mode => \"Pincer\", :SV => 4, :rate => \"#{number_of_pincers}\", :range => 0, :damage => \"d12 + 3\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"\"}\n when 7..9\n pincer_size = \"Large\"\n @@movement_rate_base -= (0.5 * number_of_pincers)\n @@character_weight += (number_of_pincers * 35)\n @@attacks << {:attack_mode => \"Pincer\", :SV => 7, :rate => \"#{number_of_pincers}\", :range => 0, :damage => \"d20 + 3\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"\"}\n when 10\n pincer_size = \"Massive\"\n @@movement_rate_base -= (0.75 * number_of_pincers)\n @@character_weight += (number_of_pincers * 50)\n @@attacks << {:attack_mode => \"Pincer\", :SV => 10, :rate => \"#{number_of_pincers}\", :range => 0, :damage => \"d20 + 10\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"63\", :notes => \"\"}\n end\n end\n\n pincer_formation_on_mutant(d(10))\n pincer_size(d(10))\n @@primary_mutations << \"Pincers: #{number_of_pincers} of #{pincer_size} size\"\n if arms_too == \"False\"\n @@appearance = [@@appearance - (number_of_pincers * d(4) + 2), 1].max\n @@character_notes << \"No human arms - character cannot use triggers, keyboards, or complex items\"\n elsif arms_too == \"True\"\n @@appearance = [@@appearance - (number_of_pincers * d(4)), 1].max\n end\n\n\n when 254..292\n def deviant_skin_structure(roll)\n case roll\n when 1..3\n @@primary_mutations << \"Fire-proof skin\"\n @@character_notes << \"No damage from fire for 10 rounds; 1/2 damage after\"\n @@character_notes << \"1/2 damage from explosions\"\n when 4..5\n @@primary_mutations << \"Reflective skin\"\n @@character_notes << \"1/2 damage from beam weapons when clothed; 70 percent resistance to beam weapons vs. bare skin\"\n @@appearance += d(6)\n when 6..7\n @@primary_mutations << \"Alkaline skin\"\n @@character_notes << \"Character totally immune to acid attacks (which still ruin character's gear)\"\n when 8..10\n @@primary_mutations << \"Weather sensitive skin\"\n @@character_notes << \"Sense weather changes in 20km radius; can sense open bodies of water within 2 km\"\n when 11\n @@primary_mutations << \"Glow in the dark skin\"\n @@character_notes << \"3m radius green glow; visible up to 12km away - character can't turn off glow\"\n when 12\n @@primary_mutations << \"Photosynthetic skin\"\n @@character_notes << \"4 hrs in sunlight = 1 meal; 1 hr in sunlight = 3 pts healing (in addition to normal resting healing)\"\n end\n end\n deviant_skin_structure(d(12))\n\n when 293..298\n @@primary_mutations << \"Devastator Pulse\"\n @@attacks << {:attack_mode => \"Devastator Pulse\", :SV => (@@accuracy + @@willpower), :rate => \"4 rounds to charge, release on 5th\", :range => @@willpower, :damage => \"3d20 / d100 + 40 vs. machines\", :ammo => \"1/rank/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"\"}\n\n when 299..300\n @@primary_mutations << \"Displacement\"\n @@character_notes << \"Displacement: #{@@willpower} rounds per day, DV -30\"\n when 301..305\n @@primary_mutations << \"Doom Sphere\"\n @@attacks << {:attack_mode => \"Doom Sphere\", :SV => \"01-95\", :rate => \"1/10 days\", :range => (@@willpower * 10), :damage => \"3d20 vs organics; 6d20 vs electronics\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"User must make intelligence type B hazard check or go insane for 1 hour (p. 126)\"}\n when 306..314\n @@primary_mutations << \"Dread Zone\"\n @@attacks << {:attack_mode => \"Dread Zone\", :SV => \"01-95\", :rate => 1, :range => @@intelligence, :damage => \"tybe B hazard check vs. intelligence or +10SV to attack\", :ammo => \"1/rank/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"Duration: rank in rounds; does not affect inorganic beings or creatures with morale = n/a\"}\n when 315..322\n @@primary_mutations << \"Earth Thump\"\n @@attacks << {:attack_mode => \"Earth Thump\", :SV => (@@willpower + 30), :rate => \"3 rounds to generate\", :range => @@willpower, :damage => \"d10/user rank\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"Targets 1 human-sized enemy per rank of user (assuming multiple targets close together)\"}\n when 323..341\n @@primary_mutations << \"Electrical Charge\"\n @@attacks << {:attack_mode => \"Electrical Charge\", :SV => 20, :rate => \"1\", :range => 0, :damage => \"d20 + HC\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"64\", :notes => \"Victim makes END-based tybe B hazard check or stunned for d3 rounds\"}\n @@character_notes << \"Four Electrical Charge jolts are suffcient to fully re-charge a standard power cell.\"\n when 342..349\n @@primary_mutations << \"Electrical Pulse\"\n @@attacks << {:attack_mode => \"Electrical Pulse\", :SV => 20, :rate => 1, :range => (@@willpower), :damage => \"d20 / 3d20 vs machines\", :ammo => \"3/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"Can be used to start fires as well\"}\n when 350..355\n @@primary_mutations << \"Electro Magnetic Pulse\"\n @@attacks << {:attack_mode => \"Electro Magnetic Pulse\", :SV => 30, :rate => 1, :range => @@willpower, :damage => \"d10/d100 vs electronics\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"\"}\n when 356..376\n @@primary_mutations << \"Empathy\"\n @@character_notes << \"Empathy: #{@@willpower} range. Unlimited uses. The subject is allowed a type C, intelligence based hazard check. If failed, mutant knows victim's emotions. Alternately, emotions can be projected.\"\n when 377..388\n @@primary_mutations << \"Energy Blade\"\n def energy_blade_type(roll) # table Hub Rules p. 65\n case roll\n when 1..20\n @@attacks << {:attack_mode => \"Energy Blade: Blue\", :SV => 10, :rate => 1, :range => 1, :damage => \"d12\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 21..40\n @@attacks << {:attack_mode => \"Energy Blade: Green\", :SV => 10, :rate => 1, :range => 1, :damage => \"d20 stun\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 41..65\n @@attacks << {:attack_mode => \"Energy Blade: Red\", :SV => 10, :rate => 1, :range => 1, :damage => \"d20\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 66..85\n @@attacks << {:attack_mode => \"Energy Blade: Orange\", :SV => 10, :rate => 1, :range => 1, :damage => \"2d20 stun\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 86..97\n @@attacks << {:attack_mode => \"Energy Blade: Purple\", :SV => 10, :rate => 1, :range => 1, :damage => \"2d20\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 98..99\n @@attacks << {:attack_mode => \"Energy Blade: White\", :SV => 10, :rate => 1, :range => 1, :damage => \"d100 stun\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n when 100\n @@attacks << {:attack_mode => \"Energy Blade: Gold\", :SV => 10, :rate => 1, :range => 1, :damage => \"d100\", :ammo => \"#{@@willpower} rounds\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"2/day/rank\"}\n end\n end\n if @@primary_mutations.include? \"Energy Blade\" # Note: NO duplication -- reroll if this result comes up twice.\n @@primary_mutations_rolls += 1\n else\n energy_blade_type(d(100))\n end\n\n when 389..401\n @@primary_mutations << \"Extreme Size Decrease\"\n @@character_height = (22 + d(20) + d(20)) # NOTE: should be dependent on GENDER, ignored that.\n 3.times @@skills << \"Stealth\"\n 2.times @@skills << \"Climbing\"\n @@character_notes << \"Cannot wield two-handed weapons. Normal one-handed weapons including pistols must be employed with both hands (except knifes and daggers, which are considered swords for this mutant)\"\n @@character_notes << \"Relic armor cannot be worn except scrap relic.\"\n def extreme_size_decrease(height) # Hub Rules p. 65\n case height\n when 22..27\n @@character_weight = (15 + d(10))\n @@agility += 20\n @@movement_rate_base == 4.5\n @@strength = [@@strength - 15, 1].max\n @@endurance = [@@endurance - 10, 1].max\n when 28..35\n @@character_weight = (20 + d(12))\n @@agility += 15\n @@movement_rate_base = 5\n @@strength = [@@strength - 10, 1].max\n @@endurance = [@@endurance - 7, 1].max\n when 36..45\n @@character_weight = (25 + d(20))\n @@agility += 10\n @@movement_rate_base = 5.5\n @@strength = [@@strength - 5, 1].max\n @@endurance = [@@endurance - 5, 1].max\n when 46..65\n @@character_weight = (30 + d(20) + d(20))\n @@agility += 7\n @@movement_rate_base = 6\n @@strength = [@@strength - 3, 1].max\n @@endurance = [@@endurance - 3, 1].max\n end\n end\n\n extreme_size_decrease(@@character_height)\n\n when 402..419\n def fang_size(roll) # Hub rules p. 65\n case roll\n when 1..3\n sizeoffangs = \"Small\"\n fangsv = 2\n fangdmg = \"d6\"\n @@appearance = [@@appearance - 1, 1].max\n when 4..8\n sizeoffangs = \"Medium\"\n fangsv = 4\n fangdmg = \"d10\"\n @@appearance = [@@appearance - (1 + d(2)), 1].max\n when 9..10\n sizeoffangs = \"Huge\"\n fangsv = 6\n fangdmg = \"d20\"\n @@appearance = [@@appearance - (d(3) + 2), 1].max\n @@character_notes << \"Ability to speak clearly greatly reduced\"\n end\n @@attacks << {:attack_mode => \"Fangs\", :SV => fangsv, :rate => 1, :range => 0, :damage => fangdmg, :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"65\", :notes => \"This attack can only be employed as a supplemental melee attack if involved in close fighting\"}\n @@primary_mutations << \"Fanged: #{sizeoffangs} size\"\n end\n\n fang_size(d(10))\n\n when 420..427\n @@primary_mutations << \"Flame Breath\"\n @@attacks << {:attack_mode => \"Flame Breath\", :SV => 10, :rate => 1, :range => \"3/rank\", :damage => \"d6/rd for 2d6 rds\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"66\", :notes => \"Up to 3 man sized targets can be attacked at once if close together\"}\n when 428..438\n def force_field_strength(roll) # Hub rules p. 66\n case roll\n when 1..10\n force_field = d(10)\n when 11..24\n force_field = (d(10) + 3)\n when 25..53\n force_field = (d(10) + 5)\n when 54..78\n force_field = (d(10) + 10)\n when 79..94\n force_field = (d(10) + 12)\n when 95\n force_field = (d(10) + 15)\n when 96\n force_field = (d(10) + 17)\n when 97\n force_field = (d(10) + 20)\n when 98\n force_field = (d(10) + 23)\n when 99\n force_field = (d(10) + 26)\n when 100\n force_field = (d(10) + 30)\n end\n @@primary_mutations << \"Force Field: 2 uses/rank/day; #{willpower} rounds duration; absorbs #{force_field} dmg/round\"\n end\n force_field_strength(d(100))\n\n when 439..445\n @@primary_mutations << \"Foul Flesh\"\n @@character_notes << \"Will not eat mutant: all mammals, all humanoids except moaners, horrlify, all amphibians, fsh, birds except black vultures, reptilius, all reptiles, except alligators and crocodilians.\"\n when 446..453\n def furred_mutation(roll)\n case roll\n when 1..3\n fur_type = \"Fine, cat-like\"\n fur_dv = -3\n fur_cold = \"Double normal human cold resistance\"\n @@appearance = [@@appearance - d(3), 1].max\n when 4..5\n fur_type = \"Wool, sheep-like\"\n fur_dv = -6\n fur_cold = \"Triple normal human cold resistance\"\n @@appearance = [@@appearance - (1 + d(4)), 1].max\n when 6..7\n fur_type = \"Thick, sheep-like wool\"\n fur_dv = -9\n fur_cold = \"Quadruple normal human cold resistance\"\n @@appearance = [@@appearance - (d(6) + 2), 1].max\n when 8..9\n fur_type = \"Badger-like bristles\"\n fur_dv = -11\n fur_cold = \"Double normal human cold resistance\"\n @@appearance = [@@appearance - (d(6) + d(6) + 2), 1].max\n @@character_notes << \"+2 dmg to basic punch attack\" # +2 dmg to punch attack -- HOW to implement??\n when 10\n fur_type = \"Porcupine-like quills\"\n fur_dv = -13\n fur_cold = \"Double normal human cold resistance\"\n @@appearance = [@@appearance - (d(6) + d(6) + 3), 1].max\n @@character_notes << \"+2 dmg to basic punch attack\" # +2 dmg to punch attack -- HOW to implement??\n end\n @@primary_mutations << \"Furred: #{fur_type}, #{fur_cold} cold resistance. #{fur_dv} DV bonus\"\n @@dv += fur_dv\n end\n furred_mutation(d(10))\n when 454..459\n\n def gaseous_discharge(roll) # Hub Rules p. 67\n case roll\n when 1..2\n gas_type = \"Sleep\"\n gas_effect = \"All must make an Endurance-based type A hazard check or pass out for d100 rounds.\"\n when 3..4\n gas_type = \"Blindness\"\n gas_effect = \"All must make an Endurance-based type A hazard check or go blind for d6 days.\"\n when 5\n gas_type = \"Stink\"\n gas_effect = \"All must make an Endurance-based type C hazard check or spend 2 rounds vomiting, becoming +30 to strike, with their own SV being reduced to half, rounded down.\"\n when 6\n gas_type = \"Corrosive\"\n gas_effect = \"All must make an Endurance-based type B hazard check suffer d6 damage/rd from corrosive acids. Those who succeed vs. hazard check take 1 dmg/rd.\"\n when 7\n gas_type = \"Hallucinogenic\"\n gas_effect = \"All must make an Intelligence-based tybe B hazard check or hallucinate, +30SV to strike and -30SV to retaliate. Animals must make a morale check or flee immediately.\"\n when 8\n gas_type = \"Poison\"\n gas_effect = \"All must make an Endurance-based type A hazard check or drop unconscious for 10 rounds. Their breathing ceases on the 11th round and if not resuscitated by artifcial respiration, will die on the 14th round.\"\n end\n @@primary_mutations << \"Gaseous Discharge: #{gas_type}\"\n @@attacks << {:attack_mode => \"Gaseous Discharge: #{gas_type}\", :SV => \"Auto\", :rate => 1, :range => \"10 m radius\", :damage => \"Special\", :ammo => \"2/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"66-67\", :notes => \"#{gas_effect} Gas dissipates in 2 rounds outdoors or lingers 2d10 + 4 rounds in enclosed areas.\"}\n @@character_notes << \"Character immune to #{gas_type}\"\n end\n\n gaseous_discharge(d(8))\n\n when 460..472\n def gaping_maw(roll) #Hub Rules p. 67\n case roll\n when 1..5\n maw_size = \"Large\"\n maw_sv = 4\n maw_damage = \"d12\"\n maw_mv_mod = 0\n maw_added_weight = 15\n @@appearance = [@@appearance - (d(4) + d(4) + 2), 1].max\n when 6..7\n maw_size = \"Huge\"\n maw_sv = 7\n maw_damage = \"d20\"\n maw_mv_mod -= 0.25\n maw_added_weight = 30\n @@appearance = [@@appearance - (d(4) + d(4) + 4), 1].max\n when 8..9\n maw_size = \"Massive\"\n maw_sv = 12\n maw_damage = \"2d20\"\n maw_mv_mod -= 0.5\n maw_added_weight = 70\n @@appearance = [@@appearance - (d(6) + d(6) + 5), 1].max\n when 10\n maw_size = \"Colossal\"\n maw_sv = 20\n maw_damage = \"3d20\"\n maw_mv_mod -= 1\n maw_added_weight = 120\n @@appearance = [@@appearance - (d(6) + d(6) + 8), 1].max\n end\n @@primary_mutations << \"Gaping Maw: #{maw_size} in size\"\n @@attacks << {:attack_mode => \"Gaping Maw\", :SV => maw_sv, :rate => 1, :range => 0, :damage => maw_damage, :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"67\", :notes => \"Can be employed as a supplemental melee attack \"}\n @@character_notes << \"Almost totally carnivorous diet. Mutant drools and spits when speaking in a low, gruff voice difficult for strangers to understand.\"\n @@character_weight += maw_added_weight\n @@movement_rate_base -= maw_mv_mod\n end\n\n gaping_maw(d(10))\n\n\n when 473..497\n def heal_touch(willpower)\n case willpower\n when 1..6\n healrate = \"d8\"\n when 7..14\n healrate = \"d12\"\n when 15..34\n healrate = \"d20\"\n when 35..64\n healrate = \"d20 + 10\"\n when 65..84\n healrate = \"d20 + 20\"\n when 85..105\n healrate = \"d20 + 30\"\n when 106..200\n healrate = \"d20 + 40\"\n end\n @@primary_mutations << \"Heal Touch: 2/day/rank, #{healrate} trait points healed. Diseases healed if victim makes Type B willpower based hazard check.\"\n end\n\n heal_touch(@@willpower)\n\n @@primary_mutations << \"Heal Touch\"\n when 498..511\n def heat_pulse(willpower) # Hub Rules p. 67\n case willpower\n when 1..6\n heat_pulse_sv = -5\n heat_pulse_dmg = \"d6\"\n heat_pulse_range = 5\n when 7..14\n heat_pulse_sv = 0\n heat_pulse_dmg = \"d10\"\n heat_pulse_range = 10\n when 15..34\n heat_pulse_sv = 4\n heat_pulse_dmg = \"d20\"\n heat_pulse_range = @@willpower\n when 35..64\n heat_pulse_sv = 6\n heat_pulse_dmg = \"d20 + 10\"\n heat_pulse_range = (@@willpower * 2)\n when 65..84\n heat_pulse_sv = 9\n heat_pulse_dmg = \"d20 + 20\"\n heat_pulse_range = (@@willpower * 3)\n when 85..105\n heat_pulse_sv = 12\n heat_pulse_dmg = \"d20 + 30\"\n heat_pulse_range = (@@willpower * 4)\n when 106..200\n heat_pulse_sv = 15\n heat_pulse_dmg = \"d20 + 40\"\n heat_pulse_range = (@@willpower * 5)\n end\n @@primary_mutations << \"Heat Pulse\"\n @@attacks << {:attack_mode => \"Heat Pulse\", :SV => heat_pulse_sv, :rate => 1, :range => heat_pulse_range, :damage => heat_pulse_dmg, :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"67\", :notes => \"\"}\n end\n\n heat_pulse(@@willpower)\n\n\n when 512..556\n\n def heightened_attributes(roll) # Hub Rules p. 68\n case roll\n when 1\n heightened_attributes_type = \"Cat Balance\"\n @@agility += (d(20) + 20)\n @@accuracy += (d(10) + d(10))\n @@perception += (d(20) + d(20))\n @@appearance += d(10)\n 2.times @@skills << \"Stealth\"\n @@character_notes << \"Due to cat balance, character always gets two hazard checks when agility or accuracy are involved.\"\n when 2\n heightened_attributes_type = \"Eagle Eyes\"\n @@accuracy += (d(10) + d(10))\n @@perception += (d(10) + d(10) + d(10))\n @@character_notes << \"Due to eagle eyes, character sees 10x better than typical human, including at night.\"\n when 3..4\n heightened_attributes_type = \"Strength\"\n @@strength += (d(20) + 30)\n @@appearance += (d(10) + d(10))\n @@character_notes << \"Due to heightened strength, character always gets two hazard checks when strength involved.\"\n when 5..6\n heightened_attributes_type = \"Endurance\"\n @@endurance += (d(20) + 30)\n @@character_notes << \"Due to heightened endurance, character always gets two hazard checks when endurance involved (eg, poison).\"\n when 7\n heightened_attributes_type = \"Hand-Eye Coordination\"\n @@accuracy += (d(20) + 20)\n @@character_notes << \"Due to superior hand-eye coordination, character always gets two hazard checks when accuracy involved.\"\n when 8\n heightened_attributes_type = \"Beauty\"\n @@appearance += (d(20) + 30)\n @@agility += d(6)\n @@accuracy += d(6)\n @@strength += d(6)\n @@character_notes << \"Due to heightened beauty, character always gets two hazard checks when appearance involved.\"\n when 9\n heightened_attributes_type = \"Auditory\"\n @@dv -= 5\n @@character_notes << \"+2 initiative when operating alone or more than 10m from companions.\"\n @@character_notes << \"Sonic attacks do double damage, while crying babies, crowded pubs, and other intense noises are painful.\"\n @@character_notes << \"Due to heightened hearing, character receives 4 attempts on hazard checks related to listening/hearing.\"\n when 10\n heightened_attributes_type = \"Olfactory\"\n (d(2) + 1).times @@skills << \"Tracking\"\n @@character_notes << \"Due to heightened sense of smell, character gets no hazard checks vs. stink-based attacks.\"\n @@character_notes << \"Character cannot be fooled by illusions at less than 10m\"\n @@character_notes << \"Bloodhound-like tracking abilities; however, after 12 hours, or rain, sand storms, or crossing water, all result in lost trails.\"\n when 11\n heightened_attributes_type = \"Willpower\"\n @@willpower += (d(20) + 30)\n @@character_notes << \"Due to heightened willpower, character always gets two hazard checks when willpower involved.\"\n when 12\n heightened_attributes_type = \"Intelligence\"\n @@intelligence += (d(20) + 30)\n @@character_notes << \"Due to heightened intelligence, character always gets two hazard checks when intelligence involved.\"\n end\n @@primary_mutations << \"Heightened Attributes: #{heightened_attributes_type}\"\n end\n\n heightened_attributes(d(12))\n\n\n when 557..566\n number_of_horns = d(4)\n @@primary_mutations << \"Horns: #{number_of_horns} on head\"\n @@character_weight += (2 * number_of_horns)\n @@attacks << {:attack_mode => \"Horns\", :SV => (3 * number_of_horns), :rate => 1, :range => 0, :damage => \"#{number_of_horns}d10\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"68\", :notes => \"This attack can be employed as a supplemental melee attack\"}\n @@character_notes << \"Due to horns, character can't wear relic helmets or shell-class armor unless horns permanently removed.\"\n when 567..571\n @@primary_mutations << \"Image Multiplication: #{@@willpower} duration, 2 uses/day/rank. Up to #{@@willpower/10.floor} images of mutant's self created. Hub Rules p. 68\"\n when 572..578\n def image_projection(intelligence)\n case intelligence\n when 1..9\n image_projection_range = \"1 km\"\n image_projection_duration = \"d4 rounds\"\n when 10..34\n image_projection_range = \"#{@@intelligence/2} km\"\n image_projection_duration = \"2d4 rounds\"\n when 35..54\n image_projection_range = \"#{@@intelligence} km\"\n image_projection_duration = \"10 + d10 rounds\"\n when 55..74\n image_projection_range = \"#{@@intelligence * 2} km\"\n image_projection_duration = \"20 + d20 rounds\"\n when 75..94\n image_projection_range = \"#{@@intelligence * 100} km\"\n image_projection_duration = \"100 + d100 rounds\"\n when 95..200\n image_projection_range = \"anywhere within solar system\"\n image_projection_duration = \"200 + 2d100 rounds\"\n end\n @@primary_mutations << \"Image Projection: #{image_projection_range} range, #{image_projection_duration} duration. 1/rank/day. Illusion can repeat 2 words/round. Creatures with 35+ intelligence can make a type B intelligence based hazard check to recognize projection as an illusion. Hub Rules p. 69\"\n end\n\n image_projection(@@intelligence)\n\n when 579..603\n def immunity_mutation(roll)\n case roll\n when 1..2\n @@primary_mutations << \"Poison immunity: totally immune to all forms of poison. Also, cannot get drunk.\"\n when 3..4\n @@primary_mutations << \"Disease immunity: All forms of infection, disease, sickness, parasites, etc. don't affect character. Immune to parasites as well.\"\n when 5..6\n @@primary_mutations << \"Radiation immunity: unaffected by all forms of radiation.\"\n end\n end\n\n immunity_mutation(d(6))\n\n when 605..613\n @@primary_mutations << \"Increased Cellular Activity\"\n @@endurance_healing_rate = (@@endurance_healing_rate * 3)\n @@character_notes << \"Character suffers no ill effects from aging (only benefits) and will live forever if not killed in combat, disease, poison, or accident.\"\n when 614..617\n @@primary_mutations << \"Light Burst: 10m radius, 2/day/rank\"\n @@attacks << {:attack_mode => \"Light Burst\", :SV => 0, :rate => 1, :range => 0, :damage => 0, :ammo => \"1/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"69\", :notes => \"Type C agility HC or blinded for 2d5 rounds. Blindness: -2 MV, -20 SV, +20 SV to be struck.\"}\n when 618..624\n @@primary_mutations << \"Limb Regeneration: see Hub Rules p. 69 for regeneration rates.\"\n when 625..630\n def mandibles_mutation(roll)\n case roll\n when 1..2\n mandibles_size = \"Small\"\n mandibles_sv = 3\n mandibles_dmg = \"d10\"\n mandibles_weight = 5\n mandibles_appearance = -(d(4) + 3)\n when 3..5\n mandibles_size = \"Medium\"\n mandibles_sv = 5\n mandibles_dmg = \"d12\"\n mandibles_weight = 15\n mandibles_appearance = -(d(6) + 4)\n when 6..7\n mandibles_size = \"Large\"\n mandibles_sv = 8\n mandibles_dmg = \"d20\"\n mandibles_weight = 20\n mandibles_appearance = -(d(8) + 6)\n @@movement_rate_base -= 0.25\n when 8..9\n mandibles_size = \"Huge\"\n mandibles_sv = 11\n mandibles_dmg = \"d20 + 5\"\n mandibles_weight = 30\n mandibles_appearance = -(d(6) + d(6) + 5)\n @@movement_rate_base -= 0.5\n when 10\n mandibles_size = \"Massive\"\n mandibles_sv = 15\n mandibles_dmg = \"d20 + 10\"\n mandibles_weight = 40\n mandibles_appearance = -(d(6) + d(6) + d(6) + 6)\n @@movement_rate_base -= 1\n\n end\n\n @@attacks << {:attack_mode => \"Mandibles\", :SV => mandibles_sv, :rate => 1, :range => 0, :damage => mandibles_dmg, :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"69\", :notes => \"Can be employed as a supplemental melee attack\"}\n @@character_weight += mandibles_weight\n @@appearance += mandibles_appearance #due to implementation method no protection here from =< 0...\n @@primary_mutations << \"Mandibles: #{mandibles_size} size\"\n end\n\n mandibles_mutation(d(10))\n\n when 631..641\n @@primary_mutations << \"Mental Mine\"\n when 642..655\n @@primary_mutations << \"Mental Screen\"\n when 656..687\n @@primary_mutations << \"Mind Crush\"\n when 688..693\n @@primary_mutations << \"Mind Waste\"\n when 694..699\n @@primary_mutations << \"Monstrous Morph\"\n when 700..718\n def multi_arm_mutation(roll) # Hub Rules p. 71\n case roll\n when 1..10\n additional_arms = 1\n when 11..85\n additional_arms = 2\n when 86..90\n additional_arms = 3\n when 91..97\n additional_arms = 4\n when 98\n additional_arms = 5\n when 99\n additional_arms = 6\n when 100\n additional_arms = (d(6) +6)\n end\n if additional_arms % 2 == 1\n def odd_arm_side(roll)\n case roll\n when 1\n odd_arm = \"right\"\n when 2\n odd_arm = \"left\"\n end\n end\n odd_arm_side(d(2))\n @@character_notes << \"Odd arm is on the #{odd_arm_side} side.\"\n end\n\n @@primary_mutations << \"Multi-Arm: #{additional_arms} additional arms\"\n end\n\n multi_arm_mutation(d(100))\n\n when 719..728\n def multi_head_mutation(roll)\n case roll\n when 1..70\n additional_heads = 1\n multi_head_appearance = -d(4)\n multi_head_mv = 0\n multi_head_initiative = 1\n when 71..88\n additional_heads = 2\n multi_head_appearance = -(d(4) + 1 )\n multi_head_mv = 0.25\n multi_head_initiative = 1\n when 89..95\n additional_heads = 3\n multi_head_appearance = -(d(6) + 2)\n multi_head_mv = 0.5\n multi_head_initiative = 2\n when 96..97\n additional_heads = 4\n multi_head_appearance = -(d(6) + 4)\n multi_head_mv = 0.75\n multi_head_initiative = 2\n when 98..99\n additional_heads = 5\n multi_head_appearance = -(d(6) + 6)\n multi_head_mv = 1\n multi_head_initiative = 3\n when 100\n additional_heads = 6\n multi_head_appearance = -(d(6) + 8)\n multi_head_mv = 1.25\n multi_head_initiative = 4\n end\n\n @@primary_mutations << \"Multi-Head: #{additional_heads} additional heads.\"\n @@appearance += multi_head_appearance\n @@movement_rate_base -= multi_head_mv\n @@initiative += multi_head_initiative\n @@character_notes << \"Heads tend to sleep at different times, with wakeful heads acting as lookout.\"\n\n while extra_heads > 0 do\n intelligence = attributes_roll(d100)\n wisdom = attributes_roll(d100)\n puts \"Extra head no. #{extra_heads} has INT of #{intelligence} and WIS of #{wisdom}\"\n def extra_head_mutations(roll2)\n case roll2\n when 1..62\n extra_head_mutation = ghost_mutations(d(100))\n @@primary_mutations << extra_head_mutation\n @@character_notes << \"Extra head no. #{extra_heads} has the mental mutation #{extra_head_mutation}\" # HOW to pick just the name of the mental mutation??\n end\n end\n end\n additional_heads -= 1\n end\n multi_head_mutation(d(100))\n\n when 729..738\n @@primary_mutations << \"Night Vision: can see as well at night as a typical human can in daylight (at least starlight must be present).\"\n when 739..745\n @@primary_mutations << \"Peeling Radius\"\n @@attacks << {:attack_mode => \"Peeling Radius\", :SV => 0, :rate => 1, :range => 10, :damage => \"d6/rd\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"71\", :notes => \"10m radius. Automatic hit. Duration: 3 rds/rank\"}\n when 746..754\n def poison_bite_mutation(roll1, roll2) # Hub Rules p. 71\n case roll1\n when 1..54\n poison_bite_strength = \"A\"\n when 55..84\n poison_bite_strength = \"B\"\n when 85..97\n poison_bite_strength = \"C\"\n when 98..99\n poison_bite_strength = \"D\"\n when 100\n poison_bite_strength = \"E\"\n end\n\n case roll2\n when 1..5\n poison_bite_type = \"Death\"\n when 6\n poison_bite_type = \"Paralysis\"\n when 7\n poison_bite_type = \"Insanity\"\n when 8..10\n poison_bite_type = \"Sleep\"\n end\n\n @@primary_mutations << \"Poison Bite: #{poison_bite_type} venom, strength #{poison_bite_strength}, 4/day. Sufficient to coat 4 arrows/darts or 1 blade per injection's worth of poison.\"\n @@attacks << {:attack_mode => \"Poison Bite\", :SV => 0, :rate => 1, :range => 0, :damage => \"d6 plus poison\", :ammo => \"4/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"71\", :notes => \"#{poison_bite_type} venom, #{poison_bite_strength} strength.\"}\n end\n\n poison_bite_mutation(d(100),d(10))\n\n\n when 755..760\n\n def poison_blood_mutation(roll1, roll2) # Hub Rules p. 71\n case roll1\n when 1..54\n poison_bite_strength = \"A\"\n when 55..84\n poison_bite_strength = \"B\"\n when 85..97\n poison_bite_strength = \"C\"\n when 98..99\n poison_bite_strength = \"D\"\n when 100\n poison_bite_strength = \"E\"\n end\n\n case roll2\n when 1..5\n poison_bite_type = \"Death\"\n when 6\n poison_bite_type = \"Paralysis\"\n when 7\n poison_bite_type = \"Insanity\"\n when 8..10\n poison_bite_type = \"Sleep\"\n end\n\n @@primary_mutations << \"Poison Blood: #{poison_bite_type} venom, #{poison_bite_strength} strength. Any creature biting mutant poisoned.\"\n\n end\n\n poison_blood_mutation(d(100),d(10))\n\n when 761..767\n paralysis_tendrils = d(6)\n @@primary_mutations << \"Paralysis Tendrils: #{paralysis_tendrils} 3m length grow from mutant's chest\"\n @@appearance = [@@appearance - (4 * paralysis_tendrils), 1].max\n @@attacks << {:attack_mode => \"Paralysis Tendrils\", :SV => 10, :rate => 1, :range => 3, :damage => \"d12 stun, 2d20 vs machines\", :ammo => \"3/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"72\", :notes => \"#{paralysis_tendrils} tendrils, each capable of attack 3/day/rank.\"}\n\n\n when 768..773\n @@primary_mutations << \"Radiation Absorption: mutant immune to radioactivity, except for radioactive weapons, which do half damage.\"\n when 774..780\n @@primary_mutations << \"Radiation Detection: automatically senses the presence of radiation within a twenty meter radius, including those rare sources found in special radiation using robots, relic weapons and life forms.\"\n when 781..786\n @@primary_mutations << \"Radioactive Pulse\"\n @@attacks << {:attack_mode => \"Radioactive Pulse\", :SV => 10, :rate => 1, :range => @@willpower, :damage => \"d20 plus radiation\", :ammo => \"1/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"72\", :notes => \"Victim makes type B endurance hazard check or suffer medium exposure; then type A hazard check or suffer strong exposure.\"}\n when 787..794\n @@primary_mutations << \"Reserve Heart: If character deemed to be killed by poison or electricity, or a critical hit which specifcally states a piercing of the heart, she will appear to be quite dead for 2d20+10 rounds. After this comatose period without a pulse or heartbeat, her back up heart will suddenly kick in and induce 2d10 endurance of healing, bringing the character slowly back to life.\"\n when 795..802\n @@primary_mutations << \"Reserve Mind: back-up brain takes over in case of brain damage, unconsciousness, insanity, or lethal damage. Hub Rules p. 72\"\n when 803..809\n @@primary_mutations << \"Scaled Skin\"\n @@dv -= 8\n @@appearance = [@@appearance - d(4), 1].max\n @@character_notes << \"Scaled skin: immune to damage from sunburn, sand storms, insect bites, and topical irritants.\"\n when 810..814\n @@primary_mutations << \"Serpentine Body: +4 mv on land or swimming\"\n @@dv -= 5\n serpent_body_length = d(3) + 1\n @@character_weight += (40 * serpent_body_length)\n @@appearance = [@@appearance - (d(6) + 1), 1].max\n @@movement_rate_base += 4\n @@movement_rate_swimming += 4\n @@character_notes << \"Unable to wear relic shell class armor\"\n @@attacks << {:attack_mode => \"Serpentine Body Strike\", :SV => 0, :rate => 1, :range => serpent_body_length, :damage => \"d20 stun\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"72\", :notes => \"Constrict for d10 lethal dmg/rd after successful strike.\"}\n\n when 815..839\n def shell_mutation(roll) # Hub Rules p. 73\n case roll\n when 1..4\n shell_rating = \"Light\"\n shell_defense_value = 10\n shell_movement_penalty = 0.5\n shell_appearance_penalty = (d(4) + 1)\n shell_weight = 20\n when 5..7\n shell_rating = \"Medium\"\n shell_defense_value = 20\n shell_movement_penalty = 1\n shell_appearance_penalty = (d(6) + 2)\n shell_weight = 30\n when 8..9\n shell_rating = \"Heavy\"\n shell_defense_value = 30\n shell_movement_penalty = 1.5\n shell_appearance_penalty = (d(6) + 4)\n shell_weight = 40\n when 10\n shell_rating = \"Extra Heavy\"\n shell_defense_value = 40\n shell_movement_penalty = 2\n shell_appearance_penalty = (d(6) + 6)\n shell_weight = 50\n end\n @@primary_mutations << \"#{shell_rating} Shell: #{shell_defense_value} DV, -#{shell_movement_penalty} MV\"\n @@appearance = [@@appearance - shell_appearance_penalty, 1].max\n @@dv -= shell_defense_value\n @@movement_rate_base -= shell_movement_penalty\n @@character_weight += shell_weight\n @@character_notes << \"Due to Shell mutation, punches, kicks, head-butts etc. deal 2d6 dmg instead of typical d6.\"\n @@character_notes << \"Shell mutation: no relic armor OTHER than ballistic, riot, and bomb squad armor can be worn. Combat armor can be modified, d6+1 days.\"\n end\n\n shell_mutation(d(10))\n\n when 840..849\n def size_decrease_mutation(height)\n case height\n when 61..95\n @@agility += (d(8) + d(8))\n @@strength = [@@strength - d(10), 1].max\n @@endurance = [@@endurance - (d(6) + d(6)), 1].max\n 4.times @@skills << \"Stealth\"\n when 66..90\n @@agility += (d(6) + d(6))\n @@strength = [@@strength - d(8), 1].max\n @@endurance = [@@endurance - (d(4) + d(4)), 1].max\n 3.times @@skills << \"Stealth\"\n when 91..110\n @@agility += (d(4) + d(4))\n @@strength = [@@strength - d(6), 1].max\n @@endurance = [@@endurance - d(6), 1].max\n 2.times @@skills << \"Stealth\"\n when 111..130\n @@agility += d(6)\n @@strength = [@@strength - d(4), 1].max\n @@endurance = [@@endurance - d(4), 1].max\n 2.times @@skills << \"Stealth\"\n when 131..140\n @@agility += d(6)\n @@strength = [@@strength - d(3), 1].max\n @@endurance = [@@endurance - 2, 1].max\n @@skills << \"Stealth\"\n when 141..159\n @@agility += d(4)\n @@skills << \"Stealth\"\n when 160..199\n @@agility += d(3)\n @@skills << \"Stealth\"\n end\n end\n\n @@character_height -= d(100)\n size_decrease_mutation(@@character_height)\n @@primary_mutations << \"Size Decrease\"\n when 850..860\n @@primary_mutations << \"Size Increase\"\n @@character_height += (d(100) + d(100) + d(100) + d(100))\n\n def size_increase_mutation(height) # Hub Rules p. 73\n case height\n when 164..184\n @@strength += d(10)\n @@endurance && @@character_weight += (d(10) + 5)\n when 185..199\n @@movement_rate_base += 0.25\n @@strength += (d(10) + 5)\n @@endurance && @@character_weight += (d(10) + 10)\n when 200..250\n @@movement_rate_base += 0.5\n @@strength += (d(10) + 10)\n @@endurance && @@character_weight += (d(20) + 15)\n when 251..299\n @@movement_rate_base += 0.75\n @@strength += (d(20) + 15)\n @@endurance && @@character_weight += (d(20) + 20)\n when 300..350\n @@movement_rate_base += 1\n @@strength += (d(20) + 20)\n @@endurance && @@character_weight += (d(20) + 30)\n when 351..399\n @@movement_rate_base += 1.25\n @@strength += (d(20) + 30)\n @@endurance && @@character_weight += (d(20) + 40)\n when 400..425\n @@movement_rate_base += 1.5\n @@strength += (d(20) + 40)\n @@endurance && @@character_weight += (d(20) + 50)\n when 426..450\n @@movement_rate_base += 1.75\n @@strength += (d(20) + 50)\n @@endurance && @@character_weight += (d(20) + 60)\n when 451..475\n @@movement_rate_base += 2\n @@strength += (d(20) + 60)\n @@endurance && @@character_weight += (d(20) + 75)\n when 476..499\n @@movement_rate_base += 3\n @@strength += (d(20) + 75)\n @@endurance && @@character_weight += (d(20) + 88)\n when 500..525\n @@movement_rate_base += 4\n @@strength += (d(20) + 88)\n @@endurance && @@character_weight += (d(20) + 100)\n when 526..560\n @@movement_rate_base += 5\n @@strength += (d(20) + 100)\n @@endurance && @@character_weight += (d(20) + 130)\n when 561..580\n @@movement_rate_base += 6\n @@strength += (d(20) + 130)\n @@endurance && @@character_weight += (d(20) + 160)\n end\n end\n\n size_increase_mutation(@@character_height)\n\n when 861..869\n def sonic_wave_radius_mutation(willpower) # Hub Rules p. 73\n case willpower\n when 1..9\n attack_radius = 1\n damage = \"d4\"\n deafness_duration = \"1 minute\"\n when 10..23\n attack_radius = 2\n damage = \"d6\"\n deafness_duration = \"5 minutes\"\n when 24..34\n attack_radius = 4\n damage = \"d8\"\n deafness_duration = \"10 minutes\"\n when 35..60\n attack_radius = 5\n damage = \"d10\"\n deafness_duration = \"30 minutes\"\n when 61..70\n attack_radius = 7\n damage = \"d12\"\n deafness_duration = \"1 hour\"\n when 71..80\n attack_radius = 9\n damage = \"d20\"\n deafness_duration = \"2d4 hours\"\n when 81..90\n attack_radius = 15\n damage = \"d20 + 5\"\n deafness_duration = \"3d6 hours\"\n when 91..100\n attack_radius = 20\n damage = \"d20 + 10\"\n deafness_duration = \"d6 days\"\n when 101..110\n attack_radius = 25\n damage = \"d20 + 15\"\n deafness_duration = \"2d4 days\"\n when 111..120\n attack_radius = 30\n damage = \"d20 + 20\"\n deafness_duration = \"3d6 days\"\n when 121..130\n attack_radius = 40\n damage = \"d20 + 30\"\n deafness_duration = \"3d6 + 10 days\"\n when 131..140\n attack_radius = 50\n damage = \"d20 + 40\"\n deafness_duration = \"3d6 + 20 days\"\n when 141..150\n attack_radius = 60\n damage = \"d20 + 50\"\n deafness_duration = \"3d6 + 30 days\"\n end\n\n @@primary_mutations << \"Sonic Wave Radius: 2/day/rank, #{attack_radius} radius, #{damage} damage, #{deafness_duration} deafness.\"\n @@attacks << {:attack_mode => \"Sonic Wave Radius\", :SV => 100, :rate => 1, :range => attack_radius, :damage => damage, :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"73\", :notes => \"#{deafness_duration} deafness\"}\n end\n\n sonic_wave_radius_mutation(@@willpower)\n\n\n when 870..876\n @@primary_mutations << \"Spines: #{d(10) + 10} cm length, + d6 dmg to punch/kick\"\n @@dv -= (d(20) + 10)\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@character_notes << \"Unable to wear relic armor unless spines are sawed off monthly.\"\n when 877..880\n @@primary_mutations << \"Sprint: 2/day/rank, duration 2d10 + rank rounds. -20DV (-20SV with misslie weapons) while sprinting OR double melee attack rate.\"\n when 881..886\n def stalked_eyes_mutation(roll)\n case roll\n when 1..67\n eye_stalks = (d(4) + 1)\n @@primary_mutations << \"Stalked eyes: mutant has #{eye_stalks} #{(d(20) + 10)} cm long instead of typical eyes.\"\n when 68..100\n eye_stalks = (d(3) + 1)\n @@primary_mutations << \"Stalked eyes: mutant has #{eye_stalks} #{(d(20) + 10)} cm long in addition to typical eyes.\"\n end\n\n @@dv -= (eye_stalks * 3)\n @@initiative += 2\n @@appearance = [@@appearance - (eye_stalks * d(6)), 1].max\n end\n\n stalked_eyes_mutation(d(100))\n\n when 887..892\n def stench_spray_location(roll) # Hub Rules p. 74\n case roll\n when 1..2\n location = \"Groin\"\n when 3..4\n location = \"Stomach\"\n when 5..6\n location = \"Chest\"\n when 7\n location = \"Left armpit\"\n when 8\n location = \"Right armpit\"\n when 9\n location = \"Back\"\n when 10\n location = \"Butt\"\n end\n\n stench_spray_app = (6 + d(6))\n @@primary_mutations << \"Stench Spray: #{20 + d(20) + d(20)} cm organ located on character's #{location}\"\n @@attacks << {:attack_mode => \"Stench Spray\", :SV => 10, :rate => 1, :range => (@@strength / 2), :damage => \"Special\", :ammo => \"2/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"74\", :notes => \"Endurance-based type B hazard check or d6 + 1 rds vomiting, +30SV to strike, -30SV to attack others.\"}\n @@character_notes << \"Character's appearance -#{stench_spray_app} penalty after stench organ seen.\"\n\n end\n\n stench_spray_location(d(10))\n\n when 893..901\n @@primary_mutations << \"Strength Burst: 2/rank/day, 4 rds/rank duration, character's strength 4x regular amount. Contributes to strength-based hazard checks, melee damage, etc.\"\n when 902..909\n def stun_ray_launcher(roll)\n case roll\n when 1..17\n stun_location = \"eyes\"\n when 18..59\n stun_location = \"left hand\"\n when 60..101\n stun_location = \"right hand\"\n end\n\n @@primary_mutations << \"Stun Ray fired from #{stun_location}.\"\n @@attacks << {:attack_mode => \"Stun Ray\", :SV => 10, :rate => 1, :range => (@@willpower * 2), :damage => \"2d20 stun, x2 vs machines\", :ammo => \"3/day/rank\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"74\", :notes => \"Stun damage fades after 1 hour.\"}\n end\n\n stun_ray_launcher(d(101))\n\n when 910..924\n def tail_mutation(roll) # Hub Rules p. 74\n case roll\n when 1..2\n tail_type = \"Club\"\n tail_length = 1.5\n tail_agility_bonus = d(4)\n tail_move = -1\n tail_sv = 6\n tail_attack_dmg = \"d12 + 2 lethal or stun\"\n when 3\n tail_type = \"Crocodile\"\n tail_length = 1.7\n tail_agility_bonus = d(8)\n tail_move = -1\n tail_move_water = 4\n tail_sv = 5\n tail_attack_dmg = \"d12 stun\"\n when 4\n tail_type = \"Dolphin\"\n tail_length = 1.5\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_move_water = 6\n tail_sv = 4\n tail_attack_dmg = \"d12 stun\"\n when 5\n tail_type = \"Eagle\"\n tail_length = 1\n tail_agility_bonus = d(6)\n tail_move = 1\n tail_sv = 0\n tail_attack_dmg = nil\n when 6\n tail_type = \"Fish\"\n tail_length = 1.3\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_move_water = 5\n tail_sv = 4\n tail_attack_dmg = \"d10 stun\"\n when 7\n tail_type = \"Fox\"\n tail_length = 1.25\n tail_agility_bonus = (d(6) + d(6))\n tail_move = 1.5\n tail_sv = 0\n tail_attack_dmg = nil\n when 8\n tail_type = \"Cat\"\n tail_length = 1.5\n tail_agility_bonus = (d(8) + d(8))\n tail_move = 2\n tail_sv = 0\n tail_attack_dmg = nil\n when 9\n tail_type = \"Whip\"\n tail_length = (3 + d(4))\n tail_agility_bonus = d(6)\n tail_move = -0.25\n tail_sv = 4\n tail_attack_dmg = \"d8\"\n @@character_notes << \"Whip tail can be used as #{tail_length} rope.\"\n when 10..13\n tail_type = \"Prehensile (monkey)\"\n tail_length = 3\n tail_agility_bonus = (d(4) + d(4))\n tail_move = 1\n tail_sv = 0\n tail_attack_dmg = nil\n @@character_notes << \"Prehensile tail can wield dagger or knife for additional melee attack.\"\n when 14\n tail_type = \"Newt\"\n tail_length = 1.5\n tail_agility_bonus = d(8)\n tail_move = -1\n tail_move_water = 4\n tail_sv = 3\n tail_attack_dmg = \"d10 stun\"\n when 15\n tail_type = \"Porcupine\"\n tail_length = 0.75\n tail_agility_bonus = 0\n tail_move = -1\n tail_sv = 5\n tail_attack_dmg = \"d12 + 1\"\n when 16..17\n tail_type = \"Rat\"\n tail_length = 1.8\n tail_agility_bonus = d(6)\n tail_move = 0.5\n tail_sv = 0\n tail_attack_dmg = nil\n @@character_notes << \"Rat tail can wield dagger or knife for additional melee attack.\"\n when 18\n tail_type = \"Scorpion\"\n tail_length = 2\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_sv = 8\n tail_attack_dmg = \"d12 + Type A poison\"\n when 19\n tail_type = \"Spiked\"\n tail_length = 1.75\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_sv = 7\n tail_attack_dmg = \"d12 + 3\"\n when 20\n tail_type = \"Bladed\"\n tail_length = 2\n tail_agility_bonus = d(6)\n tail_move = -1\n tail_sv = 7\n tail_attack_dmg = \"d20\"\n end\n\n @@primary_mutations << \"Tailed: #{tail_type} tail of #{tail_length} m length.\"\n @@appearance += tail_agility_bonus\n @@movement_rate_base += tail_move\n @@movement_rate_swimming += tail_move_water\n if tail_attack_dmg != nil\n @@attacks << {:attack_mode => \"#{tail_type} tail strike\", :SV => tail_sv, :rate => 1, :range => tail_length, :damage => \"#{tail_attack_dmg}\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"74\", :notes => \"\"}\n end\n end\n\n tail_mutation(d(20))\n\n when 925..936\n @@primary_mutations << \"Telekinesis\"\n when 937..961\n @@primary_mutations << \"Telepathy\"\n when 962..967\n def tentacle_mutation(roll)\n case roll\n when 1..28\n number_of_tentacles = (d(4) + d(4) + 2)\n @@primary_mutations << \"Tentacles: Mutant has #{number_of_tentacles} instead of arms.\"\n when 29..100\n number_of_tentacles = (d(4) + d(4))\n @@primary_mutations << \"Tentacles: Mutant has #{number_of_tentacles} in addition to arms.\"\n end\n\n @@appearance = [@@appearance - (number_of_tentacles * 2), 1].max\n 2.times @@skills << \"Climbing\"\n @@character_notes << \"Tentacles add #{number_of_tentacles * 0.5} m to character's climbing & swimming move rates.\"\n @@character_notes << \"Tentacles can wield simple melee weapons but lack the dexterity needed to operate a keyboard, stringed, or triggered weapon.\"\n @@attacks << {:attack_mode => \"Tentacle strike\", :SV => 5, :rate => number_of_tentacles, :range => 0, :damage => \"d8 stun\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"75\", :notes => \"Tentacles gain unarmed combat modifiers, too.\"}\n end\n\n tentacle_mutation(d(100))\n\n when 968..975\n @@primary_mutations << \"Throwing Quills: fire 1/rd, up to 20/day\"\n @@dv -= 18\n @@character_notes << \"Due to quills, mutant cannot wear relic armor (except specially-designed junk or scrap relic armor)\"\n @@appearance = [@@appearance - (d(4) + d(4)), 1].max\n @@attacks << {:attack_mode => \"Throwing Quill\", :SV => 6, :rate => 1, :range => (@@strength / 2), :damage => \"d10\", :ammo => \"20/day\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"incl. strength and wpn expert skill modifiers\"}\n\n when 976..982\n def thrust_spike_mutation(roll)\n case roll\n when 1\n poison = \"type A death poison\"\n when 2..10\n poison = \"None\"\n end\n thrust_spike_length = (d(4) + d(4))\n @@primary_mutations << \"Thrust Spike #{thrust_spike_length} long.\"\n @@character_notes << \"After seeing thrust spike mutant's appearance score reduced for witness by d1- + 10.\" #obvious typo here\n if poison == \"None\"\n @@attacks << {:attack_mode => \"Thrust Spike\", :SV => 0, :rate => 1, :range => thrust_spike_length, :damage => \"d20\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"+30SV, 2d20 + 10 damage on first attack.\"}\n elsif poison != \"None\"\n @@attacks << {:attack_mode => \"Thrust Spike\", :SV => 0, :rate => 1, :range => thrust_spike_length, :damage => \"d20\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"+30SV, 2d20 + 10 damage on first attack. Also: #{poison}\"}\n end\n end\n\n thrust_spike_mutation(d(10))\n\n\n when 983..986\n @@primary_mutations << \"Tusks\"\n @@attacks << {:attack_mode => \"Tusk bite\", :SV => 6, :rate => 1, :range => 0, :damage => \"2d8 + 2\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"Additional melee attack/rd.\"}\n @@appearance = [@@appearance - (d(8) + 2), 1].max\n when 987..992\n @@primary_mutations << \"Webbed Hands: character nearly impossible to drown & can hold breath 2x normal. Double swim speed.\"\n @@movement_rate_swimming += @@movement_rate_swimming\n\n when 993..1000\n def wings_mutation(roll1,roll2) # Hub Rules p. 76\n case roll1\n when 1\n wing_type = \"Bird\"\n air_speed += 6\n @@character_notes << \"Bird wings are fragile - this character suffers double damage from fire and burst radius explosives like grenades and bombs.\"\n when 2\n wing_type = \"Insect\"\n air_speed += 3\n @@character_notes << \"Due to insect wings, character has -2 MV in enclosed spaces.\"\n when 3..6\n wing_type = \"Bat\"\n end\n\n case roll2\n when 1\n wing_size = \"Tiny\"\n flight_mode = \"Glide only\"\n air_speed += (d(6) + 10)\n flying_dv = -5\n wing_attack_dmg = nil\n wing_weight = 6\n when 2\n wing_size = \"Small\"\n flight_mode = \"Flies poorly\"\n air_speed += (d(6) + 12)\n flying_dv = -10\n wing_attack_dmg = \"d4 stun\"\n wing_weight = 12\n when 3..4\n wing_size = \"Medium\"\n flight_mode = \"Flies normally\"\n air_speed += (d(6) + 15)\n flying_dv = -14\n wing_attack_dmg = \"d6 stun\"\n wing_weight = 20\n when 5\n wing_size = \"Large\"\n flight_mode = \"Flies normally\"\n air_speed += (d(6) + 20)\n flying_dv = -20\n wing_attack_dmg = \"d8 stun\"\n wing_weight = 30\n when 6\n wing_size = \"Vast\"\n flight_mode = \"Flies excellently\"\n air_speed += (d(10) + 25)\n flying_dv = -25\n wing_attack_dmg = \"d10 stun\"\n wing_weight = 40\n end\n\n @@primary_mutations << \"Wings: #{wing_size} #{wing_type} wings. Mutant #{flight_mode} at #{air_speed} MV and #{flying_dv} DV when airborne.\"\n @@movement_rate_flying += air_speed\n\n if wing_attack_dmg != nil\n @@attacks << {:attack_mode => \"Wing bash\", :SV => 0, :rate => 2, :range => 0, :damage => \"#{wing_attack_dmg}\", :ammo => \"infinite\", :skill_pts => 0, :skill_SV_bonus => 0, :skill_damage_bonus => 0, :ref => \"76\", :notes => \"\"}\n end\n\n @@character_notes << \"Character able to fly at full air speed with full gear, arms, and armor. See Hub Rules p. 76 for more.\"\n @@character_notes << \"Due to wings, standard and relic armor must be modified and fitted to this character.\"\n\n\n end\n\n wings_mutation(d(6),d(6))\n\n end\nend",
"def fiction_details_one(arg)\n puts \"Fiction\"\n puts arg\n puts \"asdfasdfsd\"\n end",
"def instructions\n\t\tputs \"\"\"Mastermind is a code-breaking game that helps develop deductive reasoning and logic by requiring players to deduce secret combinations of colors with minimal clues. After each of these chances, the creator of the code (in this case, the computer) must reveal how many pegs are the correct color in the correct location, or the correct color in the incorrect location, or completely incorrect. With this little information, the code breaker must improve upon his previous guess to crack the code. For this game we'll allow you to have 12 guesses before requiring a forfeit.\"\"\"\n\t\tputs \"Please push Enter to continue\"\n\t\tgets.chomp\n\tend",
"def get_info()\n\t\tputs \"This information report is about #{@name}.\"\n\t\tif (@sex == \"male\") || (@sex == \"Male\") || (@sex == \"M\")\n\t\t\tputs \"He is #{@age} years old.\"\n\t\t\tputs \"He is a #{@occupation}.\"\n\t\telse\n\t\t\tputs \"She is #{@age} years old.\"\n\t\t\tputs \"She is a #{@occupation}.\"\n\t\tend\n\tend",
"def hopper\n\tprogrammer_hash = \n \t\t{\n :grace_hopper => {\n :known_for => \"COBOL\",\n :languages => [\"COBOL\", \"FORTRAN\"]\n },\n :alan_kay => {\n :known_for => \"Object Orientation\",\n :languages => [\"Smalltalk\", \"LISP\"]\n },\n :dennis_ritchie => {\n :known_for => \"Unix\",\n :languages => [\"C\"]\n }\n }\n programmer_hash[:grace_hopper]\nend",
"def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n serving_sizes = { \"pie\" => 8, \"cake\" => 6, \"cookie\" => 1 } # Hash of available foods and associated counts\n food_quantities = { \"fav_food\" => 0, \"pie\" => 0, \"cake\" => 0, \"cookie\" => 0 } # Hash of food quantities\n\n # Raise error if serving sizes doesn't contain food\n raise ArgumentError.new(\"You can't make that food\") if !serving_sizes.has_key? (fav_food)\n\n # Returns the necessary number of food items needed to satisfy each serving if the \n # number of people attending is evenly divisible by the quantity of the passed favorite food.\n return \"You need to make #{num_of_people / serving_sizes[fav_food]} #{fav_food}(s).\" if num_of_people % serving_sizes[fav_food] == 0\n\n # Loop through each key in food_quantities to determine how many of each food item is needed.\n food_quantities.each do |key, value|\n if key == \"fav_food\" \n food_quantities[key] = num_of_people / serving_sizes[fav_food] # Setting \"fav_food\" property for future use in food_quantities\n food_quantities[fav_food] = food_quantities[key]\n num_of_people = num_of_people % serving_sizes[fav_food] # Setting remaining amount of people left after fav_food is determined.\n elsif num_of_people / serving_sizes[key] > 0 # key is not fav_food and number of remaining people divided by the next food item serving size is greater than zero\n food_quantities[key] = num_of_people / serving_sizes[key] # Setting count for additional food items needed for remaining people\n num_of_people = num_of_people % serving_sizes[key] # Setting number of remaining people after the additional food item\n end # Ending conditional\n end # Ending .each loop\n\n return \"You need to make #{food_quantities[\"pie\"]} pie(s), #{food_quantities[\"cake\"]} cake(s), and #{food_quantities[\"cookie\"]} cookie(s).\"\nend",
"def the_interview\n (1..100).each{ |n| puts n % 15 == 0 ? \"fizzbuzz\" : n % 3 == 0 ? \"fizz\" : n % 5 == 0 ? \"buzz\" : n }\n (0..99).reverse_each{|n| puts \"I have #{n} bottles.\"}\nend"
] | [
"0.6504072",
"0.6044925",
"0.6025884",
"0.60155064",
"0.5992971",
"0.5958038",
"0.58771497",
"0.58520645",
"0.58125186",
"0.5731678",
"0.57071084",
"0.5668288",
"0.5662267",
"0.56603974",
"0.5651699",
"0.56427264",
"0.561013",
"0.5548985",
"0.55343604",
"0.55166817",
"0.5470573",
"0.54576284",
"0.5440133",
"0.5434182",
"0.54263896",
"0.5418148",
"0.5391189",
"0.53909826",
"0.53891253",
"0.53873795",
"0.53751427",
"0.5374283",
"0.5373901",
"0.5366616",
"0.5361406",
"0.5358244",
"0.5357789",
"0.5335724",
"0.5335724",
"0.5329386",
"0.53275937",
"0.5324689",
"0.53192174",
"0.5316971",
"0.53116596",
"0.531029",
"0.53092575",
"0.529931",
"0.5299298",
"0.52984196",
"0.5294976",
"0.5294426",
"0.5291817",
"0.526842",
"0.52672035",
"0.52619916",
"0.52528375",
"0.5248279",
"0.52374864",
"0.5234948",
"0.5228241",
"0.5228075",
"0.5221119",
"0.5219879",
"0.5218014",
"0.5215125",
"0.52132416",
"0.5211469",
"0.5210255",
"0.5209396",
"0.51989514",
"0.5198742",
"0.5198664",
"0.5198116",
"0.51947415",
"0.51936895",
"0.5186624",
"0.5180541",
"0.51772285",
"0.5169679",
"0.5169213",
"0.5168051",
"0.5165389",
"0.5164093",
"0.5162923",
"0.51617837",
"0.51583666",
"0.5157965",
"0.5156429",
"0.515084",
"0.5149143",
"0.51327777",
"0.51321316",
"0.51306564",
"0.5128315",
"0.51276666",
"0.51214737",
"0.51141816",
"0.51105946",
"0.5107874",
"0.51069605"
] | 0.0 | -1 |
recomputes the sources and stores them | def sources
@sources = Dir.glob(File.join(@test_cases_path,"**","*.txt")).sort
@sources
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_sources\n SOURCES.each_pair do |suite, url|\n prepare_source_for(url, @freshen)\n end\n end",
"def reload!\n @sources.each {|k,s,v| do_load_source(k,s,v)}\n end",
"def run\n Laze.debug 'Starting source processing'\n target.reset\n store.each do |item|\n target.create item\n end\n target.save\n Laze.debug 'Source processing ready'\n end",
"def reference_sources\n build unless built\n reference_register.sources\n end",
"def update_sources\n\t @sources.each { |s| @source_counts[s] = { label: s, value: rand(100) } } \n\tend",
"def refresh_from_source(*components)\n source = Source.new\n source.options = options\n components.each do |name|\n source.clone(name)\n source.install(name) if options[:install]\n end\n end",
"def sources\n sort!\n @sources\n end",
"def merge(*sources); end",
"def all_sources\n @normal_sources + @extensions + @replacements\n end",
"def collect_sources_and_toolchains\n sources_to_build = {}\n\n exclude_files = Set.new\n exclude_sources.each do |p|\n if p.include?(\"..\")\n Printer.printError \"Error: Exclude source file pattern '#{p}' must not include '..'\"\n return nil\n end\n\n Dir.glob(p).each {|f| exclude_files << f}\n end\n files = Set.new # do not build the same file twice\n\n add_to_sources_to_build(sources_to_build, exclude_files, sources)\n\n source_patterns.each do |p|\n if p.include?(\"..\")\n Printer.printError \"Error: Source file pattern '#{p}' must not include '..'\"\n return nil\n end\n\n globRes = Dir.glob(p)\n if (globRes.length == 0)\n Printer.printWarning \"Warning: Source file pattern '#{p}' did not match to any file\"\n end\n add_to_sources_to_build(sources_to_build, exclude_files, globRes, tcs4source(p))\n end\n return sources_to_build\n end",
"def sources\n @sources ||= []\n end",
"def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n source = source_class.new\n list[source.id.to_s] = {\n 'name' => source.name,\n 'website' => source.website,\n 'notes' => source.notes,\n 'class' => source.class\n }\n end\n end",
"def sources\n @sources ||= SourcePool.new\n end",
"def refresh_from_source(*components)\n opts = components.last.is_a?(Hash) ? components.pop : {}\n source = Source.new\n source.options = options\n components.each do |name|\n source.clone(name)\n source.install_from_src(name, opts) if options[:install]\n end\n end",
"def sources(sources = nil)\n @sources.assign(sources) if sources\n @sources\n end",
"def define_sources(s_maps,verbose=nil)\n\n s_maps.uniq!\n\n #Read info from maps\n x0 = []\n y0 = []\n ncols = []\n nrows = []\n cellsize = []\n s_maps.each do |m|\n map = AscMap.new(m)\n x0 << map.params[\"xllcorner\"].to_i\n y0 << map.params[\"yllcorner\"].to_i\n ncols << map.params[\"ncols\"].to_i\n nrows << map.params[\"nrows\"].to_i\n cellsize << map.params[\"cellsize\"].to_i\n end\n\n #Check cellsize\n cellsize.uniq!\n raise \"cellsize of the sectoral allocation maps should be identical!\" unless cellsize.size==1\n cellsize = cellsize.first\n\n #Set the sources map parameters\n @src_map = AscMap.new(s_maps.first)\n @src_map.params[\"xllcorner\"] = x0.min\n @src_map.params[\"yllcorner\"] = y0.min\n x1=[];x0.each_with_index{|xllcorner,i| x1 << (xllcorner + ncols[i] * cellsize) }\n y1=[];y0.each_with_index{|yllcorner,i| y1 << (yllcorner + nrows[i] * cellsize) }\n @src_map.params[\"ncols\"] = (x1.max - x0.min) / cellsize\n @src_map.params[\"nrows\"] = (y1.max - y0.min) / cellsize\n @src_map.params[\"NODATA_value\"] = -1\n @src_map.reset!\n\n #Design the sources map\n s_maps.each do |m|\n map = AscMap.new(m)\n yshift = (map.params[\"yllcorner\"].to_i-@src_map.params[\"yllcorner\"].to_i) / cellsize\n xshift = (map.params[\"xllcorner\"].to_i-@src_map.params[\"xllcorner\"].to_i) / cellsize\n puts \"add #{m} to source map - yshift #{yshift} - xshift #{xshift}\" if verbose\n map.each_data do |row,col|\n @src_map.cells[row+yshift][col+xshift] = 1 if map.cells[row][col] > 0\n end\n end\n\n @src_map.write_asc(File.join(File.dirname(@austal_txt),'src_map.asc'))\n\n #Store the emissions sources\n @src_map.each_data do |row,col|\n x = @src_map.coord_x(col)\n y = @src_map.coord_y(row)\n @xq << x - @dem.params[\"xllcorner\"].to_i\n @yq << y - @dem.params[\"yllcorner\"].to_i\n @aq << cellsize\n @bq << cellsize\n end\n @nb_src = @xq.size\n end",
"def get_sources(workdir) # rubocop:disable Metrics/AbcSize\n sources.each do |source|\n src = Vanagon::Component::Source.source(\n source.url, workdir: workdir, ref: source.ref, sum: source.sum\n )\n src.fetch\n src.verify\n if source.erb\n erb_file(src.file, File.join(File.dirname(src.file), File.basename(src.file, \".erb\")), true)\n end\n # set src.file to only be populated with the basename instead of entire file path\n src.file = File.basename(src.url)\n extract_with << src.extract(platform.tar) if src.respond_to? :extract\n end\n end",
"def sources\n [root_source] + reference_sources\n end",
"def setup_source_files\n project.sources.each do |src|\n # Figure out where stuff should come from and go to\n source_file = src\n object_file = objectsify src\n compile_task object_file, source_file\n end#project.sources.each\n end",
"def get_sources(workdir)\n @sources.each do |source|\n cur_source = Vanagon::Component::Source.source(source.url, { :ref => source.ref, :sum => source.sum }, workdir)\n cur_source.fetch\n cur_source.verify\n end\n end",
"def merge *sources\n unless directory == '*' || sources.all? { |source| source_hash.key?(source.filename) }\n # Reload the config to determine if a new source should be included\n @config = Solargraph::Workspace::Config.new(directory)\n end\n\n includes_any = false\n sources.each do |source|\n if directory == \"*\" || config.calculated.include?(source.filename)\n source_hash[source.filename] = source\n includes_any = true\n end\n end\n\n includes_any\n end",
"def processed_source=(_); end",
"def processed_source=(_); end",
"def update_sourced_attributes source_name=nil\n if source_name\n @sources[source_name].apply\n else\n @sources.values.each(&:apply)\n end\n end",
"def srcstore\n prev=Source.count\n # path where the source links of each category are stored.\n file = \"#{PROJECT_PATH}/app/assets/SourceLinks/\"\n group=\"TopStories\"\n # call to Source model with file path and topic name as parameters for data storage\n Source.store_feeds(file+group,group) \n #group=\"Science\"\n #Source.store_feeds(file+\"TopStories\",group) \n #group=\"Entertainment\"\n #Source.store_feeds(file+group,group) \n #group=\"Industries\"\n #Source.store_feeds(file+group,group) \n #group=\"Business\"\n #Source.store_feeds(file+group,group) \n #group=\"Sports\"\n #Source.store_feeds(file+group,group) \n #group=\"UK\"\n #Source.store_feeds(file+group,group) \n \n new =Source.count\n @count=new-prev # used in views \n end",
"def sources\n []\n end",
"def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end",
"def populate_target_and_source_if_required\n return if @no_preparation\n\n populate(:target) if create_target?\n populate(:source)\n end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def sources #:nodoc:\n @sources.map{ |source| source.call }.flatten\n end",
"def rebuild\n [\"jpeg\", \"jpg\", \"png\", \"gif\"].each do |type|\n p = \"#{@root}#{@ds}**#{@ds}*.#{type}\"\n Dir[p].each do |path|\n @cached_list[path.split(@ds).last] ||= path\n end\n end\n @cached_list\n end",
"def compileSources(ordering, staleSet)\n\t\tordering.each do |target|\n\t\t\tif(staleSet.include?(target))\n\t\t\t\tcompileSourceOfTarget(target)\n\t\t\tend\n\t\tend\n\n\tend",
"def normalize_and_dedup(sources)\n normalized_sources = normalize(sources)\n Cyclid.logger.debug \"normalized_sources=#{normalized_sources}\"\n deduped_sources = dedup(normalized_sources)\n Cyclid.logger.debug(\"deduped_sources=#{deduped_sources}\")\n\n return deduped_sources\n end",
"def objects\n expand_sources(@sources).map { |x| x.gsub(/\\.c$/, '.o') }\n end",
"def restore_source_files source\n dir = Conf::directories\n base = File.join(dir.data)\n source.folders.each do |fold|\n url = File.join(dir.backup,source.name.to_s,fold)\n files = ls(url).map { |f| CDR::File.new(::File.join(url,f),search: true)}\n nurl = File.join(dir.store,source.name.to_s,fold)\n download_all_files(files,nurl) unless files.empty?\n end\n Logger.<<(__FILE__,\"INFO\",\"Restored file from backup & server for #{source.name.to_s}\")\n end",
"def prepare_publish\n workload = []\n\n source_category = \"stage\"\n destination_category = \"pool\"\n\n Component.dataset(source_category).each do |entry|\n source = Component.new(entry[:component], entry[:suitename], source_category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n destination = Architecture.new(package.architecture, entry[:component], entry[:suitename], destination_category)\n\n workload << {\n :source_fullname => fullname,\n :destination_fullname => File.join(destination.directory, package.newbasename),\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => package.architecture\n }\n end\n end\n \n workload\n end",
"def merge(source); end",
"def merge(other)\n result = super\n\n result.sources = other.sources + self.sources\n result\n end",
"def update_sources\n source_files_path = Dir['config/locales/**/*.en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: \"/#{File.basename(path).gsub('en-EU', 'en')}\",\n source: path }])\n end\n\n source_files_path = Dir['config/locales/main/en-EU.yml']\n source_files_path.each do |path|\n puts \"update #{path}\"\n @crowdin.update_file([{ dest: '/main.en.yml',\n source: path }])\n end\n end",
"def sources\n files(!p?)\n end",
"def load_files(*sources); end",
"def fetch\n @routes = []\n source_extractors.keys.each do |source|\n extract_routes(source, data_for_source(source))\n end\n end",
"def set_sources\n @yaml[:sources].each do |name, path|\n @sources << Yuyi::Source.new(name, path)\n end\n end",
"def __set_source_classes(classes_to_proxy, concurrency_model = :iterative)\n @__concurrency_model = concurrency_model\n sources_data = SourceHelper.set_sources_data(classes_to_proxy)\n @source_obj_methods = sources_data[:source_methods]\n @sources = sources_data[:source_objs]\n @__all_class_methods = @source_obj_methods.keys\n @__class_source_group = SourceGroup.new(@sources, concurrency_model) if @sources.size > 0\n end",
"def data_sources\n src.collect{|v| v['source']}\n end",
"def set_sources(sources)\n\t\treturn if sources.split(',').empty?\n\t\tquake_sources = sources.split(',')\n\t\t\tquake_sources.each do |source|\n\t\t\t\tself.sources << Source.find_or_create_by(code: source)\n\t\t\tend\n\t\tself.save!\n\tend",
"def sources(*srcs)\n @recipe.sources << srcs.flatten.compact\n end",
"def sources=(new_sources) # :nodoc:\n @sources = Set.new\n add_sources(new_sources)\n end",
"def component_sources component,platform\n @component_sources||={}\n hp_dir=File.join(@base_dir,'src','hand',platform,component)\n hc_dir=File.join(@base_dir,'src','hand','common',component)\n gp_dir=File.join(@base_dir,'src','gen',platform,component)\n gc_dir=File.join(@base_dir,'src','gen','common',component)\n @component_sources[\"#{component}_#{platform}\"]||=FileList[\"#{hp_dir}/*.c\",\"#{hc_dir}/*.c\",\"#{gp_dir}/*.c\",\"#{gc_dir}/*.c\"]\n return @component_sources[\"#{component}_#{platform}\"]\n end",
"def all_sources\n result = Set.new\n sources.each do |ev|\n result << ev\n result.merge(ev.all_sources)\n end\n result\n end",
"def load_items\n @items = []\n data_sources.each do |ds|\n items_in_ds = ds.items\n items_in_ds.each { |i| i.identifier = File.join(ds.items_root, i.identifier) }\n @items += items_in_ds\n end\n\n @items_loaded = true\n end",
"def add_sources(sources)\n sources_ready = EventMachine::MultiRequest.new\n\n sources.each do |source|\n sources_ready.add(source)\n end\n\n sources_ready.callback do\n sources.each do |source|\n source.proxies.each do |proxy|\n @proxies << proxy unless @proxies.include? proxy\n end\n end\n end\n\n sources_ready\n end",
"def find_and_save(path='.')\n @logger.info(\"searching in sources: #{@names}\")\n @sources.flat_map { |name, source| source.find_and_save(path) }\n end",
"def sources\n @iTunes.sources.each do |source|\n @sources << source\n end\n end",
"def source_index_hash\n result = {}\n sources.each do |source|\n\tresult[source] = fetch_source(source)\n end\n @fetcher_class.finish\n result\n end",
"def resolve_data_sources(object, state)\n each_member do |name, field|\n if field.respond_to?(:data_source)\n state.data_sources.set(name, field.data_source.resolve(object))\n else\n field.resolve_data_sources(object, state.__get(name, true))\n end\n end\n end",
"def merge!(src)\n raise ArgumentError.new('Mismatched object') \\\n unless src.objs == @objs\n @deps.push(src.deps).uniq!\n @rules.push(src.rules).flatten!\n @dirs_to_create.push(src.dirs_to_create).flatten!.uniq!\n src.files_to_copy.each do |k,v|\n @files_to_copy[k] ||= []\n @files_to_copy[k].concat(v).uniq!\n end\n end",
"def recompile_assets!(compiler)\n compiler.reset!\n compiler.compile!\n compiler.assets.each do |a|\n path_and_name = a.path == '' ? a.name : \"#{a.path}/#{a.name}\"\n @@asset_hashes[path_and_name] = a.current_hash\n end\n end",
"def restore\n if is_source?\n @next.data.each { |_data| yield _data if block_given? } if @next\n end\n end",
"def map\n \n # parse source data \n @source_record = parse_input\n\n # validate the source record\n return Hash.new if !source_valid?\n\n # create sha1 from URL\n #token = Digest::SHA1.hexdigest(\n # @source_record[:make] + \n # @source_record[:model_name] + \n # @source_record[:serial]\n #)\n \n token = @source_record[:make] + @source_record[:model_name] + @source_record[:serial]\n token = token[-250..-1] if token.length > 250\n\n # is there a translation record?\n translation = Translation.where(:token => token, \n :source_id => source_id).first\n \n # if not, is there a classification rule?\n if translation.blank?\n\n # convert source data hash to a classifier\n classifier_data = {\n :source_model => @source_record[:model_name],\n :source_make => @source_record[:make],\n :source_id => source_id,\n :serial => @source_record[:serial]\n }\n\n # look for existing classifier, or make a new one\n rule = Classifier.find_from_source_record(classifier_data)\n \n # create rule\n rule ||= Classifier.create(classifier_data)\n\n # if rule is empty, then exit\n return Hash.new if rule.blank? || !rule.filled?\n\n # find a target record if one exists\n target = rule.match_target_by_serial\n\n # otherwise make a new target record\n target = rule.create_target if target.blank?\n \n # create the translation for future use\n translation = Translation.create(\n :token => token, \n :source_id => source_id, \n :target_id => target.id) if !target.blank?\n\n end\n \n # add target id to hash\n if !translation.blank?\n target_id_hash = {:target_id => translation.target_id }\n @source_record.merge! target_id_hash\n end\n\n # send hash to reducer \n return @source_record\n \n end",
"def sync(source_template)\n [ :template_name, :template_type, :template_outfile, :template_rebuild_me, :template_text,\n :template_linked_file, :template_linked_file_mtime, :template_linked_file_size,\n :template_created_on, :template_modified_on, :template_created_by, :template_modified_by,\n :template_build_dynamic ].each do |attribute|\n self[attribute] = source_template[attribute]\n end\n \n # Linked files must be placed in the filesystem appropriately.\n unless self.linked_file.blank?\n blog_root_regex = Regexp.new('(/var/domain/.*/(beta|www))')\n source_blog_root = blog_root_regex.match(source_template.blog.blog_site_path)[1]\n target_blog_root = blog_root_regex.match(self.blog.blog_site_path)[1]\n self[:template_linked_file].gsub!(source_blog_root, target_blog_root)\n end\n \n # Copy templatemaps ONLY if this template has been previously saved.\n unless self.new_record?\n # Delete existing templatemaps.\n self.templatemaps.destroy_all\n \n # Copy templatemaps.\n source_template.templatemaps.each do |source_templatemap|\n self.templatemaps << MovableType::AR::Templatemap.create(self, source_templatemap)\n end\n end\n end",
"def run_prepare(opts, sources, devices, rng, io)\n sources.parse(@sources)\n mods = opts.categories ? sources.parse_mods(opts.categories) : nil\n sources.apply_mods(mods) if mods\n\n devices.storage_mount\n number = opts.number || rng.generate(sources.count)\n source = sources.get(number)\n\n puts io.run_info_table(source, number)\n source\n end",
"def read\n data_sources.each_member do |field_name, field_source|\n new_value = field_source.read\n set(field_name, new_value)\n if new_value\n last_known.set(field_name, new_value)\n end\n end\n end",
"def read_data\n @files.each do |file|\n @source.location = file[:location]\n instance_variable_set('@' + file[:var].to_s,\n @source.send(file[:method], file[:klass]))\n end\n end",
"def merge(srcfs)\n @fs.merge!( srcfs.fs )\n @fs = Cleanfs.killdupl(@@loader.source,@fs,srcfs.fs)\n end",
"def source_files; end",
"def fetch\n log.info(log_key) { \"Copying from `#{source_path}'\" }\n\n create_required_directories\n FileSyncer.sync(source_path, project_dir, source_options)\n # Reset target shasum on every fetch\n @target_shasum = nil\n target_shasum\n end",
"def build_sources\n sources = [File.join(source_dir, 'jasmine-webos-core.js'),\n File.join(source_dir, 'proxy-app-assistant.js')]\n\n sources += Dir.glob(\"#{source_dir}/**/*.js\").reject { |f| sources.include?(f) }.sort\n sources += Dir.glob(\"#{plugin_dir}/spec/helpers/*.js\")\n sources\nend",
"def update_metadata!\n compilation_context.source_file_database.update_metadata(source_path)\n compilation_context.target_file_database.update_metadata(source_path)\n end",
"def pick_sets # :nodoc:\n @sources.each_source do |source|\n @sets << source.dependency_resolver_set\n end\n end",
"def swap_builds_and_sources\n unless defined?(@swap_builds)\n self.swap_builds_and_sources = DEFAULT_SWAP_BUILDS\n end\n\n @swap_builds\n end",
"def process_other_source_files\n files = @options[:include_source_files].flatten\n files.each do |f|\n FileUtils.cp Dir[f], @working_dir\n end\n end",
"def perform\n Source.all.reduce(0) do |count, source|\n begin\n raw_feed = Feedjira::Feed.fetch_and_parse(source.url)\n rescue Feedjira::FetchFailure, Faraday::ConnectionFailed => e\n logger.info(\"Unable to fetch #{source.url}: #{e.message}\")\n next count\n rescue Feedjira::NoParserAvailable => e\n logger.info(\"No parser available for source #{source.url}: #{e.message}\")\n next count\n end\n\n refresh_source(source, raw_feed)\n\n entries_to_save = raw_feed.entries.reject do |entry|\n Post.where(internal_id: entry.entry_id).exists?\n end\n\n posts = entries_to_save.map do |entry|\n PostBuilder.build(entry, source)\n end\n\n source.subscribers.each do |user|\n posts.each do |post|\n post.populize_entry(user)\n end\n end\n\n count + entries_to_save.size\n end\n end",
"def prepareForReuse; end",
"def sources\n s = Set.new\n experiments.each { |experiment| s.merge(experiment.sources) }\n s.to_a\n end",
"def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end",
"def sources\n source_paths\n end",
"def update_libraries uri\n src = sources.find(uri)\n libraries.each do |lib|\n lib.merge src if lib.contain?(src.filename)\n end\n diagnoser.schedule uri\n end",
"def prepare_reads(base, map, fqgz0, *fqgzs0)\n\n fqgzs = [fqgz0] + fqgzs0\n\n bcs = Hash.new\n open(map, 'r').each do |line|\n bc, well = line.rstrip.split(',')\n bcs[bc] = well\n end\n \n bcl = bcs.keys.map!{|key| key.length}.sort.uniq[0]\n\n tso_pattern = '.'*options.umi_length + '.'*bcl + 'GG'\n\n #\n \n STDERR.puts \"#{`date`.strip}: Demultiplexing each raw sequence files...\"\n \n fqgz2csv0 = Hash.new\n fqgz2csv1 = Hash.new\n fqgz2base = Hash.new\n fqgzs.each do |fqgz|\n fqgz2csv0[fqgz] = get_temporary_path('strt.preprocess', 'csv', false)\n fqgz2csv1[fqgz] = get_temporary_path('strt.preprocess', 'csv', false)\n fqgz2base[fqgz] = get_temporary_path('strt.preprocess', 'base', false)\n end\n\n Parallel.map(fqgz2csv0.keys, in_processes: options.parallel) do |fqgz|\n cmds = [\n \"unpigz -c #{fqgz}\",\n \"#{fq1l_convert_command(options)}\",\n \"#{fq1l_count_command(options)} #{fqgz2csv0[fqgz]}\",\n \"fq1l match_5end#{grep_prefix_option(options)} #{tso_pattern}\",\n \"#{fq1l_count_command(options)} #{fqgz2csv1[fqgz]}\",\n \"fq1l annotate_index --first-cycle=#{options.umi_length+1} --last-cycle=#{options.umi_length+bcl}\",\n \"fq1l annotate_umi --first-cycle=1 --last-cycle=#{options.umi_length}\",\n \"fq1l sort_index#{coreutils_prefix_option}#{parallel_option(options)} --buffer-size=#{(options.maximum_memory/(fqgz2csv0.keys.size+1)).to_i}%\",\n \"fq1l demultiplex #{fqgz2base[fqgz]} #{map}\"\n ]\n cmds.insert(2, \"#{head_command(options)} -n #{options.reads}\") unless options.reads.nil?\n stats = Open3.pipeline(*cmds)\n stats.each_index do |i|\n raise \"Fail at process #{i}; #{stats[i]}; #{cmds[i]}\" unless stats[i].success? || (stats[i].signaled? && stats[i].termsig == 13)\n end\n end\n\n system \"fq1l sum_counts #{fqgz2csv0.values.join(' ')} > #{base}.count.step1.csv\"\n unlink_files(fqgz2csv0.values)\n \n system \"fq1l sum_counts #{fqgz2csv1.values.join(' ')} > #{base}.count.step2.csv\"\n unlink_files(fqgz2csv1.values)\n\n #\n \n (bcs.values + ['NA']).each do |well|\n\n STDERR.puts \"#{`date`.strip}: Finishing well #{well}...\"\n \n tmpfqgzs = fqgz2base.values.map {|base| \"#{base}.#{well}.fq.gz\"}\n csvs = Array.new(6) {|i| \"#{base}.#{well}.count.step#{i+3}.csv\"}\n \n pipeline(\"unpigz -c #{tmpfqgzs.join(' ')}\",\n \"#{fq1l_convert_command(options)}\",\n \"#{fq1l_count_command(options)} #{csvs[0]}\",\n \"#{fq1l_sort_command} --buffer-size=#{(options.maximum_memory/2).to_i}%\",\n \"fq1l exclude_duplicate\",\n \"#{fq1l_count_command(options)} #{csvs[1]}\",\n \"fq1l trim_3end_quality\",\n \"#{fq1l_count_command(options)} #{csvs[2]}\",\n \"fq1l trim_3end_primer#{coreutils_prefix_option}#{grep_prefix_option(options)}#{parallel_option(options)}\",\n \"#{fq1l_count_command(options)} #{csvs[3]}\",\n \"#{fq1l_sort_command} --buffer-size=#{(options.maximum_memory/2).to_i}%\",\n \"fq1l exclude_degenerate\",\n \"#{fq1l_count_command(options)} #{csvs[4]}\",\n \"fq1l trim_5end --minimum-length=#{options.minimum_length} #{tso_pattern}+\",\n \"#{fq1l_count_command(options)} #{csvs[5]}\",\n \"fq1l restore#{coreutils_prefix_option}\",\n \"pigz -c > #{base}.#{well}.fq.gz\")\n \n unlink_files(tmpfqgzs)\n \n end\n \n end",
"def sources\n %w[\n sample_source\n ]\nend",
"def get_source_files(info_files, root_dir)\n sources = {}\n total_lines_found = 0\n total_lines_hit = 0\n info_files.each do |file|\n @log.debug \"Processing tracefile: #{file}\"\n source_pathname = nil\n in_record = false\n lines_found = nil\n lines_hit = nil\n File.open(file).each do |line|\n @log.debug \"#{file}: #{line.rstrip}\"\n\n # SF:<absolute path to the source file>\n line.match('^SF:' + Regexp.quote(root_dir) + '/(.*)$') do |match|\n @log.warn 'Found source filename without preceding end_of_record' if in_record\n @log.debug \"Found source filename: #{match[1]}\"\n source_pathname = match[1]\n if !sources.has_key?(source_pathname) then\n source = File.read(match[1])\n sources[source_pathname] = {\n :name => source_pathname,\n :source => source,\n :coverage => Array.new(source.lines.count)\n }\n end\n in_record = true\n end\n\n # DA:<line number>,<execution count>[,<checksum>]\n line.match(/^DA:(?<line>\\d+),(?<count>\\d+)(,(?<checksum>.*))?$/) do |match|\n line_index = match[:line].to_i - 1\n if !sources[source_pathname][:coverage][line_index] then\n sources[source_pathname][:coverage][line_index] = 0\n end\n sources[source_pathname][:coverage][line_index] = \n sources[source_pathname][:coverage][line_index] + match[:count].to_i;\n end if in_record\n\n # LF:<lines found> or LH:<lines hit>\n line.match(/^LF:(?<count>\\d+)$/) { |match| lines_found = match[:count] }\n line.match(/^LH:(?<count>\\d+)$/) { |match| lines_hit = match[:count] }\n\n # end_of_record\n if line == \"end_of_record\\n\" and in_record then\n @log.info begin\n perc = get_percentage(lines_hit, lines_found)\n \"[#{perc}] #{source_pathname} (#{lines_hit}/#{lines_found})\"\n end\n total_lines_found = total_lines_found + lines_found.to_i\n total_lines_hit = total_lines_hit + lines_hit.to_i\n in_record = false\n lines_found = nil\n lines_hit = nil\n end\n end\n end\n\n @log.info begin\n perc = get_percentage(total_lines_hit, total_lines_found, true)\n \"[#{perc}] Total (#{total_lines_hit}/#{total_lines_found})\"\n end\n\n sources.values\n end",
"def save\n result = Base.redis.hset(:sources, self.name, Marshal.dump(self))\n Log.debug \"Saving Source object to Redis: #{self.name}\"\n result\n end",
"def execute\n\n copiedCounter = 0\n failedCounter = 0\n skippedCounter = 0\n \n # traverse all srcfiles\n FiRe::filesys.find(@source) { |srcItem|\n \n # give some feedback\n FiRe::log.info \"searching #{srcItem}...\" if FiRe::filesys.directory?(srcItem)\n \n # skip this subtree if it matches ignored-items\n FiRe::filesys.prune if ignore?(srcItem) \n \n # transform srcpath to destpath\n destItem = srcItem.gsub(@source, @destination)\n\n # do not copy if item already exists and looks OK\n if needCopy(destItem,srcItem)\n copyWentWell = copyItem(srcItem, destItem)\n copiedCounter += 1 if copyWentWell\n failedCounter += 1 if !copyWentWell\n else\n skippedCounter += 1 \n end\n \n }\n \n # give some feedback\n FiRe::log.info \"copied #{copiedCounter} items, while #{failedCounter} items failed. #{skippedCounter} items did not need to be copied today.\"\n\n end",
"def create_src_list\n\n if ENV['TM_PROJECT_DIRECTORY']\n\n src_list = (ENV['TM_AS3_USUAL_SRC_DIRS'] != nil) ? ENV['TM_AS3_USUAL_SRC_DIRS'].gsub(':','|') : \"src\"\n @src_dirs = `find -dE \"$TM_PROJECT_DIRECTORY\" -maxdepth 5 -regex '.*\\/(#{src_list})' -print 2>/dev/null`\n\n end\n\n cs = \"#{@completion_src}/data/completions\"\n\n # Check once for existence here as we will save repeated\n # checks later (whilst walking up the heirarchy).\n add_src_dir(\"#{cs}/intrinsic\")\n add_src_dir(\"#{cs}/frameworks/air\")\n add_src_dir(\"#{cs}/frameworks/flash_ide\")\n add_src_dir(\"#{cs}/frameworks/flash_cs3\")\n\n # Where we have access to the compressed flex 3 files use them,\n # otherwise go looking for the sdk.\n unless add_src_dir(\"#{cs}/frameworks/flex_3\")\n fx = FlexMate::SDK.src\n add_src_dir(fx) unless fx.nil?\n end\n\n #log_append( \"src_dirs \" + @src_dirs )\n\n end",
"def run\n start_time = Time.now\n\n setup\n\n importer_run.update_attributes( started_at: start_time,\n source_model: source_model.name,\n destination_model: destination_model.name,\n importer_version: VERSION )\n\n # get a total count of records to process, bail out if none are found\n count = base_query(false).count\n\n logger.info \"\"\n if count == 0\n logger.info \"no #{source_model.name.pluralize} to import, exiting\"\n return\n end\n\n logger.info \"Starting import from #{source_model.table_name} into #{destination_model.name}...\"\n\n # step through the records in batches\n (0..count).step(batch_size) do |offset|\n thread_pool.schedule do\n with_connections do\n batch_elapsed_time = Benchmark.realtime do\n logger.info \"Importing from #{source_model.table_name} into #{destination_model.name} (#{offset / batch_size + 1}/#{count / batch_size + 1})\"\n\n # wipe the slate from the last batch\n prepare_for_new_batch\n\n benchmarks[:source_db] << Benchmark.realtime do\n # grab this batch of records from source\n fetch_records(offset)\n end\n\n # bail if there aren't any\n next if records.empty?\n\n logger.info \" #{records.count} source records fetched in #{benchmarks[:source_db].last}s\"\n if source_order_by\n logger.info \" #{source_order_by}: from #{records.first.read_attribute(source_order_by)} to #{records.last.read_attribute(source_order_by)}\"\n end\n\n # process this batch of records\n process_batch(records)\n\n logger.info \" #{records.count} records processed in #{benchmarks[:processing].last}s\"\n\n insert_and_update_batch\n end\n logger.info \" batch processed in #{batch_elapsed_time}s\"\n end\n end\n end\n thread_pool.shutdown\n \n print_validation_errors\n\n logger.info \"-------------------------------------------------\"\n logger.info \"Processing: #{benchmarks[:processing].sum}s total, #{benchmarks[:processing].sum / count}s per record\"\n logger.info \"source Database: #{benchmarks[:source_db].sum}s total, #{benchmarks[:source_db].sum / count}s per record\"\n logger.info \"dest Database: #{benchmarks[:destination_db].sum}s total, #{benchmarks[:destination_db].sum / count}s per record\"\n logger.info \"Total: #{Time.now - start_time}s elapsed\"\n importer_run.update_attributes( completed_at: Time.now )\n rescue Exception => e\n importer_run.update_attributes( error_trace: \"#{e.class} - #{e.message}\\n#{e.backtrace.join(\"\\n\")}\" )\n raise e\n ensure\n importer_run.update_attributes( records_created: records_created,\n records_updated: records_updated,\n duration: ((Time.now - start_time) * 1000).round,\n validation_errors: validation_errors )\n end",
"def sources\n return @sources if @sources\n\n @sources = ['_config.yml']\n @sources << flags.split(' ').map do |flag|\n file = File.join(@site.config['source'], flag.split('=').last)\n file if File.exist? file\n end\n\n @sources << posts.map(&:path)\n\n @sources = @sources.flatten.compact\n end",
"def after_source_extraction(extracted_source)\n end",
"def mirror_engine_files\n \n begin\n initialize_base_public_directory\n \n log.debug \"Attempting to copy public engine files from '#{source_public_dir}'\"\n \n # if there is no public directory, just return after this file\n return if !File.exist?(source_public_dir)\n\n source_files = Dir[source_public_dir + \"/**/*\"]\n source_dirs = source_files.select { |d| File.directory?(d) }\n source_files -= source_dirs \n \n log.debug \"source dirs: #{source_dirs.inspect}\"\n\n # Create the engine_files/<something>_engine dir if it doesn't exist\n if !File.exists?(self.destination_public_dir)\n # Create <something>_engine dir with a message\n log.debug \"Creating #{self.destination_public_dir} public dir\"\n FileUtils.mkdir_p(self.destination_public_dir)\n end\n\n # create all the directories, transforming the old path into the new path\n source_dirs.uniq.each { |dir|\n begin \n # strip out the base path and add the result to the public path, i.e. replace \n # ../script/../vendor/plugins/engine_name/public/javascript\n # with\n # engine_name/javascript\n #\n relative_dir = dir.gsub(File.join(root, \"public\"), name)\n target_dir = File.join(Engines.public_dir, relative_dir)\n unless File.exist?(target_dir)\n log.debug \"Creating directory '#{target_dir}'\"\n FileUtils.mkdir_p(target_dir)\n end\n rescue Exception => e\n raise \"Could not create directory #{target_dir}: \\n\" + e\n end\n }\n\n # copy all the files, transforming the old path into the new path\n source_files.uniq.each { |file|\n begin\n # change the path from the ENGINE ROOT to the public directory root for this engine\n target = file.gsub(File.join(root, \"public\"), destination_public_dir)\n unless File.exist?(target) && FileUtils.identical?(file, target)\n log.debug \"copying file '#{file}' to '#{target}'\"\n FileUtils.cp(file, target)\n end \n rescue Exception => e\n raise \"Could not copy #{file} to #{target}: \\n\" + e \n end\n }\n rescue Exception => e\n log.warn \"WARNING: Couldn't create the engine public file structure for engine '#{name}'; Error follows:\"\n log.warn e\n end\n end",
"def compile_js_sources(base_dir, definitions)\n chdir(base_dir) do\n definitions.each do |definition|\n\n jscompressor = :uglifyjs\n\n sources = definition['inputs'].join(' ')\n\n sh %{cat #{sources} > #{definition['output']}.tmp}\n sh %{#{jscompressor} #{definition['output']}.tmp > #{definition['output']}}\n rm definition['output'] + '.tmp'\n end\n end\nend",
"def load\n sources_data = @gateway.sources_data\n build_entity(sources_data['sources'])\n end",
"def _all_gp_dest_src\n (0..7).each do |dest_reg|\n (0..7).each do |src_reg|\n if src_reg != dest_reg\n yield \"r#{dest_reg}\", \"r#{src_reg}\"\n end\n end\n end\n end"
] | [
"0.7342347",
"0.6772982",
"0.6438325",
"0.64239895",
"0.62638587",
"0.62148726",
"0.6212401",
"0.61977756",
"0.6143289",
"0.61194044",
"0.6117721",
"0.6111869",
"0.609418",
"0.6094128",
"0.60406435",
"0.6035261",
"0.601409",
"0.6009558",
"0.59570915",
"0.5945168",
"0.59015334",
"0.5876981",
"0.5876981",
"0.587242",
"0.5856537",
"0.58163893",
"0.581411",
"0.5779135",
"0.5778282",
"0.5778282",
"0.5778282",
"0.5778282",
"0.5778282",
"0.5778282",
"0.5778282",
"0.5778282",
"0.5778282",
"0.5778282",
"0.5778282",
"0.57768154",
"0.57756823",
"0.5763616",
"0.5761816",
"0.57552123",
"0.572448",
"0.57112044",
"0.5710988",
"0.57097626",
"0.56697804",
"0.5614783",
"0.56079316",
"0.55909175",
"0.5578284",
"0.55691373",
"0.55636406",
"0.5558032",
"0.55570036",
"0.5522453",
"0.5514292",
"0.54833394",
"0.54569954",
"0.5444886",
"0.54366326",
"0.54282707",
"0.54277086",
"0.53953046",
"0.5394896",
"0.5386482",
"0.53832847",
"0.5369068",
"0.53676623",
"0.5366365",
"0.5351839",
"0.53369975",
"0.5333131",
"0.5328718",
"0.53218067",
"0.5316842",
"0.5296769",
"0.52827024",
"0.52801055",
"0.5275785",
"0.5272808",
"0.52694905",
"0.5263823",
"0.52536345",
"0.52461904",
"0.5242585",
"0.52396154",
"0.523664",
"0.52227753",
"0.5220839",
"0.52194303",
"0.5218601",
"0.5218019",
"0.52174425",
"0.52173305",
"0.521197",
"0.52107906",
"0.52092594",
"0.5191894"
] | 0.0 | -1 |
takes a block argument which is called back by each result | def run_tests(&block)
@sources.each do |source|
result = test_source(File.absolute_path(source))
block.call({ :source => source, :result => result })
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def callBlock\n yield\n yield\nend",
"def return(&block); end",
"def callBlock\n yield ,\n end",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def each(&block)\n end",
"def each &block\n end",
"def each(&block)\n results.each(&block)\n end",
"def blocks() end",
"def results(&block)\n section(:top => 1, :bottom => 0) do\n say \"RESULT:\"\n yield\n end\n end",
"def process(&block); end",
"def print_result(&block)\n result_from_block = block.call()\n puts result_from_block\nend",
"def each(&block)\n @results.each &block\n end",
"def each(&block)\n\n end",
"def run(&block)\n end",
"def execute(&block)\n\tblock\nend",
"def execute(&block)\n\tblock\nend",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def perform(&block); end",
"def each(&block) # block into proc\n\nend",
"def multi(&block); end",
"def with_block(&block)\n end",
"def run(&block); end",
"def each_result(results = last_results, &block)\n results.each do |result|\n block.call(Hashie::Mash.new(result))\n end\nend",
"def block?; end",
"def print_block_result\n block_result = yield\n puts block_result\nend",
"def each(&block)\n @result_records.each(&block)\n end",
"def ret_block\n x = 1\n y = 2\n z = 3\n yield(x,y,z)\n yield(x)\n yield(x,x,x,x)\n yield([x,y,z])\nend",
"def on_result(&block)\n @result_handler = block\n end",
"def each(&block)\nend",
"def call_block(&block)\n block.call\nend",
"def each(&block)\n process_results unless @processed\n @results.each(&block)\n end",
"def captured_by_block; end",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def each(&block)\n @results.each(&block)\n end",
"def block_call\n expect :iter\n self[1]\n end",
"def execute(&block)\r\n block\r\nend",
"def run_block_proc\n yield\nend",
"def run_block\n yield\nend",
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def result\n @result = yield\n end",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n puts block.call\nend",
"def run\n block.call\n end",
"def yield; end",
"def each_value(&block); end",
"def return_block\n yield\nend",
"def i_take_a_block\n yield\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def execute(&block)\n block\nend",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def execute(&block)\n block.call\n puts \"End of block\"\nend"
] | [
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.80518186",
"0.7459643",
"0.7434968",
"0.74005234",
"0.7283827",
"0.7283827",
"0.7283827",
"0.7276066",
"0.7270238",
"0.7263479",
"0.7263174",
"0.7247687",
"0.7242557",
"0.7237058",
"0.7227784",
"0.7214137",
"0.7184893",
"0.71786654",
"0.71786654",
"0.7164196",
"0.7164196",
"0.7164196",
"0.7164196",
"0.7164196",
"0.7164196",
"0.7161063",
"0.715585",
"0.714803",
"0.7131199",
"0.71111256",
"0.7101569",
"0.7087869",
"0.7073929",
"0.7071973",
"0.70646226",
"0.70638996",
"0.7061176",
"0.7060363",
"0.7057147",
"0.7050519",
"0.7050466",
"0.70406586",
"0.70292914",
"0.70237124",
"0.70080787",
"0.69901305",
"0.69661075",
"0.69661075",
"0.6963526",
"0.69480544",
"0.69480544",
"0.69480544",
"0.69466203",
"0.69381744",
"0.69381744",
"0.69370013",
"0.69289505",
"0.6910524",
"0.69044495",
"0.6889266",
"0.6886394",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871918",
"0.6871855",
"0.6871855",
"0.6863114"
] | 0.0 | -1 |
GET /rows GET /rows.xml | def index
session[:search_filter_info] = {}
@screen = Screen.find(params[:id])
@action_source = params[:action_source] || 'index'
@quick_operation = params[:quick_operation] || 'index'
@filtered_reference = params[:filtered_reference] || {}
@row_ids = []
@row_pattern = Row.find(params[:row_pattern_id].to_i) unless params[:row_pattern_id].nil?
rpp = ApplicationController.current_user.rows_per_page
@pageno = (!@action_source.include?('page_')) ? 1 : params[:pageno].gsub('/','')
case @action_source
when 'index'
options = @quick_operation == 'index' ? Row.filter_by_custom_fields(params[:id].to_i, {}, 'index', false) : {}
@row_ids = options[:filtered_row_ids] || []
@row_ids_wo_limit = options[:filtered_row_ids_wo_limit] || []
@row_pattern = Row.find(options[:row_pattern_id]) unless options[:row_pattern_id].nil?
session[:sort_field_id_order] = options[:sort_field_id_order] || []
RowsController.store_session_row_ids(session.session_id, @screen.id, @row_ids, @row_ids_wo_limit)
when 'search', 'page_search', 'page_index'
session[:search_filter_info] = {}
@filtered_reference.each do |key, other|
cf = CustomField.find(key)
case cf
when CustomFields::TextField
fieldValue = other
session[:search_filter_info][cf.name] = fieldValue
when CustomFields::Reference
fieldValue = Cell.find(:first, :conditions => {:row_id => other.values}).value
session[:search_filter_info][cf.name] = fieldValue
when CustomFields::DateTimeField
count = other.length
i=0
for i in 0..(count-1)
fieldDate = other.keys[i]
fieldValue = other.values[i]
session[:search_filter_info][fieldDate] = fieldValue
end
else
fieldValue = other
a=10
end
end
screen_id = params[:request_id] || @screen.id
purge = !params[:request_id].nil?
@row_ids = RowsController.get_session_row_ids(session.session_id, screen_id.to_i, purge)
if params.has_key?(:sort_field_id)
session[:sort_field_id_order] = Row.reorder_field_sorting(session[:sort_field_id_order], params[:sort_field_id])
@row_ids = Row.sort(@row_ids, session[:sort_field_id_order])
RowsController.store_session_row_ids(session.session_id, @screen.id, @row_ids)
end
end
@sort_field_id_order = session[:sort_field_id_order]
@row_ids ||= []
@row_count = @row_ids.size
#Page generator
pageno_from = (rpp*(@pageno.to_i-1))
pageno_to = ((rpp*@pageno.to_i)-1)
@maxpage = (@row_ids.size.to_f / rpp).ceil
@row_ids = @row_ids[pageno_from..pageno_to] || []
@rows = @screen.rows.find(:all,
:conditions => {
:rows => { :id => @row_ids }
}
)
@rows.sort!{|a, b| @row_ids.index(a.id) <=> @row_ids.index(b.id)}
GC.start
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @rows }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rows\n render 'rows.html'\n end",
"def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end",
"def rows\r\n @all_rows\r\n end",
"def rows\n @rows\n end",
"def rows\n @rows\n end",
"def rows\n @rows\n end",
"def rows\n @rows\n end",
"def rows\n return @rows if @rows\n if execute && result['rows']\n @rows ||= result['rows'].map{|v| ViewRow.new(v, model)}\n else \n [ ]\n end\n end",
"def show\n @row = Row.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @row }\n end\n end",
"def rows\n return @rows\n end",
"def index\n @rows = Row.all\n end",
"def get_rows(solrparams, params)\n params.key?(:rows) ? solrparams.merge!(:rows => params[:rows]) : solrparams.merge!(:rows => 100000000) # if user passes in the rows they want, use that, else just return everything\n end",
"def rows \n @r\n end",
"def load_rows\n @rows = document.xpath('//td[@id=\"search_table_wrapper\"]//tr')\n raise(PageParserNoRowException.new()) if rows.size.zero?\n end",
"def rows()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rows::RowsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def all_rows\n @rows\n end",
"def row\n get_row\n respond_to_action(:row)\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @rowempls = Rowempl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rowempls }\n end\n end",
"def rows\n RowCollection.new(@data)\n end",
"def index\n @users = User.all\n render :xml => @users\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end",
"def getRows\n return @grid.getRows\n end",
"def rows\n (report[\"data\"][\"rows\"] || []).map { |row| Row.new(self, row) }\n end",
"def rows\n @rows.lazy\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end",
"def show\n @datashows = Datashow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @datashows }\n end\n end",
"def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clientes }\n end\n end",
"def index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end",
"def rows(opts={'start' => nil, 'limit' => nil})\n Cursor.new({'collection' => link('rows'),\n 'start' => opts['start'],\n 'limit' => opts['limit']}.update(@opts))\n end",
"def rows(x = 10)\n\t\ti = ListImporter.new(self.robocall_list_attachment.file_name, 'robocall_list', self.id)\n\t\ti.rows(x)\n\tend",
"def list\n\t\t@hras = Hra.paginate :page => params[:page], :per_page => 10\t#Pagination\n \trespond_to do |format|\t\t\n \t\t format.html \n \t\t\tformat.xml { render :xml => @hras }\t\t#Render to XML File\n \tend\n\tend",
"def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def show\n @task_row = TaskRow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task_row }\n end\n end",
"def fetch_row\n @screen = session.active_screen\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lieus }\n end\n end",
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def rows()\n ([email protected](GRT_COLROW)) ? cr[1] : nil\n end",
"def get_all_lines(page)\n return page.xpath('//tr[@class=\"cmc-table-row\"]')\nend",
"def rows\n links.map { |link| link.row }\n end",
"def rows id\n get_image(id).rows\n end",
"def results_with_rows\n load_from_rows(@dataset.all, true)\n end",
"def rows\n @array\n end",
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def rows(x = 10)\n\t\ti = ListImporter.new(self.sms_list_attachment.file_name, 'sms_list', self.id)\n\t\ti.rows(x)\n\tend",
"def index\n @transport_lines = TransportLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transport_lines }\n end\n end",
"def rows(range = 'Sheet1!A1:E')\n get_spreadsheet_data('1eu1Dk67gKnrIgQQ9Fm0Y-RCMzRfZf1UaTQzEt7hjWp0', range)\n end",
"def index\n @users = User.find(:all, :order => 'name ASC')\n respond_to do |format|\n format.html \n format.xml { @users.to_xml }\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def index\n @uitgelichts = Uitgelicht.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uitgelichts }\n end\n end",
"def index\n @users = User.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @users }\n end\n end",
"def index\n @leks = Lek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leks }\n end\n end",
"def rows\n @rows ||= star_file.sheets.first.rows\n end",
"def wikidata_rows\n sparql_client = SPARQL::Client.new(\n \"https://query.wikidata.org/sparql\",\n method: :get,\n headers: { 'User-Agent': \"Connor's Random Ruby Scripts Data Fetcher/1.0 ([email protected]) Ruby 3.1\" }\n )\n\n # Get the response from the Wikidata query.\n rows = sparql_client.query(sparql_query)\n\n rows.map! do |row|\n key_hash = row.to_h\n {\n name: key_hash[:itemLabel].to_s,\n wikidata_id: key_hash[:item].to_s.sub('http://www.wikidata.org/entity/Q', ''),\n steam_app_id: key_hash[:steamAppId].to_s.to_i\n }\n end\n\n rows\nend",
"def index\n @employees = $Vendor.employees.scopied.order(\"created_at desc\").page(params[:page]).per(25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @employees }\n end\n end",
"def index\n @entries = Entry.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def index\n @lineas = Linea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lineas }\n end\n end",
"def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def get_records(params, columns)\n []\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def rows\n fail \"Implement #{self.class}#rows\"\n end",
"def index\n @users = User.all()\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def show\n @rowempl = Rowempl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rowempl }\n end\n end",
"def index\n @alumnis = Alumni.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @alumnis }\n end\n end",
"def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end",
"def fetch_row\n @screen = session.active_screen\n \n @role = Role.find(params[:id])\n\n respond_to do |format|\n format.html # fetch_row.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def index\n @locations = Location.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def rows=(value)\n @rows = value\n end",
"def index\n @airlines = Airline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @airlines }\n end\n end",
"def get_all(query_options={}, current_page=1, limit=15) # :yields: rows,page,next_page_flag\n opts = @default_query_options.merge(query_options)\n page = current_page.to_i\n page = 1 if page < 1\n while true\n opts[\"skip\"] = limit * (page - 1)\n opts[\"limit\"] = limit + 1\n uri = gen_view_uri(opts)\n $stderr.puts \"[debug] get_all() uri=#{uri}\" if @debug\n \n rows = YALTools::YaJsonRows.new(@couch, @dbname)\n json = @couch.get(uri)\n i=0\n next_row = nil\n next_page_flag = false\n json.has_key?(\"rows\") and yield_rows(json[\"rows\"]) do |r|\n if i == limit\n next_page_flag = true\n else\n rows << r\n end\n i += 1\n end\n break if rows.length == 0\n yield [rows, page, next_page_flag]\n break if next_page_flag == false\n page += 1\n end\n end",
"def index\n @reading_weeks = ReadingWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reading_weeks }\n end\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end",
"def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def find_lift_rows(doc)\n lift_rows = []\n\n container = find_lift_container(doc)\n rows = container.xpath('//tbody/tr').each do |row|\n lift_rows << row\n end\n\n lift_rows\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end"
] | [
"0.6413202",
"0.6403182",
"0.63217473",
"0.62903666",
"0.6270877",
"0.6270877",
"0.6270877",
"0.61829215",
"0.6097462",
"0.6054289",
"0.59701735",
"0.59487486",
"0.5944638",
"0.59300935",
"0.58696544",
"0.58170253",
"0.57566464",
"0.5756029",
"0.5750333",
"0.5750333",
"0.5736338",
"0.5723479",
"0.5696546",
"0.56759596",
"0.5665751",
"0.56632173",
"0.56525075",
"0.5650246",
"0.56457716",
"0.5621646",
"0.561462",
"0.5609872",
"0.5589669",
"0.55853516",
"0.55686307",
"0.5543709",
"0.554313",
"0.5509711",
"0.5509711",
"0.5506678",
"0.5499288",
"0.5499132",
"0.549264",
"0.549203",
"0.54909337",
"0.5488471",
"0.5487204",
"0.54854375",
"0.54848504",
"0.54814327",
"0.5477947",
"0.54566514",
"0.5445087",
"0.54360986",
"0.5434772",
"0.5433911",
"0.5408401",
"0.5400818",
"0.5395686",
"0.5391585",
"0.5390265",
"0.538886",
"0.5385183",
"0.5373673",
"0.5361099",
"0.5348056",
"0.5345813",
"0.53455406",
"0.53353035",
"0.5333083",
"0.5331368",
"0.53303015",
"0.53250986",
"0.5323848",
"0.5316033",
"0.53105825",
"0.5300564",
"0.53000945",
"0.52928567",
"0.52897984",
"0.52889013",
"0.5280676",
"0.5280676",
"0.5280676",
"0.5280165",
"0.52772266",
"0.52753925",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228",
"0.5275228"
] | 0.0 | -1 |
GET /rows/1 GET /rows/1.xml | def show
@row = Row.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @row }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def show\n @datashows = Datashow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @datashows }\n end\n end",
"def rows\n render 'rows.html'\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end",
"def fetch_row\n @screen = session.active_screen\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @report }\n end\n end",
"def show\n @task_row = TaskRow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task_row }\n end\n end",
"def row\n get_row\n respond_to_action(:row)\n end",
"def index\n @rows = Row.all\n end",
"def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end",
"def index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end",
"def rows\n @rows\n end",
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clientes }\n end\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"def index\n @users = User.all\n render :xml => @users\n end",
"def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lieus }\n end\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @rowempls = Rowempl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rowempls }\n end\n end",
"def rows()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rows::RowsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def index\n\t\tindex_\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @parts[:recordset] }\n\t\tend\n\tend",
"def get_rows(solrparams, params)\n params.key?(:rows) ? solrparams.merge!(:rows => params[:rows]) : solrparams.merge!(:rows => 100000000) # if user passes in the rows they want, use that, else just return everything\n end",
"def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end",
"def index\n @transport_lines = TransportLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transport_lines }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def rows\n @rows\n end",
"def rows\n @rows\n end",
"def rows\n @rows\n end",
"def rows\r\n @all_rows\r\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def index\n @columns = Column.find(:all, :order => _(:title, :column))\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @columns.to_xml }\n end\n end",
"def index\n @alumnis = Alumni.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @alumnis }\n end\n end",
"def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end",
"def index\n @lineas = Linea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lineas }\n end\n end",
"def query\n {:xml => xml}\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def import_xml xml_data\n ###\n [table, id]\n end",
"def index\n @uitgelichts = Uitgelicht.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uitgelichts }\n end\n end",
"def index\n @entries = Entry.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def show\n @query = Query.find(params[:id])\n client = GridClientClass.new\n @modifier = @query.modifier\n @attributes = Array.new\n \n @cql1Result = client.getCQL1QueryXML(getGlobusCred, @query)\n puts @cql1Result\n \n @cql2Result = client.getCQL2QueryXML(getGlobusCred, @query)\n puts @cql2Result\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @query }\n end\n end",
"def show_row\n @dataset = Dataset.find(params[:dataset_id])\n if params[:row_id].gsub(/[0-9]/,\"\").length == 0 #il n'y a que des chiffres\n @data = ActiveRecord::Base.connection.select_one(\"SELECT * from dataset_#{@dataset.id} WHERE id = #{params[:row_id]} LIMIT 1\")\n render :inline => @data.to_json \n else\n render :text => 'Invalid parameters'\n end\n end",
"def index3\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @reading_weeks = ReadingWeek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reading_weeks }\n end\n end",
"def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end",
"def index\n @reads = Read.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reads }\n end\n end",
"def index\n @leks = Lek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leks }\n end\n end",
"def index\n @users = User.find(:all, :order => 'name ASC')\n respond_to do |format|\n format.html \n format.xml { @users.to_xml }\n end\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end",
"def fetch_row\n @screen_self = session.active_screen\n\n field_id = params[:id].to_s.split(/_/).last.to_i\n @field = Field.find(field_id)\n\n respond_to do |format|\n format.html # fetch_row.html.erb\n format.xml { render :xml => @field }\n end\n end",
"def index\n @docs = Doc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @docs }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @users }\n end\n end",
"def index\n @additions = Addition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @additions }\n end\n end",
"def index\n @users = User.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def index\n @annees = Annee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @annees }\n end\n end",
"def index\n @transactions = Transaction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end",
"def rows\n return @rows if @rows\n if execute && result['rows']\n @rows ||= result['rows'].map{|v| ViewRow.new(v, model)}\n else \n [ ]\n end\n end",
"def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end",
"def show\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dataset }\n end\n end",
"def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end",
"def index\n @entries = Entry.find_all_by_time(params[:date], :order => :created_at)\n @entry ||= Entry.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @input_records = InputRecord.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @input_records }\n end\n end",
"def load_rows\n @rows = document.xpath('//td[@id=\"search_table_wrapper\"]//tr')\n raise(PageParserNoRowException.new()) if rows.size.zero?\n end",
"def index\n @airlines = Airline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @airlines }\n end\n end",
"def index\n @batches = Batch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @batches }\n end\n end",
"def get(id: nil, name: nil, rank: nil, extinct: nil)\n response = @conn.get do |req|\n req.url 'col/webservice?'\n req.params['format'] = @format.to_s\n req.params['response'] = 'full'\n req.params['id'] = id if id\n req.params['name'] = name if name\n req.params['rank'] = rank if rank\n req.params['extinct'] = extinct if extinct\n end\n response.body['results']\n end",
"def show\r\n Connection.switch_data(params[:connection], \"daily\")\r\n @connections = Connection.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @connections.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end",
"def index\n @locations = Location.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def index\n @invoices = Invoice.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resources }\n end\n end",
"def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @users = User.all()\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def rows \n @r\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end",
"def index\n debugger\n @receitas = Receita.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receitas }\n end\n end",
"def index\n @qxes = Qx.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @qxes }\n end\n end",
"def index\n @eversions = Eversion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @eversions }\n end\n end",
"def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def show\n @tbl_40_2554_i = Tbl402554I.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tbl_40_2554_i }\n end\n end",
"def get(schema, args = {}, method = nil)\n \n # convert arguments\n method ||= schema\n url = (\"/#{method}?\" << map_args(args))\n\n content = http_get(url)\n doc = REXML::Document.new(content)\n schema_keys = QUERY_SCHEMAS[schema].keys\n\n # if there was an error, raise an exception\n doc.root.elements.each('//error') do |e|\n raise APIError, \"#{e.text}\"\n end\n\n # grab toplevel result info\n result_elem = doc.root.elements['//document/result']\n ret = schema_keys.inject({}) do |elem_vals, key|\n if val = result_elem.elements[key]\n # out_key = key.gsub(/\\//, '_')\n out_val = TYPE_PROCS[QUERY_SCHEMAS[schema][key]].call(val.text)\n elem_vals[key] = out_val\n end\n elem_vals\n end\n\n # grab each result item and toss it in the return array\n ret['items'] = []\n doc.root.elements.each('//document/item') do |e|\n # elements to grab from return XML\n item_hash = schema_keys.inject({}) do |elem_vals, key| \n if val = e.elements[key]\n # out_key = key.gsub(/\\//, '_')\n out_val = TYPE_PROCS[QUERY_SCHEMAS[schema][key]].call(val.text)\n elem_vals[key] = out_val\n end\n elem_vals\n end\n\n ret['items'] << magify_hash(item_hash)\n end\n\n # return results\n magify_hash(ret)\n end",
"def index\n @nodes = @job.nodes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n format.json { render :json => @nodes }\n end\n end",
"def index\n @results = Result.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @results }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def list\n\t\t@hras = Hra.paginate :page => params[:page], :per_page => 10\t#Pagination\n \trespond_to do |format|\t\t\n \t\t format.html \n \t\t\tformat.xml { render :xml => @hras }\t\t#Render to XML File\n \tend\n\tend",
"def show\n @rowempl = Rowempl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rowempl }\n end\n end",
"def index\n @threds = Thred.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @threds }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @data_set }\n end\n end",
"def index\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end"
] | [
"0.6468013",
"0.58220077",
"0.5796088",
"0.57727957",
"0.5766898",
"0.5766898",
"0.5700217",
"0.5696157",
"0.5677216",
"0.5623952",
"0.56088895",
"0.5596446",
"0.5593269",
"0.5592369",
"0.55885434",
"0.55766624",
"0.5574343",
"0.5570168",
"0.5565081",
"0.5565081",
"0.556031",
"0.5538186",
"0.5533417",
"0.55328786",
"0.55150986",
"0.54954654",
"0.5494462",
"0.549156",
"0.548688",
"0.5483611",
"0.547211",
"0.5464983",
"0.5461462",
"0.5453589",
"0.5448664",
"0.5444443",
"0.5444443",
"0.5444443",
"0.5429252",
"0.54230714",
"0.54215515",
"0.5408855",
"0.5396816",
"0.5395322",
"0.53937924",
"0.5385026",
"0.53833824",
"0.53726876",
"0.5349461",
"0.5348926",
"0.53487176",
"0.53315884",
"0.5328721",
"0.53218865",
"0.5321734",
"0.5321586",
"0.5321519",
"0.5309684",
"0.5306269",
"0.53008175",
"0.5300655",
"0.5297635",
"0.5296816",
"0.52948964",
"0.52933747",
"0.52907264",
"0.5285269",
"0.52847534",
"0.5282083",
"0.5282083",
"0.527453",
"0.52732575",
"0.5269645",
"0.5267178",
"0.52558815",
"0.5251987",
"0.52489257",
"0.5241571",
"0.52410996",
"0.52396846",
"0.52392846",
"0.5232271",
"0.52271307",
"0.52229697",
"0.52218676",
"0.5215502",
"0.5211808",
"0.5209599",
"0.52056885",
"0.52053475",
"0.52043647",
"0.5200639",
"0.5199902",
"0.5199837",
"0.51978844",
"0.51952225",
"0.51928985",
"0.51820606",
"0.5178394",
"0.5178138"
] | 0.62354 | 1 |
GET /rows/new GET /rows/new.xml | def new
@screen = Screen.find(params[:id])
@row = HeaderRow.new(:screen_id => @screen.id)
@filtered_reference = params[:filtered_reference] || {}
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @row }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @task_row = TaskRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_row }\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 get_all_new\n uri = [@@base_uri, 'all', 'getAllNew'].join('/')\n return get(uri)\n end",
"def new\n\n @datashows = Datashow.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datashows }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @lookup_truthtable = LookupTruthtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_truthtable }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @page }\n end\n end",
"def new\n @tuple = Tuple.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tuple }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @import }\n end\n end",
"def new\n @rowempl = Rowempl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rowempl }\n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @addition = Addition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addition }\n end\n end",
"def new\n @coffee_table = CoffeeTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coffee_table }\n end\n end",
"def new\n @column = Column.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @column }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def new\n @index = Index.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end",
"def new\n @index = Indice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end",
"def new\n @browsenodeid = Browsenodeid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @browsenodeid }\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 @tbl_40_2554_i = Tbl402554I.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tbl_40_2554_i }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end",
"def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\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 respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end",
"def new\n @tx = Tx.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx }\n end\n end",
"def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end",
"def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def index\n @newnodes = Newnode.all\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end",
"def new\n @time_table_entry = TimeTableEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_table_entry }\n end\n end",
"def new\n @tgl_row = TglRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tgl_row }\n end\n end",
"def new\n @thred = Thred.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thred }\n end\n end",
"def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\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 @rep = Rep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rep }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @t1 = T1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @t1 }\n end\n end",
"def new\n @news_update = NewsUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_update }\n end\n end",
"def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end",
"def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @show }\n end\n end",
"def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end",
"def new\n @temp = Temp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @temp }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @client = Client.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n\n end",
"def new\n @journal_line = JournalLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal_line }\n end\n end",
"def new\n @database = Database.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @database }\n end\n end",
"def new\n @new_employee_request = NewEmployeeRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_employee_request }\n end\n end",
"def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def new\n @data_set = DataSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_set }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n \n end\n end",
"def new\n @explain = Explain.new\n @page = 'new-explain'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @explain }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @page = Page.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @client = Client.new\n respond_to do |format|\n format.html #new.html.erb\n format.xml { render :xml => @client }\n end\n end",
"def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classroom }\n end\n end",
"def new\n @historico = Historico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @historico }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @page }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @document }\n end\n end",
"def new\n @retain_node = RetainNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node }\n format.json { render :json => @retain_node }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"def new\n @linea = Linea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @linea }\n end\n end",
"def new\n @table = Table.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table }\n end\n end",
"def new\n @table = Table.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @table }\n end\n end",
"def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end",
"def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\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 @zebra = Zebra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @zebra }\n end\n end",
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end"
] | [
"0.6665572",
"0.66210467",
"0.6539119",
"0.64179224",
"0.6272423",
"0.62522334",
"0.6196304",
"0.61499584",
"0.6144718",
"0.6140753",
"0.6130457",
"0.61265266",
"0.612116",
"0.6119578",
"0.61002594",
"0.60907435",
"0.6075035",
"0.60455763",
"0.6034289",
"0.60233486",
"0.60071784",
"0.5995387",
"0.59918904",
"0.59887457",
"0.59887457",
"0.5974337",
"0.5972194",
"0.5962498",
"0.59609973",
"0.5942898",
"0.59331334",
"0.59269834",
"0.5921027",
"0.5921027",
"0.59099865",
"0.590878",
"0.5907792",
"0.5903362",
"0.58971846",
"0.5891576",
"0.5889256",
"0.5889256",
"0.5889256",
"0.58882743",
"0.588814",
"0.58875763",
"0.58844227",
"0.5884286",
"0.5883302",
"0.58825177",
"0.5878247",
"0.5875506",
"0.58731735",
"0.5872984",
"0.5872984",
"0.5872984",
"0.58710915",
"0.58680356",
"0.58631307",
"0.5862385",
"0.58613235",
"0.5858001",
"0.5851876",
"0.58514774",
"0.5850144",
"0.5849493",
"0.58454245",
"0.58453137",
"0.58453137",
"0.58453137",
"0.58453137",
"0.58453137",
"0.58453137",
"0.584154",
"0.58389616",
"0.58375776",
"0.58358693",
"0.58356744",
"0.58356744",
"0.5833288",
"0.58325076",
"0.58323693",
"0.5832012",
"0.5832012",
"0.5830374",
"0.5830321",
"0.5828688",
"0.58242476",
"0.58220816",
"0.58197963",
"0.58176035",
"0.58175415",
"0.5817209",
"0.5815516",
"0.58131504",
"0.58131504",
"0.581263",
"0.5807407",
"0.58058405",
"0.5804784",
"0.5801671"
] | 0.0 | -1 |
POST /rows POST /rows.xml | def create
@row = HeaderRow.save(params)
respond_to do |format|
format.html # create.html.erb
format.xml { render :xml => @row }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_modify_rows(action, rows, per_page=100)\n if not per_page.is_a? Fixnum or not per_page > 0\n raise VeritableError.new(\"Batch upload or delete must have integer page size greater than 0.\")\n end\n batch = []\n rows.each do |row|\n Util.check_row(row)\n batch.push(row)\n if batch.size == per_page\n post(link('rows'), {'action' => action, 'rows' => batch}) \n batch = []\n end \n end\n if batch.size > 0\n post(link('rows'), {'action' => action, 'rows' => batch})\n end\n end",
"def batch_upload_rows(rows, per_page=100); batch_modify_rows('put', rows, per_page); end",
"def feed_rows(rows)\n write_bytes(27, 74, rows)\n end",
"def add_row(table_name, column_values)\n options = {\n :query => {\n 'ZOHO_ACTION' => 'ADDROW',\n },\n :body => column_values\n }\n\n send_request get_uri(table_name), 'post', options\n end",
"def rows\n render 'rows.html'\n end",
"def rows=(value)\n @rows = value\n end",
"def create\n @row = Row.new(row_params)\n\n respond_to do |format|\n if @row.save\n format.html { redirect_to @row, notice: 'Row was successfully created.' }\n format.json { render :show, status: :created, location: @row }\n else\n format.html { render :new }\n format.json { render json: @row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def row_params\n params.require(:row).permit(:identifier, :project_id, :data)\n end",
"def POST; end",
"def create\n fail = 0\n @errors = []\n @rows = []\n params[:rows].each_value do |pnum|\n num = PartNum.new(pnum)\n @rows << num\n if ! num.save\n fail = 1\n @errors << num.errors\n end\n end\n \n respond_to do |format|\n if fail == 0\n flash[:notice] = 'Part numbers was successfully created.'\n format.html { redirect_to( part_nums_path() ) }\n format.xml { render :xml => @part_num, :status => :created, :location => @part_num }\n else\n flash[:notice] = 'Part number creation failed.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @errors, :status => :unprocessable_entity }\n end\n end\n end",
"def row\n get_row\n respond_to_action(:row)\n end",
"def rows()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Rows::RowsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end",
"def create_row(xml)\n row = self.rowclass.new\n self.columns.each { |colname|\n row.send(colname +\"=\", xml[colname]) # row content ignored so far (needs to be added!!!)\n }\n if xml.children && xml.containers.length > 0\n xml.containers.each { |child|\n el = EAAL::Result::ResultElement.parse_element(self.rowclass.name, child)\n row.add_element(el.name, el)\n }\n end\n row\n end",
"def write_batch_data\n data = []\n # Loop through each row of data\n @document.xpath('//Row').each do |xml_row|\n row = []\n # Loop through each column value\n @column_names.keys.each do |column|\n row.append(xml_row.xpath(column).text)\n end\n data.append(row)\n end\n\n # Write the data to a csv file\n CSV.open(csv_file_path, 'a') do |csv|\n # Add each row by row\n data.each do |row|\n csv << row\n end\n end\n end",
"def create\n @task_row = TaskRow.new(params[:task_row])\n\n respond_to do |format|\n if @task_row.save\n format.html { redirect_to(@task_row, :notice => 'Task row was successfully created.') }\n format.xml { render :xml => @task_row, :status => :created, :location => @task_row }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task_row.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rows\n RowCollection.new(@data)\n end",
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def import_row(data) #TODO: Research use\n return @client.raw(\"post\", \"/config/importers/import_row\", nil, data)\n end",
"def rows\n @rows\n end",
"def create_row(options = nil)\n require_relative 'datarow'\n DataRow.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/rows\", options))\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def postToolsGooglesheetAdd_row( spreadsheet_key, worksheet_key, data)\n params = Hash.new\n params['spreadsheet_key'] = spreadsheet_key\n params['worksheet_key'] = worksheet_key\n params['data'] = data\n return doCurl(\"post\",\"/tools/googlesheet/add_row\",params)\n end",
"def write_row(row)\n end",
"def get_rows(solrparams, params)\n params.key?(:rows) ? solrparams.merge!(:rows => params[:rows]) : solrparams.merge!(:rows => 100000000) # if user passes in the rows they want, use that, else just return everything\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def create_row(params)\n\t\tself.google_doc.restart_session_if_necessary\n\t\treset_worksheet_obj if @worksheet_obj == nil\n\t\t# add the keys if they don't exist\n\t\tparams.each do | key, value |\n\t\t\tif(!@worksheet_obj.list.keys.include?(key))\n\t\t\t\tadd_column_key(key)\n\t\t\tend\n\t\tend\n\t\t# save key changes\n\t\tif(@worksheet_obj.dirty?)\n\t\t\t@worksheet_obj.synchronize\n\t\tend\n\t\t#push the new row\n\t\tnew_row = @worksheet_obj.list.push(params)\n\t\t@worksheet_obj.save\n\t\treturn new_row\n\tend",
"def new\n @task_row = TaskRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_row }\n end\n end",
"def create_escrow_using_post(escrow_params, opts = {})\n data, _status_code, _headers = create_escrow_using_post_with_http_info(escrow_params, opts)\n data\n end",
"def post_data(body)\r\n raise ConfigError, 'no json_records' if body.empty?\r\n # Create REST request header\r\n header = get_header(body.bytesize)\r\n # Post REST request \r\n response = RestClient.post(@uri, body, header)\r\n\r\n return response\r\n end",
"def post_request(params, useSSL=false)\n # get a server handle\n port = (useSSL == true) ? 443 : 80\n http_server = Net::HTTP.new(API_HOST, port)\n http_server.use_ssl = useSSL\n \n # build a request\n http_request = Net::HTTP::Post.new(API_PATH_REST)\n http_request.form_data = params\n \n # get the response XML\n return http_server.start{|http| http.request(http_request)}.body\n end",
"def index\n @rows = Row.all\n end",
"def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end",
"def save\n if row_data[:id] == 0\n row = Vh.new\n else\n row = Vh.find(row_data[:id])\n end\n\n row.name = row_data[:name]\n row.exp1_type = row_data[:exp1_type]\n row.exp1_value = row_data[:exp1_value]\n row.exp2_type = row_data[:exp2_type]\n row.exp2_value = row_data[:exp2_value]\n row.condition = row_data[:condition]\n row.save\n\n render json: {\n data: Vh.all\n }\n end",
"def send_post(data_xml,url)\r\n result = @client.post(self.target_uri(url), :body => data_xml , :head => {'Content-Type' => 'application/xml'} ) \r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200') \r\n #reply = Reply.from_xml(result.http_body)\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end",
"def table_rows(table)\n table.xpath('.//tr').drop 1\n end",
"def create\n @invoice_row = @invoice.invoice_rows.create(invoice_row_params)#InvoiceRow.new(invoice_row_params)\n\n respond_to do |format|\n if @invoice_row.save\n format.html { redirect_to edit_invoice_path(@invoice), notice: 'Invoice row was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice_row }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rows\n return @rows if @rows\n if execute && result['rows']\n @rows ||= result['rows'].map{|v| ViewRow.new(v, model)}\n else \n [ ]\n end\n end",
"def rows\n @rows\n end",
"def rows\n @rows\n end",
"def rows\n @rows\n end",
"def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def row\n new_row = RowBuilder.new\n\n yield new_row\n\n @rows << new_row\n end",
"def rows=(rows)\n resize_field rows, @columns\n end",
"def xhr_post *args, params_or_action\n Presto::Browser.new(@controller, env, 'POST', true).body *args, params_or_action\n end",
"def iterate(params = {})\n query_record_count = count(params)\n @http_client = @http_client.headers({ 'Accept' => \"application/#{@accept}\" })\n default_query_params = {size: 1, offset: 0}\n query_options = params.dup\n query_options.delete :page\n query_options.delete :pageSize\n query_params = default_query_params.merge(query_options)\n while query_params[:offset] < query_record_count\n response = @http_client.post url, json: query_params\n act response\n query_params[:offset] += query_params[:size]\n end\n 'done'\n end",
"def index\n @rowempls = Rowempl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rowempls }\n end\n end",
"def row; end",
"def rows(parts=@parts)\n \n @renderer.rows(parts)\n \n end",
"def create_escrow_using_post_with_http_info(escrow_params, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EscrowApi.create_escrow_using_post ...'\n end\n # verify the required parameter 'escrow_params' is set\n if @api_client.config.client_side_validation && escrow_params.nil?\n fail ArgumentError, \"Missing the required parameter 'escrow_params' when calling EscrowApi.create_escrow_using_post\"\n end\n # resource path\n local_var_path = '/escrow'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(escrow_params)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'EscrowResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EscrowApi#create_escrow_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @java_dynamic_row = JavaDynamicRow.new(params[:java_dynamic_row])\n\n respond_to do |format|\n if @java_dynamic_row.save\n format.html { redirect_to @java_dynamic_row, :notice => 'Java dynamic row was successfully created.' }\n format.json { render :json => @java_dynamic_row, :status => :created, :location => @java_dynamic_row }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @java_dynamic_row.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rowempl = Rowempl.new(params[:rowempl])\n\n respond_to do |format|\n if @rowempl.save\n format.html { redirect_to @rowempl, notice: 'Rowempl was successfully created.' }\n format.json { render json: @rowempl, status: :created, location: @rowempl }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rowempl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def load_rows\n @rows = document.xpath('//td[@id=\"search_table_wrapper\"]//tr')\n raise(PageParserNoRowException.new()) if rows.size.zero?\n end",
"def rows \n @r\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def create_row(params)\n # add the keys if they don't exist\n params.each do | key, value |\n if(!@worksheet_obj.list.keys.include?(key))\n add_key(key)\n end\n end\n # save key changes\n if(@worksheet_obj.dirty?)\n @worksheet_obj.synchronize\n end\n #push the new row\n @worksheet_obj.list.push(params)\n @worksheet_obj.save\n end",
"def index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end",
"def set_row\n @row = Row.find(params[:id])\n end",
"def set_row\n @row = Row.find(params[:id])\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def batch_delete_rows(rows, per_page=100)\n begin\n batch_modify_rows('delete', rows, per_page)\n rescue VeritableError => e\n if (not e.respond_to?(:http_code)) or (not (e.http_code == \"404 Resource Not Found\"))\n raise e\n end\n end\n end",
"def import_xml xml_data\n ###\n [table, id]\n end",
"def create\n @tgl_row = TglRow.new(params[:tgl_row])\n\n respond_to do |format|\n if @tgl_row.save\n format.html { redirect_to @tgl_row, notice: 'Tgl row was successfully created.' }\n format.json { render json: @tgl_row, status: :created, location: @tgl_row }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tgl_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rows\n (report[\"data\"][\"rows\"] || []).map { |row| Row.new(self, row) }\n end",
"def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def post(method, params = {})\n url = make_url method, params\n query = url.query\n url.query = nil\n\n req = Net::HTTP::Post.new url.path\n req.body = query\n req.content_type = 'application/x-www-form-urlencoded'\n\n res = Net::HTTP.start url.host, url.port do |http|\n http.request req\n end\n\n xml = Nokogiri::XML(res.body, nil, nil, 0)\n\n check_error xml\n\n parse_response xml\n rescue SystemCallError, SocketError, Timeout::Error, IOError,\n Nokogiri::XML::SyntaxError => e\n raise CommunicationError.new(e)\n rescue Net::HTTPError => e\n xml = Nokogiri::XML(e.res.body) { |cfg| cfg.strict }\n check_error xml\n raise CommunicationError.new(e)\n end",
"def post(data)\n jss = self.get_structure() # For referencing purposes\n\n input = self.query_to_hash(data)\n bad_request = false\n resp = nil\n jss.each do |key, value|\n # Check if we have it on the query too\n unless input.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Not enough data for a new resource\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n input.each do |key, value|\n # Check if we have it on the structure too\n unless jss.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Wrong argument #{key}\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n \n\n # Insert the values if we have a good request\n unless bad_request\n fields = Hash.new\n inserts = Hash.new\n main_table = self.get_structure.values[0].split('/')[0]\n input.each do |key, value|\n struct = jss[key]\n table = struct.split(\"/\")[0]\n inserts[table] ||= []\n fields[table] ||= []\n inserts[table].push \"\\\"\" + value + \"\\\"\"\n fields[table].push struct.split(\"/\")[1]\n if struct.split(\"/\").length > 2\n match = struct.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n fields[table].push matching_field\n if @engine.config[\"dbengine\"] == :mysql\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID()))\"\n else\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(last_insert_rowid()))\"\n end\n end\n end\n queries = [] \n inserts.each do |table, values|\n queries.push \"INSERT INTO #{table}(#{fields[table].join(',')}) VALUES (#{inserts[table].join(',')});\"\n end\n # Connect to the database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n results = []\n rid = nil\n # Find the ID to return in the response (only for the first query)\n queries.each do |q|\n results.push dbe.query(dblink, q)\n if @engine.config[\"dbengine\"] == :mysql\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID());\"), \"id\")\n else\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(last_insert_rowid());\"), \"id\")\n end\n end\n @engine.http_status = \"201 Created\"\n resp = {status: \"201 created\", id: rid}\n end\n return resp\n end",
"def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def create_draft_table_rows_with_http_info(table_id_or_name, batch_input_hub_db_table_row_v3_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RowsBatchApi.create_draft_table_rows ...'\n end\n # verify the required parameter 'table_id_or_name' is set\n if @api_client.config.client_side_validation && table_id_or_name.nil?\n fail ArgumentError, \"Missing the required parameter 'table_id_or_name' when calling RowsBatchApi.create_draft_table_rows\"\n end\n # verify the required parameter 'batch_input_hub_db_table_row_v3_request' is set\n if @api_client.config.client_side_validation && batch_input_hub_db_table_row_v3_request.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_input_hub_db_table_row_v3_request' when calling RowsBatchApi.create_draft_table_rows\"\n end\n # resource path\n local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/create'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_hub_db_table_row_v3_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'BatchResponseHubDbTableRowV3'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"RowsBatchApi.create_draft_table_rows\",\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: RowsBatchApi#create_draft_table_rows\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def new\n\n @datashows = Datashow.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datashows }\n end\n end",
"def addLogsBatchXML(collection=\"lclsLogs\", dizList, bulk: false)\n uri = URI.parse(\"http://#{@host}:#{@port}/solr/#{collection}/update\") \n # uri = URI.parse(\"http://psmetric04:8983/solr/lclsLogs/update\") \n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/xml')\n req.body = formatLogBatchAsXML(dizList)\n # puts req.body \n # res = http.request(req, xml: formatLogBatchAsXML(dizList) )\n res = http.request(req)\n # puts \"response: #{res.body}\"\n return [dizList.length, req.body.size, res]\n end",
"def post_data; end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def test_insert_table_row\n remote_file_name = 'TestInsertTableRow.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request_row = TableRowInsert.new({:ColumnsCount => 5})\n request = InsertTableRowRequest.new(name: remote_file_name, table_path: 'sections/0/tables/2', row: request_row, folder: remote_data_folder)\n\n result = @words_api.insert_table_row(request)\n assert_equal false, result.nil?\n end",
"def new\n @java_dynamic_row = JavaDynamicRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @java_dynamic_row }\n end\n end",
"def to_nokogiri(doc) # :nodoc:\n row = doc.create_element('row'); doc.add_child(row)\n each { |key,value|\n element = doc.create_element(key.to_s)\n element.add_child(doc.create_text_node(value.to_s))\n row.add_child(element)\n }\n row\n end",
"def post(path, params)\n connection.post(path) { |req| req.body = params }\n end",
"def new\n @rowempl = Rowempl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rowempl }\n end\n end",
"def create_rows\n (row_count.to_i - rows.size).times { rows.create(position: rows.size) }\n end",
"def datasource_params\n {\n start: start,\n rows: rows,\n wt: 'json'\n }\n end",
"def generate_xml(row)\n xml = Builder::XmlMarkup.new\n xml.PAP_INTVSCH_RECORD do |d|\n d.appLseNumber(row[\"appNumber\"])\n d.enabled(\"Y\")\n (0..@config[\"lease_terms\"].to_i).each do |i|\n\n duedate = row[\"dueDate_#{i}\"].nil? ? '' : row[\"dueDate_#{i}\"]\n amount = row[\"amount_#{i}\"].nil? ? '' : row[\"amount_#{i}\"]\n\n d.__send__(\"dueDate_#{i}\") do\n d << duedate\n end\n d.__send__(\"amount_#{i}\") do\n d << amount\n end\n end\n end\n end",
"def rows\r\n @all_rows\r\n end",
"def invoice_row_params\n params.require(:invoice_row).permit(:invoice_id, :desc, :value)\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\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 @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://localhost:3001/servicios/wsdl\")\n tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n total_pagar = params[:orden][:total]\n pago = '<Message>\n <Request>\n <numero_tdc>'+tdc.numero+'</numero_tdc>\n <nombre_tarjetahabiente>'+tdc.tarjetahabiente+'</nombre_tarjetahabiente>\n <fecha_vencimiento>'+tdc.mes_vencimiento+'/'+tdc.ano_vencimiento+'</fecha_vencimiento>\n <codigo_seguridad>'+tdc.codigo+'</codigo_seguridad>\n <tipo_tarjeta>'+tdc.tipo+'</tipo_tarjeta>\n <direccion_cobro>'+tdc.direccion+'</direccion_cobro>\n <total_pagar>'+total_pagar+'</total_pagar>\n <cuenta_receptora>'+cuenta_receptora+'</cuenta_receptora>\n </Request>\n </Message>'\n #response = client.request :verificar_pago, body: { \"value\" => pago } \n #if response.success?\n # data = response.to_hash[:verificar_pago_response][:value][:response].first\n # @respuesta = XmlSimple.xml_in(data)\n #end\n\n #NAMESPACE = 'pagotdc'\n #URL = 'http://localhost:8080/'\n #banco = SOAP::RPC::Driver.new(URL, NAMESPACE)\n #banco.add_method('verificar_pago', 'numero_tdc', 'nombre_tarjetahabiente', 'fecha_vencimiento', 'codigo_seguridad', 'tipo_tarjeta', 'direccion_cobro', 'total_pagar', 'cuenta_receptora')\n #\n \n #respuesta = banco.verificar_pago(tdc.numero, tdc.tarjetahabiente, tdc.mes_vencimiento.to_s+'/'+tdc.ano_vencimiento.to_s, tdc.codigo, tdc.tipo, params[:orden][:total], tdc.direccion)\n \n if true #respuesta.ack.eql?(0)\n params[:orden][:cliente_id] = usuario_actual.id\n params[:orden][:total] = Seleccion.precio_total(usuario_actual.id)\n params[:orden][:fecha_entrega] = \"0000-00-00\"\n @orden = Orden.new(params[:orden])\n \n if @orden.save\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n @venta = Venta.new(:producto_id=>p.id, \n :orden_id=>@orden.id,\n :categoria_id=>p.categoria_id, \n :cantidad=>seleccion.cantidad,\n :costo=>p.precio)\n @venta.save\n end\n \n Seleccion.vaciar_carro(usuario_actual.id)\n respond_to do |format|\n format.html { redirect_to ver_ordenes_path, notice: 'Orden generada correctamente.' }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\", notice: respuesta.mensaje }\n end\n end\n end",
"def postEntityEmployee( entity_id, title, forename, surname, job_title, description, email, phone_number)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['forename'] = forename\n params['surname'] = surname\n params['job_title'] = job_title\n params['description'] = description\n params['email'] = email\n params['phone_number'] = phone_number\n return doCurl(\"post\",\"/entity/employee\",params)\n end",
"def rows\n fail \"Implement #{self.class}#rows\"\n end",
"def send_request( xml )\n write( xml )\n read\n end",
"def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\n end",
"def post\n resource.post(request, response)\n end",
"def import_row(server, row, pastel)\n scenario_id, *values = row\n print \"Importing scenario #{scenario_id}... \"\n\n RestClient.put(\n \"#{server}/api/v3/scenarios/#{scenario_id}\",\n { scenario: { user_values: user_values(values) } }.to_json,\n accept: :json, content_type: :json\n )\n\n puts pastel.green(\"done (#{values.length} user values).\")\n true\nrescue RestClient::NotFound\n puts pastel.red(\"scenario not found.\")\n false\nrescue RestClient::UnprocessableEntity => ex\n puts pastel.red(\"validation error.\")\n\n JSON.parse(ex.http_body)['errors'].each do |msg|\n puts pastel.red(\" * #{msg}\")\n end\n\n false\nend",
"def rows\n @body.size\n end",
"def tbody_params\n params.require(:tbody).permit(:main, :name)\n end",
"def post(params, answer_sheet)\n questions_indexed = @questions.index_by(&:id)\n\n # loop over form values\n params ||= {}\n params.each do |question_id, response|\n next if questions_indexed[question_id.to_i].nil? # the rare case where a question was removed after the app was opened.\n # update each question with the posted response\n questions_indexed[question_id.to_i].set_response(posted_values(response), answer_sheet)\n end\n end",
"def update_row_resource(resource, params)\n resource.attributes = params\n resource.save\n end"
] | [
"0.59664047",
"0.5861051",
"0.5593458",
"0.54831976",
"0.5367803",
"0.53363127",
"0.52645123",
"0.5258665",
"0.51800036",
"0.51765615",
"0.51674116",
"0.5113631",
"0.5076991",
"0.50438255",
"0.5033215",
"0.50232726",
"0.50009197",
"0.49986017",
"0.4996895",
"0.4938371",
"0.49322647",
"0.4922692",
"0.4916937",
"0.4886922",
"0.48854327",
"0.4846604",
"0.48365954",
"0.48354092",
"0.4824686",
"0.48102462",
"0.48090115",
"0.47959194",
"0.47939384",
"0.47938922",
"0.47883222",
"0.47871056",
"0.4785019",
"0.4783816",
"0.4778047",
"0.4778047",
"0.4778047",
"0.47698203",
"0.47698137",
"0.47629136",
"0.47306177",
"0.47222623",
"0.47164202",
"0.46932396",
"0.4692416",
"0.46902746",
"0.46876583",
"0.46697515",
"0.46647218",
"0.46582505",
"0.4658149",
"0.46507764",
"0.46465924",
"0.4635461",
"0.4635461",
"0.4629411",
"0.4626273",
"0.46234626",
"0.46106088",
"0.46088773",
"0.4604833",
"0.46047077",
"0.46037555",
"0.4597718",
"0.45940503",
"0.4593655",
"0.45903826",
"0.45895016",
"0.45895016",
"0.45881394",
"0.45855248",
"0.45827657",
"0.45804998",
"0.45790976",
"0.45780176",
"0.4560265",
"0.4559551",
"0.45584914",
"0.4556956",
"0.45542836",
"0.45507413",
"0.45451236",
"0.45446014",
"0.45440707",
"0.45368177",
"0.4531941",
"0.4530095",
"0.4526604",
"0.45250946",
"0.45249417",
"0.4522656",
"0.45210645",
"0.45191926",
"0.4518121",
"0.4517859",
"0.45176435"
] | 0.5322555 | 6 |
PUT /rows/1 PUT /rows/1.xml | def update
@row = Row.find(params[:id])
respond_to do |format|
if @row.update_attributes(:remark => params[:remark])
@cells = params[:cells]
@cells.each do |field_id,value|
@cell = Cell.find(:first, :conditions => ['row_id = ? and field_id = ?', @row.id , field_id])
if @cell == nil
Cell.new(:row_id => @row.id, :field_id => field_id, :value => value).save
else
@cell.update_attributes(:row_id => @row.id, :field_id => field_id, :value => value)
end
end
forward_to_front_desk :format => format, :object => @row, :screen_id =>@row.screen_id
else
back_to_operation_form :format => format, :action => 'edit', :object_errors => @row.errors
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def batch_upload_rows(rows, per_page=100); batch_modify_rows('put', rows, per_page); end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def 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_row_resource(resource, params)\n resource.attributes = params\n resource.save\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @task_row = TaskRow.find(params[:id])\n\n respond_to do |format|\n if @task_row.update_attributes(params[:task_row])\n format.html { redirect_to(@task_row, :notice => 'Task row was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task_row.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reindex(*entries)\n list = Upload.get_relation(*entries).to_a\n result = ingest_api.put_records(*list)\n result.exec_report.error_messages.each { |e| $stderr.puts e }.blank?\n end",
"def update_sheet(rows)\n a1_notation = \"'Published factchecks'!R1:S#{rows.count}\"\n\n request_body = Google::Apis::SheetsV4::BatchUpdateValuesRequest.new\n value_range = Google::Apis::SheetsV4::ValueRange.new\n value_range.range = a1_notation\n value_range.major_dimension = \"ROWS\"\n value_range.values = rows\n\n request_body.data = [value_range]\n request_body.include_values_in_response = true\n request_body.value_input_option = \"RAW\"\n\n response = @service.batch_update_values(@spreadsheet_id, request_body)\n puts response.to_json\n end",
"def batch_modify_rows(action, rows, per_page=100)\n if not per_page.is_a? Fixnum or not per_page > 0\n raise VeritableError.new(\"Batch upload or delete must have integer page size greater than 0.\")\n end\n batch = []\n rows.each do |row|\n Util.check_row(row)\n batch.push(row)\n if batch.size == per_page\n post(link('rows'), {'action' => action, 'rows' => batch}) \n batch = []\n end \n end\n if batch.size > 0\n post(link('rows'), {'action' => action, 'rows' => batch})\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update\n respond_to do |format|\n if @row.update(row_params)\n format.html { redirect_to @row, notice: 'Row was successfully updated.' }\n format.json { render :show, status: :ok, location: @row }\n else\n format.html { render :edit }\n format.json { render json: @row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_row\n @row = Row.find(params[:id])\n end",
"def set_row\n @row = Row.find(params[:id])\n end",
"def batch_update(batch_data, cellfeed_uri)\n batch_uri = cellfeed_uri + '/batch'\n\n batch_request = <<FEED\n<?xml version=\"1.0\" encoding=\"utf-8\"?> \\\n <feed xmlns=\"http://www.w3.org/2005/Atom\" \\\n xmlns:batch=\"http://schemas.google.com/gdata/batch\" \\\n xmlns:gs=\"http://schemas.google.com/spreadsheets/2006\" \\\n xmlns:gd=\"http://schemas.google.com/g/2005\">\n <id>#{cellfeed_uri}</id>\nFEED\n\n batch_data.each do |batch_request_data|\n version_string = get_version_string(cellfeed_uri + '/' +\n batch_request_data[:cell_id])\n data = batch_request_data[:data]\n batch_id = batch_request_data[:batch_id]\n cell_id = batch_request_data[:cell_id]\n row = batch_request_data[:cell_id][1,1]\n column = batch_request_data[:cell_id][3,1]\n edit_link = cellfeed_uri + '/' + cell_id + '/' + version_string\n \n batch_request<< <<ENTRY\n <entry>\n <gs:cell col=\"#{column}\" inputValue=\"#{data}\" row=\"#{row}\"/>\n <batch:id>#{batch_id}</batch:id>\n <batch:operation type=\"update\" />\n <id>#{cellfeed_uri}/#{cell_id}</id>\n <link href=\"#{edit_link}\" rel=\"edit\" type=\"application/atom+xml\" />\n </entry>\nENTRY\n end\n \n batch_request << '</feed>'\n return post(batch_uri, batch_request)\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 test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sheet.add_row(count_params) if params[:change] == \"add_row\"\n @sheet.add_column(count_params) if params[:change] == \"add_column\"\n @sheet.move_row(move_params) if params[:change] == \"move_row\"\n @sheet.move_column(move_params) if params[:change] == \"move_column\"\n @sheet.drop_row(count_params) if params[:change] == \"drop_row\"\n @sheet.drop_column(count_params) if params[:change] == \"drop_column\"\n\n @sheet.update_content(content_params) if params[:change] == \"content\"\n\n @sheet.update_attributes(sheet_params) if params[:sheet]\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, notice: 'Sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sheet.add_row(count_params) if params[:change] == \"add_row\"\n @sheet.add_column(count_params) if params[:change] == \"add_column\"\n @sheet.move_row(move_params) if params[:change] == \"move_row\"\n @sheet.move_column(move_params) if params[:change] == \"move_column\"\n @sheet.drop_row(count_params) if params[:change] == \"drop_row\"\n @sheet.drop_column(count_params) if params[:change] == \"drop_column\"\n\n @sheet.update_content(content_params) if params[:change] == \"content\"\n\n @sheet.update_attributes(sheet_params) if params[:sheet]\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, notice: 'Sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def puts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:put,path,params,opts,&block)\n end",
"def update!(**args)\n @annotation_specs = args[:annotation_specs] if args.key?(:annotation_specs)\n @rows = args[:rows] if args.key?(:rows)\n end",
"def put(*args)\n request :put, *args\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @rows = args[:rows] if args.key?(:rows)\n end",
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def update\n connection.put(element_path, to_xml)\n end",
"def update\n @rowempl = Rowempl.find(params[:id])\n\n respond_to do |format|\n if @rowempl.update_attributes(params[:rowempl])\n format.html { redirect_to @rowempl, notice: 'Rowempl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rowempl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_table_row_with_http_info(name, slide_index, shape_index, row_index, dto, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.update_table_row ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.update_table_row\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.update_table_row\"\n end\n # verify the required parameter 'shape_index' is set\n if @api_client.config.client_side_validation && shape_index.nil?\n fail ArgumentError, \"Missing the required parameter 'shape_index' when calling SlidesApi.update_table_row\"\n end\n # verify the required parameter 'row_index' is set\n if @api_client.config.client_side_validation && row_index.nil?\n fail ArgumentError, \"Missing the required parameter 'row_index' when calling SlidesApi.update_table_row\"\n end\n # verify the required parameter 'dto' is set\n if @api_client.config.client_side_validation && dto.nil?\n fail ArgumentError, \"Missing the required parameter 'dto' when calling SlidesApi.update_table_row\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/rows/{rowIndex}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'shapeIndex', shape_index)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'rowIndex', row_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dto)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'TableRow')\n return data, status_code, headers\n end",
"def update\n put :update\n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def put!\n request! :put\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 update\r\n CSV.parse(open(url).read) do |row|\r\n populate row\r\n end\r\n end",
"def update\n @java_dynamic_row = JavaDynamicRow.find(params[:id])\n\n respond_to do |format|\n if @java_dynamic_row.update_attributes(params[:java_dynamic_row])\n format.html { redirect_to @java_dynamic_row, :notice => 'Java dynamic row was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @java_dynamic_row.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @column_headers = args[:column_headers] if args.key?(:column_headers)\n @kind = args[:kind] if args.key?(:kind)\n @rows = args[:rows] if args.key?(:rows)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end",
"def put(path, body: {}, headers: nil)\n response = conn.put do |req|\n build_request(req, path: path, body: body, headers: headers)\n end\n puts response.body\n response.body unless response.blank?\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def update\n @tgl_row = TglRow.find(params[:id])\n\n respond_to do |format|\n if @tgl_row.update_attributes(params[:tgl_row])\n format.html { redirect_to @tgl_row, notice: 'Tgl row was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tgl_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params)\n request(:put, path, params)\n end",
"def update\n respond_to do |format|\n if @invoice_row.update(invoice_row_params)\n format.html { redirect_to @invoice_row, notice: 'Invoice row was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invoice_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params)\n parse_response @client[path].put(params)\n end",
"def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_row(hash)\n raise ORM::TableError, \"Something went wrong.\" unless hash[:id].present?\n\n result_table = table.map! { |e| e[:id] == hash[:id] ? e = e.merge!(hash) : e }\n File.write(@table_path, JSON.generate(result_table))\n end",
"def post_to_solr(params,commit=true)\n url=\"#{Blacklight.default_index.connection.options[:url]}/update?commit=#{commit}\"\n RestClient.post url, params,:content_type => :json, :accept=>:json\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\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 api_update_for(not_needed_params = {})\r\n api = set_api\r\n begin\r\n xml = api.get(\"char/CharacterSheet\")\r\n rescue Exception => e\r\n logger.error e.inspect\r\n else\r\n # Update date of birth manually because of discrepancy between DB and API name\r\n self.date_of_birth = xml.xpath('/eveapi/result/DoB').text\r\n # Set Array containing xml paths\r\n a = [\"race\", \"bloodLine\", \"ancestry\", \"gender\", \"corporationID\",\r\n \"cloneName\", \"cloneSkillPoints\", \"balance\",\r\n \"attributes/intelligence\", \"attributes/memory\",\r\n \"attributes/charisma\", \"attributes/perception\",\r\n \"attributes/willpower\"]\r\n # Update attributes using the XML paths\r\n a.each do |param|\r\n param_u = param.gsub(\"attributes/\", \"\").underscore\r\n if respond_to?(:\"#{param_u}=\")\r\n send(:\"#{param_u}=\", xml.xpath(\"/eveapi/result/\" + param).text)\r\n end\r\n end\r\n self.save\r\n\r\n # Update implants rowset\r\n implant.api_update\r\n EveRole.api_update(self, xml)\r\n end\r\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\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\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(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 Neo4j::Transaction.run do\n @q_resource = QResource.find(params[:id])\n @q_resource.update_attributes!(params[:q_resource])\n respond_to do |format|\n if @q_resource.update_attributes(params[:q_resource])\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update_entity(table_name, entity_values, options={})\n if_match = \"*\"\n if_match = options[:if_match] if options[:if_match]\n\n query = { }\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n uri = entities_uri(table_name, \n entity_values[:PartitionKey] || entity_values['PartitionKey'],\n entity_values[:RowKey] || entity_values[\"RowKey\"], query)\n\n headers = {}\n headers[\"If-Match\"] = if_match || \"*\" unless options[:create_if_not_exists]\n\n body = Table::Serialization.hash_to_entry_xml(entity_values).to_xml\n\n response = call(:put, uri, body, headers, options)\n response.headers[\"etag\"]\n rescue => e\n raise_with_response(e, response)\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 rows=(rows)\n resize_field rows, @columns\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end",
"def update\n @slide.row_order_position = slide_params[:row_order_position]\n if @slide.save\n render nothing: true\n else\n render json: {files: [{\n error: @slide.errors.full_messages.join(\" \")\n }]}, status: 400\n end\n end",
"def put(path, parameters = {})\n request(:put, path, parameters)\n end",
"def update\n respond_to do |format|\n if @tbody.update(tbody_params)\n format.html { redirect_to @tbody, notice: 'Tbody was successfully updated.' }\n format.json { render :show, status: :ok, location: @tbody }\n else\n format.html { render :edit }\n format.json { render json: @tbody.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update\n @datashows = Datashow.find(params[:id])\n\n respond_to do |format|\n if @datashows.update_attributes(params[:datashow])\n flash[:notice] = 'RESERVA ALTERADA COM SUCESSO'\n format.html { redirect_to(@datashows) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @datashows.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def write_row(row)\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def reindex_resource\n\t\tresource.reindex\n\tend",
"def update\n @column = Column.find(params[:id])\n\n params[:column].delete(:id)\n params[:column].delete(:cards)\n params[:column].delete(:updated_at)\n\n if params[:column][:position] == nil || @column.position.to_i == params[:column][:position].to_i\n params[:column].delete(:position)\n updateResult = @column.update_attributes(params[:column])\n else\n updateResult = @column.insert_at(params[:column][:position])\n end\n\n respond_to do |format|\n if updateResult\n format.xml { head :ok }\n else\n format.xml { render :xml => @column.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\")\n req = Net::HTTP::Post.new(uri)\n req.body = { \"doc\": document }.to_json\n run(uri, req)\n end",
"def update(index_name, payload)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = \"application/json\"\n req.body = payload.to_json\n @client.send_http(req, true, ['200'])\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def couchdb_put(urn, host = '127.0.0.1', options = @@default_options)\n query_couchdb(urn, 'PUT', host, options)\n end",
"def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end",
"def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end",
"def update\n @topic = Topic.find(params[:id])\n row = @topic.id+1\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n @ws[row,2] = @topic.topic\n @ws[row,3] = @topic.subject.subject\n @ws[row,4] = @topic.seab_sub_topic.topic\n @ws[row,5] = @topic.description\n @ws.save()\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @t1 = T1.find(params[:id])\n\n respond_to do |format|\n if @t1.update_attributes(params[:t1])\n flash[:notice] = 'T1 was successfully updated.'\n format.html { redirect_to(@t1) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @t1.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @estoque = Estoque.find(params[:id])\n\n respond_to do |format|\n if @estoque.update_attributes(params[:estoque])\n format.html { redirect_to @estoque, notice: 'Estoque was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end"
] | [
"0.62992954",
"0.61409783",
"0.5824773",
"0.5819761",
"0.57864124",
"0.5729437",
"0.56530464",
"0.5637884",
"0.55770445",
"0.554965",
"0.5521953",
"0.551672",
"0.54710233",
"0.54595786",
"0.5441335",
"0.53758335",
"0.53758335",
"0.52860487",
"0.5282932",
"0.5271425",
"0.5263273",
"0.5240586",
"0.5197895",
"0.5197895",
"0.51961803",
"0.51693904",
"0.5166612",
"0.5162988",
"0.5154736",
"0.5148603",
"0.51243925",
"0.5099617",
"0.5083366",
"0.5076863",
"0.5069325",
"0.5067839",
"0.5056335",
"0.50416195",
"0.5024907",
"0.5023193",
"0.5016116",
"0.5014086",
"0.50015604",
"0.49967813",
"0.49962956",
"0.49933136",
"0.49913234",
"0.49896383",
"0.49725592",
"0.4965057",
"0.49633452",
"0.4958789",
"0.49515745",
"0.49485287",
"0.4941505",
"0.4941505",
"0.4941505",
"0.49395347",
"0.49248213",
"0.49248213",
"0.49248213",
"0.49248213",
"0.49248213",
"0.49248213",
"0.49248213",
"0.49248213",
"0.49196577",
"0.49133444",
"0.49008483",
"0.48993877",
"0.48902273",
"0.48902273",
"0.48781586",
"0.48767552",
"0.48764485",
"0.4874087",
"0.48731107",
"0.48695594",
"0.48695436",
"0.48677695",
"0.48677695",
"0.48671937",
"0.48632005",
"0.48586372",
"0.4856595",
"0.48553383",
"0.4849019",
"0.4846731",
"0.48403636",
"0.48374262",
"0.483575",
"0.483303",
"0.48322353",
"0.4831927",
"0.48218447",
"0.48218066",
"0.48208192",
"0.48171413",
"0.4816441",
"0.4816441"
] | 0.5445404 | 14 |
Example from another LS member | def swapcase(string)
string.chars.map {|c| c == c.upcase ? c.downcase : c.upcase}.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def example_passed(example)\n end",
"def example\n @example ||= example_override\n end",
"def usage; end",
"def usage; end",
"def lab\n # STUB\n end",
"def example(example) #:doc:\n return unless Apipie.active_dsl?\n Apipie.add_example(example)\n end",
"def eg(name = nil, &example)\n Exemplor.extract_example_file caller # only runs once\n return Exemplor::ExampleEnv if name.nil? && example.nil?\n if name.nil?\n file, line_number = caller.first.match(/^(.+):(\\d+)/).captures\n line = File.readlines(file)[line_number.to_i - 1].strip\n name = line[/^eg\\s*\\{\\s*(.+?)\\s*\\}$/,1] if name.nil?\n raise Exemplor::ExampleDefinitionError, \"example at #{caller.first} has no name so must be on one line\" if name.nil?\n end\n Exemplor.examples.add(name, &example)\nend",
"def member; end",
"def member; end",
"def member; end",
"def member; end",
"def member; end",
"def example_passed(_)\n end",
"def details(*args); end",
"def shared_examples_for(title)\nend",
"def sld; end",
"def example_started(example)\n end",
"def learning_new\n puts \"I am Learning #{TECH_ONE}\"\n end",
"def details=(_); end",
"def example_passed(example_proxy)\n end",
"def example(text)\n Runner.instance.add_example text\n end",
"def explanation\n end",
"def lsi; end",
"def examples\n @examples ||= HappinessExercises::Example.new\nend",
"def sn\n end",
"def member\n end",
"def demo\n end",
"def demo2\n end",
"def on_top_level_example_group(_node); end",
"def examples\n @examples\n end",
"def demo1\n end",
"def show(msg)\n puts 'EXAMPLE<basic> ' + msg\nend",
"def details; end",
"def purpose\n end",
"def example_passed(example)\n create_example(example, :passing)\n end",
"def main_description; end",
"def demo3\n end",
"def standalone=(_arg0); end",
"def name\n metadata.fetch(:example_name, example.description)\n end",
"def desc=(_); end",
"def learning_help(m)\n m.reply \"Learning module\"\n m.reply \"===========\"\n m.reply \"Description: Teach the bot about things, and have it repeat that info back later.\"\n m.reply \"Usage: [botname] [thing] is [information] (to store additional [information] under the keyword [thing].)\"\n m.reply \"[botname] [thing] (to get whatever the bot knows about [thing].)\"\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def description\n \"Whois lookup\"\nend",
"def stest_method_1(test); end",
"def examples_page\n Format.usage('This is my examples page, I\\'ll show you a few examples of how to get me to do what you want.')\n Format.usage('Running me with a file: whitewidow.rb -f <path/to/file> keep the file inside of one of my directories.')\n Format.usage('Running me default, if you don\\'t want to use a file, because you don\\'t think I can handle it, or for whatever reason, you can run me default by passing the Default flag: whitewidow.rb -d this will allow me to scrape Google for some SQL vuln sites, no guarentees though!')\n Format.usage('Running me with my Help flag will show you all options an explanation of what they do and how to use them')\n Format.usage('Running me without a flag will show you the usage page. Not descriptive at all but gets the point across')\nend",
"def docstring; end",
"def docstring; end",
"def desc() summary; end",
"def say_hello\n # LOCAL VARIABLE - only avaialble to this\n _hello_string = \"Hello\"\n # INSTEAD OF CALLING THE INSTANCE VARIABLE, WE CAN CALL THE GETTER SINCE WE HAVE GETTERS AND SETTERS (IE film_name below)\n puts \"#{_hello_string} #{film_name}\"\n end",
"def notes_from_training\n end",
"def description\n \"testing\"\n end",
"def description\n \"testing\"\n end",
"def usage\n print <<EOUSAGE\n\n#{$0} <Class.som>\n\ngenerates lodable primitive from som-file for class Class.\n\n\nEOUSAGE\nend",
"def label; end",
"def label; end",
"def example num\n puts\n puts \"------ Example #{num} ------\"\nend",
"def example_method\n # code\n end",
"def desc; end",
"def examples\n @examples ||= []\n end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def help(some, arg)\n say \"Bootic CLI v#{BooticCli::VERSION}\\n\\n\", :bold\n super\n\n examples if respond_to?(:examples)\n end",
"def name() end",
"def run\n\t\t\tsummary\n\t\tend",
"def usage( examples, explanation = nil )\n puts \"Script #{@name} #{version} - Usage:\"\n (examples.respond_to?(:split) ? examples.split(\"\\n\") : examples).map {|line| puts \" #{@name} #{line}\"}\n puts explanation if explanation\n exit 1\n end",
"def set_example\n @example = Example.find(params[:id])\n end",
"def name() title; end",
"def name() title; end",
"def set_example\n @example = Example.find(params[:id])\n end",
"def example_pending(*args)\n end",
"def members _args\n \"members _args;\" \n end",
"def example\n \"I'm an instance of A, not A itself\"\n end",
"def who_we_are\r\n end",
"def visit_examples_name(keyword, name)\n tc_examples_name(keyword, name)\n super\n end",
"def flag_example!\n example.metadata[:run] = true\n end"
] | [
"0.64237046",
"0.6148968",
"0.6121934",
"0.6121934",
"0.5989123",
"0.59646344",
"0.5806157",
"0.576811",
"0.576811",
"0.576811",
"0.576811",
"0.576811",
"0.5762931",
"0.5698781",
"0.5689984",
"0.56871474",
"0.5624785",
"0.5585145",
"0.5529111",
"0.5524651",
"0.55181485",
"0.5515523",
"0.5514419",
"0.5495089",
"0.549266",
"0.54779464",
"0.5477322",
"0.5447471",
"0.54409474",
"0.5434813",
"0.54284996",
"0.54222995",
"0.5421921",
"0.54209363",
"0.5409675",
"0.5400563",
"0.5400078",
"0.5383829",
"0.5358501",
"0.5353701",
"0.53291625",
"0.53227735",
"0.53227735",
"0.53227735",
"0.53227735",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5301069",
"0.5300399",
"0.52954286",
"0.5286897",
"0.52843904",
"0.52843904",
"0.52798736",
"0.52772254",
"0.5260965",
"0.5253341",
"0.5253341",
"0.52513385",
"0.5250659",
"0.5250659",
"0.5247848",
"0.52446467",
"0.5236764",
"0.5223519",
"0.5222852",
"0.5222852",
"0.5222852",
"0.5219275",
"0.5218054",
"0.52103174",
"0.5209942",
"0.5207619",
"0.5204812",
"0.5204812",
"0.51881504",
"0.51863563",
"0.5184188",
"0.51832217",
"0.51827526",
"0.51706696",
"0.51687086"
] | 0.0 | -1 |
this method notifies the user a new analisy event | def user_event_analisys(user, event)
@user = user
@event = event
@meeting = user.meetings.find_by(event: event)
mail(to: @user.email, subject: t('user_event_analisys', scope: 'message.email.subjects')) if @user.email.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acknowledged_event(user,event)\n @greeting = \"Hi\"\n @event = event\n mail to: user.email\n end",
"def event; end",
"def event; end",
"def event; end",
"def notify\n end",
"def create\n @event = Event.find(params[:attended_event_id])\n if current_user.attend(@event)\n flash[:success] = \"Confirmed. Enjoy #{@event.title} on #{@event.date.strftime(\"%a, %b %d %Y %I : %M %p\")}\"\n redirect_to user_path(current_user)\n end\n end",
"def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def resolved_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end",
"def notify\n {\n }\n end",
"def notify\n {\n }\n end",
"def create\n @event = Event.new(event_params)\n @event.user = @user\n @event.save\n # Cehck if there is any highschooler interested in talking to this undergraduate\n notify_highschooler if @user.interested_in_me.present?\n end",
"def new_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end",
"def notify_new_finding_answer\n finding_answer = FindingAnswer.take\n users = finding_answer.finding.users\n\n NotifierMailer.notify_new_finding_answer users, finding_answer\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 notification(event)\n scene.notification(event.to_sym,self)\n end",
"def send_events; end",
"def evented\n @evented = true\n end",
"def send_email_changed_notification; end",
"def send_email_changed_notification?; end",
"def new_event(event)\n # @greeting = \"Hi\"\n\n\n @greeting = \"Hello \" + ((event.who != \"\") ? (event.who + \",\") : \"there!\")\n @event = event\n\n mail( to: event.email, subject: event.name)\n end",
"def notifier; end",
"def notifier; end",
"def human_event; end",
"def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end",
"def fatigue(user, event)\n @greeting = \"Hi #{user.first_name}\"\n\n @event = event\n\n @link = \"toto\"\n\n mail to: user.email\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail\n end",
"def events\n end",
"def notify_question_owner(answer)\n \t@answer = answer\n \t@question = answer.question\n \t@receiver = @question.user\n \tmail(to: @receiver.email,\n \t\t\t subject: \"You've got a new answer!\")\n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail \n end",
"def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def on_entry\n end",
"def alert(event)\n log \"Got an alert about #{event}\", Logger::Ultimate\n log \"I am #{self.goid}\", Logger::Ultimate\n reactions = @reactor.react_to(event)\n unless reactions.nil?\n reactions.each do |reaction|\n log \"I am reacting...#{reaction.inspect}\", Logger::Ultimate\n action = CommandParser.parse(self, reaction)\n unless action.nil?\n log \"I am doing an action...\", Logger::Ultimate\n changed\n #notify_observers(action)\n raise \"This used to notify observers, not sure how this worked so need to fix this, most likely this will be rewritten before it becomes an issue.\"\n else\n log \"Action did not parse: #{reaction}\", Logger::Medium\n end\n end\n else\n log \"No Reaction to #{event}\", Logger::Ultimate\n end\n end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def notifications\n end",
"def signed_up_alert(evt)\n @evt = evt\n host = User.find_by_id(@evt.user_id)\n mail(:to => host.email, :subject => \"There is a seat request for your Local Yum event\", :from => \"\\\"Local Yum\\\" <[email protected]>\")\n end",
"def on_user1_signal( signo )\n\t\tself.log.info \"Checkpoint: User signal.\"\n\tend",
"def handle_event(event)\n\n\t\tend",
"def listener; end",
"def mark_worker_was_here\n @adventure.events.create(action: 'worker_ran')\n end",
"def event_change\n\t\n\tend",
"def reminder_sent\n end",
"def notify_post\n raise \"not yet implemented\"\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def attend\n\n @event = Event.find(params[:id])\n if attending?\n @text = \"unattended\"\n else\n @attendee [email protected](user_id: current_user.id)\n @text = \"attending\"\n end\n redirect_to event_path(@event)\n end",
"def confirm_event\n @event.update(confirmed: true)\n end",
"def notify_employee\n \t\temployees.each do |employee|\n \t\t\tputs \"Notification sent to #{employee.name} at #{employee.email}\"\n \t\t\tputs \"\"\n \t\tend\t\n end",
"def event_admin_message_notice(action, user, event)\n @action = action\n @user = user\n @event = event\n \n mail(:to => @user.email, :subject => \"#{@action.user.name} posted on your StreetMeet - #{event.title}\") unless @user.email.blank?\n end",
"def attend_event\n current_user.attended_events << Event.find(params[:event_id])\n flash[:notice] = 'Event was successfully added to your attended events!'\n redirect_to user_path\n end",
"def on_new_investigation; end",
"def on_new_investigation; end",
"def on_new_investigation; end",
"def alert(annc, user)\n\t\t@greeting = annc.company.name.upcase + \" (#{annc.company.hk_ticker}) has posted an announcement at #{annc.datetime.to_formatted_s(:short)}: #{annc.message}.\"\n\t\t@url = annc.url\n\n\t\tmail to: user.email, subject: \"HK Equities Alert (#{annc.company.hk_ticker})\"\n\tend",
"def activate_user\n self.save\n self.send_user_notification_email\n end",
"def notify_ready\n appointment = Appointment.find(params[:appointment_id])\n flash[:danger] = 'Patient has not checked in' unless appointment.checked_in?\n appointment.push_notify_ready\n redirect_to admin_appointments_path(@admin)\n end",
"def fires_in; end",
"def add_angel(user_id, anonymous)\n\n if anonymous == 1\n self.anon_angel = true\n else \n self.anon_angel = false\n end\n \n self.angel_id = user_id\n self.current_status = 5\n \n Status.create(:request_id => self.id, :status => 'Matched, initial') \n \n self.save\n Email.new.send_email(\"Angel Signup\", User.find(self.angel_id), self.id)\n\tend",
"def appointment_complete\n end",
"def send_notification\n\n\n end",
"def send_ta_notification(user)\n\t\t@user = user\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend",
"def alert; end",
"def alert; end",
"def after_update_actions\n if is_newbie_changed? && is_newbie == false # registration completed\n if Date.today.to_s == \"2017-03-03\" || Date.today.to_s == \"2017-03-04\"\n conv = Conversation.where(key: 'event_intellect').first\n unless conv.present?\n User.bot.conversations.create!(key: 'event_intellect', group_title: 'Intellect', new_members: [id])\n else\n conv.add_participant(id)\n end\n end\n end\n end",
"def assist_to_event\n creator.assist(self)\n end",
"def attend(event, status)\n post(:session, {:method => \"event.attend\", :event => event, :status => status})\n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def moved_up_event_waiting_user\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/events/#{@event.id}\")\n subject = \"[bootcamp] #{@event.title}で、補欠から参加に繰り上がりました。\"\n mail to: @user.email, subject: subject\n end",
"def on_ask(ask)\r\n warn \"Ask \" + ask.to_s\r\n end",
"def announce; end",
"def event(msg)\n unknown(\"=====> #{msg}\")\n end",
"def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end",
"def fire(event)\n\t\tevent.add_labels(self.labels) unless self.labels.empty?\n\t\t# send any notifications\n\tend",
"def notify_users_after_change\n if !id ||\n saved_change_to_when? ||\n saved_change_to_where? ||\n saved_change_to_location_id? ||\n saved_change_to_notes? ||\n saved_change_to_specimen? ||\n saved_change_to_is_collection_location? ||\n saved_change_to_thumb_image_id?\n notify_users(:change)\n end\n end",
"def on_enter\n end",
"def set_new_state_after_notify(was_successful, event, status)\n unless status.attending?\n if was_successful\n if event.event?\n status.not_responded!\n else\n status.delivered!\n end\n else\n status.not_delivered!\n end\n status.save\n end\n end",
"def on_add(clicker)\n end",
"def candidate_updated\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def hotel_notification(hotel, action, current_user)\n @user = current_user\n @action = action\n @hotel = hotel\n mail(to: \"[email protected]\", subject: \"Hotel created/updated/destroyed\")\n end",
"def event_edit_notice(user, event)\n @user = user\n @event = event\n mail(:to => @user.email, :subject => \"StreetMeet - #{event.title}' has been edited\") unless @user.email.blank?\n end",
"def handle_notify_event(event, is_being_published)\n event.users.each do |user|\n I18n.with_locale(user.get_locale) do\n status = EventStatus.find_by(user_id: user.id, event_id: event.id)\n if !status.blank? && !status.not_attending?\n if is_being_published\n send_publish_event_notification(event, user, status)\n else\n send_delete_event_notification(event, user)\n end\n end\n end\n end\n end",
"def to_wires_event; self; end",
"def after_commit(result)\n\t\tif result.send_notification\n NotificationTrigger.add_change_vote(result.voting_session.agenda_id)\n end\n end",
"def some_business_logic\n puts \"\\nSubject: I am doing something important.\"\n @state = rand(0..10)\n\n puts \"Subject: My state has just changed to: #{state}\"\n notify\n end",
"def trigger(owner, event, *args); end",
"def notify_starting\n\t\tuser_list = []\n\t\tparty_list.each do |uid, uhash|\n\t\t\tuser_list <<= uid if uhash[:status] == STATUS_ATTENDING\t\t\t\n\t\tend\n\t\tnotification = EventNotification.new(NOTIF_EVENT_STARTING, self)\n\t\tnotify(notification, user_list, false)\n\tend",
"def fired_event(event)\n history << event\n\t update_task_status(event)\n end",
"def some_business_logic\n puts \"\\nSubject: I'm doing something important.\"\n @state = rand(0..10)\n\n puts \"Subject: My state has just changed to: #{@state}\"\n notify\n end",
"def new_participant_notification(participant)\n @participant = participant\n @pid = @participant.id\n @name = @participant.name\n @greeting = \"Hi\"\n @event_name = @participant.event.name\n @start_time = @participant.event.start_time.to_formatted_s(:long)\n\n mail to: \"#{@name} <#{@participant.email}>\", subject: \"Confirmation Needed: #{@event_name}\"\n end",
"def reminder_received(event)\n @event = event\n\n mail :to => event.email, :subject => 'Reminder alert'\n end"
] | [
"0.68957365",
"0.6646867",
"0.6646867",
"0.6646867",
"0.6635636",
"0.65104336",
"0.64653444",
"0.64395034",
"0.6338823",
"0.63362455",
"0.63362455",
"0.6304962",
"0.6301756",
"0.62648666",
"0.62400764",
"0.62400764",
"0.62400764",
"0.62400764",
"0.62400764",
"0.62400764",
"0.62400764",
"0.62400764",
"0.6239763",
"0.62339747",
"0.62080973",
"0.6193354",
"0.61498266",
"0.61105853",
"0.6093636",
"0.6093636",
"0.6073782",
"0.6053899",
"0.603673",
"0.5999514",
"0.59859425",
"0.59848434",
"0.595433",
"0.59494627",
"0.5944482",
"0.59260726",
"0.59260726",
"0.59260726",
"0.59232074",
"0.59217733",
"0.5914077",
"0.5911023",
"0.59022164",
"0.5890972",
"0.58902276",
"0.58809686",
"0.5879292",
"0.5855879",
"0.5849339",
"0.5845954",
"0.584379",
"0.583841",
"0.58365554",
"0.5821959",
"0.58084315",
"0.58037823",
"0.5800943",
"0.5800943",
"0.5800943",
"0.576743",
"0.57590413",
"0.57464784",
"0.5742891",
"0.57407343",
"0.5735553",
"0.5720366",
"0.5719761",
"0.57194525",
"0.57194525",
"0.5717662",
"0.57146615",
"0.5705803",
"0.5701149",
"0.5693139",
"0.5691758",
"0.5689879",
"0.5687129",
"0.56741244",
"0.5665338",
"0.565605",
"0.5653465",
"0.56529355",
"0.5644001",
"0.5640987",
"0.56398165",
"0.5637221",
"0.56325483",
"0.5630841",
"0.562795",
"0.56176674",
"0.5617374",
"0.56117135",
"0.5603603",
"0.5597559",
"0.5594788",
"0.55927825"
] | 0.6041477 | 32 |
this method notifies the user a new visit event | def user_event_visit(user, event)
@user = user
@event = event
@meeting = user.meetings.find_by(event: event)
mail(to: @user.email, subject: t('user_event_visit', scope: 'message.email.subjects')) if @user.email.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visit\n self.update(last_visit: DateTime.now);\n self.update(visit_count: (self.visit_count + 1));\n end",
"def new_visit\n visit = Visit.find_by(vis_type: 'TV')\n UserMailer.new_visit(visit)\n end",
"def add_visit\n self.visits += 1\n self.date_last_visit = DateTime.now\n end",
"def track_visitor\n visitor_cookie_name = \"teaser.#{@teaser.id}.visitor\"\n if cookies[visitor_cookie_name].blank? || (@visitor = @teaser.visitors.find_by_cookie(cookies[visitor_cookie_name])).nil?\n @visitor = @teaser.visitors.create!\n install_persistent_cookie(visitor_cookie_name, @visitor.cookie)\n end\n \n if recent_visit = @visitor.visits.last(:conditions => ['visited_at > ?', 1.hour.ago])\n recent_visit.update_attribute(:visited_at, Time.now)\n else\n @visitor.visits.create!\n end\n end",
"def create\n flash[:notice] = \"Visit was successfully created.\" if visit.save\n respond_with(visit)\n end",
"def create\n @users_visit = Users::Visit.new(users_visit_params)\n\n respond_to do |format|\n if @users_visit.save\n format.html { redirect_to @users_visit, notice: 'Visit was successfully created.' }\n format.json { render :show, status: :created, location: @users_visit }\n else\n format.html { render :new }\n format.json { render json: @users_visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def visit!\n self.duration = [(Time.now - self.updated_at).to_i, 15 * 30].min # if user stay on page more than 15 min\n self.visits += 1\n self.save!\n end",
"def new_visit\n @phrase.add_visit\n end",
"def add_visit\n self.increment!(:visits, 1)\n end",
"def create\n authorize! :edit, Visit\n @visit = Visit.new(visit_params)\n @visit.assigner = current_user\n respond_to do |format|\n if @visit.save\n format.html { redirect_to @visit, falsh: { success: 'Visit was successfully created.' } }\n format.json { render json: @visit}\n else\n format.html { render :new }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def visited\n self.visited_at = Time.now\n self.save!\n end",
"def record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end",
"def visits(*args)\n webrat_session.visits(*args)\n end",
"def enter\n visitors.first.enter\n end",
"def set_visit\r\n @visit = Visit.find(params[:id])\r\n end",
"def set_users_visit\n @users_visit = Users::Visit.find(params[:id])\n end",
"def set_visit\n @visit = Visit.find(params[:id])\n end",
"def set_visit\n @visit = Visit.find(params[:id])\n end",
"def set_visit\n @visit = Visit.find(params[:id])\n end",
"def set_visit\n @visit = Visit.find(params[:id])\n end",
"def register_visit\r\n if @debug\r\n puts \"REQUEST IN REGISTER VISIT: #{request}\"\r\n puts \"BODY REQUEST: #{request.body}\"\r\n puts \"AUTH REQUEST: #{request.authorization}\"\r\n puts \"LENGTH REQUEST: #{request.content_length}\"\r\n puts \"FORM DATA REQUEST: #{request.form_data?}\"\r\n puts \"FULLPATH REQUEST: #{request.fullpath}\"\r\n puts \"HEADERS REQUEST: #{request.headers}\"\r\n puts \"IP REQUEST: #{request.ip}\"\r\n puts \"REQUEST IP ADDRESS: #{request['ip_address']}\"\r\n puts \"REQUEST REMOTE IP: #{request['remote_ip']}\"\r\n end\r\n response = @mints_pub.register_visit(request)\r\n if @debug\r\n puts \"RESPONSE IN REGISTER VISIT: #{response}\"\r\n end\r\n @contact_token = response['contact_token'] ? response['contact_token'] : response['user_token']\r\n @visit_id = response['visit_id']\r\n if @debug\r\n puts \"VISIT ID: #{@visit_id}\"\r\n end\r\n cookies.permanent[:mints_contact_id] = { value: @contact_token, secure: true, httponly: true }\r\n cookies.permanent[:mints_visit_id] = { value: @visit_id, secure: true, httponly: true }\r\n end",
"def visited_page(url); end",
"def visited_page(url); end",
"def fresh_visit?(visit = nil)\n visit ||= current_visit\n visit && visit.updated_at + Const::VISIT_STALE_AFTER > Time.now\n end",
"def logvisitor\n @visitor.end = DateTime.current\n @visitor.save\n\n render :nothing => true\n end",
"def show\r\n @ip_events = Ahoy::Event.events_for_ip_and_visit(@visit.ip, @visit.id)\r\n @user_events = []\r\n @event_days = Ahoy::Event.uniq_events_days_for_ip(@visit.ip)\r\n @event_links = Ahoy::Event.top_x_url_visits_for_ip(15, @visit.ip)\r\n end",
"def create\n @visit = Visit.new(params[:visit])\n\n respond_to do |format|\n if @visit.save\n flash[:notice] = 'visit was successfully created.'\n format.html { redirect_to(@visit) }\n format.xml { render :xml => @visit, :status => :created, :location => @visit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @visit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def visited\n @per_page = params[:per_page] || (current_user.profile_viewed.per_page || 20)\n @profile_visitors = @users = current_user.profile_viewed.paginate(:per_page => @per_page, :page => params[:page], :select => \"users.*, profile_viewers.viewed_at\")\n end",
"def show\n @link = Link.find_by(token: params[:token])\n @link.times_visited = @link.times_visited + 1\n @link.save\n Click.create(link: @link) # for reporting on most popular\n redirect_to @link.original_url\n end",
"def create\n @visitor = Analytics::Visitor.new(params[:visitor])\n\n respond_to do |format|\n if @visitor.save\n flash[:notice] = 'Analytics::Visitor was successfully created.'\n format.html { redirect_to(@visitor) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def set_visit\n @visit = Visit.find(params[:id])\n end",
"def set_visit\n @visit = Visit.find(params[:id])\n end",
"def create\n @visit = Visit.new(params[:visit])\n\n respond_to do |format|\n if @visit.save\n format.html { redirect_to @visit, notice: 'Visit was successfully created.' }\n format.json { render json: @visit, status: :created, location: @visit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @visit = @patient.visits.new(visit_params)\n\n respond_to do |format|\n if @visit.save\n format.html { redirect_to [@patient, @visit], notice: 'Visit was successfully created.' }\n format.json { render action: 'show', status: :created, location: @visit }\n else\n format.html { render action: 'new' }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list\n #TODO set visits to an array of visits that are associated with the current user\n end",
"def after_invite_new_user(invite)\n end",
"def create\n super\n if current_visit\n current_visit.started_at = Time.now\n current_visit.usuario_id = current_usuario.id\n current_visit.save\n end\n \n Ahoy.user_method = :current_usuario\n ahoy.authenticate(current_usuario)\n set_login_token\n end",
"def fresh_visit?\n visit = current_visit\n visit && visit.updated_at + Constants::Config::VISIT_STALE_AFTER > Time.now\n end",
"def visit_page\n register\n visit('/groups/new')\n self\n end",
"def update\n flash[:notice] = \"Visit was successfully updated.\" if visit.save\n respond_with(visit)\n end",
"def link_new_user_to_event(params)\n\t\t@token = params[:invitation_token]\n\t\t#puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#{params}\"\n\t\tif @token\n\t\t\t@event = Event.decrypt(@token)\n\t\t\t@user = User.find_by_email(params[:user][:email])\n\t\t\tif @event\n\t\t\t\[email protected]!(@user.id) unless @user.nil?\n\t\t\tend\n\t\tend\n\tend",
"def view_event(user, event) \n\tend",
"def create\n @guest_visit = GuestVisit.new(guest_visit_params)\n\n respond_to do |format|\n if @guest_visit.save\n format.html { redirect_to @guest_visit, notice: 'Guest visit was successfully created.' }\n format.json { render :show, status: :created, location: @guest_visit }\n else\n format.html { render :new }\n format.json { render json: @guest_visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_visit\n @visit = @patient.visits.find(params[:id])\n end",
"def new\n @visitor = Analytics::Visitor.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def create\n params[:visit][:prev_visit_id] = nil if params[:relative_visit] == \"false\"\n @visit = @study.visits.build(params[:visit])\n\n respond_to do |format|\n if @study.save\n flash[:notice] = 'Visit was successfully created.'\n format.xml { render :xml => @visit, :status => :created, :location => @visit }\n format.js #create.js.rjs\n else\n format.xml { render :xml => @visit.errors, :status => :unprocessable_entity }\n format.js #create.js.rjs\n end\n end\n end",
"def show\n set_user_activity\n end",
"def add_visit(db_connection=nil)\n\t\t\t\tStats.add_visit(db_connection)\n\t\t\tend",
"def new\n @visit = Visit.new\n\n respond_to do |format|\n format.json { render json: @visit }\n end\n end",
"def create\n @event = Event.find(params[:attended_event_id])\n if current_user.attend(@event)\n flash[:success] = \"Confirmed. Enjoy #{@event.title} on #{@event.date.strftime(\"%a, %b %d %Y %I : %M %p\")}\"\n redirect_to user_path(current_user)\n end\n end",
"def visit\n @mark = true\n end",
"def on_new_success(payload)\n @user = payload\n end",
"def set_visitor\n @visitor = Visitor.find(params[:id])\n end",
"def set_visitor\n @visitor = Visitor.find(params[:id])\n end",
"def user_registered(user)\n @user = user\n\n mail to: \"[email protected]\",\n subject: \"[apptrack] New User has registered for apptrack\"\n end",
"def new_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end",
"def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end",
"def create\n @visit = Visit.new(visit_params)\n\n respond_to do |format|\n if @visit.save\n #format.html { redirect_to @visit.company, notice: 'Visita creada con exito' }\n format.html { render :show }\n format.json { render :show, status: :created, location: @visit }\n else\n format.html { render :new }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @visit = Visit.new\n @visit.customer = Customer.where(visit_customer_params) unless Customer.where(visit_customer_params).empty?\n @visit.check_in = Time.now\n @visit.order = Order.new\n respond_to do |format|\n if @visit.save\n format.html { redirect_to @visit, notice: 'Visit was successfully created.' }\n format.json { render :show, status: :created, location: @visit }\n else\n format.html { render :new }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_guest_visit\n @guest_visit = GuestVisit.find(params[:id])\n end",
"def new\n @visit = @study.visits.new\n\n respond_to do |format|\n format.xml { render :xml => @visit }\n format.js \n end\n end",
"def user_activity\n current_user.touch(:last_response_at) if signed_in?\n end",
"def create\n @patient = Patient.find(params[:patient_id])\n @visit = @patient.visits.build(params[:visit])\n\n respond_to do |format|\n if @visit.save\n format.html { redirect_to @patient, notice: 'Visit was successfully created.' }\n format.json { render json: @visit, status: :created, location: @visit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_visitor\n @visitor = Visitor.find(params[:id])\n end",
"def set_visitor\n @visitor = Visitor.find(params[:id])\n end",
"def set_visitor\n @visitor = Visitor.find(params[:id])\n end",
"def create\n @visit = Visit.new(params[:visit])\n\n respond_to do |format|\n if @visit.save\n format.html {\n redirect_to :controller => 'people', :action => 'edit', :id => @visit.person_id\n }\n format.json { render json: @visit, status: :created, location: @visit }\n else\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_visited_page\n @visited_page = VisitedPage.find(params[:id])\n end",
"def new\n if get_viewer\n msg = \"You are already registered! Please log out to create a new account.\"\n respond_to do |format|\n format.html { flash[:notice] = msg; redirect_to get_viewer }\n format.js { flash.now[:notice] = msg }\n end\n return\n end\n @page_title = \"Become a new Juscribe member!\"\n @user, @blog = User.new, Blog.new\n @registration_closed = registration_closed?\n respond_to do |format|\n format.html { trender }\n format.js\n end\n end",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def show\n @user = current_user\n\n if user_signed_in?\n visited = Visit.new(ip_address: request.remote_ip, :what => \"tag_show\", :user_id => current_user.id)\n visited.save\n else\n visited = Visit.new(ip_address: request.remote_ip, :what => \"tag_show\")\n visited.save\n end\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def log_funnel_page_visit\n log_funnel_event(:view_page)\n end",
"def set_visit(id, params={})\n visits[id] = RoutificApi::Visit.new(id, params)\n end",
"def show\n @page_title = \"Event Submitted: #{@user_event.title}\"\n end",
"def show\n if @invite.first_viewed_at < Time.now - 1.year && @invite.created_at < Time.now - 1.hour\n @invite.first_viewed_at = Time.now\n end\n @invite.most_recently_viewed_at = Time.now\n @invite.save\n \n cookies[:user_url] = @invite.url\n end",
"def visit_new_page(model, **opt, &block)\n visit_action_page(model, :new, **opt, &block)\n end",
"def visit(item)\n @visited << item\n @visit.call(item)\n end",
"def visit(_visit_path)\n true\n end",
"def visited!\n self.count = self.count.to_i + 1\n self.last_used = Time.now\n save!\n end",
"def new\n @site = Site.find(params[:site_id])\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end",
"def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end",
"def register_visit_by(ip_address)\r\n return unless ip_address\r\n\r\n visit = visits.where(ip_address_id: ip_address.id).first_or_create\r\n visit.increment!(\"count\")\r\n\r\n # update current visited at if more than 15 minutes ago\r\n if visit.current_visited_at.nil?\r\n\tvisit.past_visited_at = visit.current_visited_at = Time.now\r\n end\r\n\r\n if visit.current_visited_at < 15.minutes.ago\r\n\tvisit.past_visited_at = visit.current_visited_at\r\n\tvisit.current_visited_at = Time.now\r\n\tvisit.save\r\n end\r\n end",
"def create\n if @owner.nil?\n respond_to do |format|\n format.js { render json: { notice: { base: ['Pass Not Found'] } } }\n end\n\n else\n @visit = Visit.new(owner: @owner)\n\n respond_to do |format|\n if @visit.save\n format.js { render json: { notice: \"#{@owner} successfully checked-in.\", checked_in: true } }\n else\n format.js { render json: { notice: @visit.errors } }\n end\n end\n end\n end",
"def create\n @daily_visitor = DailyVisitor.new(daily_visitor_params)\n @daily_visitor.id = DailyVisitor.last.id + 1 \n respond_to do |format|\n if @daily_visitor.save\n format.html { redirect_to @daily_visitor, notice: 'Daily visitor was successfully created.' }\n format.json { render :show, status: :created, location: @daily_visitor }\n else\n format.html { render :new }\n format.json { render json: @daily_visitor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @demot.visits+=1\n @demot.save\n end",
"def new\n @days_since_visit = DaysSinceVisit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @days_since_visit }\n end\n end",
"def show_visitor\n @visitor = visitor_db_or_new\n @visitor = Visitor.create if Visitor.all.empty?\n end",
"def create\n #@visit = Visit.new(params[:visit])\n @visit = Visit.new\n @visit.visit_date = Date.today.to_time_in_current_zone\n @client = Client.find(params[:client_id])\n @visit.client = @client\n @goal_categories = GoalCategory.all\n \n respond_to do |format|\n \n if tryToSaveNewVisit(@visit)\n #if visit.save\n format.html { redirect_to client_visit_path(@visit.client, @visit), notice: 'Visit was successfully created.' }\n format.json { render json: @visit, status: :created, location: @visit }\n else\n prepareShow()\n @visit = @visits.last\n format.html { render action: \"show\" }\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def visit_today\n # TODO: the impossible - know the first date of visit with provider\n # {Is your visit today/{Was your visit on {DATE OF VISIT}}\n \"Is your visit today\"\n end",
"def new_user_FirstClick(user_id, url_id)\n @user = User.find(user_id)\n @url = User.find_by_id(url_id)\n mail :to => recipient(@user.email), :subject => \"Welcome to 25c!\"\n end",
"def register\r\n @user = User.new\r\n @visit_register = \"true\"\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @user }\r\n end\r\n end",
"def new\n @external_activity = ExternalActivity.new\n @external_activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @external_activity }\n end\n end",
"def set_visited_url\n @visited_url = VisitedUrl.find(params[:id])\n end",
"def set_visit_person\n @visit_person = VisitPerson.find(params[:id])\n end",
"def create\n @visitor = Visitor.new(visitor_params)\n\n respond_to do |format|\n if @visitor.save\n format.html { redirect_to @visitor, notice: 'Visitor was successfully created.' }\n format.json { render :show, status: :created, location: @visitor }\n else\n format.html { render :new }\n format.json { render json: @visitor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @visitor = Visitor.new(visitor_params)\n\n respond_to do |format|\n if @visitor.save\n format.html { redirect_to @visitor, notice: 'Visitor was successfully created.' }\n format.json { render :show, status: :created, location: @visitor }\n else\n format.html { render :new }\n format.json { render json: @visitor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notify_pusher\n Pusher.trigger('location', 'new', self.trip.as_json)\n end",
"def accept_visitor(visitor)\n visit_method_name = \"visit#{basename(self.class.name.to_s.gsub(/::/, '/'))}\".to_sym\n visitor.send(visit_method_name, self) if visitor.respond_to?(visit_method_name)\n end",
"def started_viewing(user = nil, dont_notify: false)\n if user && !viewing?(user)\n Cache.set_add(viewing_cache_key, collaborator_json_stringified(user))\n end\n received_changes(num_viewers_changed: true) unless dont_notify\n end",
"def on_user1_signal( signo )\n\t\tself.log.info \"Checkpoint: User signal.\"\n\tend"
] | [
"0.71183974",
"0.67220324",
"0.6346431",
"0.6289727",
"0.6224122",
"0.613647",
"0.6110393",
"0.6035355",
"0.5973513",
"0.5943135",
"0.58394134",
"0.5809386",
"0.5805647",
"0.5773279",
"0.57558066",
"0.57520026",
"0.574163",
"0.574163",
"0.574163",
"0.574163",
"0.5731923",
"0.57291645",
"0.57291645",
"0.57270986",
"0.5672294",
"0.5639786",
"0.56300277",
"0.56281596",
"0.56254506",
"0.56214494",
"0.56197214",
"0.56197214",
"0.5561206",
"0.5551372",
"0.554076",
"0.55345976",
"0.5531748",
"0.55265665",
"0.5522908",
"0.5496685",
"0.5468953",
"0.54678994",
"0.54648656",
"0.5454339",
"0.544934",
"0.54446256",
"0.5444621",
"0.5441592",
"0.54317456",
"0.5428716",
"0.542703",
"0.5419366",
"0.5406995",
"0.5406995",
"0.5393332",
"0.53914773",
"0.53837043",
"0.5379622",
"0.5362828",
"0.53593737",
"0.5351315",
"0.53411406",
"0.5323268",
"0.5316472",
"0.5316472",
"0.5316472",
"0.5311143",
"0.5300034",
"0.5299329",
"0.52887",
"0.52829623",
"0.52783847",
"0.5269773",
"0.52696437",
"0.52619404",
"0.5261397",
"0.52560157",
"0.52530986",
"0.5238992",
"0.52353096",
"0.5225417",
"0.5224011",
"0.52228594",
"0.52210057",
"0.5220436",
"0.5216917",
"0.521419",
"0.52127594",
"0.5206358",
"0.520552",
"0.5204399",
"0.5202134",
"0.52012813",
"0.5201",
"0.5198437",
"0.5198437",
"0.5194367",
"0.51890296",
"0.5188843",
"0.518748"
] | 0.63359 | 3 |
this method notifies the user a new event | def user_event_confirmed(user, event)
@user = user
@event = event
meeting = user.meetings.find_by(event: event)
attachments.inline['prenotazione.ics'] = meeting.ical.to_ical if meeting.confirmed?
mail(to: @user.email, subject: t('user_event_modified', scope: 'message.email.subjects') + ' ' + (l event.date_on)) if user.email.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acknowledged_event(user,event)\n @greeting = \"Hi\"\n @event = event\n mail to: user.email\n end",
"def new_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end",
"def event; end",
"def event; end",
"def event; end",
"def new_event(event)\n # @greeting = \"Hi\"\n\n\n @greeting = \"Hello \" + ((event.who != \"\") ? (event.who + \",\") : \"there!\")\n @event = event\n\n mail( to: event.email, subject: event.name)\n end",
"def notify\n end",
"def notification(event)\n scene.notification(event.to_sym,self)\n end",
"def resolved_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end",
"def create\n @event = Event.new(event_params)\n @event.user = @user\n @event.save\n # Cehck if there is any highschooler interested in talking to this undergraduate\n notify_highschooler if @user.interested_in_me.present?\n end",
"def event_change\n\t\n\tend",
"def handle_event(event)\n\n\t\tend",
"def create\n @event = Event.find(params[:attended_event_id])\n if current_user.attend(@event)\n flash[:success] = \"Confirmed. Enjoy #{@event.title} on #{@event.date.strftime(\"%a, %b %d %Y %I : %M %p\")}\"\n redirect_to user_path(current_user)\n end\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 send_events; end",
"def notify\n {\n }\n end",
"def notify\n {\n }\n end",
"def new_event(event)\n @greeting = \"Hello!\"\n @id = event.id\n @desc = event.desc\n @title = event.calendar.title\n mail to: event.calendar.user.email\n end",
"def evented\n @evented = true\n end",
"def add_events(new_events); end",
"def new_event(player, event)\n @player=player\n @event = event\n emails = \"#{player.email},#{player.parent_email},#{player.parent_email2}\"\n mail(to: emails, subject: \"#{event.eventtype.name} scheduled #{event.the_date}\")\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n\t\[email protected]_notification\n\t\[email protected]\n format.html { redirect_to events_path(:playerid=>current_player.playerid), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_events\n end",
"def fired_event(event)\n history << event\n\t update_task_status(event)\n end",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def events\n end",
"def create\n @event = Event.new(event_params)\n @current_user.events << @event\n @event.confirm = nil\n @event.save\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @new_event = Event.new\n end",
"def create\n @event = Event.new(event_params)\n users = User.all\n if @event.save\n @event.delay.call_notification(I18n.t('Notification.event_created'), I18n.t('Email.event_created'))\n render json: @event, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def changed_event(player,oldevent,newevent)\n @player=player\n @event = newevent\n @oldevent = oldevent\n emails = \"#{player.email},#{player.parent_email},#{player.parent_email2}\"\n mail(to: emails, subject: \"#{@oldevent.eventtype.name} on #{oldevent.the_date} has changed\")\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def confirm_event\n @event.update(confirmed: true)\n end",
"def on_event_registered(unit, event)\n event\n end",
"def respond_event(event_id, new_status)\n\t\tbegin\n\t\t\tevent = Event.find(event_id)\n\t\trescue ActiveRecord::RecordNotFound\n\t\t\treturn\n\t\tend\n\t\tevent.set_user_status(self.id, new_status)\n\tend",
"def send_email_changed_notification; end",
"def new_participant_notification(participant)\n @participant = participant\n @pid = @participant.id\n @name = @participant.name\n @greeting = \"Hi\"\n @event_name = @participant.event.name\n @start_time = @participant.event.start_time.to_formatted_s(:long)\n\n mail to: \"#{@name} <#{@participant.email}>\", subject: \"Confirmation Needed: #{@event_name}\"\n end",
"def fired_event(event)\n history << event\n update_task_status(event)\n end",
"def link_new_user_to_event(params)\n\t\t@token = params[:invitation_token]\n\t\t#puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#{params}\"\n\t\tif @token\n\t\t\t@event = Event.decrypt(@token)\n\t\t\t@user = User.find_by_email(params[:user][:email])\n\t\t\tif @event\n\t\t\t\[email protected]!(@user.id) unless @user.nil?\n\t\t\tend\n\t\tend\n\tend",
"def reminder_received(event)\n @event = event\n\n mail :to => event.email, :subject => 'Reminder alert'\n end",
"def after_update_actions\n if is_newbie_changed? && is_newbie == false # registration completed\n if Date.today.to_s == \"2017-03-03\" || Date.today.to_s == \"2017-03-04\"\n conv = Conversation.where(key: 'event_intellect').first\n unless conv.present?\n User.bot.conversations.create!(key: 'event_intellect', group_title: 'Intellect', new_members: [id])\n else\n conv.add_participant(id)\n end\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end",
"def attend_event\n current_user.attended_events << Event.find(params[:event_id])\n flash[:notice] = 'Event was successfully added to your attended events!'\n redirect_to user_path\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n EventAddedNotifier.created(@event).deliver\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def notify\n {}\n end",
"def fire(event)\n\t\tevent.add_labels(self.labels) unless self.labels.empty?\n\t\t# send any notifications\n\tend",
"def notify_new_finding_answer\n finding_answer = FindingAnswer.take\n users = finding_answer.finding.users\n\n NotifierMailer.notify_new_finding_answer users, finding_answer\n end",
"def notify_post\n raise \"not yet implemented\"\n end",
"def new\n\t\t@event = Event.new\n\tend",
"def send_email_changed_notification?; end",
"def create\n @event = Event.new(params[:event])\n @event.admin_key = SecureRandom.hex(4)\n \n respond_to do |format|\n if @event.save\n\n UserMailer.event_confirmation(@event).deliver\n\n format.html { redirect_to @event, notice: \"#{@event.admin}, your #{@event.name} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bookEvent\n end",
"def create\n # @event = current_user.events.build(event_params)\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n if logged_in?\n current_user.attend_event(@event)\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_new\n cust_id = params[\"cust_id\"]\n @customer = Customer.where(florist_id: session[\"found_florist_id\"]).where(id: cust_id).first\n @event = Event.new\n @employee_list = [\"\"] + Employee.where(florist_id: session[\"found_florist_id\"]).where(status: \"Active\").uniq.pluck(:name)\n render(:event_new) and return\n end",
"def create\r\n @event = Event.new(event_params)\r\n @event.user_id = current_user.id\r\n\r\n respond_to do |format|\r\n if @event.save\r\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @event }\r\n @event.attend!(current_user)\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def edit_event(event_info_hash) \n\t\tif event_info_hash.has_key?(:name)\n\t\t\tnew_name = event_info_hash[:name]\n\t\t\treturn ERR_INVALID_NAME if new_name.blank? || new_name.length > NAME_MAX_LENGTH\n\t\t\tself.name = new_name\n\t\t\tself.update_attribute(:name, new_name)\n\t\tend\n\t\tif event_info_hash.has_key?(:time)\n\t\t\tnew_time = event_info_hash[:time].to_i\n\t\t\t\treturn ERR_INVALID_TIME if new_time.blank? || (new_time < DateTime.now.ago(60*15).to_i)\n\t\t\tself.time = new_time\n\t\t\tself.update_attribute(:time, new_time)\n\t\t\tbegin\n\t\t\t\tNotifyHandler.task_scheduler.unschedule(self.scheduler_job_id) if self.scheduler_job_id != -1\n\t\t\trescue \n\t\t\tend\n\t\t\t# Schedule a notification only if the event is starting more than 10\n\t\t\t# minutes from now. \n\t\t\tif (self.time > (DateTime.now.to_i + 10*60))\n\t\t\t\ttime_string = Time.at(self.time).to_datetime.to_formatted_s(:rfc822)\n\t\t\t\tnotify_job_id = NotifyHandler.task_scheduler.in time_string, NotifyHandler\n\t\t\t\tNotifyHandler.add_job_mapping(notify_job_id, self.id)\n\t\t\tend\n\t\tend\n\t\tif event_info_hash.has_key?(:description)\n\t\t\tself.description = event_info_hash[:description]\n\t\t\tself.update_attribute(:description, self.description)\n\t\tend\n\t\tif event_info_hash.has_key?(:location)\n\t\t\tself.location = event_info_hash[:location]\n\t\t\tself.update_attribute(:location, self.location)\n\t\tend\n\t\treturn SUCCESS\n\tend",
"def issueEvent\n loop do\n [email protected]\n changed\n notify_observers(event[0],event[1],event[2],event[3])\n end\n end",
"def listener; end",
"def notifier; end",
"def notifier; end",
"def notify_user(ad)\n #create notification for the user\n notification = self.notifications.unviewed.event(:new_relevant_ad).new\n notification.user = self.user\n notification.ad = ad\n notification.save!\n end",
"def fatigue(user, event)\n @greeting = \"Hi #{user.first_name}\"\n\n @event = event\n\n @link = \"toto\"\n\n mail to: user.email\n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail\n end",
"def create\n assign_new_event\n if @event.save\n expire_cache\n flash[:notice] = \"Created #{@event.name}\"\n redirect_to edit_admin_event_path(@event)\n else\n flash[:warn] = @event.errors.full_messages.join\n render :edit\n end\n end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def event\n @event ||= Hyrax::Event.create( action, Time.current.to_i )\n end",
"def on_entry\n end",
"def moved_up_event_waiting_user\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/events/#{@event.id}\")\n subject = \"[bootcamp] #{@event.title}で、補欠から参加に繰り上がりました。\"\n mail to: @user.email, subject: subject\n end",
"def reminder_sent\n end",
"def create\n\t\t@event = current_user.events.create(params[:event])\n\t\tcurrent_user.add_role :author, @event\n\t\t#@event = Beautorial.new(params[:event])\n\n\t\trespond_to do |format|\n\t\t\tif @event.save\n\t\t\t\tformat.html { redirect_to @event, notice: 'Event was successfully created.' }\n\t\t\t\tformat.json { render json: @event, status: :created, location: @event }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @event.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def notify_admin_about_newbie(user)\n @user = user\n mail \n end",
"def create\n # here, we want to use the current user -- but we might have a way to have an admin register someone?\n @user_event = UserEvent.new(user_event_params)\n\n respond_to do |format|\n if @user_event.save\n # on the notice add the event name\n format.html { redirect_to [@event,@user_event], notice: 'User was successfully registered.' }\n format.json { render :show, status: :created, location: [@event,@user_event] }\n else\n format.html { render :new }\n format.json { render json: @user_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_event\n @event = Event.find(params[:attended_event_id])\n end",
"def notifications\n end",
"def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end",
"def event(msg)\n unknown(\"=====> #{msg}\")\n end",
"def push_notification\n UserMailer.new_message(self).deliver_now\n end",
"def create\n @custom_event = CustomEvent.new(params[:custom_event])\n #@custom_event.idee = @custom_event.id + 1\n logger.debug \"@current_user: #{@current_user}\" \n logger.debug \"current_user: #{current_user}\" \n logger.debug \":current_user: #{:current_user}\" \n @custom_event.author = current_account.username\n respond_to do |format|\n if @custom_event.save\n flash[:notice] = 'CustomEvent was successfully created.'\n format.html { redirect_to( :action => 'index') }\n format.xml { render :xml => @custom_event, :status => :created, :location => @custom_event }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @custom_event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"You're event has been received. Once approved it will be included in the next mailing.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event\n @event\n end",
"def new_date_event_application\n DateEventApplicationsMailer.new_date_event_application\n end",
"def view_event(user, event) \n\tend",
"def create_notification; end",
"def create\n @event_event = Event::Event.new(event_event_params)\n @event_event.user.add_event #incrementa o contador de eventos do user\n\n\n respond_to do |format|\n if @event_event.save\n @event_event.user.add_event\n\n format.html { redirect_to [:admin, @event_event], notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event_event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def qualified_event; end",
"def qualified_event; end",
"def event(event) # TODO args for events like keypress\n @events << event\n self\n end",
"def perform\n @event = Event.new(\n stakato_version_key: @stakato_version_key,\n key: @key,\n #event_key: @event_key,\n event_profile_key: @event_profile_key,\n profile_id: @profile_id,\n event_type_key: @event_type_key,\n event_data: @event_data,\n ruby_message: @ruby_message\n )\n @event.save\n @event\n end",
"def create\n @notification = current_user.notifications.new(params[:notification])\n @event = Event.find_by_id(params[:event_id]) if params[:event_id]\n @notification.event = @event if @event\n if @notification.save\n if @event\n redirect_to @event \n else\n redirect_to(@notification, :notice => 'Notification was successfully created.')\n end \n end\n end",
"def event_admin_message_notice(action, user, event)\n @action = action\n @user = user\n @event = event\n \n mail(:to => @user.email, :subject => \"#{@action.user.name} posted on your StreetMeet - #{event.title}\") unless @user.email.blank?\n end",
"def notify!(event)\n notifications.find_or_create_by!(event: event)\n end"
] | [
"0.7072374",
"0.70721227",
"0.6928551",
"0.6928551",
"0.6928551",
"0.68989295",
"0.66684985",
"0.66242516",
"0.66161937",
"0.6615172",
"0.65598845",
"0.6533328",
"0.65123487",
"0.639797",
"0.639797",
"0.639797",
"0.639797",
"0.639797",
"0.639797",
"0.639797",
"0.639797",
"0.6395318",
"0.6350319",
"0.6350319",
"0.6339304",
"0.63265496",
"0.6270038",
"0.62684965",
"0.6255415",
"0.6227786",
"0.62143224",
"0.62097055",
"0.6208841",
"0.6186945",
"0.6183272",
"0.6164814",
"0.6159385",
"0.61540484",
"0.6148913",
"0.6146721",
"0.61374456",
"0.61364216",
"0.6118802",
"0.6118738",
"0.6104071",
"0.61036766",
"0.6100454",
"0.60964334",
"0.6082754",
"0.60578585",
"0.6046818",
"0.6026728",
"0.6026728",
"0.6026728",
"0.6019337",
"0.6017649",
"0.6002647",
"0.59976673",
"0.59913725",
"0.5969804",
"0.5960439",
"0.5958875",
"0.5954515",
"0.5940328",
"0.5934889",
"0.59339195",
"0.59268564",
"0.59206605",
"0.59206605",
"0.59193176",
"0.59147793",
"0.59096587",
"0.59091127",
"0.59069854",
"0.5900055",
"0.5895463",
"0.5892143",
"0.58759254",
"0.58707803",
"0.58674055",
"0.5864467",
"0.5858207",
"0.58574617",
"0.5852155",
"0.5850375",
"0.58442324",
"0.58266747",
"0.5824949",
"0.58220696",
"0.5821882",
"0.5820843",
"0.58201754",
"0.5818403",
"0.5808134",
"0.5792451",
"0.5792451",
"0.578974",
"0.57882994",
"0.57854885",
"0.5783087",
"0.5781786"
] | 0.0 | -1 |
Serves predictions for the buyers | def predictions
raise "Err"
buyer_suggestions = PropertyBuyer.suggest_buyers(params[:str]).select([:id, :name, :image_url]).limit(20)
render json: buyer_suggestions, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict\n\t\t@bio = Bio.where(:user_id => current_user.id).last \n\n\t\t# Game_date and @players transformed to JSON and send to API in order to fetch player predictions\n\t\t@game_date = params[:game_date]\n\t\t@players = params[:players] \n\n\t\t# API Returns player predictions\n\t\t\t#first look in database, and if predictions already exist, pull from here\n\t\t\t#else get request to API, and API returns predictions\n\n\t\t# Temp fake data is returned instead // modify this to store into database instead of this weird Array/Url string voodoo\n\t\t@array = Array.new\n\t\t8.times do\n\t\t @array.push Faker::Name.name\n\t\tend\n\n\t\trender(\"sports/predict/\", :notice => \"Successfully fetched player predictions from API.\")\n\t\t\n\tend",
"def predict_all\r\n @recommendations = Professional.all.map do |professional|\r\n Recommender.new(professional).recommend\r\n end\r\n true\r\n end",
"def predictions\n @predictions ||= Prediction.predict_for(self)\n end",
"def test_predict\n data = Disco.load_movielens\n recommender = Disco::Recommender.new(factors: 20)\n recommender.fit(data)\n assert_kind_of Array, recommender.predict(data.first(5))\n end",
"def index\n @predictions = Prediction.all\n end",
"def get_test_set_data\n\t\treturn @predictions\n\tend",
"def predict()\n self.extend(Prediction)\n end",
"def fit_predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end",
"def predict(predictive_users, movie_id, user_id)\n score = 0.0\n total = 0.0\n tally = 0.0\n predictive_users.each do |user|\n score = rating(user, movie_id).to_i #Takes the average score of users in the predictive \n #array and sets that to the prediction. \n if score != 0\n total += score\n tally += 1\n end\n end\n \n base_prediction = (total / tally).to_f\n prediction = prediction_modifiers(base_prediction, movie_id, user_id)\n return prediction\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n liked_by_set = Recommendations::Helpers::RedisKeyMapper.liked_by_set_for(klass, item_id)\n similarity_sum = 0.0\n\n # Get sum of similarities of each item in set\n similarity_sum = similarity_total_for(user_id, liked_by_set)\n\n liked_by_count = Recommendations.redis.pipelined do\n Recommendations.redis.scard(liked_by_set)\n end\n prediction = similarity_sum / (liked_count).to_f\n prediction.finite ? prediction : 0.0\n end",
"def predict_rating(user,film)\r\n f_amount=SVD_param.find_by_name(@f_amoun_str).value.to_i\r\n\r\n mu=SVD_param.find_by_name(@global_predictor_str).value\r\n user_prd=user.base_predictor\r\n film_prd=film.base_predictor\r\n\r\n baseline=mu+user_prd+film_prd\r\n\r\n user_f_vect=create_user_factor_vector(user.id)\r\n film_f_vect=create_film_factor_vector(film.id)\r\n\r\n prediction=baseline + multiply_vectors(\r\n film_f_vect,\r\n user_f_vect\r\n )\r\n return prediction\r\n end",
"def payment_predictions\n @results = Project.payment_prediction_results(@account, params, @start_date, @end_date)\n @totals = Project.payment_prediction_totals(@account, params, @start_date, @end_date)\n end",
"def index\n @prediction = Prediction.all\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n gemd_by_set = Recommendable::Helpers::RedisKeyMapper.gemd_by_set_for(klass, item_id)\n disgemd_by_set = Recommendable::Helpers::RedisKeyMapper.disgemd_by_set_for(klass, item_id)\n similarity_sum = 0.0\n\n similarity_sum += Recommendable.redis.smembers(gemd_by_set).inject(0) do |memo, id|\n memo += Recommendable.redis.zscore(similarity_set, id).to_f\n end\n\n similarity_sum += Recommendable.redis.smembers(disgemd_by_set).inject(0) do |memo, id|\n memo -= Recommendable.redis.zscore(similarity_set, id).to_f\n end\n\n gemd_by_count = Recommendable.redis.scard(gemd_by_set)\n disgemd_by_count = Recommendable.redis.scard(disgemd_by_set)\n prediction = similarity_sum / (gemd_by_count + disgemd_by_count).to_f\n prediction.finite? ? prediction : 0.0\n end",
"def predict(object)\n liked_by, disliked_by = object.send :create_recommendable_sets\n rated_by = Recommendable.redis.scard(liked_by) + Recommendable.redis.scard(disliked_by)\n similarity_sum = 0.0\n prediction = 0.0\n \n Recommendable.redis.smembers(liked_by).inject(similarity_sum) {|sum, r| sum += Recommendable.redis.zscore(similarity_set, r).to_f }\n Recommendable.redis.smembers(disliked_by).inject(similarity_sum) {|sum, r| sum -= Recommendable.redis.zscore(similarity_set, r).to_f }\n \n prediction = similarity_sum / rated_by.to_f\n \n object.send :destroy_recommendable_sets\n \n return prediction\n end",
"def predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end",
"def predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end",
"def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n Recommendable.set_shard_key user_id\n liked_by_set = Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(klass, item_id)\n disliked_by_set = Recommendable::Helpers::RedisKeyMapper.disliked_by_set_for(klass, item_id)\n similarity_set = Recommendable::Helpers::RedisKeyMapper.similarity_set_for(user_id)\n similarity_sum = 0.0\n\n similarity_sum += Recommendable.redis.eval(similarity_total_for_lua, keys: [liked_by_set, similarity_set]).to_f\n similarity_sum -= Recommendable.redis.eval(similarity_total_for_lua, keys: [disliked_by_set, similarity_set]).to_f\n\n liked_by_count, disliked_by_count = Recommendable.redis.pipelined do\n Recommendable.redis.scard(liked_by_set)\n Recommendable.redis.scard(disliked_by_set)\n end\n prediction = similarity_sum / (liked_by_count + disliked_by_count).to_f\n prediction.finite? ? prediction : 0.0\n end",
"def predict!(current_diff)\n prediction_strategies.flat_map { |strategy| strategy.call(current_diff, map) }\n end",
"def prediction_data(user_id, movie_id)\n if user_id != @user_marker\n @best_match.clear\n most_similar(user_id) #will return the top 20 best matched viewers.\n @user_marker = user_id\n end\n\n matched_movies = viewers(movie_id) #list of all users who saw the movie\n if matched_movies == 0\n prediction = 1\n return prediction\n end\n predictive_users = (@best_match & matched_movies) #sets our predictive data to be the subset \n # of best_match that has also seen this movie\n \n my_prediction = MoviePredictor.new(@user_hash, @movie_hash)\n \n if predictive_users.empty? \n return my_prediction.rating_average(movie_id)\n end\n \n return my_prediction.predict(predictive_users, movie_id, user_id)\n end",
"def run_test\n for i in 0..@count-1\n @predictions << Prediction.new(@test_set[i].user_id,@test_set[i].movie_id, @test_set[i].rating,@database.predict(@test_set[i].user_id, @test_set[i].movie_id))\n end\n end",
"def initialize \n\t\t@predictions = []\n\tend",
"def predict(user, movie)\n\n popularity = @popularityMap[movie].to_i\n \n feature = [popularity]\n linearRegressionModel = user_predictMap[user]\n \n predictRating = linearRegressionModel.predict(feature)\n\n #if there is no enough data to make the predict, then we will take the average rating\n # of the given user\n if predictRating.nan?\n return @avgRatingMap[user].to_i\n end\n if predictRating >= 1 && predictRating<= 5\n if predictRating*10%10 >= 5\n return predictRating.ceil\n else \n return predictRating.floor\n end\n else \n if predictRating > 5\n return 5\n else\n return 1\n end\n end\n end",
"def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'emotion_prediction_id'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :headers => {'Content-Type' => 'application/json'},\n :body_object => training\n )\n\n assemble_json_body(result)\n end",
"def predict(comment)\n input = @prediction.trainedmodels.predict.request_schema.new\n input.input = {}\n input.input.csv_instance = comment\n\n result = @client.execute(\n :api_method => @prediction.trainedmodels.predict,\n :parameters => {'id' => 'emotion_prediction_id'},\n :headers => {'Content-Type' => 'application/json'},\n :body_object => input\n )\n\n assemble_json_body(result)\n end",
"def show_prediction_by_postcode\n params = location_params\n @cur_date = {:date => Time.now.strftime(\"%d-%m-%Y\")}\n postcode = Postcode.find_by(postcode: params[:post_code])\n @location = postcode.locations.first\n @predictions = DataHelper.predict(@location, params[:period])\n end",
"def predict(observation, method)\n Combine.send(method, @models.map{|t| t.predict(observation, method) })\n end",
"def index\n @predict_charts = PredictChart.all\n end",
"def predict(u,m)\n viewer_list = []\n viewers(m).each do |id|\n viewer_list << @user_list[id]\n end\n @user_list[u].predict(m, viewer_list)\n end",
"def set_prediction\n @prediction = Prediction.find(params[:id])\n end",
"def set_prediction\n @prediction = Prediction.find(params[:id])\n end",
"def predict(tokens)\n\n @data.each do |category, counts|\n \n end\n\n predicted_category\n end",
"def predict\n @stop=Stop.find(params[:id])\n json=fetchPredictionRaw(@stop.stopid)\n @predictions=JSON.parse(json);\n @minimal=params[:minimal]\n respond_to do |format|\n format.html { render :predict, layout: !@minimal }\n format.json { render text: json }\n end\n end",
"def predictor\n w = perceptron\n\n train_data = normalize_data(\"votes-test.csv\")\n actual_values = train_data.map { |x| x.last }\n predictions = train_data.map { |x| activation_output(x.first, w) }\n\n wrong = (0..actual_values.length-1).select { |i| actual_values[i] != predictions[i] }.count\n correct = actual_values.length - wrong\n\n p \"CORRECT: #{correct}\"\n p \"WRONG: #{wrong}\"\nend",
"def predict(m, viewer_list)\n return 3 if viewer_list.size == 0\n prediction, similarity_tally = 0, 0\n viewer_list.each do |viewer|\n sim = similarity(viewer)\n similarity_tally += sim\n prediction += sim * viewer.rating_list[m].rating\n end\n return prediction/similarity_tally.to_f unless similarity_tally == 0\n return 3\n end",
"def predict(*signals)\n body = {:data => {:input => {:text => [signals]}}}.to_json\n req = GData::HTTP::Request.new(@base_uri + '/' + @model + \"/predict\",\n {:method => :post, :body => body, :headers => HEADERS})\n hsh = sign_and_request(req)\n\n return hsh['data']['output']['output_label'] if hsh['data']\n if hsh['error']\n raise ClassifierException, hsh['error']['message']\n end\n end",
"def predict_by_iterator(predict_iterator, batch_size: 100)\r\n start_predict_by_iterator(predict_iterator, batch_size: batch_size)\r\n update while evaluating?\r\n predicted_data\r\n end",
"def predict u, m\n \tif rating(u, m) == 0\n \t\t#puts avg_rating \n \t\treturn avg_rating u\n \telse\n \t\t#puts rating u, m\n \t\treturn rating u, m\n \tend\n end",
"def create\n @predict = Predict.new(params[:predict])\n\n respond_to do |format|\n if @predict.save\n format.html { redirect_to @predict, notice: 'Predict was successfully created.' }\n format.json { render json: @predict, status: :created, location: @predict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @predict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:predictions].each do |prediction|\n @prediction = current_user.predictions.new(prediction)\n if @prediction.valid?\n @prediction.save\n end\n end\n redirect_to root_path\n end",
"def predict (u, m)\n\t\tusers = most_similar(u)\n\n\t\tusers.each do |el|\n\t\t\tif @train_data[el[0]].return_rating(m)\n\t\t\t\tif el[1] >= 0 \n\t\t\t\t\treturn @train_data[el[0]].return_rating(m)\n\t\t\t\telse return 6-@train_data[el[0]].return_rating(m)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def train\n run_aggregation\n run_syntetics\n run_values_to_ranges\n run_reverse\n\n [name, classifier]\n end",
"def predict(user_id, movie_id)\n movie_average_rating = set.popularity(movie_id)\n #puts \"The popularity of movie #{movie_id} is #{movie_average_rating}\"\n\n most_similar_users_list_ratings = set.most_similar(user_id)[0..29].collect do |u, r|\n if rating(u, movie_id)!=0 then\n rating(u, movie_id)\n end\n end.compact[0..9]\n #puts \"Actual rating: #{rating(user_id, movie_id)}\"\n #puts \"most_similar_users_list_ratings: #{most_similar_users_list_ratings}\"\n #puts \"Prediction: #{take_average(most_similar_users_list_ratings)}\"\n\n if most_similar_users_list_ratings.size > 0\n avg_most_similar_users_ratings = take_average(most_similar_users_list_ratings)\n 0.3*avg_most_similar_users_ratings+0.7*movie_average_rating\n else\n movie_average_rating\n end\n end",
"def predict(u, m)\n if @testSet != nil\n aveUserRating = @testSet.average(@testSet.allUsersHash[\"#{u}\"].values) #returns the average rating u gave all movies\n popularity = @testSet.popularity(m)\n popularity + aveUserRating*0.01\n end\n end",
"def predict(user_id, movie_id)\n\t\tmovie_avg = movie_avg(movie_id)\n\t\tuser_deviation = user_deviation(user_id)\n\t\tpredict = movie_avg + user_deviation\n\t\tif predict < 1\n\t\t\treturn 1.0\n\t\telsif predict > 5\n\t\t\treturn 5.0\n\t\telse\n\t\t\treturn predict\t\n\t\tend\t\n\tend",
"def predict(user, movie)\n\t\tprint \"BEFORE CALLING: \"\n\t\tputs Time.now\n\t\treturn average_of_ratings(@movie_ratings[movie])\n\tend",
"def fit_predict(x) # rubocop:disable Lint/UselessMethodDefinition\n super\n end",
"def index\n \n if predictor_signed_in?\n\n elsif user_signed_in?\n\n @action = \"recent\"\n\n @displaypredictor = true\n\n #need to add logic for sorted array that includes both premium and non premium predictions\n\n @myPurchases = Purchase.all.where(:user_id => current_user.id)\n\n @predictions = Array.new \n\n unless @myPurchases.count == 0\n\n @myPurchases.each do |myPurchase|\n\n @predictor = Predictor.find(myPurchase.predictor_id)\n\n if myPurchase.premium == true\n\n @predictor.prediction_games.each do |prediction_game|\n\n @predictions << prediction_game\n\n end\n\n else\n\n @predictor.prediction_games.each do |prediction_game|\n\n unless prediction_game.paid\n @predictions << prediction_game\n end\n\n end\n \n end\n \n end\n\n end\n\n elsif admin_signed_in?\n @prediction_games = PredictionGame.all\n\n end\n\n end",
"def train_data\n ::RubyFann::TrainData.new(\n :inputs => inputs, \n :desired_outputs=> desired_outputs)\n end",
"def get_prediction(appointment_id)\n\tend",
"def predict(x, batch_size: 100)\r\n Utils.check_input_data_type(\"x\", x, Xumo::SFloat)\r\n start_predict(x, batch_size: batch_size)\r\n update while predicting?\r\n predicted_data\r\n end",
"def predict(user, movie)\n\t\tother_users = viewers(movie)\n\t\tratings_combined = 0.0\n\t\t#2.5 is a default value in case there is no other data to base the rating off of.\n\t\tif other_users == nil\n\t\t\treturn 2.5\n\t\tend\n\t\trating_count = other_users.length\n\t\tother_users.each do |other_user|\n\t\t\tratings_combined += rating(other_user, movie).to_f\n\t\tend\n\t\t#The algorithm sets the prediction equal to the average of all other ratings for the movie.\n\t\treturn ratings_combined / rating_count\n\tend",
"def predict_emails\n @test_dataset.each do |test_item|\n domain_name = test_item[1]\n if !@all_domains.keys.include?(domain_name)\n puts \"Predictions for \" + test_item[0] + \" are - \"\n puts \"Can not predict email for this domain as no sufficient information is available\"\n puts \"-\" * 50\n else\n current_domain = get_current_domain(domain_name) \n current_domain.display_predictions(test_item[0])\n end\n end\n end",
"def predict(u_id,m_id)\n #puts \"u:#{u_id},m#{m_id}\"\n sim=most_similar(u_id,m_id).map { |item| [data.rating(item[0],m_id),item[1]] }\n result=@aggregation_func.call(data,u_id,sim)\n result.finite? ? result : data.avg_rating(u_id)\n end",
"def predict (user1, movie)\n\t\tuser1= user1.to_s\n\t\tmovie = movie.to_s\n list_of_users = most_similar(user1)\n counter=0.0\n weighted_sum=0.0\n list_of_users.each do |sim, user| #go through each user, sim = similarity level \n user_rating = rating(user,movie) \n next if (user_rating == 0 || sim.to_i==0)\n weighted_sum = (5.0/sim.to_f) * user_rating + weighted_sum #take weighted average\n counter = (5.0/sim.to_f) + counter\n end\n begin\n num = (weighted_sum/counter).round\n return num\n rescue FloatDomainError\n end\n end",
"def index\n\n if predictor_signed_in?\n\n elsif user_signed_in?\n\n @action = \"posts\"\n\n @displaypredictor = true\n\n @predictors = current_user.predictors.collect\n\n @articles = Array.new \n\n if @predictors.count > 0\n\n @predictors.each do |predictor|\n\n if predictor.articles.count > 0\n predictor.articles.each do |article|\n\n @articles << article\n\n end\n end\n\n end\n\n end\n\n #@predictions.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n\n\n end\n \n end",
"def fit(predictors, targets)\n @predictors = predictors.map { |pred| Vector.elements(pred) }\n @targets = targets\n\n nil\n end",
"def batch_predict(rows, count=100)\n return raw_predict(rows.to_enum, count, api_limits['predictions_max_response_cells'], api_limits['predictions_max_cols'], true)\n end",
"def og_prediction\n (1 + (0.035 * @efficiency * @grist_weight / @batch_volume)).round(3)\n end",
"def predict(user_id, movie_id)\n raise 'User or movie does not exist.' unless @movie_database.users_include?(user_id) && @movie_database.movies_include?(movie_id)\n products, weights = predict_product_weights(movie_id, user_id)\n return 3.0 unless weights > 0\n result = products / weights\n result.round(1)\n end",
"def create\n @prediction = Prediction.new(prediction_params)\n\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to @prediction, notice: 'Prediction was successfully created.' }\n format.json { render :show, status: :created, location: @prediction }\n else\n format.html { render :new }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def train(combos, rewards)\n RubyFann::TrainData.new(\n inputs: combos,\n desired_outputs: rewards\n )\n end",
"def prediction_params\n params.require(:prediction).permit(:body, :expires_at, :resolution_date, :tags, :group_id, :contest_id, :contest_stage_id)\n end",
"def fit_predict(x)\n x = Rumale::Validation.check_convert_sample_array(x)\n\n fit(x).predict(x)\n end",
"def predict u, m\n #for each movie mw watched my u, determine mw's prediction for r\n predictions = movies(u).map do |mw|\n #rw = u's rating of movie mw\n rw = rating(u, mw)\n #for all users ux that have given mw the same rating as u, record ux's rating for m\n r_given_rw = Array.new(0)\n @mv_rating[mw].each do |ux, rwx|\n rx = rating ux, m\n #record ux's rating for m if agree with u on rating for mw\n r_given_rw.push(rx) if rx && rwx == rw\n end\n\n #mw's prediction for r(m) is average of all user's rating of m that have agreed with u on mw\n return r_given_rw.mean.round unless r_given_rw.empty?\n end\n\n #default to 3 because neutral rating\n return predictions.median_ish || 3\n end",
"def show\n @prediction = Prediction.find(params[:id])\n end",
"def train\n raise NotImplementedError\n end",
"def predict new_data_set=nil\n if new_data_set.nil? then\n @fitted_mean_values\n else\n new_data_matrix = new_data_set.to_matrix\n b = @coefficients.to_matrix axis=:vertical\n create_vector measurement(new_data_matrix, b).to_a.flatten\n end\n end",
"def train\r\n return @train\r\n end",
"def predict(u,m,k=25) \n\t\tt1=Time.now\n\t\t@predict_call_count+=1\n\t\tcandidate_list=[]\n\t\tif viewers(m).empty?\n\t\t\treturn rand(5) #if a movie has no viewer then return a random score\n\t\tend\n\t\tviewers(m).each do |viewer|\n\t\t\tsimilarity_score=similarity(viewer,u)\n\t\t\tfind_and_replace(candidate_list,viewer,similarity_score,k)\n\t\tend\n\t\tresult=0\n\t\tcandidate_list.each do |element|\n\t\t\tresult+=rating(element.user,m)\n\t\tend\n\t\tt2=Time.now\n\t\t@timmer+=t2-t1\n\t\treturn result/Float(candidate_list.length)\n\tend",
"def generate_predictions\n stat_hash = @email_statistics.hashed_statistics\n temp = stat_hash.sort_by{ |k, v| v }\n max_value = temp.last.last\n stat_hash.each{ |k,v| @predictions << k if v == max_value }\n # puts @predictions\n # puts \"-\" * 30\n end",
"def run_test(k)\n test=MovieTest.new\n @test_data.first(k).each do |data|\n predict_rate=predict(data[0],data[1])\n test.add_to_result([data[0],data[1],data[2],predict_rate])\n end\n return test\n end",
"def predict(u,m)\n \n # 1. the average\n \t\tcount=0\n \t\tsum=0.0\n \t\tdatab.each do |line| \n\t\t\tif line[\"user_id\"]==u.to_i\n\t\t\tcount+=1\n\t\t\tsum+=line[\"rating\"]\n\t\t\tend\n \t\tend\n \t\tans1 = sum/count\n \t# 2. rating from the most similar user\n \t \ta_movie_data = MovieData0.new(datab)\n \t \t\n \t \tsimilar_user_info_arr = a_movie_data.most_similar(u)\n \t puts\tsimilar_user_info_arr\n \t \tputs \"here predict2\"\n \t \tsimilar_rating = 0.0\n \t \ttop_20percent_index = 0.2*similar_user_info_arr.size() #only search in top 20percent most similar users\n \t \t\n \t \tsimilar_user_info_arr[0..top_20percent_index].each do |hs| \n \t \t\n \t \t\tuser_id=hs[\"user_id\"] \n\t\t\tif z.rating(user_id,m)!=0\n\t\t\tsimilar_rating z.rating(user_id,m)\n\t\t\tend\n \t \tend\n \t \t\n \t \tif similar_rating == 0 \n \t \t\tputs \"no matches\"\n \t \t\treturn ans1\n \t \telse\n \t \t\treturn (similar_rating+ans1)/2\n \t \tend\n end",
"def predict(input)\n # Perform forward propagation to predict output\n \n # Activation on input nodes should simply be the input\n @activation_input[-1] = 1 # set bias node's activation to 1\n @activation_input[0..-2] = input\n \n # Compute the weighted sum into each hidden node\n @hiddenNodes.times do |x|\n s = 0.0\n @inputNodes.times do |i|\n s = s + (@activation_input[i] * @w_1[i][x])\n end\n # update activation for the hidden layer\n @activation_hidden[x] = NeuralNetwork::activation(s)\n end\n \n # Now compute the weighted sum into each output node\n @outputNodes.times do |x|\n s = 0.0\n @hiddenNodes.times do |h|\n s = s + (@activation_hidden[h] * @w_2[h][x])\n end\n # update activations for the output layer\n @activation_output[x] = NeuralNetwork::activation(s)\n end\n\n @activation_output\n\n end",
"def train\n\n funny_joke_votes = Vote.all( :fields => [:joke_id], :username => @username, :percent.gt => 50 )\n unfunny_joke_votes = Vote.all( :fields => [:joke_id], :username => @username, :percent.lt => 50 )\n funny_joke_ids = []\n unfunny_joke_ids = []\n\n funny_joke_votes.each { |j| funny_joke_ids << j.joke_id.to_i }\n unfunny_joke_votes.each { |j| unfunny_joke_ids << j.joke_id.to_i }\n\n funny = []\n unfunny = []\n\n funny_joke_ids.each do |jid|\n funny << Joke.all( :id => jid )\n end\n\n unfunny_joke_ids.each do |jid|\n unfunny << Joke.all( :id => jid )\n end\n\n\n funny.flatten!\n unfunny.flatten! \n\n b = Classifier::Bayes.new 'funny', 'unfunny'\n\n @log.message :info, \"Training funny jokes (amount: #{funny.length.to_s})\"\n funny.each do |joke|\n content = joke.title.to_s + joke.content.to_s\n b.train_funny content\n end\n\n @log.message :info, \"Training unfunny jokes (amount: #{unfunny.length.to_s})\"\n unfunny.each do |joke|\n content = joke.title.to_s + joke.content.to_s\n b.train_unfunny content\n end\n\n result = []\n \n Joke.all.each do |joke|\n content = joke.title.to_s + joke.content.to_s\n type = b.classify content\n\n if( type.downcase == \"funny\" )\n result << joke \n end\n end\n \n result\n end",
"def prediction_params\n params.require(:prediction).permit(:name,:company)\n end",
"def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def predictionByLocation\n latitude= params[:lat]\n longitude= params[:long]\n period=params[:period]\n @p= LocationPrediction.prediction(latitude,longitude,period)\n respond_to do |format|\n format.html\n format.json #json format is implemented in *.json.erb file\n end\n end",
"def predict_price_after_discounts!\n m_discounts = []\n f = build_discount_items :fixed_amount\n m_discounts += f\n \n self.price_after_fixed_discounts = (self.price * self.qty).to_i + m_discounts.each {|discount| discount.price_extend }.sum(&:price_extend).to_i\n\n p = build_discount_items :percentage\n m_discounts += p\n \n self.price_after_all_discounts = (self.price * self.qty).to_i + m_discounts.each {|discount| discount.price_extend }.sum(&:price_extend).to_i\n \n if self.price_after_all_discounts < 0\n discount_amount = self.price_after_all_discounts * -1\n discount_sku = Product.find_by_name(\"Discount\").sku\n discount_attributes = {:product_sku => discount_sku, :qty => 1, \n :currency_used => \"BTC\", \n :price => discount_amount, :price_extend => discount_amount,\n :description => \"Discount to prevent line_item from less than zero condition\" }\n \n self.discounts.create(discount_attributes)\n end\n \n [self.price_after_all_discounts, m_discounts]\n end",
"def to_a()\n return prediction_result\n end",
"def show\n # monthly_payment, total_payment = TwLaborIncome.load_payment(buy_house_params[\"house_price\"].to_i,buy_house_params[\"loan_duration\"].to_i) \n @predicted_income = TwLaborIncome.new.get_prediction(@buy_house)\n end",
"def set_predict_chart\n @predict_chart = PredictChart.find(params[:id])\n end",
"def buyers\n BuyerDecorator.decorate_collection(raw_buyers)\n .map(&:new_application_data)\n end",
"def update_predictions(user_vector, unrated_content_vectors, content_type)\n inversed_document_frequency_hash = build_inversed_document_frequency_hash(content_type)\n unrated_content_vectors.each do |content_vector|\n set_single_prediction(user_vector, content_vector, inversed_document_frequency_hash, content_type)\n end\n end",
"def prediction id = 0\r\n\t\t@predictionSet[id]\r\n\tend",
"def train\n run_thresholds\n run_values_to_ranges\n run_reverse\n\n @classifiers\n end",
"def show\n @prediction = Prediction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prediction }\n end\n end",
"def create\n p = params[:prediction]\n q = filter_params(p)\n p = Prediction.where(nt: q[:nt], cutoff: q[:cutoff]).where(\"res_seq like ?\", \"%#{q[:res_seq]}%\").first\n @prediction = Prediction.new q\n unless p.nil?\n i = p.res_seq.index q[:res_seq]\n @prediction.res_status = p.res_status[i, q[:res_seq].length]\n @prediction.res_ri = p.res_ri[i, q[:res_seq].length]\n @prediction.pdb_flag = p.pdb_flag\n @prediction.pdb_id = p.pdb_id\n end\n\n respond_to do |format|\n if @prediction.save\n @notice = \"Your task were accepted, the result will be sent to you by email\"\n Resque.enqueue(ProgressPrediction, @prediction.id, q[:email])\n format.html { render action: \"new\" }\n format.json { render json: @prediction, status: :created, location: @prediction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def predict(u,m)\n rating = 0\n count = 0\n most_similar = -1\n\n #the rating from the user who has rated m and is most similar to user u is\n #our prediction\n\n #to avoid we repeat computing similarity between two users, we use similarity_list to\n #contain similarity between users.\n if !@similarity_list.has_key?(u)\n @similarity_list[u] = Hash.new\n end\n\n viewers(m).each do |viewer|\n similarity = 0\n #if this similarity is already in the similarity_list, we directly access it from the list\n if @similarity_list[u].has_key?(viewer)\n similarity = @similarity_list[u][viewer]\n elsif @similarity_list.has_key?(viewer) && @similarity_list[viewer].has_key?(u)\n similarity = @similarity_list[viewer][u]\n else\n #if this similarity is not in the list, we compute it and put it into the list\n similarity = similarity(u, viewer)\n @similarity_list[u][viewer] = similarity\n end\n\n #then we look for the user who is most similar to user u. If there exists more than one,\n #we average the sum of ratings.\n if similarity > most_similar\n most_similar = similarity\n count = 1\n rating = @moviemap[m][viewer]\n elsif similarity == most_similar\n count = count + 1\n rating += @moviemap[m][viewer]\n end\n end\n\n if count == 0\n #if no one ever rates this movie, predict an average rating 3\n 3\n else\n rating/count.to_f\n end\n end",
"def predict(user, movie)\n list = most_similar(user) #array of similar users\n done = true\n user_predicted_rating = 0;\n\n #see which user has seen the movie\n while done && !list.empty?\n first_user = list.shift #user similar to u\n\n if $unique_user_data[first_user.to_i - 1].has_key?(movie)\n user_predicted_rating = $unique_user_data[first_user.to_i - 1][movie]\n return user_predicted_rating\n end\n end\n return user_predicted_rating\n end",
"def create\n @prediction = Prediction.new(params[:prediction])\n\n respond_to do |format|\n if @prediction.save\n flash[:notice] = 'Prediction was successfully created.'\n format.html { redirect_to(@prediction) }\n format.xml { render :xml => @prediction, :status => :created, :location => @prediction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prediction.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_user_prediction\n @user_prediction = UserPrediction.find(params[:id])\n end",
"def start_predict(x, batch_size: 100)\r\n Utils.check_input_data_type(\"x\", x, Xumo::SFloat)\r\n start_predict_by_iterator(Iterator.new(x, random: false), batch_size: batch_size)\r\n end",
"def show\n @predicts = Predict.where(params[:matchpick_id])\n @matchpick = Matchpick.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @predict }\n end\n end",
"def train_for(user)\n dataset = Predictors::StopRequestDataset.for(user)\n train(dataset)\n end",
"def predicting?\r\n @predict_state != :none\r\n end",
"def to_a()\n return @predictions\n end",
"def new\n @prediction = Prediction.new\n end",
"def prediction_params\n params.require(:prediction).permit(:id, :height, :weight)\n end",
"def predict_chart_params\n params.fetch(:predict_chart, {})\n end"
] | [
"0.66308594",
"0.65091336",
"0.6460537",
"0.6067307",
"0.6058793",
"0.6032062",
"0.5990188",
"0.5979455",
"0.5977669",
"0.59733355",
"0.5946819",
"0.59376407",
"0.58779806",
"0.57795596",
"0.5755886",
"0.5754334",
"0.5754334",
"0.57266814",
"0.57213825",
"0.5720535",
"0.5718992",
"0.5717544",
"0.5697935",
"0.56967646",
"0.56867",
"0.5681048",
"0.5674605",
"0.5674286",
"0.56714034",
"0.5650267",
"0.5650267",
"0.56319827",
"0.5614493",
"0.55844176",
"0.55636567",
"0.55591214",
"0.5538084",
"0.551351",
"0.5492876",
"0.5490215",
"0.5447564",
"0.5446588",
"0.5445844",
"0.54437906",
"0.5443423",
"0.5434166",
"0.5434055",
"0.54214823",
"0.54085535",
"0.53964317",
"0.5364022",
"0.5350327",
"0.5348314",
"0.5347153",
"0.5345681",
"0.53446394",
"0.53402406",
"0.5339725",
"0.53377384",
"0.53354174",
"0.5306349",
"0.5296691",
"0.5283644",
"0.5282515",
"0.52743095",
"0.5274083",
"0.52664787",
"0.52588737",
"0.5255099",
"0.52369004",
"0.52299196",
"0.522342",
"0.52188444",
"0.5206841",
"0.52040714",
"0.520074",
"0.5193387",
"0.5186653",
"0.51846826",
"0.51826185",
"0.51777023",
"0.51775885",
"0.51741904",
"0.5155308",
"0.5147758",
"0.5132197",
"0.51252073",
"0.5124865",
"0.51197827",
"0.5116459",
"0.5114888",
"0.511177",
"0.50973827",
"0.50958204",
"0.50943434",
"0.5092336",
"0.50914115",
"0.5082396",
"0.507495",
"0.50699943"
] | 0.6594821 | 1 |
buyer tracking history curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4OCwiZXhwIjoxNTAzNTEwNzUyfQ.7zo4a8g4MTSTURpU5kfzGbMLVyYN_9dDTKIBvKLSvPo" ' | def tracking_history
buyer = user_valid_for_viewing?('Buyer')
if !buyer.nil?
events = Events::Track.where(buyer_id: buyer.id).order("created_at desc")
results = events.map do |event|
{
udprn: event.udprn,
hash_str: event.hash_str,
type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],
created_at: event.created_at,
tracking_id: event.id
}
end
render json: results, status: 200
else
render json: { message: 'Authorization failed' }, status: 401
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_wechat_access_token\n res = RestClient.get \"https://foodtrust.cn/wx/get-access-token?badge=#{ENV['RDS_AGENT']}\"\n #ap res.code; res.cookies; ap res.headers; ap res.body\n return JSON.parse(res.body)['access_token']\nend",
"def get_json_bitbucket_action header\n header['x-event-key'][0]\n end",
"def get_withdrawal_history\n # body = {\n # cmd: \"get_withdrawal_history\"\n # }\n\n end",
"def signed_get_request url\n token=jwt_get_signature url\n HTTParty.get('http://localhost:5000'+url,\n headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\"\n }\n )\n end",
"def send_return_history_request(attrs={})\n request = ReturnHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n response = get(request.to_xml.to_s)\n return response if request.raw_xml==true || request.raw_xml==1\n ReturnHistoryResponse.format(response)\n end",
"def get_signedheaders(timestamp,path,body:\"\",method:\"POST\")\n\n timestamp = Time.now.to_i.to_s\n # body = JSON.generate(body)\n text = timestamp + method + path + body\n sign = OpenSSL::HMAC::hexdigest(OpenSSL::Digest::SHA256.new, SECRET, text)\n\n headers = {\n 'ACCESS-KEY' => KEY,\n 'ACCESS-TIMESTAMP' => timestamp,\n 'ACCESS-SIGN' => sign,\n 'Content-Type' => 'application/json'\n }\n\n # p response = HTTParty.post(url, body:body, headers:headers)\n end",
"def request_history(timestamp=1.day.ago)\n @ws.send({request: \"history\", timestamp: timestamp}.to_json)\n end",
"def history(params = {})\n params.select! { |key, _value| @api.history_config[:allowed_params].include? key }\n\n response = self.class.get(@api.history_config[:url],\n :query => { :auth_token => @token }.merge(params),\n :headers => @api.headers\n )\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n response.body\n end",
"def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend",
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def digest\n @request.header('Authorization')\n end",
"def profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end",
"def key_for_request\n \"#{@referrer}-#{@openx_url.to_s.gsub(/o=[0-9]+&callback=OX_[0-9]+/,'')}v4\"\n end",
"def send_cancellation_history_request(attrs={})\n request = CancellationHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n response = get(request.to_xml.to_s)\n return response if request.raw_xml==true || request.raw_xml==1\n CancellationHistoryResponse.format(response)\n end",
"def author() headers['author'] end",
"def history_usd\n rest.get stats_path(:historyUSD) do |response|\n response_handler response\n end\n end",
"def history(params)\n Client.current.get(\"#{resource_url}/candles\", params)\n end",
"def token\n request.headers['Authorization']\n end",
"def get_token\n request.headers[\"Authorization\"]\n end",
"def vcd_session(vcd, username, password)\n vcd_session_link = RestClient::Resource.new(vcd + '/api/sessions', username, password )\n vcd_session_response = vcd_session_link.post({'Accept' => 'application/*+xml;version=5.5'})\n myvar = 'x_vcloud_authorization'\n @mysession = vcd_session_response.headers[myvar.to_sym]\nend",
"def token\n request.headers[\"Authorization\"]\n end",
"def request_get(token)\n url = \"https://api.spotify.com/v1/browse/new-releases?limit=2\"\n\n options = {\n headers: {\n \"Content-Type\": 'application/json',\n \"Accept\": 'application/json',\n \"Authorization\": \"Bearer #{token}\"\n }\n }\n\n return my_request = HTTParty.get(url, options)\nend",
"def auth_header # gets the authorization header from the request\n # { Authorization: 'Bearer <token>' }\n request.headers['Authorization']\n end",
"def jwt_get_signature url\n\n payload=JWT.encode({ #Payload\n key: \"master\",\n method: \"GET\",\n path: url,\n },\n \"badgemaster\", #Secret\n \"HS256\", #Algoritmo\n {typ: \"JWT\", alg:\"HS256\"} #Headers\n )\n\n end",
"def getHeader\n #updateToken\n {'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' + @token}\n end",
"def fetch_history\n service_response = Economy::Transaction::FetchHistory.new(params).perform\n render_api_response(service_response)\n end",
"def headers\n hash = {}\n hash['Content-Type'] = 'application/json'\n hash['Authorization'] = \"ShacipKey #{api_key}\" unless api_key.nil?\n hash\n end",
"def headers\n {:content_type => :json, :accept => :json, :authorization => \"TAuth realm=\\\"https://odg.t-online.de\\\",tauth_token=\\\"#{token}\\\"\"}\n end",
"def order_tracking_url\n hash[\"OrderTrackingUrl\"]\n end",
"def test_request_signature_get\n uri = URI 'http://localhost/foo/bar?baz=quux%2Fxyzzy#plugh'\n req = Net::HTTP::Get.new uri\n req['Date'] = '2015-09-29'\n req['Cookie'] = 'foo; bar; baz=quux'\n req['Gap-Auth'] = 'mbland'\n\n assert_equal(\n ['GET',\n '',\n '',\n '',\n '2015-09-29',\n '',\n '',\n '',\n '',\n 'foo; bar; baz=quux',\n 'mbland',\n '/foo/bar?baz=quux%2Fxyzzy#plugh',\n ].join(\"\\n\") + \"\\n\",\n auth.string_to_sign(req))\n\n assert_equal(\n 'sha1 ih5Jce9nsltry63rR4ImNz2hdnk=',\n auth.request_signature(req))\n end",
"def headers\n {\n \"Authorization\" => \"Bearer #{ENV.fetch(\"SALESLOFT_ACCESS_TOKEN\")}\"\n }\n end",
"def call\n query_params = {\n base: params[:base_currency],\n symbols: params[:exchange_currency],\n start_at: params[:duration].to_i.days.ago.to_date.to_s, # remove this magic\n end_at: Date.today.to_s # this one too\n }.to_query\n\n url = \"#{URL_BASE}/history?#{query_params}\"\n\n self.class.fetch(url)\n end",
"def auth_token\n response_hash[:ebay_auth_token]\n end",
"def api_signature\n ts = timestamp\n [\n Rackspace::Email::Api.configuration.user_key,\n ts,\n hash(ts)\n ].join(':')\n end",
"def headers\n {\n 'Accept' => 'application/json',\n 'Content-type' => 'application/json',\n 'Authorization' => \"Basic #{Base64.strict_encode64(@options[:api_key].to_s).strip}\",\n 'User-Agent' => \"Netbanx-Paysafe v1.0/ActiveMerchant #{ActiveMerchant::VERSION}\"\n }\n end",
"def tracking_identifier\n self.issuer\n end",
"def headers\n {\n \"X-Ridepilot-Token\" => @token,\n \"Content-Type\" => \"application/json\"\n }\n end",
"def successful_purchase_response\n 'response=1&responsetext=SUCCESS&authcode=123456&transactionid=1869031575&avsresponse=N&cvvresponse=N&orderid=1&type=auth&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id='\n end",
"def history\n # retrieves a paginated list of the current user's purchases\n @purchases = current_user.purchases.page params[:page]\n end",
"def request_keys\n [:created_at, :user_agent, :referrer, :remote_ip]\n end",
"def buyer_details\n authenticate_request('Buyer', ['Buyer', 'Agent'])\n if @current_user\n details = @current_user.as_json\n details['buying_status'] = PropertyBuyer::REVERSE_BUYING_STATUS_HASH[details['buying_status']]\n details['funding'] = PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[details['funding']]\n details['status'] = PropertyBuyer::REVERSE_STATUS_HASH[details['status']]\n render json: details, status: 200\n end\n end",
"def headers\n h = {\n 'X-Api-Version' => @api_version,\n :accept => :json,\n }\n\n if @account_id\n h['X-Account'] = @account_id\n end\n\n if @access_token\n h['Authorization'] = \"Bearer #{@access_token}\"\n elsif @cookies\n h[:cookies] = @cookies\n end\n\n if @local_token\n h['X-RLL-Secret'] = @local_token\n end\n\n h\n end",
"def fetch_detail\n service_response = Economy::Transaction::FetchHistory.new(params).perform\n render_api_response(service_response)\n end",
"def head\n {\n \"Host\" => HOST,\n \"Content-Type\" => CONTENT_TYPE,\n \"Accept-Encoding\" => ACCEPT_ENCODINGS.join(','),\n \"User-Agent\" => USER_AGENT,\n \"Authorization\" => \"#{ authorization }\",\n }\n end",
"def get_history\n @request_history = Request.history_request\n end",
"def usage\n @headers['x-ratelimit-usage']\n end",
"def authorization_header\n { 'Authorization' => \"Zoho-oauthtoken #{@access_token}\" }\n end",
"def http_auth_token\n request.headers['Authorization']&.split(' ')&.last\n end",
"def getHMACFromDeleteConfirmationPage(id, cookies)\n url = 'https://news.ycombinator.com/delete-confirm?id=' + id.to_s\n ret = RestClient.get url, :user_agent => \"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)\", :cookies => cookies\n splits = ret.split('\"hmac\" value=\"')\n right_side = splits[1]\n hmac = right_side.split('\"').first\n hmac\nend",
"def include_proxy_authorization_header; end",
"def get_metadata(payload)\n auth_server_id = payload['iss'].split('/').last # iss: \"https://<org>.oktapreview.com/oauth2/<auth_server_id>\"\n client_id = payload['cid']\n metadata_response = client(payload['iss']).get do |req|\n req.url \"/oauth2/#{auth_server_id}/.well-known/oauth-authorization-server?client_id=#{client_id}\"\n end\n JSON.parse(metadata_response.body)\n end",
"def balance_history(opts={})\n return nil unless have_key?\n url = \"/v1/history\"\n ho = {currency:'usd', limit: 500}.merge(opts)\n options = {\n 'currency' => ho[:currency],\n 'limit' => ho[:limit]\n }\n begin\n\n resp = self.class.post(url, :headers => headers_for(url, options)).parsed_response\n rescue => e\n raise \"Error getting balance_history: #{e.message}: #{e.inspect}\"\n end\n\n resp\n end",
"def headers; return {}; end",
"def headers; return {}; end",
"def http_auth_hash; end",
"def get_usages_history_csv(authToken, startDate, endDate)\n raise 'startDate is Invalid, must be instance of String' if startDate.nil? || !startDate.instance_of?(String)\n raise 'endDate is Invalid, must be instance of String' if endDate.nil? || !endDate.instance_of?(String)\n\n verify_auth_token(authToken)\n\n path = \"/v3/scans/usages/history?start=#{startDate}&end=#{endDate}\"\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent,\n 'Authorization' => \"Bearer #{authToken.accessToken}\"\n }\n\n request = Net::HTTP::Get.new(path, headers)\n handle_response(@api_client.request(request), 'get_usages_history_csv')\n end",
"def headers\n {\n 'Authorization' => \"key=#{@server_key}\",\n 'Content-Type' => 'application/json'\n }\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 history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end",
"def get_token(options)\n\t\tmethod = \"GET\"\n\t\tendpoint = \"auditlogtoken\"\n\t\turi = ApiUri::build_uri(endpoint, options)\n\t\treturn @client.request_json(method, uri)\n\tend",
"def packages_history_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PackagesApi.packages_history_get ...'\n end\n # resource path\n local_var_path = '/packages/history'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PackagePurchaseHistoryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackagesApi#packages_history_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def data\n { 'X-TrackerToken' => api_token,\n 'Content-type' => \"application/xml\" }\n end",
"def history(source = nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/history\", params) { |json| json }\n end",
"def query(action, hash = {})\n # uri = URI.parse(\"https://130.59.10.31\")\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n #\n # request = Net::HTTP::Get.new(uri.request_uri)\n #\n # response = http.request(request)\n # response.body\n # response.status\n # response[\"header-here\"] # All headers are lowercase\n uri = URI.parse(@url + \"/api/xml?action=#{action}\")\n hash.each_pair do |key, val|\n if val\n if key == \"filter\" or key == \"sort\"\n uri.query += val.query\n else\n uri.query += \"&\" + key + \"=\" + CGI::escape(\"#{val}\")\n end\n end\n end\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme == \"https\"\n http.use_ssl=true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request = Net::HTTP::Get.new(uri.request_uri)\n # logger = Logger.new('log/development.log')\n # logger.info(url.path + \"?\" + url.query)\n if @sessionid\n request.add_field(\"Cookie\", \"BREEZESESSION=\"+@sessionid)\n end\n puts \"ACS query - request: \" + request.path\n response = http.request(request)\n puts \"ACS query - response: \" + response.body.inspect\n return response\n end",
"def private_get_order_history_by_instrument_get_with_http_info(instrument_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TradingApi.private_get_order_history_by_instrument_get ...'\n end\n # verify the required parameter 'instrument_name' is set\n if @api_client.config.client_side_validation && instrument_name.nil?\n fail ArgumentError, \"Missing the required parameter 'instrument_name' when calling TradingApi.private_get_order_history_by_instrument_get\"\n end\n # resource path\n local_var_path = '/private/get_order_history_by_instrument'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'instrument_name'] = instrument_name\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'include_old'] = opts[:'include_old'] if !opts[:'include_old'].nil?\n query_params[:'include_unfilled'] = opts[:'include_unfilled'] if !opts[:'include_unfilled'].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] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['bearerAuth']\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: TradingApi#private_get_order_history_by_instrument_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def header_token\n request.headers['Authorization'].split(' ').last\n end",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def call_gh_api(url)\n auth = \"Bearer #{session[:access_token]}\"\n HTTParty.get(url, headers: { 'Authorization' => auth })\n end",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def bid_history_detail(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/BidHistoryDetail\", Yahoo::Api.merge(opts))\r\n end",
"def request_keys\n [:created_at, :user_agent, :browser_name, :browser_version, :referrer, :remote_ip]\n end",
"def test_request_signature_get_with_multiple_values_for_header\n uri = URI 'http://localhost/foo/bar'\n req = Net::HTTP::Get.new uri\n req['Date'] = '2015-09-29'\n # Note that Net::HTTPHeader only honors the last header with the same\n # name, discarding earlier values. We can still approximate a cookie\n # with multiple values using the representation below.\n req['Cookie'] = ['foo', 'bar', 'baz=quux']\n req['Gap-Auth'] = 'mbland'\n\n assert_equal(\n ['GET',\n '',\n '',\n '',\n '2015-09-29',\n '',\n '',\n '',\n '',\n 'foo,bar,baz=quux',\n 'mbland',\n '/foo/bar',\n ].join(\"\\n\") + \"\\n\",\n auth.string_to_sign(req))\n\n assert_equal(\n 'sha1 JlRkes1X+qq3Bgc/GcRyLos+4aI=',\n auth.request_signature(req))\n end",
"def example2\n 'ca679660018162' \\\n 'eyJhbGciOiJIUzI1NiIsImtpZCI6IjE6ODE5MjpjYTY3OTY6QUFBQUFBQUFBQUFBIiw' \\\n 'idHlwIjoiSldUIn0.' \\\n 'eyJjb2RlIjoiZXhhbXBsZS5jb20iLCJmbGciOjk2LCJsZW4iOjEyLCJtc2siOiJfX19' \\\n 'fX19fX19fX19fX19fIiwidmVyIjoyfQ.' \\\n '7YhYmorl6qcKy2LeKfJDKrSi-d5r6c8VL8adJxNPfbY' \\\n 'example.com'\n end",
"def pp_signature headers\n headers['Autorizacion']\n end",
"def procore_headers(company_id: nil, token: '')\n if company_id.nil?\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n }\n else\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n \"Procore-Company-Id\": \"#{company_id}\"\n }\n end\nend",
"def fetchInstallations(token)\n url = URI(\"https://api.acceptance.hertekconnect.nl/api/v1/installations\")\n\n http = Net::HTTP.new(url.host, url.port);\n http.use_ssl = true\n request = Net::HTTP::Get.new(url)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Authorization\"] = \"Bearer #{token}\"\n\n response = http.request(request)\n puts response.read_body\nend",
"def auth_header\n { 'Authorization': \"Bearer #{@auth.token}\" }.with_indifferent_access\n end",
"def generate_headers\n nonce = Time.now.to_i.to_s\n {\n 'X-Auth-Apikey' => @api_key,\n 'X-Auth-Nonce' => nonce,\n 'X-Auth-Signature' => OpenSSL::HMAC.hexdigest('SHA256', @secret, nonce + @api_key),\n 'Content-Type' => 'application/json'\n }\n end",
"def dynamic_headers\n {\n 'Authorization' => token,\n 'RequestID' => request_id,\n }\n end",
"def headers\n { 'x-apigw-api-id' => tmp_api_id }\n end",
"def api_request(url, user_token)\n request = HTTParty.get(url,\n headers: { 'Accept' => 'application/json',\n 'Authorization' => \"Bearer #{user_token}\" })\n return request\nend",
"def history\n command = AccountHistory.call(@current_user)\n if command.success?\n @history = command.result\n render 'history.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end",
"def api_key\n request.headers['HTTP_AUTHORIZATION']\n end",
"def history\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n \n @audits=Kaminari.paginate_array(@purchase_requisition.audits.sort_by{|e| -e.id}).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchase_requisitions }\n end \n\n end",
"def headers\n\t\t\tuser = \"#{config[:oauth_key]}|#{config[:fingerprint]}\"\n\t\t\tgateway = \"#{config[:client_id]}|#{config[:client_secret]}\"\n\t\t\theaders = {\n\t\t\t\tcontent_type: :json,\n\t\t\t\taccept: :json,\n\t\t\t\t'X-SP-GATEWAY' => gateway,\n\t\t\t 'X-SP-USER' => user,\n\t\t\t 'X-SP-USER-IP' => config[:ip_address],\n\t\t\t}\n if config[:idemopotency_key]\n headers['X-SP-IDEMPOTENCY-KEY'] = config[:idemopotency_key]\n end\n headers\n\t\tend",
"def raw_headers; end",
"def auth_get_call(location,params,auth)\n puts \"#Wrapper Service GET req:- \\n#Host: #{@host} \\n#Location: #{location} \\n#Params: #{params.to_json} \"\n response = @conn.get do |req|\n req.url location\n req.headers['Content-Type'] = 'application/json'\n req.headers['Authorization'] = auth.to_s\n req.body = params.to_json\n end\n puts \"#Response Code: #{response.status}\"\n return response\n end",
"def history_item(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.history_item(struct)\n rt = nil\n val\n end",
"def dummy_api_hit\n # barchart daily data api hit return\n {\"status\":{\"code\":200,\"message\":\"Success.\"},\"results\":\n [{\"symbol\":\"AAPL\",\"exchange\":\"BATS\",\"name\":\"Apple Inc\",\"dayCode\":\"R\",\n \"serverTimestamp\":\"2018-12-28T13:32:27-06:00\",\"mode\":\"i\",\"lastPrice\":157.51,\n \"tradeTimestamp\":\"2018-12-28T14:17:24-06:00\",\"netChange\":1.36,\n \"percentChange\":0.87,\"unitCode\":\"2\",\"open\":157.3,\"high\":157.65,\n \"low\":154.55,\"close\":0,\"flag\":\"\",\"volume\":1949701\n }]\n }\n end",
"def headers\n { 'Referer' => 'http://www.google.com' }\n end",
"def getTokenReport( entity_id, portal_name, language, flatpack_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['portal_name'] = portal_name\n params['language'] = language\n params['flatpack_id'] = flatpack_id\n return doCurl(\"get\",\"/token/report\",params)\n end",
"def authorization_from(response)\n response[:unique_id]\n end",
"def headers\n [\n { :key => \"User-Agent\", :value => user_agent},\n { :key => \"Content-Type\", :value => \"application/json; charset=utf-8\" },\n { :key => \"Accept\", :value => \"application/json\"}\n ]\n end",
"def headers\n headerRet = {\n 'x-myobapi-version' => 'v2',\n 'Content-Type' => 'application/json'\n }\n token = (@current_company_file || {})[:token]\n unless token.nil? || token.empty?\n headerRet['x-myobapi-cftoken'] = token\n end\n key = (@consumer || {})[:key]\n unless key.nil? || key.empty?\n headerRet['x-myobapi-key'] = key\n end\n headerRet\n end",
"def auth_token\n request.env['HTTP_X_GEOTIX_AUTH_TOKEN']\n end",
"def call\n url = URI(\"https://api.covid19api.com/summary\")\n https = Net::HTTP.new(url.host, url.port);\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n response = https.request(request).read_body\n\n data_hash = JSON.parse(response)\n end",
"def extract_bearer_token(request)\n if request.headers['Authorization'].present?\n token = request.headers['Authorization'].split.last\n token.gsub!(/(\\'|\\\")/, '')\n token\n end\n end",
"def auth_header\n request.headers['Authorization']\n end",
"def auth_header\n request.headers['Authorization']\n end"
] | [
"0.5797186",
"0.5700164",
"0.56709397",
"0.5640822",
"0.5569054",
"0.54849124",
"0.5482643",
"0.54783344",
"0.5473061",
"0.5461563",
"0.5458975",
"0.54404914",
"0.5436548",
"0.54051435",
"0.5400448",
"0.5377582",
"0.5368418",
"0.53604376",
"0.5323719",
"0.5309286",
"0.52948594",
"0.52910185",
"0.52814",
"0.52738714",
"0.52722216",
"0.5267783",
"0.52554464",
"0.5250369",
"0.5245103",
"0.52443576",
"0.5234462",
"0.52232355",
"0.52181995",
"0.5212548",
"0.52095443",
"0.5208294",
"0.5206711",
"0.52059865",
"0.52032113",
"0.5199178",
"0.5196994",
"0.51872694",
"0.5179886",
"0.51784205",
"0.5177256",
"0.5165969",
"0.5162637",
"0.51478606",
"0.5144005",
"0.5141959",
"0.51267534",
"0.5125642",
"0.5125429",
"0.5125429",
"0.512018",
"0.51154447",
"0.5108461",
"0.51060766",
"0.51055557",
"0.5104883",
"0.5104649",
"0.51039726",
"0.50959253",
"0.5088108",
"0.50764555",
"0.5074449",
"0.50677246",
"0.5067594",
"0.5066946",
"0.5066946",
"0.5064898",
"0.50618994",
"0.50610095",
"0.50605273",
"0.50525033",
"0.5052305",
"0.50444263",
"0.50363433",
"0.50355285",
"0.5034777",
"0.5033883",
"0.5026405",
"0.50198287",
"0.50074977",
"0.50026417",
"0.49996835",
"0.49985957",
"0.499767",
"0.49967068",
"0.49939612",
"0.49880403",
"0.4986474",
"0.49826166",
"0.49799082",
"0.49753278",
"0.4974797",
"0.49742812",
"0.4969886",
"0.49684358",
"0.49684358"
] | 0.6094292 | 0 |
Get tracking stats for a buyer curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" " | def tracking_stats
buyer = @current_user
property_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).count
street_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:street_tracking]).count
locality_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:locality_tracking]).count
stats = {
type: (buyer.is_premium? ? 'Premium' : 'Standard'),
locality_tracking_count_limit: Events::Track::BUYER_LOCALITY_PREMIUM_LIMIT[buyer.is_premium.to_s],
street_tracking_count_limit: Events::Track::BUYER_STREET_PREMIUM_LIMIT[buyer.is_premium.to_s],
property_tracking_count_limit: Events::Track::BUYER_PROPERTY_PREMIUM_LIMIT[buyer.is_premium.to_s],
locality_tracking_count: locality_tracking_count,
property_tracking_count: property_tracking_count,
street_tracking_count: street_tracking_count
}
render json: stats, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usage\n @headers['x-ratelimit-usage']\n end",
"def get_member_brief_stats(custid)\n res = $client.get(\"/membersite/member/CareerStats.do?custid=#{custid}\", $headers)\n start = res.body.index('buf = \\'{\"memberSince\"') + 7\n length = res.body.index(\"MemberProfile.driver = extractJSON\") - 3 - start\n data = res.body[start, length]\n JSON.parse data\nend",
"def buyer_details\n authenticate_request('Buyer', ['Buyer', 'Agent'])\n if @current_user\n details = @current_user.as_json\n details['buying_status'] = PropertyBuyer::REVERSE_BUYING_STATUS_HASH[details['buying_status']]\n details['funding'] = PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[details['funding']]\n details['status'] = PropertyBuyer::REVERSE_STATUS_HASH[details['status']]\n render json: details, status: 200\n end\n end",
"def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend",
"def stats\n Client.current.get(\"#{resource_url}/stats\")\n end",
"def raw_stats\n url = URI.parse(stats_url)\n Net::HTTP.start(url.host, url.port) {|http|\n http.request(Net::HTTP::Get.new(url.path))\n }.body\nend",
"def usage_stats\n\t login_filter\n \n\t stats_page = @agent.get(\"/account\")\n\t \n\t stats = stats_page.at('#usage-percent').content.scan(/(\\d+(?:\\.\\d+)?)%\\ used\\ \\((\\d+(?:\\.\\d+)?)([MG])B of (\\d+(?:\\.\\d+)?)GB\\)/).collect{ |d|\n\t { :used => d[1].to_f * ((d[2] == \"G\") ? 1024 : 1),\n\t :total => d[3].to_f * 1024,\n\t :free => (d[3].to_f * 1024 - d[1].to_f * ((d[2] == \"G\") ? 1024 : 1)),\n\t :percent => Percentage.new(d[0].to_f/100)\n\t }\n\t }[0]\n\t \n\t regular_data = stats_page.at('span.bar-graph-legend.bar-graph-normal').next.content.scan(/\\((\\d+(?:\\.\\d+)?)([MG])B/)[0]\n\t stats[:regular_used] = regular_data[0].to_f * ((regular_data[1] == \"G\") ? 1024 : 1) unless regular_data.nil?\n\n\t shared_data = stats_page.at('span.bar-graph-legend.bar-graph-shared').next.content.scan(/\\((\\d+(?:\\.\\d+)?)([MG])B/)[0]\n\t stats[:shared_used] = shared_data[0].to_f * ((shared_data[1] == \"G\") ? 1024 : 1) unless shared_data.nil?\n\n return stats\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def vendor_details\n authenticate_request('Vendor')\n if @current_user\n vendor_details = @current_user.as_json\n yearly_quote_count = Agents::Branches::AssignedAgents::Quote.where(vendor_id: @current_user.id).where(\"created_at > ?\", 1.year.ago).group(:property_id).select(\"count(id)\").to_a.count\n vendor_details[:yearly_quote_count] = yearly_quote_count\n vendor_details[:quote_limit] = Agents::Branches::AssignedAgents::Quote::VENDOR_LIMIT\n vendor_details[:is_premium] = @current_user.buyer.is_premium\n render json: vendor_details, status: 200\n end\n end",
"def visitors(id, date)\n begin\n # json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=today&metrics=ym:s:users&filters=ym:pv:URL=@'ships'&id=33242200&oauth_token=8d3f347e9bfe4be49785fc3922ccc4e1\"))\n json = Net::HTTP.get_response(URI.parse(\"https://api-metrika.yandex.ru/stat/v1/data?date1=#{date.strftime(\"%Y-%m-%d\")}&metrics=ym:s:users&filters=ym:pv:URL=@%27ships/#{id}%27&id=33242200&oauth_token=AQAAAAADvq36AAQsNhxUuZrk40_bsQtY8fXNqrU\"))\n rescue Exception => e\n logger.debug(\"---------------------- #{e}\")\n retry\n end\n\n if (json.present? and json.code == \"200\")\n data_hash = JSON.parse(json.body)\n if data_hash[\"data\"].present?\n visitors = data_hash[\"data\"][0][\"metrics\"][0] \n else\n visitors = nil\n end\n else\n visitors = nil\n end\n\n return visitors\n end",
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def stats\n response[\"stats\"]\n end",
"def raw_info\n yql = \"select * from social.profile where guid='#{uid}'\"\n request = \"https://query.yahooapis.com/v1/yql?q=#{encode_uri_component(yql)}&format=json\"\n @raw_info ||= MultiJson.decode(access_token.get(request).body)\n rescue ::Errno::ETIMEDOUT\n raise ::Timeout::Error\n end",
"def stats\n expose Metadata.stats(@oauth_token)\n end",
"def tracking_history\n buyer = user_valid_for_viewing?('Buyer')\n if !buyer.nil?\n events = Events::Track.where(buyer_id: buyer.id).order(\"created_at desc\")\n results = events.map do |event|\n {\n udprn: event.udprn,\n hash_str: event.hash_str,\n type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],\n created_at: event.created_at,\n tracking_id: event.id\n }\n end\n render json: results, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def users\n response.present? ? response.totals_for_all_results['ga:users'] : 0\n end",
"def stats\n # lookup user + stats via api\n if user_signed_in? and request.headers['HTTP_COOKIE'] and @user = Shelby::API.get_user(params['user_id'])\n @frames = Shelby::API.get_user_stats(params['user_id'], req0uest.headers['HTTP_COOKIE'])\n end\n end",
"def get_payout_stats_v1_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentAuditServiceDeprecatedApi.get_payout_stats_v1 ...'\n end\n # resource path\n local_var_path = '/v1/paymentaudit/payoutStatistics'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'payorId'] = opts[:'payor_id'] if !opts[:'payor_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(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetPayoutStatistics'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :operation => :\"PaymentAuditServiceDeprecatedApi.get_payout_stats_v1\",\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: PaymentAuditServiceDeprecatedApi#get_payout_stats_v1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_usage_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_usage ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/stats/usage'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HistoricalUsageAggregateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_usage\",\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: HistoricalApi#get_usage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def usage(opts)\n url = '/stats/usage'\n url += '_by_month' if opts.delete(:by_month)\n url += '_by_service' if opts.delete(:by_service)\n client.get_stats(url, opts)\n end",
"def get_blockchain_stats\n stats = HTTParty.get(\"http://webbtc.com/stats.json\")\nend",
"def profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end",
"def stats\n @client.stats\n end",
"def get_payout_stats_v4_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PaymentAuditServiceApi.get_payout_stats_v4 ...'\n end\n # resource path\n local_var_path = '/v4/paymentaudit/payoutStatistics'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'payorId'] = opts[:'payor_id'] if !opts[:'payor_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(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetPayoutStatistics'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :operation => :\"PaymentAuditServiceApi.get_payout_stats_v4\",\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: PaymentAuditServiceApi#get_payout_stats_v4\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_accounts_receivable_retry_stats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.get_accounts_receivable_retry_stats ...'\n end\n # resource path\n local_var_path = '/order/accountsReceivableRetryConfig/stats'\n\n # query parameters\n query_params = {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountsReceivableRetryStatsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#get_accounts_receivable_retry_stats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def request_stats\n @all = current_user.trip_requests.requests.count\n @completed = current_user.trip_requests.completed.requests.count\n @cancelled = current_user.trip_requests.cancelled.requests.count\n @active = current_user.trip_requests.active.requests.count\n @stats = current_user.trip_requests.requests.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @response = { all: @all, completed: @completed, cancelled: @cancelled, active: @active, requests: @stats }\n json_response(@response)\n end",
"def agent_details\n authenticate_request\n if @current_user && !@current_user.is_developer\n details = @current_user.details\n render json: details, status: 200\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 get_stats_headers(options={format: \"json\"})\n Rails.cache.fetch([\"/game/stats\", { query: options }], :expires => 1.hour) do\n self.class.get(\"/game/stats\", { query: options })\n end\n end",
"def get_accounting_stats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountingApi.get_accounting_stats ...'\n end\n # resource path\n local_var_path = '/accounting/report'\n\n # query parameters\n query_params = {}\n query_params[:'accounting_method'] = opts[:'accounting_method'] if !opts[:'accounting_method'].nil?\n query_params[:'nucleus_business_id'] = opts[:'nucleus_business_id'] if !opts[:'nucleus_business_id'].nil?\n query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil?\n query_params[:'period_length'] = opts[:'period_length'] if !opts[:'period_length'].nil?\n query_params[:'period_month'] = opts[:'period_month'] if !opts[:'period_month'].nil?\n query_params[:'period_quarter'] = opts[:'period_quarter'] if !opts[:'period_quarter'].nil?\n query_params[:'period_type'] = opts[:'period_type'] if !opts[:'period_type'].nil?\n query_params[:'period_year'] = opts[:'period_year'] if !opts[:'period_year'].nil?\n query_params[:'report'] = opts[:'report'] if !opts[:'report'].nil?\n query_params[:'statement_date'] = opts[:'statement_date'] if !opts[:'statement_date'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountingFinalResponseVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountingApi#get_accounting_stats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_tracking_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V2UserAnalyticsApi.get_tracking_status ...\"\n end\n # resource path\n local_var_path = \"/v2/user/analytics/tracking/status\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TrackingStatus')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V2UserAnalyticsApi#get_tracking_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_wechat_access_token\n res = RestClient.get \"https://foodtrust.cn/wx/get-access-token?badge=#{ENV['RDS_AGENT']}\"\n #ap res.code; res.cookies; ap res.headers; ap res.body\n return JSON.parse(res.body)['access_token']\nend",
"def quick_stats\n puts \"\"; merchant_stats\n end",
"def call\n url = URI(\"https://api.covid19api.com/summary\")\n https = Net::HTTP.new(url.host, url.port);\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n response = https.request(request).read_body\n\n data_hash = JSON.parse(response)\n end",
"def get_hist_stats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_hist_stats ...'\n end\n # unbox the parameters from the hash\n allowable_values = [\"hour\", \"minute\", \"day\"]\n if @api_client.config.client_side_validation && opts[:'by'] && !allowable_values.include?(opts[:'by'])\n fail ArgumentError, \"invalid value for \\\"by\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"usa\", \"europe\", \"asia\", \"asia_india\", \"asia_southkorea\", \"africa_std\", \"southamerica_std\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/stats'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'by'] = opts[:'by'] if !opts[:'by'].nil?\n query_params[:'region'] = opts[:'region'] if !opts[:'region'].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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HistoricalResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_hist_stats\",\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: HistoricalApi#get_hist_stats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_user(screen_name)\n result = self.class.get(\"/users/#{screen_name}\", :headers => @headers)\n puts \"#{result.headers['x-ratelimit-remaining']} requests left!\"\n JSON.parse(result.body)\n\n end",
"def history_usd\n rest.get stats_path(:historyUSD) do |response|\n response_handler response\n end\n end",
"def trackgen_info;\treturn @json_data['trackgen_info'];\tend",
"def stats\n return self.endpoint.stats(self.id)\n end",
"def get_event_stats ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/stats\"\n end",
"def tracking_identifier\n self.issuer\n end",
"def dummy_api_hit\n # barchart daily data api hit return\n {\"status\":{\"code\":200,\"message\":\"Success.\"},\"results\":\n [{\"symbol\":\"AAPL\",\"exchange\":\"BATS\",\"name\":\"Apple Inc\",\"dayCode\":\"R\",\n \"serverTimestamp\":\"2018-12-28T13:32:27-06:00\",\"mode\":\"i\",\"lastPrice\":157.51,\n \"tradeTimestamp\":\"2018-12-28T14:17:24-06:00\",\"netChange\":1.36,\n \"percentChange\":0.87,\"unitCode\":\"2\",\"open\":157.3,\"high\":157.65,\n \"low\":154.55,\"close\":0,\"flag\":\"\",\"volume\":1949701\n }]\n }\n end",
"def info(username)\n perform_request({:action => 'reseller-info', :username => username}) && returned_parameters\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def info(username)\n perform_request(action: 'reseller-info', username: username) && returned_parameters\n end",
"def get_productivity_stats()\n @client.api_helper.get_response(Config::TODOIST_COMPLETED_GET_STATS_COMMAND, {})\n end",
"def raw_info\n @raw_info ||= MultiJson.decode(access_token.get('https://api.trademe.co.nz/v1/MyTradeMe/Summary.json').body)\n rescue ::Errno::ETIMEDOUT\n raise ::Timeout::Error\n end",
"def hunting_info(req, hits)\n info = {\n client_ip: req.env[\"REMOTE_ADDR\"],\n hits: hits.join(\",\"),\n type: \"sleep-warm-hunting\"\n }\n info[:message] = \"#{info[:client_ip]} #{info[:hits]}\"\n\n info\n end",
"def stats\n _get(\"/system/stats\") { |json| json }\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def getinfo\n @api.request 'getinfo'\n end",
"def http_statistics\n super\n end",
"def get_statistics\n response = get_siteinfo('statistics')\n ret = {}\n response['query']['statistics'].each { |k, v| ret[k] = v }\n ret\n end",
"def ping_google_analytics()\n # Trying to get some metrics for usage, just comment out if you don't want it.\n Kitchenplan::Log.info 'Sending a ping to Google Analytics to count usage'\n require 'Gabba'\n Gabba::Gabba.new(\"UA-46288146-1\", \"github.com\").event(\"Kitchenplan\", \"Run\", ENV['USER'])\n end",
"def user_stats\n generate 'sufia:user_stats'\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def api_v11_audits_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_audits_get ...\"\n end\n \n # resource path\n path = \"/api/v11/audits\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'maxResults'] = opts[:'max_results'] if opts[:'max_results']\n query_params[:'resultOffset'] = opts[:'result_offset'] if opts[:'result_offset']\n query_params[:'startTime'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'endTime'] = opts[:'end_time'] if opts[:'end_time']\n query_params[:'query'] = opts[:'query'] if opts[:'query']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\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 = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_audits_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def getwalletinfo\n @api.request 'getwalletinfo'\n end",
"def ping_google_analytics()\n # Trying to get some metrics for usage, just comment out if you don't want it.\n Kitchenplan::Log.info 'Sending a ping to Google Analytics to count usage'\n require 'gabba'\n Gabba::Gabba.new(\"UA-46288146-1\", \"github.com\").event(\"Kitchenplan\", \"Run\", ENV['USER'])\n end",
"def developer_details\n authenticate_request('Developer')\n if @current_user && @current_user.is_developer\n details = @current_user.as_json\n details.delete(\"oauth_token\")\n details.delete(\"oauth_expires_at\")\n details.delete(\"password\")\n details.delete(\"password_digest\")\n search_params = { agent_id: @current_user.id } \n api = PropertySearchApi.new(filtered_params: search_params)\n api.modify_filtered_params\n api.apply_filters\n\n ### THIS LIMIT IS THE MAXIMUM. CAN BE BREACHED IN AN EXCEPTIONAL CASE\n #api.query[:size] = 10000\n udprns, status = api.fetch_udprns\n total_count = api.total_count\n details[:properties_count] = total_count\n first_agent = @current_user.branch.assigned_agents.unscope(where: :is_developer).where(is_developer: true).order('id asc').first\n details[:first_agent_invited_agents] = InvitedDeveloper.where(entity_id: first_agent.id).count\n details[:friends_family_count] = InvitedVendor.where(agent_id: @current_user.id).where(source: Vendor::INVITED_FROM_CONST[:family]).count\n render json: details, status: 200\n end\n end",
"def account_usage(uid)\n usage_hash = @client.user_usage(\"#{uid}\")\n Rails.logger.debug '> Radosgw: Account usage'\n usage_hash\n end",
"def headers\n {\n 'Accept' => 'application/json',\n 'Content-type' => 'application/json',\n 'Authorization' => \"Basic #{Base64.strict_encode64(@options[:api_key].to_s).strip}\",\n 'User-Agent' => \"Netbanx-Paysafe v1.0/ActiveMerchant #{ActiveMerchant::VERSION}\"\n }\n end",
"def stats(api_key = nil)\n if api_key && (!api_key.is_a? String)\n error = InvalidOptions.new(['API key(String)'], ['API key(String)'])\n raise error\n end\n\n # Disable cache for API key status calls\n get_request('/stats/', {:key => api_key}, true)\n end",
"def get_gen1_account_info(name) \n response = HTTParty.get(\"https://management.azure.com/subscriptions/#{subscriptionId}/resourceGroups/#{resourceGroupName}/providers/Microsoft.DataLakeStore/accounts/#{name}?api-version=2016-11-01\", {\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => '*/*',\n \"Cache-Control\" => 'no-cache',\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n \n verify: true,\n })\n\n return JSON.parse response.read_body\n end",
"def data\n { 'X-TrackerToken' => api_token,\n 'Content-type' => \"application/xml\" }\n end",
"def info\n @info ||= client.try(:get, transaction_url)||{}\n end",
"def getTokenReport( entity_id, portal_name, language, flatpack_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['portal_name'] = portal_name\n params['language'] = language\n params['flatpack_id'] = flatpack_id\n return doCurl(\"get\",\"/token/report\",params)\n end",
"def get_champ_stats(api_key, id, attributes)\n url = \"https://na1.api.riotgames.com/lol/static-data/v3/champions\"\n url += \"/\" + id.to_s + \"?api_key=\" + api_key + \"&champData=stats\"\n response = HTTParty.get(url)\n stats = {}\n case response.code\n when 200\n stats = response[\"stats\"]\n when 404\n puts \"failed to find stats for the id \" + id.to_s\n return {}\n end\n ret_set = []\n attributes.each do |attr|\n ret_set.push(stats[attr])\n end\n puts ret_set\n return ret_set\nend",
"def statistics\n JSON.parse @gapi.statistics.to_json\n end",
"def get_insurance_coverage_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InsuranceApi.get_insurance_coverage_all_using_get ...'\n end\n # resource path\n local_var_path = '/insurance_coverage'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageInsuranceCoverage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InsuranceApi#get_insurance_coverage_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['stats']) do\n if params[:id] == current_user.id.to_s\n # A regular user can only view his/her own stats\n @user = current_user\n elsif current_user.is_admin\n # admin users can view anyone's stats\n unless @user = User.where(:id => params[:id]).first\n return render_error(404, \"could not find that user\")\n end\n else\n return render_error(401, \"unauthorized\")\n end\n\n @status = 200\n num_recent_frames = params[:num_frames] ? params[:num_frames].to_i : Settings::UserStats.num_recent_frames\n @stats = GT::UserStatsManager.get_dot_tv_stats_for_recent_frames(@user, num_recent_frames)\n @stats.each {|s| s.frame.creator[:shelby_user_image] = s.frame.creator.avatar_url}\n end\n end",
"def top_buyer\n all_sales = Sale.count\n user = User.left_joins(:sales).group('users.id').order('COUNT(sales.id) DESC').first\n\n {\n user: UserSerializer.new(user),\n all_sales: all_sales,\n user_sales: user.sales.count,\n percentage: (user.sales.count * 100) / all_sales,\n }\n end",
"def track!(*args)\n begin\n opts = args.extract_options!\n data = { v: 1, tid: Setting.google_analytics, cid: opts[:session] || SecureRandom.uuid[0,32], t: :pageview, dp: \"/#{self.code}\", dh: \"mycolor.today\", dt: self.title }\n data[:dr] = opts[:referrer] if opts[:referrer].present?\n data[:uid] = opts[:user] if opts[:user].present?\n resp = RestClient.post( 'http://www.google-analytics.com/collect', data )\n rescue\n nil\n end\n end",
"def getUser\n result = @driver.GetUser(:ApiKey => @apikey)\n if result.getUserResult.errorCode == \"0\" then\n output = [result.getUserResult.items.apiResponseItem.username, result.getUserResult.items.apiResponseItem.email]\n else\n output = \"Error Getting FlexRate: #{result.getUserResult.errorMessage}\"\n end\n return output\n end",
"def fasthttp_statistics\n super\n end",
"def prepare_http_requests\n {\n label: :uber_prices,\n url: @uber_api_service.estimates_price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @uber_api_service.headers \n }\n }\n end",
"def get_withdrawal_info\n # body = {\n # cmd: \"get_withdrawal_info\"\n # }\n\n end",
"def get_order_buyer_info_with_http_info(order_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrdersV0Api.get_order_buyer_info ...'\n end\n # verify the required parameter 'order_id' is set\n if @api_client.config.client_side_validation && order_id.nil?\n fail ArgumentError, \"Missing the required parameter 'order_id' when calling OrdersV0Api.get_order_buyer_info\"\n end\n # resource path\n local_var_path = '/orders/v0/orders/{orderId}/buyerInfo'.sub('{' + 'orderId' + '}', order_id.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'GetOrderBuyerInfoResponse' \n\n auth_names = opts[:auth_names] || []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrdersV0Api#get_order_buyer_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_hamper_data\n hamper_data = convert_session_hamper_into_hash(\"hamper0\") if(!customer_signed_in?)\n # hamper_data = Hamper.where('customer_id = ?', current_customer.id).to_json(:include => { :hamper_items => { :include => { :product => {:only => :name } } } }) if(customer_signed_in?)\n hamper_data = Hamper.where('customer_id = ? AND ordered = ?', current_customer.id, false).to_json(:include => { :hamper_items => { :include => { :product => {:only => :name } } } }) if(customer_signed_in?)\n head :ok, hampers: hamper_data, format: :json\n end",
"def get_team_stats()\n query_params = { }\n headers = {}\n body = nil\n\n path = \"/team/stats\"\n\n @client.request(\n method: :get,\n path: path,\n query: query_params,\n headers: headers,\n body: body)\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def get_store_tracked_clicks_with_http_info(store_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V2UserAnalyticsApi.get_store_tracked_clicks ...\"\n end\n # verify the required parameter 'store_id' is set\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling V2UserAnalyticsApi.get_store_tracked_clicks\" if store_id.nil?\n if !opts[:'count'].nil? && opts[:'count'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling V2UserAnalyticsApi.get_store_tracked_clicks, must be smaller than or equal to 100.'\n end\n\n if !opts[:'count'].nil? && opts[:'count'] < 5\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling V2UserAnalyticsApi.get_store_tracked_clicks, must be greater than or equal to 5.'\n end\n\n # resource path\n local_var_path = \"/v2/user/analytics/{storeId}/tracking/clicks\".sub('{format}','json').sub('{' + 'storeId' + '}', store_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TrackedClicks')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V2UserAnalyticsApi#get_store_tracked_clicks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def signed_get_request url\n token=jwt_get_signature url\n HTTParty.get('http://localhost:5000'+url,\n headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\"\n }\n )\n end",
"def get_account_analytics_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_account_analytics ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling ManagementApi.get_account_analytics\"\n end\n # resource path\n local_var_path = '/v1/accounts/{accountId}/analytics'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'AccountAnalytics' \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_account_analytics\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_user_report\n service_response = AdminManagement::Report::User.new(params).perform\n render_api_response(service_response)\n end",
"def show_info\n render json: TrackingInformationQuery.single(@tracking_information, @order), status: 200\n end",
"def get_info(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getInfo')\n return get(uri)\n end",
"def get(opts = {})\n with_monitoring do\n connection.get(opts[:path]) do |req|\n req.headers = headers.merge('Authorization' => \"Bearer #{opts[:access_token]}\")\n end\n end\n end",
"def get_user_id_harvest\n harvest_uri = URI(\"https://api.harvestapp.com/v2/users/me\")\n\n Net::HTTP.start(harvest_uri.host, harvest_uri.port, use_ssl: true) do |http|\n harvest_request = Net::HTTP::Get.new harvest_uri\n\n harvest_request[\"Authorization\"] = \"Bearer #{harvest_access_token}\"\n harvest_request[\"Harvest-Account-ID\"] = harvest_account_id\n harvest_request[\"User-Agent\"] = harvest_user_agent\n \n harvest_response = http.request harvest_request\n json_response = JSON.parse(harvest_response.body)\n return json_response[\"id\"]\n end\n end",
"def system_mycompany_purchasing_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MyCompanyPurchasingsApi.system_mycompany_purchasing_count_get ...\"\n end\n # resource path\n local_var_path = \"/system/mycompany/purchasing/count\"\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MyCompanyPurchasingsApi#system_mycompany_purchasing_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def api_request(url, user_token)\n request = HTTParty.get(url,\n headers: { 'Accept' => 'application/json',\n 'Authorization' => \"Bearer #{user_token}\" })\n return request\nend",
"def get_user_device_usage_statistics_using_get_with_http_info(user_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsageAndStatisticsApi.get_user_device_usage_statistics_using_get ...'\n end\n # verify the required parameter 'user_id' is set\n if @api_client.config.client_side_validation && user_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling UsageAndStatisticsApi.get_user_device_usage_statistics_using_get\"\n end\n # resource path\n local_var_path = '/api/v2/users/{userId}/device-usage'.sub('{' + 'userId' + '}', user_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'forWholeAccount'] = opts[:'for_whole_account'] if !opts[:'for_whole_account'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'skipCommonProject'] = opts[:'skip_common_project'] if !opts[:'skip_common_project'].nil?\n query_params[:'skipShared'] = opts[:'skip_shared'] if !opts[:'skip_shared'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'startTime'] = opts[:'start_time'] if !opts[:'start_time'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKeyInHeader', 'oAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'APIListOfAPIDeviceUsage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsageAndStatisticsApi#get_user_device_usage_statistics_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_senders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SendersApi.get_senders ...'\n end\n # resource path\n local_var_path = '/senders'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'created_at_from'] = opts[:'created_at_from'] if !opts[:'created_at_from'].nil?\n query_params[:'created_at_to'] = opts[:'created_at_to'] if !opts[:'created_at_to'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SenderListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SendersApi#get_senders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats(socket)\n stats = Time.now.to_i + \"\\n\" + \n @data.flatten + \"\\n\" + \n @expire.flatten + \"\\n\"\n socket.print(stats, \"\\n\\r\")\n end",
"def user_information(username)\n response = get \"v1/market/user:#{username}.json\"\n response[:user]\n end",
"def get_client_summary_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/clients/summary/#{args[:tenantId]}\", args)\nend"
] | [
"0.629435",
"0.62524647",
"0.6112888",
"0.6063808",
"0.5868",
"0.58195317",
"0.57700455",
"0.5760547",
"0.5760547",
"0.5737094",
"0.5737094",
"0.5677557",
"0.5658288",
"0.564761",
"0.56249946",
"0.5598312",
"0.55890745",
"0.55623746",
"0.5556137",
"0.5533361",
"0.5524257",
"0.5506604",
"0.5503354",
"0.5502482",
"0.548076",
"0.5466214",
"0.5455322",
"0.5438385",
"0.54356223",
"0.5428467",
"0.5425606",
"0.54097337",
"0.5388854",
"0.538814",
"0.5355535",
"0.5333697",
"0.53202677",
"0.5293721",
"0.52849525",
"0.5273773",
"0.5263504",
"0.5262699",
"0.52565366",
"0.5255037",
"0.5254301",
"0.5251191",
"0.52470195",
"0.52381116",
"0.52138615",
"0.52119404",
"0.52066964",
"0.51898855",
"0.51798683",
"0.51798683",
"0.517808",
"0.5174242",
"0.5172932",
"0.5166646",
"0.5166086",
"0.51600593",
"0.51567274",
"0.51537573",
"0.5147213",
"0.5145958",
"0.514018",
"0.51317006",
"0.5124832",
"0.5116924",
"0.51104134",
"0.51025355",
"0.5102303",
"0.50964695",
"0.50941163",
"0.5087613",
"0.50873536",
"0.50872153",
"0.50861657",
"0.50811434",
"0.50762504",
"0.50716764",
"0.50714225",
"0.50688905",
"0.50594896",
"0.50575495",
"0.50445354",
"0.5042777",
"0.5041492",
"0.5039707",
"0.5038012",
"0.50375056",
"0.50347525",
"0.50307935",
"0.5026373",
"0.5026299",
"0.5026065",
"0.502595",
"0.5025815",
"0.5025194",
"0.5022018",
"0.50213426"
] | 0.64779234 | 0 |
Get tracking filters and find details of properties in type of tracking TODO: Net HTTP calls made with hardcoded hostnames to be removed TODO: tracking id should be returned or not? | def tracking_details
buyer = @current_user
type_of_tracking = (params[:type_of_tracking] || "property_tracking").to_sym
if type_of_tracking == :property_tracking
udprns = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).pluck(:udprn)
api = PropertySearchApi.new(filtered_params: {})
body = api.fetch_details_from_udprns(udprns)
render json: {property_details: body}, status: 200
else
if params["hash_str"].present?
body = Oj.load(Net::HTTP.get(URI.parse(URI.encode("http://52.66.124.42/api/v0/properties/search?hash_str=#{params['hash_str']}"))))
render json: {property_details: body}, status: 200
else
body = []
search_hashes = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[type_of_tracking]).pluck(:hash_str).compact
search_hashes.each do |search_hash|
### TODO: Fix this. Use internal methods rather than calling the api
body = Oj.load(Net::HTTP.get(URI.parse(URI.encode("http://api.prophety.co.uk/api/v0/properties/search?hash_str=#{search_hash}")))) + body
end
render json: {search_hashes: search_hashes, property_details: body}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trackers(query, type=nil)\n if type.nil?\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n get('host-attributes/trackers', {'query' => query})\n else\n is_valid_with_error(__method__, [:tracker_type], type)\n get('trackers/search', {'query' => query, 'type' => type})\n end\n end",
"def get_tracking_categories\n response_xml = http_get(\"#{xero_url}/tracking\")\n parse_response(response_xml) \n end",
"def usage_filters\n get('/1/reporting/filters').to_a\n end",
"def list_filters\n {\n track_end_date: 'TrkEndDate gt VALUE',\n track_first_submitted: 'TrkFirstSubmitted gt VALUE',\n app_no: 'AppNo eq VALUE',\n first_name: 'AppFirstName eq VALUE',\n last_name: 'AppLastName eq VALUE',\n email: 'AppEmailAddress eq VALUE'\n }\n end",
"def get_all_tracking_pixels_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TrackingControllerApi.get_all_tracking_pixels ...'\n end\n allowable_values = [\"ASC\", \"DESC\"]\n if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])\n fail ArgumentError, \"invalid value for \\\"sort\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/tracking/pixels'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'PageTrackingPixelProjection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrackingControllerApi#get_all_tracking_pixels\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def trackingfield_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TrackingFieldApi.trackingfield_list ...'\n end\n # resource path\n local_var_path = '/tracking_fields'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrackingFieldApi#trackingfield_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tracking_stats\n buyer = @current_user\n property_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).count\n street_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:street_tracking]).count\n locality_tracking_count = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:locality_tracking]).count\n stats = {\n type: (buyer.is_premium? ? 'Premium' : 'Standard'),\n locality_tracking_count_limit: Events::Track::BUYER_LOCALITY_PREMIUM_LIMIT[buyer.is_premium.to_s],\n street_tracking_count_limit: Events::Track::BUYER_STREET_PREMIUM_LIMIT[buyer.is_premium.to_s],\n property_tracking_count_limit: Events::Track::BUYER_PROPERTY_PREMIUM_LIMIT[buyer.is_premium.to_s],\n locality_tracking_count: locality_tracking_count,\n property_tracking_count: property_tracking_count,\n street_tracking_count: street_tracking_count\n }\n render json: stats, status: 200\n end",
"def trackers(query, start_at: nil, end_at: nil)\n params = {\n query: query,\n start: start_at,\n end: end_at,\n }.compact\n\n _get(\"/host-attributes/trackers\", params) { |json| json }\n end",
"def test_that_you_may_filter_to_single_track\n getting '/v2/exercises?tracks=fruit'\n\n returns_tracks %w( fruit )\n end",
"def stories(project, api_key, filter='')\n\treq = Net::HTTP::Get.new(\n \"/services/v3/projects/#{project}/stories?filter=#{filter}\",\n {'X-TrackerToken'=>api_key}\n )\n res = Net::HTTP.start(@pt_uri.host, @pt_uri.port) {|http|\n http.request(req)\n }\n\n return res.body\nend",
"def tracking_history\n buyer = user_valid_for_viewing?('Buyer')\n if !buyer.nil?\n events = Events::Track.where(buyer_id: buyer.id).order(\"created_at desc\")\n results = events.map do |event|\n {\n udprn: event.udprn,\n hash_str: event.hash_str,\n type_of_tracking: Events::Track::REVERSE_TRACKING_TYPE_MAP[event.type_of_tracking],\n created_at: event.created_at,\n tracking_id: event.id\n }\n end\n render json: results, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def index\n included = default_to_array(params[:included])\n excluded = default_to_array(params[:excluded])\n records = Record.custom_filter(included, excluded)\n related_hostnames = Hostname\n .filter_related_hostnames(included, excluded)\n .map{ |h| h.address }\n .tally\n\n render json: {\n total_records: records.length,\n records: records.map { |r| { id: r.id, ip_address: r.ip } },\n related_hostnames: related_hostnames.map { |h, c| { hostname: h, count: c } }\n }\n end",
"def initialize_url_filters\n # We use a hash which tells the domains to filter.\n # The hash value tells that if company name contains that string then don't filter\n @url_filter = Hash.new\n @url_filter[\"facebook.com\"] = \"facebook\"\n @url_filter[\"linkedin.com\"] = \"linkedin\"\n @url_filter[\"wikipedia.org\"] = \"wikipedia\"\n @url_filter[\"yahoo.com\"] = \"yahoo\"\n @url_filter[\"zdnet.com\"] = \"zdnet\"\n @url_filter[\"yelp.com\"] = \"yelp\"\n @url_filter[\"yellowpages.com\"] = \"yellowpages\"\n @url_filter[\"thefreelibrary.com\"] = \"thefreelibrary\"\n @url_filter[\"thefreedictionary.com\"] = \"thefreedictionary\"\n @url_filter[\"superpages.com\"] = \"superpages\"\n @url_filter[\"businessweek.com\"] = \"week\"\n @url_filter[\"indiamart.com\"] = \"mart\"\n @url_filter[\"naukri.com\"] = \"naukri\"\n @url_filter[\"monsterindia.com\"] = \"monster\"\n @url_filter[\"answers.com\"] = \"answers\"\n @url_filter[\"sulekha.com\"] = \"sulekha\"\n @url_filter[\"asklaila.com\"] = \"asklaila\"\n @url_filter[\"blogspot.com\"] = \"blogspot\"\n @url_filter[\"manta.com\"] = \"manta\"\n @url_filter[\"zoominfo.com\"] = \"zoom\"\n @url_filter[\"twitter.com\"] = \"twitter\"\n @url_filter[\"hotfrog.com\"] = \"hotfrog\"\n @url_filter[\"amazon.com\"] = \"amazon\"\n end",
"def cost_filters\n get('/1/reporting/cost/filters').to_a\n end",
"def lookup_track_info(orig_url)\n uri = URI.parse(orig_url)\n \n split_url = uri.path.split('/')\n\n puts uri.host\n \n track_info = Hash.new();\n\n #This needs to be better, include only track urls of specific services\n if uri.host == 'open.spotify.com'\n puts 'spotify lookup'\n track_info = spotify_lookup(split_url[2])\n elsif uri.host.ends_with? 'last.fm'\n puts 'lastfm lookup'\n track_info = last_fm_lookup(split_url[2], split_url[4])\n elsif uri.host.ends_with? 'grooveshark.com'\n track_info = grooveshark_lookup('', split_url[2])\n elsif uri.host == 'rd.io'\n print 'rdio lookup'\n else\n # Return an empty track_info hash\n puts 'non-valid url'\n end\n\n return track_info\n end",
"def tracking\n # @@neo = Neography::Rest.new\n self_node = self.get_node\n if self_node\n trackers = []\n begin\n trackers_list = self_node.outgoing(:friends).map{ |n| [n.object_type, n[:object_id]] }\n trackers_list = trackers_list.group_by{|x| x[0]}\n trackers_list.each do |tracker_type|\n tracker_ids = tracker_type[1].map{|u|u[1]}\n trackers << tracker_type[0].safe_constantize.where(id: tracker_ids).try(:to_a)\n end\n rescue Exception\n end\n\n return trackers.flatten\n else\n return []\n end\n end",
"def custom(cfg)\n metrics = []\n @client.query(cfg['query']).each do |result|\n source = if result['metric']['instance'] =~ /^\\d+/\n result['metric']['app']\n else\n result['metric']['instance']\n end\n\n metrics << {\n 'source' => source,\n 'value' => result['value'][1]\n }\n end\n metrics\n end",
"def index\n if params[:track_id]\n @track = Track.find(params[:track_id])\n @events = Event.where(track_id: params[:track_id]).where(event_type: 'track')\n else\n @events = Event.all\n end\n end",
"def common_metrics( request )\n metrics = [ \"External/all\" ]\n metrics << \"External/#{request.host}/all\"\n\n if NewRelic::Agent::Transaction.recording_web_transaction?\n metrics << \"External/allWeb\"\n else\n metrics << \"External/allOther\"\n end\n\n return metrics\n end",
"def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend",
"def atg_tracking_data\n env = params[:env].downcase # uat or uat2\n loc = params[:loc].downcase # US or CA\n\n if env.blank? || loc.blank?\n render plain: ['']\n else\n render plain: AtgTracking.where(\"email like '%atg_#{env}_#{locale}%'\").order(updated_at: :desc).pluck(:email, :address1)\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 tracking_tags\n @config['aftership_tracking_tag']\n end",
"def data_track_list\n $tracer.trace(format_method(__method__))\n return @tag.get(\"data-track\").split(\"|\")\n end",
"def trip_filters\n elems = []\n TimeFilterHelper.time_filters.each do |tf|\n elems << {\n :id => 100 + tf[:id],\n :value => tf[:value]\n }\n end\n TripPurpose.all.each do |tp|\n elems << {\n :id => tp.id,\n :value => tp\n } \n end\n return elems \n end",
"def trackers\n tr = @params['tr']\n if tr\n tr\n else\n []\n end\n end",
"def tracks_get_info params = { :track_id => nil }\n json = send_request 'tracks_get_info', params\n if json['success'] == true\n json['data']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"def tracking_events\n InstallTracking::TrackingEvent.where(['device_token = ? OR old_token = ? OR device_token = ?', self.device_token || \"NONE\", self.device_token || \"NONE\", self.hardware_token || \"NONE\"]);\n end",
"def filter_specs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilterApi.filter_specs ...'\n end\n # resource path\n local_var_path = '/filters/_specs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.feedpushr.filter-spec.v1+json; type=collection'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<FilterSpec>' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: FilterApi#filter_specs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def filter(event)\n require 'time'\n host = event.get(\"[agent][name]\")\n logpath = event.get(\"[log][file][path]\")\n implant_id = event.get(\"[implant][id]\")\n timefromcs = event.get(\"[c2][timestamp]\") + \" UTC\"\n timestring = Time.parse(timefromcs).strftime(\"%I%M%S\")\n temppath = logpath.split('/cobaltstrike')\n temppath2 = temppath[1].split(/\\/([^\\/]*)$/)\n screenshoturl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike\" + \"#{temppath2[0]}\" + \"/screenshots/screen_\" + \"#{timestring}\" + \"_\" + \"#{implant_id}\" + \".jpg\"\n thumburl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike\" + \"#{temppath2[0]}\" + \"/screenshots/screen_\" + \"#{timestring}\" + \"_\" + \"#{implant_id}\" + \".jpg.thumb.jpg\"\n event.tag(\"_rubyparseok\")\n event.set(\"[screenshot][full]\", screenshoturl)\n event.set(\"[screenshot][thumb]\", thumburl)\n return [event]\nend",
"def track(value,filter = Hash.new)\n options, filter = Kernel::filter_options(filter,[:ports,:types,:limit])\n raise \"Cannot understand filter: #{filter}\" unless filter.empty?\n\n @ports.each_value do |port|\n if(options.has_key? :ports)\n next unless port.name =~ options[:ports]\n end\n if(options.has_key? :types)\n next unless port.type_name =~ options[:types]\n end\n if(options.has_key? :limit)\n next unless port.number_of_samples <= options[:limit]\n end\n port.tracked = value\n Log.info \"set\" + port.stream.name + value.to_s\n end\n\n @properties.each_value do |property|\n if(options.has_key? :propertys)\n next unless property.name =~ options[:properties]\n end\n if(options.has_key? :types)\n next unless property.type_name =~ options[:types]\n end\n if(options.has_key? :limit)\n next unless property.number_of_samples <= options[:limit]\n end\n property.tracked = value\n @tracked = value\n Log.info \"set\" + property.stream.name + value.to_s\n end\n end",
"def test_it_can_get_list_of_filters\n VCR.insert_cassette 'filters'\n filters = @api.filters('writer1').reverse\n\n assert_kind_of Array, filters\n assert_equal 2, filters.size\n\n assert_kind_of Hash, filters.first\n assert_kind_of Hash, filters.last\n\n assert_equal \"filter1\", filters.first[\"name\"]\n assert_equal \"filter2\", filters.last[\"name\"]\n assert_equal \"out.c-main.users.name\", filters.first[\"attribute\"]\n assert_equal \"out.c-main.users.name\", filters.last[\"attribute\"]\n assert_equal \"=\", filters.first[\"operator\"]\n assert_equal \"<>\", filters.last[\"operator\"]\n end",
"def select_stats(dispatcher, *filter)\n lf = []\n while q = filter.shift\n lf << \n case q\n when 'on_node' then\n n = filter.shift \n lambda { |req| req.rjr_node_type.to_s == n}\n\n when \"for_method\" then\n m = filter.shift\n lambda { |req| req.rjr_method == m}\n\n when 'successful' then\n lambda { |req| req.result.success }\n\n when 'failed' then\n lambda { |req| req.result.failed }\n\n end\n end\n\n dispatcher.requests.select { |ds| lf.all? { |lfi| lfi.call(ds) } }\nend",
"def direct_filter_data\n data = {}\n direct_filters.group_by { |tag| tag.type.underscore.pluralize }.\n each_pair { |type, values| data[type] = tag_list(values) }\n data\n end",
"def filter_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilterApi.filter_list ...'\n end\n # resource path\n local_var_path = '/filters'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.feedpushr.filter.v1+json; type=collection'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Filter>' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: FilterApi#filter_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def metrics_for_regular_request( request )\n metrics = []\n metrics << \"External/#{request.host}/#{request.type}/#{request.method}\"\n\n return metrics\n end",
"def get_feed_filters\n filters = self.filters.to_h.reject{ |k, _v| PROHIBITED_FILTERS.include?(k.to_s) }\n filters.merge!({ 'report_status' => ['published'] }) if self.published\n filters\n end",
"def preFetchFilter\n @filtered = Filter.new(@combinedWaypoints)\n debug \"Filter running cycle 1, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['cacheType']\n # post-filter by cacheType\n @appliedFilters['-c'] = { 'f' => \"#{@option['cacheType']}\", 't' => \"type\" }\n # event+ is now all_event, unknown+ is now all_unknown\n if @option['cacheType'] !~ /\\+$/ and\n @option['cacheType'] !~ /^all_/\n # but only if there's no \"all xxx\" chosen\n # we must trust that the query returns correct data here...\n @filtered.cacheType(@option['cacheType'])\n else\n displayWarning \"Not filtering for cache type!\"\n end\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Cache type\")\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeArchived']\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if not @option['includeDisabled']\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @filtered.removeByElement('membersonly')\n end\n # may not be accurate before fetching details?\n if @option['onlyPMO']\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n if $DTSFILTER\n #-------------------\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n #-------------------\n end # $DTSFILTER\n\n debug \"Filter running cycle 2, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['foundDateInclude']\n @appliedFilters['-r'] = { 'f' => \"#{@option['foundDateInclude']}\", 't' => \"found age max\" }\n @filtered.foundDateInclude(@option['foundDateInclude'].to_f)\n end\n if @option['foundDateExclude']\n @appliedFilters['-R'] = { 'f' => \"#{@option['foundDateExclude']}\", 't' => \"found age min\" }\n @filtered.foundDateExclude(@option['foundDateExclude'].to_f)\n end\n if @option['placeDateInclude']\n @appliedFilters['-j'] = { 'f' => \"#{@option['placeDateInclude']}\", 't' => \"cache age max\" }\n @filtered.placeDateInclude(@option['placeDateInclude'].to_f)\n end\n if @option['placeDateExclude']\n @appliedFilters['-J'] = { 'f' => \"#{@option['placeDateExclude']}\", 't' => \"cache age min\" }\n @filtered.placeDateExclude(@option['placeDateExclude'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Date\")\n\n debug \"Filter running cycle 3, #{caches(@filtered.totalWaypoints)} left.\"\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['notFound']\n @appliedFilters['-n'] = { 'f' => \"\", 't' => \"virgins\" }\n @filtered.notFound\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Unfound\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['travelBug']\n @appliedFilters['-b'] = { 'f' => \"\", 't' => \"trackables\" }\n @filtered.travelBug\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Trackable\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['ownerExclude']\n @appliedFilters['-I'] = { 'f' => \"#{@option['ownerExclude']}\", 't' => \"not owned by\" }\n @option['ownerExclude'].split($delimiters).each{ |owner|\n @filtered.ownerExclude(owner)\n }\n end\n if @option['ownerInclude']\n @appliedFilters['-i'] = { 'f' => \"#{@option['ownerInclude']}\", 't' => \"owned by\" }\n @option['ownerInclude'].split($delimiters).each{ |owner|\n @filtered.ownerInclude(owner)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Owner\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['titleKeyword']\n @appliedFilters['-k'] = { 'f' => \"#{@option['titleKeyword']}\", 't' => \"matching title keyword\" }\n @filtered.titleKeyword(@option['titleKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Title\")\n\n displayMessage \"Pre-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n end",
"def get_triggered_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"triggered\", :fields => \"incident_number\" }\n end",
"def trip_filters\n elems = []\n TimeFilterHelper.time_filters.each do |tf|\n elems << {\n :id => 100 + tf[:id],\n :value => tf[:value]\n }\n end\n TripPurpose.all.each do |tp|\n elems << {\n :id => tp.id,\n :value => TranslationEngine.translate_text(tp.name)\n }\n end\n return elems\n end",
"def get_report_filters_with_http_info(store_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsReportsApi.get_report_filters ...\"\n end\n # verify the required parameter 'store_id' is set\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling AnalyticsReportsApi.get_report_filters\" if store_id.nil?\n # resource path\n local_var_path = \"/user/analytics/{storeId}/reports/filters\".sub('{format}','json').sub('{' + 'storeId' + '}', store_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportFilters')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsReportsApi#get_report_filters\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def data_urls\n # returns\n # @instrument\n # @varnames: a hash keyed on the shortname, containing the long name\n \n if params.key?(:instrument_id) \n if Instrument.exists?(params[:instrument_id])\n inst_id = params[:instrument_id]\n else\n inst_id = Instrument.all.first.id\n end\n else\n inst_id = Instrument.all.first.id\n end\n \n @instrument = Instrument.find(inst_id)\n varshortnames = Var.all.where(\"instrument_id = ?\", inst_id).pluck(:shortname)\n # Create a hash, with shortname => name\n @varnames = {}\n varshortnames.each do |vshort|\n @varnames[vshort] = Var.all.where(\"instrument_id = ? and shortname = ?\", inst_id, vshort).pluck(:name)[0]\n end\n \n end",
"def postFetchFilter\n @filtered= Filter.new(@detail.waypoints)\n\n # caches with warnings we choose not to include.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeArchived']\n @appliedFilters['--includeArchived'] = { 'f' => \"\", 't' => \"also archived\" }\n else\n # this would cause too much noise, don't advertise\n #@appliedFilters['--excludeArchived'] = { 'f' => \"\", 't' => \"not archived\" }\n @filtered.removeByElement('archived')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Archived\")\n #\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['includeDisabled']\n @appliedFilters['-z'] = { 'f' => \"\", 't' => \"also disabled\" }\n else\n @appliedFilters['+z'] = { 'f' => \"\", 't' => \"not disabled\" }\n @filtered.removeByElement('disabled')\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Disabled\")\n\n # exclude Premium Member Only caches on request\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['noPMO']\n @appliedFilters['-O'] = { 'f' => \"\", 't' => \"no PMO\" }\n @filtered.removeByElement('membersonly')\n end\n if @option['onlyPMO']\n @appliedFilters['-Q'] = { 'f' => \"\", 't' => \"PMO\" }\n @filtered.removeByElement('membersonly', false)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"PM-Only\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['descKeyword']\n @appliedFilters['-K'] = { 'f' => \"#{@option['descKeyword']}\", 't' => \"matching descr. keyword\" }\n @filtered.descKeyword(@option['descKeyword'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Keyword\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['difficultyMin']\n @appliedFilters['-d'] = { 'f' => \"#{@option['difficultyMin']}\", 't' => \"difficulty min\" }\n @filtered.difficultyMin(@option['difficultyMin'].to_f)\n end\n if @option['difficultyMax']\n @appliedFilters['-D'] = { 'f' => \"#{@option['difficultyMax']}\", 't' => \"difficulty max\" }\n @filtered.difficultyMax(@option['difficultyMax'].to_f)\n end\n if @option['terrainMin']\n @appliedFilters['-t'] = { 'f' => \"#{@option['terrainMin']}\", 't' => \"terrain min\" }\n @filtered.terrainMin(@option['terrainMin'].to_f)\n end\n if @option['terrainMax']\n @appliedFilters['-T'] = { 'f' => \"#{@option['terrainMax']}\", 't' => \"terrain max\" }\n @filtered.terrainMax(@option['terrainMax'].to_f)\n end\n if @option['sizeMin']\n @appliedFilters['-s'] = { 'f' => \"#{@option['sizeMin']}\", 't' => \"size min\" }\n @filtered.sizeMin(@option['sizeMin'])\n end\n if @option['sizeMax']\n @appliedFilters['-S'] = { 'f' => \"#{@option['sizeMax']}\", 't' => \"size max\" }\n @filtered.sizeMax(@option['sizeMax'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"D/T/Size\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['favFactorMin']\n @appliedFilters['-g'] = { 'f' => \"#{@option['favFactorMin']}\", 't' => \"favFactor min\" }\n @filtered.favFactorMin(@option['favFactorMin'].to_f)\n end\n if @option['favFactorMax']\n @appliedFilters['-G'] = { 'f' => \"#{@option['favFactorMax']}\", 't' => \"favFactor max\" }\n @filtered.favFactorMax(@option['favFactorMax'].to_f)\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"FavFactor\")\n\n # We filter for users again. While this may be a bit obsessive, this is in case\n # our local cache is not valid.\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['userExclude']\n @appliedFilters['-E'] = { 'f' => \"#{@option['userExclude']}\", 't' => \"not done by\" }\n @option['userExclude'].split($delimiters).each{ |user|\n @filtered.userExclude(user)\n }\n end\n if @option['userInclude']\n @appliedFilters['-e'] = { 'f' => \"#{@option['userInclude']}\", 't' => \"done by\" }\n @option['userInclude'].split($delimiters).each{ |user|\n @filtered.userInclude(user)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"User\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['attributeExclude']\n @appliedFilters['-A'] = { 'f' => \"#{@option['attributeExclude']}\", 't' => \"attr no\" }\n @option['attributeExclude'].split($delimiters).each{ |attribute|\n @filtered.attributeExclude(attribute)\n }\n end\n if @option['attributeInclude']\n @appliedFilters['-a'] = { 'f' => \"#{@option['attributeExclude']}\", 't' => \"attr yes\" }\n @option['attributeInclude'].split($delimiters).each{ |attribute|\n @filtered.attributeInclude(attribute)\n }\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Attribute\")\n\n beforeFilterTotal = @filtered.totalWaypoints\n if @option['minLongitude']\n @appliedFilters['--minLon'] = { 'f' => \"#{@option['minLongitude']}\", 't' => \"West\" }\n @filtered.longMin(@option['minLongitude'])\n end\n if @option['maxLongitude']\n @appliedFilters['--maxLon'] = { 'f' => \"#{@option['maxLongitude']}\", 't' => \"East\" }\n @filtered.longMax(@option['maxLongitude'])\n end\n if @option['minLatitude']\n @appliedFilters['--minLat'] = { 'f' => \"#{@option['minLatitude']}\", 't' => \"South\" }\n @filtered.latMin(@option['minLatitude'])\n end\n if @option['maxLatitude']\n @appliedFilters['--maxLat'] = { 'f' => \"#{@option['maxLatitude']}\", 't' => \"North\" }\n @filtered.latMax(@option['maxLatitude'])\n end\n excludedFilterTotal = beforeFilterTotal - @filtered.totalWaypoints\n showRemoved(excludedFilterTotal, \"Lat/Lon\")\n\n displayMessage \"Post-fetch filter complete, #{caches(@filtered.totalWaypoints)} left.\"\n return @filtered.totalWaypoints\n end",
"def get_telephony_providers_edges_trunkswithrecording_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TelephonyProvidersEdgeApi.get_telephony_providers_edges_trunkswithrecording ...\"\n end\n \n \n \n \n if opts[:'trunk_type'] && !['EXTERNAL', 'PHONE', 'EDGE'].include?(opts[:'trunk_type'])\n fail ArgumentError, 'invalid value for \"trunk_type\", must be one of EXTERNAL, PHONE, EDGE'\n end\n \n \n \n \n # resource path\n local_var_path = \"/api/v2/telephony/providers/edges/trunkswithrecording\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'trunkType'] = opts[:'trunk_type'] if opts[:'trunk_type']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TrunkRecordingEnabledCount')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TelephonyProvidersEdgeApi#get_telephony_providers_edges_trunkswithrecording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def parameters\n parameters = settings.dup\n parameters.delete(:return_response)\n\n [:opens, :clicks].each do |sym|\n if tracking.key?(sym)\n parameter = :\"track_#{sym}\"\n case tracking[sym]\n when true, false, nil\n parameters[parameter] = tracking[sym]\n when 'yes'\n parameters[parameter] = true\n when 'no'\n parameters[parameter] = false\n end # ignore \"htmlonly\"\n end\n end\n\n parameters\n end",
"def get_report_filters_with_http_info(store_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V2UserAnalyticsApi.get_report_filters ...\"\n end\n # verify the required parameter 'store_id' is set\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling V2UserAnalyticsApi.get_report_filters\" if store_id.nil?\n # resource path\n local_var_path = \"/v2/user/analytics/{storeId}/reports/filters\".sub('{format}','json').sub('{' + 'storeId' + '}', store_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportFilters')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V2UserAnalyticsApi#get_report_filters\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def filter_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilterApi.filter_get ...'\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 FilterApi.filter_get\"\n end\n # resource path\n local_var_path = '/filters/{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(['application/vnd.feedpushr.filter.v1+json', 'application/vnd.goa.error'])\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] || 'Filter' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: FilterApi#filter_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def filters; end",
"def filters; end",
"def get_cookie_tracking\n dputs __method__.to_s\n track_req = setup_http_request($tracking, @cookie)\n res = @http.request(track_req)\n get_cookie(res)\n end",
"def tracks(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end",
"def filter!(collection)\n # Limit by type\n collection = collection.where(type: params[:type]) if params.has_key?(:type)\n\n # Limit by Tracker ID\n if params.has_key? :tracker_id\n tracker_ids = (params[:tracker_id] || '').to_s.split(\",\")\n collection = collection.where(tracker_id: tracker_ids)\n\n # not a perfect place, but should be okay for now...\n Tracker.where(id: tracker_ids).each { |tracker| tracker.delay.remote_sync_if_necessary(state: \"open\", person: current_user) }\n end\n\n # Limit by Tracker Type\n if params.has_key?(:tracker_type)\n constant_names = tracker_constant_names_for_type(params[:tracker_type])\n collection = collection.joins(:tracker).where('trackers.type IN (?)', constant_names) unless constant_names.blank?\n end\n\n # Filter by Tracker owner type and id\n if params.has_key?(:tracker_team_id)\n collection = filter_by_tracker_team_id(collection, params[:tracker_team_id])\n end\n\n # Filter by issue open/closed\n collection = collection.where(can_add_bounty: params[:can_add_bounty].to_bool) if params.has_key?(:can_add_bounty)\n\n #Filter by issue paid_out\n collection = collection.where(paid_out: params[:paid_out].to_bool) if params.has_key?(:paid_out)\n\n # Filter by Featured\n collection = collection.where(featured: params[:featured].to_bool) if params.has_key?(:featured)\n\n # Filter by issue accepting request_for_proposals\n if params[:accepting_proposals].to_bool\n collection = filter_by_accepting_proposals(collection.joins(:request_for_proposal))\n end\n\n if params.has_key?(:bounty_min) || params.has_key?(:bounty_max)\n collection = filter_by_bounty_total(collection)\n end\n\n # Filter by Tracker owner type and id\n if params.has_key?(:thumbed_by_person_id)\n if params[:thumbed_by_person_id] == 'me' && current_user\n person_id = current_user.id\n else\n person_id = params[:thumbed_by_person_id]\n end\n collection = collection.joins(:thumbs).where(\"thumbs.person_id\" => person_id, \"thumbs.downvote\" => false)\n end\n\n collection\n end",
"def index\n sc = Soundcloud.register({:site => \"http://api.#{$sc_host}\"})\n @hot_tracks = sc.Track.find(:all, :params => {\"filter\" => \"streamable\", \"order\" => \"hotness\"} )\n end",
"def all_filters(**args)\n params = parameters(args) do\n optional_params :type\n end\n request(:get, 'filters', params)\n end",
"def get_tracking_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V2UserAnalyticsApi.get_tracking_status ...\"\n end\n # resource path\n local_var_path = \"/v2/user/analytics/tracking/status\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TrackingStatus')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V2UserAnalyticsApi#get_tracking_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def filters\n @filters ||= {}\n end",
"def filter_data\n case params[:filter][:info]\n when 'Public'\n @tag = Tag.find_by(tag: 'Public')\n when 'Basketball Courts'\n @tag = Tag.find_by(tag: 'Basketball Courts')\n when 'Book Store'\n @tag = Tag.find_by(tag: 'Book Store')\n end\n\n @joins = Tagtoilet.where('tag_id = ?', @tag.id)\n @toilets = @joins.map{|join| Toilet.find(join.toilet_id)}\n @toilets.to_json\n end",
"def index\n\n if params[:source] == \"external\"\n @referrer_urls = ReferrerUrl.all(:conditions => \"url NOT LIKE '%http://www.onshutters.com%'\")\n elsif params[:source] == \"internal\"\n @referrer_urls = ReferrerUrl.all(:conditions => \"url LIKE '%http://www.onshutters.com%'\")\n else\n @referrer_urls = ReferrerUrl.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @referrer_urls }\n end\n end",
"def summary(args)\n out = {'known'=> {}, 'forwarded'=>{},'unknown'=>{} }\n args[:end] ||= Time.now\n args[:start] ||= args[:end] - 10*86400 # 10 days\n get_all_reports_by_date(args[:start],args[:end]).each do |r|\n get_all_records_filtered(\"report_metadata_id\",r.id).each do |record|\n # if record.source_ip is part of authorized_senders\n out['known']['count'] += record.count\n end\n end\n return out\n end",
"def test_it_can_get_list_of_filters_projects\n VCR.insert_cassette 'filters_projects'\n filters = @api.filters_projects('writer1', optionals: { filter: 'filter1' })\n\n assert_kind_of Array, filters\n assert_equal 1, filters.size\n\n assert_kind_of Hash, filters.first\n\n assert_equal \"filter1\", filters.first[\"filter\"]\n assert_equal \"/gdc/md/PID/obj/123\", filters.first[\"uri\"]\n assert_equal \"PID\", filters.first[\"pid\"]\n end",
"def prepare_http_requests\n {\n label: :lyft_prices,\n url: @lyft_api_service.price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @lyft_api_service.headers \n }\n }\n end",
"def filter\n grpc.filter\n end",
"def trackingfield_list(opts = {})\n data, _status_code, _headers = trackingfield_list_with_http_info(opts)\n data\n end",
"def google_analytics_check \n (request.host == 'myhalomonitor.com' or request.host == 'www.myhalomonitor.com') #and !@@google_analytics_filter.include? request.env[\"REMOTE_ADDR\"].to_s\n end",
"def list\n @client.call(method: :get, path: 'tracking-domains')\n end",
"def track\n # Log an event\n params.reject{|k,v| ['action', 'controller'].include? k}.each do |event_type, event_detail|\n Event.create :name => event_type, :description => event_detail,\n :ip => request.remote_ip, :useragent => request.headers['user-agent']\n end\n render :nothing => true\n end",
"def get_audit_log_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuditLogApi.get_audit_log_all_using_get ...'\n end\n # resource path\n local_var_path = '/audit_log'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?\n query_params[:'integration_type'] = opts[:'integration_type'] if !opts[:'integration_type'].nil?\n query_params[:'is_request'] = opts[:'is_request'] if !opts[:'is_request'].nil?\n query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'request_type'] = opts[:'request_type'] if !opts[:'request_type'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'vendor_name'] = opts[:'vendor_name'] if !opts[:'vendor_name'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Pageobject')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditLogApi#get_audit_log_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def params\n flat = {}\n @options[:params].merge( :track => @options[:filters] ).each do |param, val|\n next if val.to_s.empty? || (val.respond_to?(:empty?) && val.empty?)\n val = val.join(\",\") if val.respond_to?(:join)\n flat[param.to_s] = val.to_s\n end\n flat\n end",
"def show\n @report = Report.find(params[:id])\n @records = Report.connection.execute(sprintf(@report.sql, params[:param] || @report.param_default))\n @lookups = {} \n @report.lookups.split.each do |r| # original lookups string sample: \"id:34 name:34:id\"\n a = r.split(\":\")\n h = Hash.new\n h[:link_field_name] = a[0]\n h[:report_id] = a[1]\n h[:param_field_name] = a[2]\n @lookups[a[0]] = h\n end if @report.lookups\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end",
"def track(*keywords)\n query_params = keywords.pop if keywords.last.is_a?(::Hash)\n query_params ||= {}\n filter(query_params.merge(:track => keywords))\n end",
"def get_tracking_categories\n response_xml = http_get(@client, \"#{xero_url}/TrackingCategories\")\n\n parse_response(response_xml, {}, {:request_signature => 'GET/TrackingCategories'})\n end",
"def server_object_filter\n self.parameters[:object_filter].to_h if self.parameters.has_key?(:object_filter)\n end",
"def link_to_filter_options(filters)\n options = {\n :controller => 'issues',\n :action => 'index',\n :set_filter => 1,\n :fields => [],\n :values => {},\n :operators => {}\n }\n\n filters.each do |f|\n name, operator, value = f\n options[:fields].push(name)\n options[:operators][name] = operator\n options[:values][name] = [value]\n end\n\n options\n end",
"def method_missing(method, *args)\n if Track.session_dimensions.include?(params[:action])\n params[:action] = ['locality','region','country'] if params[:action] == 'locality'\n @site_summary = @property.site_summary(params).all\n render :action => 'site_summary'\n elsif Track.campaign_dimensions.include?(params[:action])\n @campaign_summary = @property.campaign_summary(params).all\n render 'campaigns/campaign_summary' \n elsif Track.loyalty_dimensions.include?(params[:action])\n @visit_summary = @property.visit_summary(params).all\\\n .sort{|a,b| a[params[:action]].to_i <=> b[params[:action]].to_i }\n render :action => 'visit_summary' \n elsif Track.event_dimensions.include?(params[:action])\n @site_summary = @property.content_summary(params).all\n render :action => 'content_summary'\n else\n raise ActiveRecord::RecordNotFound\n end\n end",
"def get_analytics_reporting_metadata_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.get_analytics_reporting_metadata ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/reporting/metadata\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'locale'] = opts[:'locale'] if opts[:'locale']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportMetaDataEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#get_analytics_reporting_metadata\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tracking_options\n return [] if @export.tracking.empty?\n\n @export.tracking.map do |key, value|\n {\n 'Name' => key,\n 'Option' => value\n }\n end\n end",
"def get_architect_dependencytracking_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_types ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/types\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DependencyTypeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def get_architect_dependencytracking_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_types ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/types\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DependencyTypeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_filters(filters); end",
"def show\n @filter = params[:id].to_sym\n\n case @filter\n when :fb_auth\n @setting = {:status => self.current_user.fb_authorized?}\n\n when :tw_auth\n @setting = {:status => self.current_user.tw_authorized?}\n\n when :tumblr_auth\n @setting = {:status => self.current_user.tumblr_authorized?}\n \n when :google_auth\n @setting = {:status => self.current_user.google_authorized?}\n \n when :yahoo_auth\n @setting = {:status => self.current_user.yahoo_authorized?}\n \n when :hotmail_auth\n @setting = {:status => self.current_user.hotmail_authorized?}\n\n when :fb_access_token\n @setting = {:status => self.current_user.fb_access_token_valid?}\n end\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end",
"def trackingfield_get_with_http_info(field_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TrackingFieldApi.trackingfield_get ...'\n end\n # verify the required parameter 'field_id' is set\n if @api_client.config.client_side_validation && field_id.nil?\n fail ArgumentError, \"Missing the required parameter 'field_id' when calling TrackingFieldApi.trackingfield_get\"\n end\n # resource path\n local_var_path = '/tracking_fields/{fieldId}'.sub('{' + 'fieldId' + '}', field_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrackingFieldApi#trackingfield_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_filter(agent, filters, vars)\n agent.reset\n if filters[:discovery]\n agent.discover({:nodes => filters[:discovery]})\n else\n ['identity', 'fact', 'class', 'compound'].each do |kind|\n next unless filters[kind]\n add_filter = agent.method(\"#{kind}_filter\".to_sym)\n if filters[kind].is_a?(String)\n add_filter.call(interpolate(filters[kind], vars))\n else\n filters[kind].each do |filter|\n add_filter.call(interpolate(filter, vars))\n end\n end\n end\n end\n agent\nend",
"def get_team_filters\n filters = []\n self.feed_teams.each do |ft|\n if ft.sharing_enabled?\n filters << ft.filters.to_h.reject{ |k, _v| PROHIBITED_FILTERS.include?(k.to_s) }.merge({ 'team_id' => ft.team_id })\n end\n end\n filters\n end",
"def get_report_filter_with_http_info(store_id, report_filter_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsReportsApi.get_report_filter ...\"\n end\n # verify the required parameter 'store_id' is set\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling AnalyticsReportsApi.get_report_filter\" if store_id.nil?\n # verify the required parameter 'report_filter_id' is set\n fail ArgumentError, \"Missing the required parameter 'report_filter_id' when calling AnalyticsReportsApi.get_report_filter\" if report_filter_id.nil?\n # resource path\n local_var_path = \"/user/analytics/{storeId}/reports/filters/{reportFilterId}\".sub('{format}','json').sub('{' + 'storeId' + '}', store_id.to_s).sub('{' + 'reportFilterId' + '}', report_filter_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportFilter')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsReportsApi#get_report_filter\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def filter(query_params = {})\n [:follow, :track, :locations].each do |param|\n if query_params[param].is_a?(Array)\n query_params[param] = query_params[param].flatten.collect{|q| q.to_s}.join(',')\n elsif query_params[param]\n query_params[param] = query_params[param].to_s\n end\n end\n start('statuses/filter', query_params.merge(:method => :post))\n end",
"def index\n facility_id = params[:facility_id]\n org_id = params[:org_id]\n opts = {\n user_facility_ids: facility_id && BSON::ObjectId(facility_id),\n user_org_ids: org_id && BSON::ObjectId(org_id),\n access_ids: params[:access_id] && BSON::ObjectId(params[:access_id]),\n status: params[:status],\n :pass_time.gte => params[:start_at],\n :pass_time.lte => params[:end_at]\n }.delete_if { |key, value| value.blank? }\n query = []\n unless params[:key].blank?\n query << { user_name: /.*#{params[:key]}.*/ }\n query << { user_sno: /.*#{params[:key]}.*/ }\n query << { user_nationality: /.*#{params[:key]}.*/ }\n end\n query << {} if query.blank?\n @trackers = paginate(Tracker.where(opts).and('$or': query))\n end",
"def full_get(*vars)\n return unless instance.elastics_indexable?\n Elastics.search_by_id(metainfo, {:refresh => true, :params => {:_source => '*'}}, *vars)\n end",
"def extract_target_entries\n extract_host_entries\n extract_event_entries\n extract_service_entries\n extract_note_entries\n extract_vuln_entries\n extract_web_entries\n end",
"def typus_fields_for(filter); end",
"def filter_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.filter_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/filter\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'trip_id'] = opts[:'trip_id'] if !opts[:'trip_id'].nil?\n query_params[:'ticket_id'] = opts[:'ticket_id'] if !opts[:'ticket_id'].nil?\n query_params[:'package_id'] = opts[:'package_id'] if !opts[:'package_id'].nil?\n query_params[:'course_id'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#filter_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def woopra_http_request(is_tracking, event = nil)\n base_url = 'www.woopra.com'\n get_params = {}\n\n # Configuration\n get_params['host'] = @current_config[:domain].to_s\n get_params['cookie'] = @current_config[:cookie_value].to_s\n get_params['ip'] = @current_config[:ip_address].to_s\n get_params['timeout'] = @current_config[:idle_timeout].to_s\n\n # Identification\n @user.each do |key, value|\n get_params['cv_' + key.to_s] = value.to_s\n end\n\n if !is_tracking\n url = '/track/identify/?'\n else\n if event[0].nil?\n get_params['event'] = 'pv'\n get_params['ce_url'] = @current_config[:url]\n else\n get_params['event'] = event[0].to_s\n event[1]&.each do |key, value|\n get_params['ce_' + key.to_s] = value.to_s\n end\n end\n url = '/track/ce/?'\n end\n\n get_params.each do |key, value|\n url += CGI.escape(key) + '=' + CGI.escape(value) + '&'\n end\n\n url = url[0..-1] + '&ce_app=' + SDK_ID\n\n http = Net::HTTP.new(base_url)\n user_agent = @current_config[:user_agent]\n\n req = if !user_agent.nil?\n Net::HTTP::Get.new(url, 'User-Agent' => user_agent)\n else\n Net::HTTP::Get.new(url)\n end\n\n http.request(req)\n end",
"def test_filter_by_unknown_host_like_known_host\n filter = Galaxy::Filter.new :host => \"fo\" #don't match with \"foo\"\n\n assert_equal [ ], @agents.select(&filter)\n end",
"def filter(event)\n\thost = event.get(\"[agent][name]\")\n \tfilename = event.get(\"[file][name]\")\n\tfile_path = event.get(\"[file][directory_local]\")\n\tfile_patharray = file_path.split(/\\/([^\\/]*)$/)\n\tfile_id = file_patharray[-1]\n\tdownloadsurl = \"/c2logs/\" + \"#{host}\" + \"/cobaltstrike/downloads/\" + \"#{file_id}\" + \"_\" + \"#{filename}\"\n\tevent.tag(\"_rubyparseok\")\n \tevent.set(\"[file][url]\", downloadsurl)\n\treturn [event]\nend",
"def get_report_filter_with_http_info(store_id, report_filter_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V2UserAnalyticsApi.get_report_filter ...\"\n end\n # verify the required parameter 'store_id' is set\n fail ArgumentError, \"Missing the required parameter 'store_id' when calling V2UserAnalyticsApi.get_report_filter\" if store_id.nil?\n # verify the required parameter 'report_filter_id' is set\n fail ArgumentError, \"Missing the required parameter 'report_filter_id' when calling V2UserAnalyticsApi.get_report_filter\" if report_filter_id.nil?\n # resource path\n local_var_path = \"/v2/user/analytics/{storeId}/reports/filters/{reportFilterId}\".sub('{format}','json').sub('{' + 'storeId' + '}', store_id.to_s).sub('{' + 'reportFilterId' + '}', report_filter_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReportFilter')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V2UserAnalyticsApi#get_report_filter\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def statuses\n request(:get, \"applicant_tracking/statuses\")\n end",
"def filters\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def initialize(uri, filters = {}, headers = {})\n @uri = uri\n @filters = filters\n @headers = headers\n\n response = Clever.request :get, uri, filters, @headers\n\n @auth_token = @headers[:Authorization].split[1]\n response[:data].map { |x| x[:data][:auth_token] = @auth_token }\n\n @all = Util.convert_to_clever_object response[:data]\n @links = {}\n response[:links].each do |link|\n @links[link[:rel].to_sym] = link[:uri]\n end\n end"
] | [
"0.597705",
"0.59144413",
"0.5735036",
"0.5617689",
"0.54666567",
"0.5431689",
"0.54226965",
"0.5419066",
"0.53725445",
"0.5345034",
"0.5329371",
"0.5322544",
"0.5312536",
"0.52893865",
"0.5265697",
"0.5249971",
"0.5234865",
"0.5217012",
"0.52111447",
"0.5188541",
"0.51814127",
"0.5128734",
"0.51148283",
"0.5097971",
"0.5093833",
"0.5089233",
"0.5067661",
"0.5062418",
"0.5057262",
"0.5051175",
"0.5034099",
"0.50252205",
"0.5024118",
"0.5019042",
"0.5013049",
"0.50054455",
"0.5003591",
"0.49894524",
"0.49865192",
"0.4978258",
"0.49757862",
"0.4972986",
"0.49577075",
"0.49552536",
"0.49312538",
"0.493039",
"0.49297222",
"0.4925092",
"0.4925092",
"0.49192142",
"0.4916012",
"0.49116844",
"0.4901217",
"0.48974594",
"0.4888311",
"0.48816726",
"0.4880906",
"0.48795855",
"0.48588827",
"0.4849777",
"0.48336878",
"0.48296958",
"0.48296535",
"0.4828687",
"0.48278153",
"0.4826616",
"0.48206463",
"0.48186252",
"0.4817962",
"0.48177436",
"0.4804949",
"0.47973746",
"0.47965136",
"0.47950667",
"0.47909856",
"0.47905082",
"0.47802526",
"0.4780069",
"0.4777967",
"0.47779185",
"0.47709513",
"0.47680447",
"0.47657236",
"0.47524935",
"0.47519487",
"0.47495496",
"0.47405863",
"0.4733177",
"0.4732394",
"0.47313333",
"0.4726499",
"0.47227818",
"0.472278",
"0.47202417",
"0.47178307",
"0.47108024",
"0.4707624",
"0.47071287",
"0.47071287",
"0.47069168"
] | 0.65677255 | 0 |
Edit tracking details curl XPOST H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" " | def edit_tracking
buyer = @current_user
destroyed = Events::Track.where(id: params[:tracking_id].to_i).last.destroy
render json: { message: 'Destroyed tracking request' }, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tracking_params\n params.permit(:location, :trip_request_id)\n end",
"def post_curl\n `curl -X \"POST\" -H \"Authorization: Basic #{_encode}\" -d grant_type=client_credentials https://accounts.spotify.com/api/token`\n end",
"def tracking_params\n params.require(:tracking).permit(:content, :project_id)\n end",
"def tracking_params\n params.require(:tracking).permit(:nombre, :guia, :estado, :desde, :hasta, :description)\n end",
"def click_tracking_params\n params.require(:click_tracking).permit(:zip, :url, :user_id)\n end",
"def put_authcontrols_exemptmids_token_with_http_info(token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthControlsApi.put_authcontrols_exemptmids_token ...'\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling AuthControlsApi.put_authcontrols_exemptmids_token\"\n end\n # resource path\n local_var_path = '/authcontrols/exemptmids/{token}'.sub('{' + 'token' + '}', CGI.escape(token.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 '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[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"AuthControlsApi.put_authcontrols_exemptmids_token\",\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: AuthControlsApi#put_authcontrols_exemptmids_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def capture_authorization_by_external_key_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsApi.capture_authorization_by_external_key ...\"\n end\n # resource path\n local_var_path = \"/1.0/kb/payments\"\n\n # query parameters\n query_params = {}\n query_params[:'controlPluginName'] = @api_client.build_collection_param(opts[:'control_plugin_name'], :multi) if !opts[:'control_plugin_name'].nil?\n query_params[:'pluginProperty'] = @api_client.build_collection_param(opts[:'plugin_property'], :multi) if !opts[:'plugin_property'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-Killbill-CreatedBy'] = opts[:'x_killbill_created_by'] if !opts[:'x_killbill_created_by'].nil?\n header_params[:'X-Killbill-Reason'] = opts[:'x_killbill_reason'] if !opts[:'x_killbill_reason'].nil?\n header_params[:'X-Killbill-Comment'] = opts[:'x_killbill_comment'] if !opts[:'x_killbill_comment'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsApi#capture_authorization_by_external_key\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @click_tracking.update(click_tracking_params)\n format.html { redirect_to @click_tracking, notice: 'Click tracking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @click_tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tracker_params\n params.require(:tracker).permit(:token, :description, :enabled)\n end",
"def post(opts = {})\n with_monitoring do\n connection.post(opts[:path]) do |req|\n prefix = opts[:access_token] ? 'Bearer' : 'Basic'\n suffix = opts[:access_token] || opts[:claims_token]\n req.headers = headers.merge('Authorization' => \"#{prefix} #{suffix}\")\n end\n end\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @id_token = args[:id_token] if args.key?(:id_token)\n @phone_verification_info = args[:phone_verification_info] if args.key?(:phone_verification_info)\n @tenant_id = args[:tenant_id] if args.key?(:tenant_id)\n @totp_verification_info = args[:totp_verification_info] if args.key?(:totp_verification_info)\n end",
"def update\n @api_tracking = ApiTracking.find(params[:id])\n\n respond_to do |format|\n if @api_tracking.update_attributes(params[:api_tracking])\n format.html { redirect_to @api_tracking, notice: 'Api tracking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def atest_ID_25845_edit_profile_edit_profile_details\n # Need clarification\n end",
"def cust_details_track_params\n params.require(:cust_details_track).permit(:order_ref_id, :order_date, :ext_ref_id, :custdetails, :vpp, :dealtran, :last_call_back_on, :no_of_attempts, :mobile, :alt_mobile, :products, :current_status)\n end",
"def _build_request resource, request\n admin_token = resource.bootstrap_token\n request.add_field 'X-Auth-Token', admin_token\n request.add_field 'Content-type', 'application/json'\n request.add_field 'user-agent', 'Chef keystone_credentials'\n request\nend",
"def details_access_params\n params.require(:details_access).permit(:user_id, :ip_address, :user_agent)\n end",
"def update(options = {})\n data = PostData.new\n data[:user] = @login\n data[:pass] = @password\n if options[:tid]\n data[:tid] = options[:tid]\n else\n data[:ord_id] = options[:ord_id]\n data[:service_id] = options[:service_id]\n end\n\n ssl_post(STATUS_TEST_URL, data.to_post_data)\n end",
"def modify_identifier(identifier, metadata_hash)\n request_uri = '/id/' + identifier\n uri = URI(ENDPOINT + request_uri)\n request = Net::HTTP::Post.new uri.request_uri\n response = call_api(uri, request, metadata_hash)\nend",
"def update_tag_profile\n # body = {\n # cmd: \"update_tag_profile\"\n # }\n\n end",
"def _build_request resource, request\n admin_token = resource.bootstrap_token\n request.add_field 'X-Auth-Token', admin_token\n request.add_field 'Content-type', 'application/json'\n request.add_field 'user-agent', 'Chef keystone_register'\n request\nend",
"def getTokenEdit( entity_id, language, flatpack_id, edit_page)\n params = Hash.new\n params['entity_id'] = entity_id\n params['language'] = language\n params['flatpack_id'] = flatpack_id\n params['edit_page'] = edit_page\n return doCurl(\"get\",\"/token/edit\",params)\n end",
"def set_TrackingID(value)\n set_input(\"TrackingID\", value)\n end",
"def capture_with_http_info(sbp_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#capture ...\"\n end\n \n # verify the required parameter 'sbp_request' is set\n fail \"Missing the required parameter 'sbp_request' when calling capture\" if sbp_request.nil?\n \n # resource path\n path = \"/v1/transaction/capture\".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']\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/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_request)\n \n\n auth_names = []\n data, status_code, headers = @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 => 'SbpResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#capture\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end",
"def policy_activities_actions_issue_quotes_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyActivitiesApi.v1_policy_activities_actions_issue_quotes_post ...'\n end\n # resource path\n local_var_path = '/v1/policy_activities/actions/issue_quotes'\n # query parameters\n query_params = opts[:query_params] || {}\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/plain', 'application/octet-stream', 'application/json-patch+json', 'text/json', 'application/*+json'])\n # form parameters\n form_params = opts[:form_params] || {}\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])\n # return_type\n return_type = opts[:debug_return_type] || 'Array<CentralEntCoreFrameworkServiceLibraryApiModelIssueQuoteResponse>'\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Bearer']\n new_options = opts.merge(\n :operation => :\"PolicyActivitiesApi.v1_policy_activities_actions_issue_quotes_post\",\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 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: PolicyActivitiesApi#v1_policy_activities_actions_issue_quotes_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n head :unauthorized\n end",
"def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @phone_auth_info = args[:phone_auth_info] if args.key?(:phone_auth_info)\n @refresh_token = args[:refresh_token] if args.key?(:refresh_token)\n @totp_auth_info = args[:totp_auth_info] if args.key?(:totp_auth_info)\n end",
"def add_purchase_details(post, options)\n post[:InternalNote] = options.fetch(:internal_note, '')\n post[:PaymentReason] = options.fetch(:payment_reason, '')\n post[:TokenisationMode] = options.fetch(:tokenisation_mode, 0)\n post[:SettlementDate] = options.fetch(:settlement_date, '')\n post[:Source] = options.fetch(:source, '')\n post[:StoreCard] = options.fetch(:store_card, false)\n post[:SubType] = options.fetch(:sub_type, 'single')\n post[:TestMode] = test?\n post[:Type] = options.fetch(:type, 'cardpresent')\n end",
"def update!(**args)\n @external_identity = args[:external_identity] if args.key?(:external_identity)\n @resolution_status_code = args[:resolution_status_code] if args.key?(:resolution_status_code)\n end",
"def update!(**args)\n @external_identity = args[:external_identity] if args.key?(:external_identity)\n @resolution_status_code = args[:resolution_status_code] if args.key?(:resolution_status_code)\n end",
"def auth_capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_type' => \"AUTH_CAPTURE\"\n )\n\n astro_curl(@validator_url, data)\n end",
"def issue_tracker_access_params\n params.require(:issue_tracker_access).permit(:name, :role, :employee_id, :status, :is_confirm, :issue_tracker_group_id, :issue_tracker_member_id)\n end",
"def postTransactionAuthorised( transaction_id, paypal_getexpresscheckoutdetails)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_getexpresscheckoutdetails'] = paypal_getexpresscheckoutdetails\n return doCurl(\"post\",\"/transaction/authorised\",params)\n end",
"def update!(**args)\n @content_details = args[:content_details] if args.key?(:content_details)\n @etag = args[:etag] if args.key?(:etag)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @snippet = args[:snippet] if args.key?(:snippet)\n end",
"def update\n respond_to do |format|\n if @tracking.update(tracking_params)\n format.html { redirect_to @tracking, notice: \"Tracking was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tracking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_recordings_deletionprotection_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.put_recordings_deletionprotection ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recordings/deletionprotection\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'protect'] = opts[:'protect'] if opts[:'protect']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#put_recordings_deletionprotection\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 update\n respond_to do |format|\n if @cust_details_track.update(cust_details_track_params)\n format.html { redirect_to @cust_details_track, notice: 'Cust details track was successfully updated.' }\n format.json { render :show, status: :ok, location: @cust_details_track }\n else\n format.html { render :edit }\n format.json { render json: @cust_details_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_webhooks_token_with_http_info(token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhooksApi.put_webhooks_token ...'\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling WebhooksApi.put_webhooks_token\"\n end\n # resource path\n local_var_path = '/webhooks/{token}'.sub('{' + 'token' + '}', CGI.escape(token.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'WebhookResponseModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"WebhooksApi.put_webhooks_token\",\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: WebhooksApi#put_webhooks_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update_params\n #json_data = request.raw_post()\n #params.require(:reference_number).permit(:name, :email, :twitter)\n params.permit(:dependents)\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 capture_request(tid, total = nil)\n capture_request = Cielo::CaptureRequest.new\n response = send_request(capture_request.serialize(tid, total = nil, @affiliation, @affiliation_key))\n end",
"def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @phone_auth_info = args[:phone_auth_info] if args.key?(:phone_auth_info)\n @refresh_token = args[:refresh_token] if args.key?(:refresh_token)\n end",
"def postEntityPhone( entity_id, number, trackable)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number'] = number\n params['trackable'] = trackable\n return doCurl(\"post\",\"/entity/phone\",params)\n end",
"def update!(**args)\n @body = args[:body] if args.key?(:body)\n @headers = args[:headers] if args.key?(:headers)\n @http_method = args[:http_method] if args.key?(:http_method)\n @oauth_token = args[:oauth_token] if args.key?(:oauth_token)\n @oidc_token = args[:oidc_token] if args.key?(:oidc_token)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def postEntityAdd( entity_id, add_referrer_url, add_referrer_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['add_referrer_url'] = add_referrer_url\n params['add_referrer_name'] = add_referrer_name\n return doCurl(\"post\",\"/entity/add\",params)\n end",
"def update params\n post \"https://api.sendgrid.com/apiv2/customer.profile.json\", params.merge(task: 'set')\n end",
"def tracker_params\n params.require(:tracker).permit!\n end",
"def post_businesses_token_notes_with_http_info(token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BusinessesApi.post_businesses_token_notes ...'\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling BusinessesApi.post_businesses_token_notes\"\n end\n # resource path\n local_var_path = '/businesses/{token}/notes'.sub('{' + 'token' + '}', CGI.escape(token.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'CardholderNoteResponseModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"BusinessesApi.post_businesses_token_notes\",\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: BusinessesApi#post_businesses_token_notes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @tracking_url = args[:tracking_url] if args.key?(:tracking_url)\n end",
"def update!(**args)\n @content_details = args[:content_details] if args.key?(:content_details)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @snippet = args[:snippet] if args.key?(:snippet)\n end",
"def update!(**args)\n @address = args[:address] if args.key?(:address)\n @expiration = args[:expiration] if args.key?(:expiration)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @params = args[:params] if args.key?(:params)\n @payload = args[:payload] if args.key?(:payload)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n @resource_uri = args[:resource_uri] if args.key?(:resource_uri)\n @token = args[:token] if args.key?(:token)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n @verification_code = args[:verification_code] if args.key?(:verification_code)\n end",
"def detail_params\n params.require(:detail).permit(:church_name, :event_name, :emailed, :title, :top_comment, :notes, :user_id, :premium, :image_data, :remove_date, :user_id, :disable)\n end",
"def update!(**args)\n @owner_email = args[:owner_email] if args.key?(:owner_email)\n @recording_session_id = args[:recording_session_id] if args.key?(:recording_session_id)\n @session_state_info = args[:session_state_info] if args.key?(:session_state_info)\n end",
"def update!(**args)\n @ad_tracking_id = args[:ad_tracking_id] if args.key?(:ad_tracking_id)\n @description1 = args[:description1] if args.key?(:description1)\n @description2 = args[:description2] if args.key?(:description2)\n end",
"def data\n { 'X-TrackerToken' => api_token,\n 'Content-type' => \"application/xml\" }\n end",
"def postEntityClaim( entity_id, claimed_user_id, claimed_reseller_id, expiry_date, claimed_date, claim_method, phone_number, referrer_url, referrer_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['claimed_user_id'] = claimed_user_id\n params['claimed_reseller_id'] = claimed_reseller_id\n params['expiry_date'] = expiry_date\n params['claimed_date'] = claimed_date\n params['claim_method'] = claim_method\n params['phone_number'] = phone_number\n params['referrer_url'] = referrer_url\n params['referrer_name'] = referrer_name\n return doCurl(\"post\",\"/entity/claim\",params)\n end",
"def tracking_identifier\n self.issuer\n end",
"def edit_identity hash = {}\n organise hash.update :action => 'edit_identity'\n end",
"def update\n expose Challenge.update(@oauth_token, params[:challenge_id].strip,\n params[:data])\n end",
"def tracking_details\n return unless tracking_number.present?\n\n TrackingDetails.new(tracking_number: tracking_number)\n end",
"def pp_signature headers\n headers['Autorizacion']\n end",
"def save_credit_card_info_with_http_info(request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountApi.save_credit_card_info ...\"\n end\n # verify the required parameter 'request' is set\n fail ArgumentError, \"Missing the required parameter 'request' when calling AccountApi.save_credit_card_info\" if request.nil?\n # resource path\n local_var_path = \"/v2/user/customer/account/creditCardInfo\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountApi#save_credit_card_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def tracker_params\n params.fetch(:tracker, {}).permit!\n end",
"def build_request\n b = builder\n build_authentication(b)\n b.instruct!\n \n b.TrackRequest do\n b.Request do\n b.RequestAction \"Track\"\n b.RequestOption \"activity\"\n end\n \n b.TrackingNumber tracking_number\n end\n end",
"def post_v2_capture_by_order_with_http_info(order_uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OrderApi.post_v2_capture_by_order ...'\n end\n # verify the required parameter 'order_uuid' is set\n if @api_client.config.client_side_validation && order_uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'order_uuid' when calling OrderApi.post_v2_capture_by_order\"\n end\n # resource path\n local_var_path = '/order/{order_uuid}/capture'.sub('{' + 'order_uuid' + '}', order_uuid.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n 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(opts[:'body'])\n\n return_type = opts[:return_type] || 'InlineResponse2006'\n\n auth_names = opts[:auth_names] || ['Bearer']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#post_v2_capture_by_order\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def postEntityStatus( entity_id, status, inactive_reason, inactive_description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['status'] = status\n params['inactive_reason'] = inactive_reason\n params['inactive_description'] = inactive_description\n return doCurl(\"post\",\"/entity/status\",params)\n end",
"def set_data_in_details\n json_data.provision_details_hash!\n end",
"def trackingfield_create_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TrackingFieldApi.trackingfield_create ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling TrackingFieldApi.trackingfield_create\"\n end\n # resource path\n local_var_path = '/tracking_fields'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2018')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TrackingFieldApi#trackingfield_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch_recordings_screensession_with_http_info(recording_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.patch_recordings_screensession ...\"\n end\n \n \n # verify the required parameter 'recording_session_id' is set\n fail ArgumentError, \"Missing the required parameter 'recording_session_id' when calling RecordingApi.patch_recordings_screensession\" if recording_session_id.nil?\n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recordings/screensessions/{recordingSessionId}\".sub('{format}','json').sub('{' + 'recordingSessionId' + '}', recording_session_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#patch_recordings_screensession\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @verification_method = args[:verification_method] if args.key?(:verification_method)\n @token = args[:token] if args.key?(:token)\n end",
"def UpdateField params = {}\n \n APICall(path: 'ticket_fields.json',method: 'PUT',payload: params.to_json)\n \n end",
"def papinotas_headers_basic\n {\n 'access-token': 'basic_token',\n client: 'basic_client',\n uid: '[email protected]'\n }\n end",
"def update_identity_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdminApi.update_identity ...'\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 AdminApi.update_identity\"\n end\n # resource path\n local_var_path = '/identities/{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(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_identity'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Identity'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"AdminApi.update_identity\",\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: AdminApi#update_identity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update!(**args)\n @group_id = args[:group_id] if args.key?(:group_id)\n @name = args[:name] if args.key?(:name)\n @tracking_issues = args[:tracking_issues] if args.key?(:tracking_issues)\n end",
"def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @scope = args[:scope] if args.key?(:scope)\n @token_type = args[:token_type] if args.key?(:token_type)\n end",
"def update!(**args)\n @lead = args[:lead] if args.key?(:lead)\n @recaptcha_status = args[:recaptcha_status] if args.key?(:recaptcha_status)\n @response_metadata = args[:response_metadata] if args.key?(:response_metadata)\n end",
"def save_credit_card_info_with_http_info(request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerAccountApi.save_credit_card_info ...\"\n end\n # verify the required parameter 'request' is set\n if @api_client.config.client_side_validation && request.nil?\n fail ArgumentError, \"Missing the required parameter 'request' when calling CustomerAccountApi.save_credit_card_info\"\n end\n # resource path\n local_var_path = \"/user/customer/account/creditCardInfo\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerAccountApi#save_credit_card_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def google_analytic_params\n params.require(:google_analytic).permit(:tracking_id, :shop_id, :employee_user_id)\n end",
"def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @issued_token_type = args[:issued_token_type] if args.key?(:issued_token_type)\n @token_type = args[:token_type] if args.key?(:token_type)\n end",
"def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @issued_token_type = args[:issued_token_type] if args.key?(:issued_token_type)\n @token_type = args[:token_type] if args.key?(:token_type)\n end",
"def update!(**args)\n @auto_retrieval_info = args[:auto_retrieval_info] if args.key?(:auto_retrieval_info)\n @ios_receipt = args[:ios_receipt] if args.key?(:ios_receipt)\n @ios_secret = args[:ios_secret] if args.key?(:ios_secret)\n @phone_number = args[:phone_number] if args.key?(:phone_number)\n @play_integrity_token = args[:play_integrity_token] if args.key?(:play_integrity_token)\n @recaptcha_token = args[:recaptcha_token] if args.key?(:recaptcha_token)\n @safety_net_token = args[:safety_net_token] if args.key?(:safety_net_token)\n end",
"def update!(**args)\n @access_type = args[:access_type] unless args[:access_type].nil?\n @audience = args[:audience] unless args[:audience].nil?\n @email = args[:email] unless args[:email].nil?\n @expires_in = args[:expires_in] unless args[:expires_in].nil?\n @issued_to = args[:issued_to] unless args[:issued_to].nil?\n @scope = args[:scope] unless args[:scope].nil?\n @token_handle = args[:token_handle] unless args[:token_handle].nil?\n @user_id = args[:user_id] unless args[:user_id].nil?\n @verified_email = args[:verified_email] unless args[:verified_email].nil?\n end",
"def update!(**args)\n @lead = args[:lead] if args.key?(:lead)\n @recaptcha_challenge = args[:recaptcha_challenge] if args.key?(:recaptcha_challenge)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def headers\n {\n \"X-Ridepilot-Token\" => @token,\n \"Content-Type\" => \"application/json\"\n }\n end",
"def post(url)\n options = { :body => { \n :__VIEWSTATE => '/wEPDwUJNTI1NzY5NDcyD2QWAgIDD2QWFAIfDw8WBB4EVGV4dAUPQ29udGFpbiBTZWFyY2g6HgdWaXNpYmxlZ2RkAiEPEA8WAh8BZ2RkZGQCLQ8QDxYGHg1EYXRhVGV4dEZpZWxkBQ1EaXN0cmljdF9OYW1lHg5EYXRhVmFsdWVGaWVsZAUNRGlzdHJpY3RfQ29kZR4LXyFEYXRhQm91bmRnZBAVFAZTRUxFQ1QjQmFua3VyYSAgICAgICAgICAgICAgICAgICAgICAgIFswMV0jQnVyZHdhbiAgICAgICAgICAgICAgICAgICAgICAgIFswMl0jQmlyYmh1bSAgICAgICAgICAgICAgICAgICAgICAgIFswM10jRGFyamVlbGluZyAgICAgICAgICAgICAgICAgICAgIFswNF0jSG93cmFoICAgICAgICAgICAgICAgICAgICAgICAgIFswNV0jSG9vZ2hseSAgICAgICAgICAgICAgICAgICAgICAgIFswNl0jSmFscGFpZ3VyaSAgICAgICAgICAgICAgICAgICAgIFswN10jQ29vY2hiZWhhciAgICAgICAgICAgICAgICAgICAgIFswOF0jTWFsZGEgICAgICAgICAgICAgICAgICAgICAgICAgIFswOV0jUGFzY2hpbSBNaWRuYXBvcmUgICAgICAgICAgICAgIFsxMF0jUHVyYmEgTWlkbmFwb3JlICAgICAgICAgICAgICAgIFsxMV0jTXVyc2hpZGFiYWQgICAgICAgICAgICAgICAgICAgIFsxMl0jTmFkaWEgICAgICAgICAgICAgICAgICAgICAgICAgIFsxM10jUHVydWxpYSAgICAgICAgICAgICAgICAgICAgICAgIFsxNF0jTm9ydGggMjQtUGFyZ2FuYXMgICAgICAgICAgICAgIFsxNV0jU291dGggMjQtUGFyZ2FuYXMgICAgICAgICAgICAgIFsxNl0jRGFrc2hpbiBEaW5hanB1ciAgICAgICAgICAgICAgIFsxN10jVXR0YXIgRGluYWpwdXIgICAgICAgICAgICAgICAgIFsxOF0jS29sa2F0YSAgICAgICAgICAgICAgICAgICAgICAgIFsxOV0VFAEwAjAxAjAyAjAzAjA0AjA1AjA2AjA3AjA4AjA5AjEwAjExAjEyAjEzAjE0AjE1AjE2AjE3AjE4AjE5FCsDFGdnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnFgFmZAIxDxAPFggfAgUKQkxPQ0tfTkFNRR8DBQpCTE9DS19DT0RFHwRnHgdFbmFibGVkZ2QQFQEDQUxMFQEAFCsDAWcWAWZkAjMPDxYEHwAFC1BhbmNoYXlhdCA6HwFoZGQCNQ8QDxYKHwIFB0dQX05BTUUfAwUHR1BfQ09ERR8EZx8BaB8FaGQQFQAVABQrAwAWAGQCNw8PFgQfAAUHTW91emEgOh8BaGRkAjkPEA8WCB8CBQtFTkdfTU9VTkFNRR8DBQdtb3Vjb2RlHwRnHwFoZBAVABUAFCsDABYAZAI7DxAPFgIfAWdkZBYBZmQCPw88KwALAgAPFgoeC18hSXRlbUNvdW50Zh4IRGF0YUtleXMWAB8BaB4JUGFnZUNvdW50AgEeFV8hRGF0YVNvdXJjZUl0ZW1Db3VudGZkATwrABQCAzwrAAQBABYCHwFnBDwrAAQBABYCHwFoZGR/u9mK2BOq0HHWP5gKuP0KvXCJ3A==',\n :__EVENTTARGET => 'ddlDistrict', \n :__EVENTARGUMENT => ''\n }}\n self.class.post(url, options)\n end",
"def putEntity( type, scope, country, trust, our_data)\n params = Hash.new\n params['type'] = type\n params['scope'] = scope\n params['country'] = country\n params['trust'] = trust\n params['our_data'] = our_data\n return doCurl(\"put\",\"/entity\",params)\n end",
"def append_info_to_payload(payload)\n super\n payload[:host] = \"asdfasdf\"# request.host\n payload[:host] = request.host\n payload[:remote_ip] = request.remote_ip\n payload[:origin] = request.headers['HTTP_ORIGIN'] rescue '' + request.headers['ORIGINAL_FULLPATH']\n payload[:uuid] = request.uuid\n payload[:browser] = \"#{browser.name} #{browser.full_version}\"\n payload[:user_agent] = request.headers['HTTP_USER_AGENT']\n end",
"def update_value\n # I don't know why it isn't working with HTTPI\n # Putting these exact fields into HTTPI fails and this works correctly so...\n url = \"#{@credential.sentinelone_url}#{ANALYST_VERDICT_URL}#{@action}\"\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Authorization\"] = \"ApiToken #{@credential.access_token}\"\n body = { \"filter\" => { \"ids\" => [@app_result.details.id] } }\n request.body = JSON.dump(body)\n req_options = { use_ssl: uri.scheme == \"https\" }\n\n resp = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n resp\n end",
"def write_git_commiter_details(full_name, email)\n if full_name.empty? and email.empty?\n creds = {'optout' => true}\n else\n creds = {'full_name' => full_name, 'email' => email}\n end\n File.open(@vagrant_git_commiter_details, 'w') do |f|\n f.write(JSON.dump(creds))\n end\n end",
"def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expire_time = args[:expire_time] if args.key?(:expire_time)\n end",
"def update!(**args)\n @legacy_unique_id = args[:legacy_unique_id] if args.key?(:legacy_unique_id)\n @upload_metadata = args[:upload_metadata] if args.key?(:upload_metadata)\n end",
"def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @phone_enrollment_info = args[:phone_enrollment_info] if args.key?(:phone_enrollment_info)\n @tenant_id = args[:tenant_id] if args.key?(:tenant_id)\n @totp_enrollment_info = args[:totp_enrollment_info] if args.key?(:totp_enrollment_info)\n end",
"def set_meta_headers(headers)\n @logger.info \"Setting #{headers.keys.join(', ')} for tenant #{@fog_options[:hp_tenant_id]}...\"\n response = @connection.request({\n :method => 'POST',\n :headers => headers\n })\n\n # Confirm meta data changes\n response = @connection.request({\n :method => 'HEAD'\n })\n\n @logger.info \"Done setting account meta key.\"\n end",
"def update\n authorize [:api, :v1, @requesting_object]\n ticket = ServiceTicket.where(\n client_key: params['avatar_key'],\n id: params['id']\n ).first\n if params['comment_text']\n ticket.comments << Comment.new(author: params['avatar_name'],\n text: params['comment_text'])\n end\n ticket.update(status: params['status']) if params['status']\n render json: { message: 'OK' }, status: :ok\n end",
"def update!(**args)\n @click_tracking_id = args[:click_tracking_id] if args.key?(:click_tracking_id)\n @uploader_channel_id = args[:uploader_channel_id] if args.key?(:uploader_channel_id)\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_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end"
] | [
"0.540576",
"0.53994876",
"0.5268931",
"0.52506155",
"0.52359056",
"0.52315164",
"0.5205049",
"0.5192182",
"0.51643455",
"0.51627517",
"0.5141517",
"0.5140408",
"0.5091574",
"0.5076165",
"0.5075412",
"0.5070239",
"0.50637466",
"0.5051737",
"0.50487304",
"0.5031082",
"0.49848428",
"0.49842492",
"0.49827364",
"0.4979794",
"0.4977636",
"0.49708778",
"0.49586725",
"0.49467856",
"0.49377543",
"0.49377543",
"0.49195027",
"0.49138957",
"0.4906092",
"0.48922873",
"0.48891437",
"0.4888502",
"0.48727706",
"0.48621064",
"0.4860831",
"0.48524585",
"0.4847817",
"0.48436764",
"0.4827793",
"0.48151803",
"0.48001266",
"0.47969627",
"0.479523",
"0.47928205",
"0.47913253",
"0.4790101",
"0.47896278",
"0.47885382",
"0.4779633",
"0.47794396",
"0.4773238",
"0.47717357",
"0.47622404",
"0.47613868",
"0.47590685",
"0.47587472",
"0.47549814",
"0.47477803",
"0.47372022",
"0.4737132",
"0.47359133",
"0.4733733",
"0.4731794",
"0.4731705",
"0.4728334",
"0.4726374",
"0.47188836",
"0.47175112",
"0.47151166",
"0.4707331",
"0.47047427",
"0.47034654",
"0.4703134",
"0.47025922",
"0.46992728",
"0.4698726",
"0.46968377",
"0.46968377",
"0.46956927",
"0.46928293",
"0.46911544",
"0.46891823",
"0.46885073",
"0.46878096",
"0.4687433",
"0.46870616",
"0.46869662",
"0.46857604",
"0.46832752",
"0.46750987",
"0.4670644",
"0.4670468",
"0.4667354",
"0.46653348",
"0.4664306",
"0.46640277"
] | 0.5718332 | 0 |
Stripe agents subscription recurring payment curl XPOST H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4OCwiZXhwIjoxNTAzNTEwNzUyfQ.7zo4a8g4MTSTURpU5kfzGbMLVyYN_9dDTKIBvKLSvPo" ' | def remove_subscription
buyer = @current_user
customer_id = buyer.stripe_customer_id
customer = Stripe::Customer.retrieve(customer_id)
subscription.delete
render json: { message: 'Unsubscribed succesfully' }, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_subscription\n session[:merchant_subscription_id] = 'User' + sprintf('%03d', rand(1000)) + 'Subscription' + sprintf('%04d', rand(10000))\n\n # prepare payload\n data = {\n :Amount => params[:product] == '1' ? 1.99 : 3.99,\n :Category => 1,\n :Channel => 'MOBILE_WEB',\n :Description => 'Word game 1',\n :MerchantTransactionId => session[:merchant_subscription_id],\n :MerchantProductId => 'wordGame1',\n :MerchantPaymentRedirectUrl => settings.subscription_redirect_url,\n :MerchantSubscriptionIdList => 'sampleSubscription1',\n :IsPurchaseOnNoActiveSubscription => 'false',\n :SubscriptionRecurringNumber => '99999',\n :SubscriptionRecurringPeriod => 'MONTHLY',\n :SubscriptionRecurringPeriodAmount => 1\n }\n\n response = RestClient.post settings.notary_app_sign_url, :payload => data.to_json\n from_json = JSON.parse response\n\n redirect settings.FQDN + \"/Commerce/Payment/Rest/2/Subscriptions?clientid=#{settings.api_key}&SignedPaymentDetail=#{from_json['signed_payload']}&Signature=#{from_json['signature']}\"\nend",
"def charge_recurring_subscription(credentials, payload, subscription_plan, subscriber)\n Client.new(\n AccesstypeAdyen::CONFIG[credentials[:environment].to_sym],\n credentials\n ).charge_recurring_subscription(\n payload[:subscription][:additional_data][:dropin_state_data][:paymentMethod],\n payload[:subscription][:payment][:amount_cents],\n payload[:subscription][:payment][:amount_currency].to_s,\n credentials[:merchant_account],\n payload[:attempt_token],\n payload[:subscription][:additional_data][:return_url],\n payload[:subscription][:additional_data][:dropin_state_data][:browserInfo] ? payload[:subscription][:additional_data][:dropin_state_data][:browserInfo].to_enum.to_h : nil,\n payload[:subscription][:additional_data][:origin],\n subscriber[:id]\n )\n end",
"def generate_subscription_payload(amount, category, desc, merch_trans_id, \n merch_prod_id, merch_sub_id, \n sub_recurrances, redirect_uri, opts={})\n sub_period_amount = (opts[:sub_period_amount] || 1) \n sub_period = (opts[:sub_period] || 'MONTHLY')\n is_purchase_on_no_active_sub = (opts[:iponas] || false)\n channel = (opts[:channel] || \"MOBILE_WEB\")\n\n payload = {\n :Amount => amount,\n :Category => category,\n :Description => desc,\n :MerchantTransactionId => merch_trans_id,\n :MerchantProductId => merch_prod_id,\n :MerchantSubscriptionIdList => merch_sub_id,\n :SubscriptionRecurrences => sub_recurrances,\n :MerchantPaymentRedirectUrl => redirect_uri,\n :SubscriptionPeriodAmount => sub_period_amount,\n :SubscriptionPeriod => sub_period,\n :IsPurchaseOnNoActiveSubscription => is_purchase_on_no_active_sub,\n :Channel => channel,\n }.to_json\nend",
"def test_recurring_with_initial_authorization\n response = @gateway.recurring(1000, @credit_card, \n :periodicity => :monthly,\n :initial_transaction => {\n :type => :purchase,\n :amount => 500\n }\n )\n \n return if user_authentication_failed?(response)\n \n assert_success response\n assert !response.params['profile_id'].blank?\n assert response.test?\n end",
"def test_recurring_with_initial_authorization\n response = @gateway.recurring(1000, @credit_card, \n :periodicity => :monthly,\n :initial_transaction => {\n :type => :authorization\n }\n )\n return if user_authentication_failed?(response)\n \n assert_success response\n assert !response.params['profile_id'].blank?\n assert response.test?\n end",
"def process_payment_unlimitess\n customer = Stripe::Customer.create email: email, card: token\n update_stripe_customer_id(customer)\n Stripe::Subscription.create customer: customer.id,\n items: [\n {price: 'price_1IndU1Bje2Voz8401SdrQuM0'},\n ]\n\n# customer = Stripe::Customer.create email: email, card: token\n# Stripe::Charge.create customer: customer.id,\n# amount: 10000,\n# description: 'Premium',\n# currency: 'usd'\n end",
"def create(params)\n params.merge!(\n :order_no => (Time.now.to_f * 10000).to_i.to_s, # Produce a unique order_no - it's not used anywhere, but ePay needs this\n :amount => 0\n )\n \n post = Api.default_post_for_params(params).merge({\n :subscription => 1,\n :subscriptionname => params[:description]\n })\n \n query = Api.authorize(post)\n \n if query['accept']\n # Return the new subscriber\n subscription = new(query[\"subscriptionid\"].to_i).reload\n \n # Set (obfuscated) card number:\n subscription.card_no = query[\"tcardno\"]\n \n subscription\n else\n new(nil, 'error' => query[\"error\"])\n end\n end",
"def create_subscription(credit_card, options = {})\n\n u = self.user\n options[:order_id] = number # currently just loading a date\n options[:email] = u.email\n options[:address] = {\n :first_name => u.first_name,\n :last_name => u.last_name,\n :address1 => u.street_address1,\n :address2 => (u.street_address2 || \"\"),\n :company => (u.company || \"\"),\n :city => u.city,\n :state => u.us_state,\n :zip => u.zip,\n :country => 'United States',\n :phone => u.primary_phone\n }\n\n subscription = OrderTransaction.generate_yearly_subscription(credit_card, options)\n self.save!\n order_transactions << subscription\n\n if subscription.success?\n self.payment_captured!\n else\n self.transaction_declined!\n end\n\n subscription\n end",
"def create\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::POST_SUBSCRIPTION\n\n args.req_body = ZAPIArgs.new\n args.req_body.accountKey = SAMPLE_ACCOUNT_KEY\n args.req_body.contractEffectiveDate = '2013-02-1'\n args.req_body.termType = 'TERMED'\n args.req_body.initialTerm = '12'\n args.req_body.autoRenew = true\n args.req_body.renewalTerm = \"3\"\n args.req_body.notes = 'Test POST subscription from z-ruby-sdk'\n args.req_body.subscribeToRatePlans = []\n args.req_body.subscribeToRatePlans[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].productRatePlanId = 'ff8080811ca15d19011cdda9b0ad3b51'\n args.req_body.subscribeToRatePlans[0].chargeOverrides = []\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].productRatePlanChargeId =\n 'ff8080811ca15d19011cddad8c953b53'\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].quantity = 10\n args.req_body.invoiceTargetDate = '2013-12-31'\n args.req_body.invoiceCollect = false\n\n puts \"========== CREATE A SUBSCRIPTION ============\"\n\n begin\n @z_client.post(args) do |resp|\n ap resp\n return resp.subscriptionNumber if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end",
"def thank_you\n user = session[:user]\n user.zip = params[:zip]\n \n start_date = Date.today\n start_date += 61\n \n response = create_autorrecuring_subscription(start_date, user, params[:card_number], params[:month], params[:year], \n params[:cvc], params[:card_type], params[:city], params[:state],\n params[:billing_address_1], params[:billing_address_2])\n if response.success?\n session[:errors] = nil\n session[:user] = nil\n user.arb_subscription_id = response.subscription_id\n user.arb_status = AuthorizeNet::ARB::Subscription::Status::ACTIVE\n user.billing_information_id = user.add_billing_information(params[:fullname], params[:billing_address_1] ,\n params[:billing_address_2], params[:city], params[:state],\n params[:zip]).id\n user.save\n else\n puts \"Failed to make purchase. \" + response.response_reason_code + \" - \" + response.response_reason_text\n user.errors.clear()\n user.errors.add(:transaction, response.response_reason_text)\n session[:errors] = user.errors\n redirect_to admin_signup_step3_path\n end \n\n \n end",
"def create_stripe_subscription!\n Stripe::Subscription.create(\n customer: create_stripe_customer!,\n tax_percent: Price::DEFAULT_TAX_RATE,\n trial_from_plan: store.eligible_for_trial_subscription?,\n items: [\n {plan: stripe_plan_id},\n ],\n metadata: {store: store.name}\n )\n end",
"def subscription_params\n params.require(:subscription).permit(:paypal_customer_token, :paypal_payment_token, :paypal_recurring_profile_token,\n # Assosiations\n :account_id, :user_id, :plan_id )\n end",
"def create_subscription(payment_intent_id)\n result = ChargeBee::Subscription.create({\n plan_id: '<chargebee-plan-id>',\n auto_collection: 'on',\n payment_intent: {\n gateway_account_id: '<checkout.com-gateway-id>',\n gw_token: payment_intent_id\n }\n })\n subscription = result.subscription\n puts \"Chargebee subscription ID: #{subscription.id} created for Checkout.com payment ID: #{payment_intent_id}\"\n end",
"def make_subscription(params = {})\n plan = params.delete(:plan) || 'gold'\n {\n :current_period_end => 1308681468,\n :status => \"trialing\",\n :plan => {\n :interval => \"month\",\n :amount => 7500,\n :trial_period_days => 30,\n :object => \"plan\",\n :identifier => plan\n },\n :current_period_start => 1308595038,\n :start => 1308595038,\n :object => \"subscription\",\n :trial_start => 1308595038,\n :trial_end => 1308681468,\n :customer => \"c_test_customer\",\n :id => 's_test_subscription'\n }.merge(params)\n end",
"def recurring(money, creditcard, options = {})\r\n requires!(options, :rebill_frequency)\r\n\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_recurring_data(request, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformPurchase(request, response)\r\n return create_response(response)\r\n end",
"def fetch_subscriptions_payment\n subscription = UserSubscription.where(id: params[:subscription_id]).first\n\n if subscription.present?\n message = subscription.get_payment_message\n #we need the payment details for the paused orders hence passing \"paused\" to this function.\n card_id = subscription.get_card(\"paused\")\n else\n flash[:error] = \"Sorry, you are not authorized for this subscription.\"\n redirect_to main_app.profile_users_path and return\n end\n\n render json: {message: message, card_id: card_id}.to_json\n end",
"def success\n if params[:reference].present?\n\n paystackObj = Paystack.new(ENV['PAYSTACK_PUBLIC_KEY'], ENV['PAYSTACK_PRIVATE_KEY'])\n\n subscriptions = PaystackSubscriptions.new(paystackObj)\n result = subscriptions.create(\n\n :customer => current_user.email,\n :plan => \"PLN_96ws6ovviw8028d\", #plan id\n :amount => 200000 #in KOBO\n\n \n )\n\n\n u = current_user\n u.subscribed = true\n u.subscription_code = code\n u.email_token = token\n u.save!\n \n else\n redirect_to new_subscription_path, notice: \"Error Making Payment, Try Again\"\n\n end\n end",
"def authorise_recurring_payment(attributes)\n request = authorise_recurring_payment_request(attributes)\n execute_request(request)\n end",
"def purchase\n\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n \n #create_card_transaction(action: \"purchase\", amount: price_in_cents, response: response)\n \n #@registration.update_attribute(:purchased_at, Time.now) if response.success?\n #response.success?\n end",
"def paypal_checkout_recurring\n description = \"Pay to buy this domain.\"\n description += \"Domain: \" + (session['domain']['name']+\".\"+session['domain']['type']).downcase\n description += \".billing:\"\n description += \" -period: Month,\"\n description += \" -frequency: 12,\"\n description += \" -amount: \" + session['order_item']['total_price'] +\",\"\n description += \" -currency_code: USD.\"\n\n Paypal.sandbox! if PAYPAL_API[:sandbox]\n request = Paypal::Express::Request.new(\n :username => PAYPAL_API[:username],\n :password => PAYPAL_API[:password],\n :signature => PAYPAL_API[:signature]\n )\n payment_request = Paypal::Payment::Request.new(\n :currency_code => :USD, # if nil, PayPal use USD as default\n :billing_type => :RecurringPayments,\n :billing_agreement_description => description\n )\n response = request.setup(\n payment_request,\n paypal_recurring_url,\n root_url\n )\n #@my_redirect_uri = response.redirect_uri\n\n redirect_to response.redirect_uri\n end",
"def test_create_recurring_profile\n response = @gateway.recurring(1000, @credit_card, :periodicity => :monthly)\n \n return if user_authentication_failed?(response)\n \n assert_success response\n assert !response.params['profile_id'].blank?\n assert response.test?\n end",
"def initiate_charge(payload:, subscription_plan:, subscriber:)\n response = Api.charge_recurring_subscription(\n credentials,\n payload,\n subscription_plan,\n subscriber\n )\n\n if response.code.to_i == 200\n if VALID_STATUSES.include?(response['resultCode'].to_s)\n payment_fee = response['splits']&.find_all { |split| split['type'] == 'PaymentFee' }&.first\n PaymentResult.success(\n AccesstypeAdyen::PAYMENT_GATEWAY,\n payment_token: payload[:payment_token],\n payment_gateway_fee: !payment_fee.nil? ? payment_fee['amount']['value'] : nil,\n payment_gateway_fee_currency: !payment_fee.nil? ? payment_fee['amount']['currency'] || response['amount']['currency'] : nil,\n amount_currency: !response['amount'].nil? ? response['amount']['currency'].to_s : nil,\n amount_cents: !response['amount'].nil? ? response['amount']['value'] : nil,\n metadata: !response['action'].nil? ? response['action']['paymentData'] : nil,\n status: response['resultCode'],\n client_payload: response\n )\n else\n error_response(\n response['refusalReasonCode'],\n response['refusalReason'],\n response['resultCode'],\n payload[:payment_token]\n )\n end\n else\n error_response(\n response['errorCode'],\n response['message'],\n response['status'],\n payload[:payment_token]\n )\n end\n end",
"def make_payment\n payment_id = params[:payment_id]\n user_id = params[:user_id]\n offer_id = params[:offer_id]\n response = Subscription.make_payment(payment_id, user_id, offer_id)\n render json: response\n end",
"def purchase_subscription\n\t\tif self.total > 0\n\t\t\tresponse = GATEWAY.recurring(self.total, credit_card, options_recurring)\n\t\t\tOrderTransaction.create!(\t:action => \"subscription\",\n\t\t\t \t\t\t\t\t\t\t:order_id => self.id,\n\t\t\t\t\t\t\t\t\t\t:price => self.total, \n\t\t\t\t\t\t\t\t\t\t:success => response.success?, \n\t\t\t\t\t\t\t\t\t\t:reference => response.authorization,\n\t\t\t\t\t\t\t\t\t\t:message => response.message,\n\t\t\t\t\t\t\t\t\t\t:params => response.params,\n\t\t\t\t\t\t\t\t\t\t:test => response.test? \n\t\t\t\t\t\t\t\t\t\t)\n\n\t\t\tif response.success?\n\t\t\t\t#todo check the subscription_id setting\n\t\t\t\tSubscribing.create!(\t:user_id => self.user.id,\n\t\t\t\t\t\t\t\t\t\t:order_id => self.id,\n\t\t\t\t\t\t\t\t\t\t:subscription_id => self.sku.sku_items.first.item.id,\n\t\t\t\t\t\t\t\t\t\t:status => 'ActiveProfile',\n\t\t\t\t\t\t\t\t\t\t:profile_id => self.order_transaction.params[\"profile_id\"],\n\t\t\t\t\t\t\t\t\t\t:origin => 'paid',\n\t\t\t\t\t\t\t\t\t\t:trial_end_date => options_recurring[:starting_at]\n\t\t\t\t\t\t\t\t\t)\n\t\t\tend\n\n\t\t\tresponse.success?\n\t\telse\n\t\t\treturn false\t\t\n\t\tend\n\tend",
"def authorise_recurring_payment_request(attributes={})\n Adyen::REST::AuthoriseRecurringPayment::Request.new('Payment.authorise', attributes,\n response_class: Adyen::REST::AuthorisePayment::Response)\n end",
"def process_regular_subscription_payment(attributes = {})\n ::Nokogiri::XML::Builder.new(:encoding => \"utf-8\") do |xml|\n xml.send(\"soapenv:Envelope\", \"xmlns:soapenv\" => \"http://schemas.xmlsoap.org/soap/envelope/\", \"xmlns:v1\" => \"http://gpe.cz/pay/pay-ws/proc/v1\", \"xmlns:type\" => \"http://gpe.cz/pay/pay-ws/proc/v1/type\") {\n xml.send(\"soapenv:Header\")\n xml.send(\"soapenv:Body\") {\n xml.send(\"v1:processRegularSubscriptionPayment\") {\n xml.send(\"v1:regularSubscriptionPaymentRequest\") {\n xml.send(\"type:messageId\", attributes[:message_id])\n xml.send(\"type:provider\", \"0100\")\n xml.send(\"type:merchantNumber\", attributes[:merchant_number])\n xml.send(\"type:paymentNumber\", attributes[:order_number])\n xml.send(\"type:masterPaymentNumber\", attributes[:master_order_number])\n xml.send(\"type:orderNumber\", attributes[:merchant_order_number])\n xml.send(\"type:subscriptionAmount\", attributes[:amount])\n xml.send(\"type:captureFlag\", attributes[:capture_flag])\n xml.send(\"type:cardHolderData\") {\n xml.send(\"type:cardholderDetails\") {\n xml.send(\"type:name\", attributes[:card_holder_name])\n xml.send(\"type:email\", attributes[:card_holder_email])\n xml.send(\"type:phoneCountry\", attributes[:card_holder_phone_country])\n xml.send(\"type:phone\", attributes[:card_holder_phone])\n xml.send(\"type:mobilePhoneCountry\", attributes[:card_holder_mobile_phone_country])\n xml.send(\"type:mobilePhone\", attributes[:card_holder_mobile_phone])\n }\n xml.send(\"type:addressMatch\", attributes[:address_match])\n xml.send(\"type:billingDetails\") {\n xml.send(\"type:name\", attributes[:billing_name])\n xml.send(\"type:address1\", attributes[:billing_address1])\n xml.send(\"type:city\", attributes[:billing_city])\n xml.send(\"type:postalCode\", attributes[:billing_postal_code])\n xml.send(\"type:country\", attributes[:billing_country])\n }\n xml.send(\"type:shippingDetails\") {\n xml.send(\"type:name\", attributes[:shipping_name])\n xml.send(\"type:address1\", attributes[:shipping_address1])\n xml.send(\"type:city\", attributes[:shipping_city])\n xml.send(\"type:postalCode\", attributes[:shipping_postal_code])\n xml.send(\"type:country\", attributes[:shipping_country])\n }\n }\n xml.send(\"type:signature\", attributes[:digest])\n }\n }\n }\n }\n end.to_xml\n end",
"def purchase_sub_existing_card\n @plan = params[:sub][:plan] #integer corresponding to my_plan_id\n @events_number = params[:sub][:events_number]\n @code = params[:sub][:code]\n @new_price = params[:sub][:new_price]\n\n # retrieve stripe customer object yet again\n if !current_user.customer_id.blank?\n c = Stripe::Customer.retrieve(current_user.customer_id)\n end \n \n if is_valid_sub_coupon(@code) \n\n #create subscription for this customer in stripe (note that update_subscription creates a new subscription for this customer in this case)\n if has_not_trialed?\n c.update_subscription(:plan => @plan, :coupon => @code)\n else\n c.update_subscription(:plan => @plan, :trial_end => (Date.today + 1.day).to_time.to_i, :coupon => @code) \n end \n #create new subscription object in my database\n @sub = Subscription.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id, :my_plan_id => @plan, :plan_name => Plan.find_by_my_plan_id(@plan).name, :active => true)\n @sub.events_remaining = @events_number\n @sub.coupon = @code\n @sub.save \n\n #create receipt\n @r = Receipt.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id,\n :subscription_id => @sub.id, :sub_my_plan_id => @sub.my_plan_id, :sub_plan_name => @sub.plan_name,\n :sub_events_number => @sub.events_remaining, :sub_reg_monthly_cost_in_cents => Plan.find_by_my_plan_id(@sub.my_plan_id).monthly_cost_cents,\n :sub_actual_monthly_cost_in_cents => @new_price, :sub_coupon_name => @sub.coupon) \n @r.save\n\n #mail receipt\n UserMailer.sub_receipt(current_user, @r).deliver\n\n else\n #create subscription for this customer in stripe (note that update_subscription creates a new subscription for this customer in this case)\n if has_not_trialed?\n c.update_subscription(:plan => @plan)\n else\n c.update_subscription(:plan => @plan, :trial_end => (Date.today + 1.day).to_time.to_i) \n end \n #create new subscription object in my database\n @sub = Subscription.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id, :my_plan_id => @plan, :plan_name => Plan.find_by_my_plan_id(@plan).name, :active => true)\n @sub.events_remaining = @events_number\n @sub.save \n\n #create receipt\n @r = Receipt.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id,\n :subscription_id => @sub.id, :sub_my_plan_id => @sub.my_plan_id, :sub_plan_name => @sub.plan_name,\n :sub_events_number => @sub.events_remaining, :sub_reg_monthly_cost_in_cents => Plan.find_by_my_plan_id(@sub.my_plan_id).monthly_cost_cents,\n :sub_actual_monthly_cost_in_cents => @new_price, :sub_coupon_name => @sub.coupon) \n @r.save\n\n #mail receipt\n UserMailer.sub_receipt(current_user, @r).deliver\n end \n\n\n flash[:success] = \"Thank you! You are now subscribed to the #{Plan.find_by_my_plan_id(@plan).name.titleize} plan!\"\n redirect_to current_user\n\n #rescue Stripe::StripeError => e # THIS CODE WORKS!!! NEEED TO FIGURE OUT HOW EXACTLY\n # logger.error \"Stripe error while creating subscription w/o active sub for existing user with card on file (purchase_sub_existing_card)\"\n # flash[:error] = \"Something went wrong. Please try again or contact us!\"\n # redirect_to current_user\n\nend",
"def test_subscription_payment_transaction\n capt = OrderTransaction.capture(@amount, '123')\n assert capt.success\n assert_equal 'capture', capt.action\n assert_equal BogusGateway::SUCCESS_MESSAGE, capt.message\n end",
"def charge\r\n if paypal?\r\n if (@response = paypal.get_profile_details(billing_id)).success?\r\n next_billing_date = Time.parse(@response.params['next_billing_date'])\r\n if next_billing_date > Time.now.utc\r\n update_attributes(:next_renewal_at => next_billing_date, :state => 'active')\r\n subscription_payments.create(:subscriber => subscriber, :amount => amount) unless amount == 0\r\n true\r\n else\r\n false\r\n end\r\n else\r\n errors.add(:base, @response.message)\r\n false\r\n end\r\n else\r\n if amount == 0 || (@response = gateway.purchase(amount_in_pennies, billing_id)).success?\r\n update_attributes(:next_renewal_at => self.next_renewal_at.advance(:months => self.renewal_period), :state => 'active')\r\n subscription_payments.create(:subscriber => subscriber, :amount => amount, :transaction_id => @response.authorization) unless amount == 0\r\n true\r\n else\r\n errors.add(:base, @response.message)\r\n false\r\n end\r\n end\r\n end",
"def create\n\n @user = current_user\n if @user.is_admin? and not session[:express_token]\n # Make a new membership.\n @membership = Membership.new(membership_params)\n @membership.purchase_date = DateTime.now\n payment_complete = true\n else\n # Do the PayPal purchase\n payment_complete = false\n notice_message_for_user = \"Something went wrong, sorry!\"\n @user = current_user\n @membership = @user.memberships.build(:valid_from => (@user.last_membership.try(:expiry_date) or DateTime.now), :duration => session[:express_purchase_membership_duration], :purchase_date => DateTime.now)\n\n if session[:express_autodebit]\n # It's an autodebit, so set that up\n # 1. setup autodebit by requesting payment\n ppr = PayPal::Recurring.new({\n :token => session[:express_token],\n :payer_id => session[:express_payer_id],\n :amount => (session[:express_purchase_price] / 100),\n :ipn_url => \"#{payment_notifications_url}\",\n :currency => 'AUD',\n :description => session[:express_purchase_description]\n })\n response_request = ppr.request_payment\n logger.info \"XXXXXXXXXXXX\"\n logger.info response_request.to_json\n # raise \"Response denied\"\n logger.info \"XXXXXXXXXXXX\"\n\n if response_request.approved?# and response_request.completed?\n # 2. create profile & save recurring profile token\n # Set :period to :daily and :frequency to 1 for testing IPN every minute\n ppr = PayPal::Recurring.new({\n :token => session[:express_token],\n :payer_id => session[:express_payer_id],\n :amount => (session[:express_purchase_price] / 100),\n :currency => 'AUD',\n :description => session[:express_purchase_description],\n :frequency => session[:express_purchase_membership_duration], # 1,\n :period => :monthly, # :daily,\n :reference => \"#{current_user.id}\",\n :ipn_url => \"#{payment_notifications_url}\",\n :start_at => (@membership.valid_from + session[:express_purchase_membership_duration].months), # Time.now\n :failed => 1,\n :outstanding => :next_billing\n })\n\n response_create = ppr.create_recurring_profile\n if not(response_create.profile_id.blank?)\n @membership.paypal_profile_id = response_create.profile_id\n # If successful, update the user's membership date.\n # update_membership_expiry_date\n # Reset refund if they had one in the past\n @membership.refund = nil\n\n # TODO: Background task\n # TODO: Check paypal recurring profile id still valid\n # TODO: Setup future update_membership_expiry_date\n\n # Save the PayPal data to the @membership model for receipts\n save_paypal_data_to_membership_model\n payment_complete = true\n else\n # Why didn't this work? Log it.\n logger.warn \"create_recurring_profile failed: #{response_create.params}\"\n end\n else\n # Why didn't this work? Log it.\n logger.warn \"request_payment failed: #{response_request.params}\"\n notice_message_for_user = response_request.params[:L_LONGMESSAGE0]\n raise \"Request payment failed\"\n end\n else\n # It's a single purchase so make the PayPal purchase\n response = EXPRESS_GATEWAY.purchase(session[:express_purchase_price], express_purchase_options)\n\n if response.success?\n # If successful, update the user's membership date.\n # update_membership_expiry_date\n logger.info \"Paypal is happy!\"\n save_paypal_data_to_membership_model\n payment_complete = true\n else\n # The user probably hit back and refresh or paypal is broken.\n logger.info \"Paypal is sad.\"\n logger.warn response.params\n notice_message_for_user = response.message\n # redirect_to user_path(current_user), notice: response.message\n # return\n end\n end\n\n end\n\n respond_to do |format|\n if payment_complete and @membership.save\n format.html { redirect_to user_path(@user), notice: 'Membership was successfully created.' }\n format.json { render action: 'show', status: :created, location: @membership }\n else\n logger.info \"Uh oh, couldn't save.......\"\n raise \"couldn't save.\"\n format.html { render action: 'index', notice: @membership.errors }\n format.json { render json: @membership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recurring(money, creditcard, options={})\n options[:recurring] = true\n @autobill_prefix = options[:autobill_prefix] || \"A\"\n\n response = authorize(money, creditcard, options)\n return response if !response.success? || response.fraud_review?\n\n capture_resp = capture(money, response.authorization, options)\n return capture_resp if !response.success?\n\n # Setting up a recurring AutoBill requires an associated product\n requires!(options, :product_sku)\n autobill_response = check_subscription(authorize_subscription(options.merge(:product_sku => options[:product_sku])))\n\n if autobill_response.success?\n autobill_response\n else\n # If the AutoBill fails to set-up, void the transaction and return it as the response\n void_response = void(capture_resp.authorization, options)\n if void_response.success?\n return autobill_response\n else\n return void_response\n end\n end\n end",
"def create_subscription(options)\n stripe_service.create_subscription(options)\n end",
"def test_successful_purchase_with_account_set_up_and_repeat_payments\n @params[:set_up_continuous_authority] = true\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert !response.authorization.to_s.split(';')[2].blank?\n assert response.test?\n\n #Make second payment on the continuous authorization that was set up in the first purchase\n second_order_params = { :order_id => generate_unique_id }\n purchase = @gateway.purchase(201, response.params['ca_reference'], second_order_params)\n assert_success purchase\n assert purchase.test?\n end",
"def create_gocardless_subscription\n GO_CARDLESS_CLIENT.subscriptions.create(\n params: {\n amount: User::PLAN_AMOUNT.to_i,\n currency: User::GO_CARDLESS_CURRENCY,\n name: User::GO_CARDLESS_NAME,\n interval_unit: User::INTERVAL_UNIT,\n interval: 1,\n start_date: Date.current + 2.month,\n day_of_month: 1,\n links: {\n mandate: current_user.go_cardless_mandate\n }\n }\n )\n end",
"def gen_payment\n cc = @data_object\n pay = Payment.new\n pay.pay_type = Payment::CC\n pay.pay_our_ref = \"CC:\" + sprintf(\"%06d\", cc.cc_id)\n pay.pay_doc_ref = cc.cc_trans_id\n pay.pay_payor = cc.cc_payor[0, 40]\n pay.pay_amount = cc.cc_amount\n pay\n end",
"def test_successful_purchase_with_account_set_up_and_repeat_payments\n @params[:set_up_continuous_authority] = true\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert !response.authorization.to_s.split(';')[2].blank?\n assert response.test?\n\n # Make second payment on the continuous authorization that was set up in the first purchase\n second_order_params = { order_id: generate_unique_id }\n purchase = @gateway.purchase(201, response.authorization, second_order_params)\n assert_success purchase\n end",
"def subscribe\n # Find the user to pay.\n user = User.find( params[:id] )\n\n # Calculate the fee percentage that applies to\n # all invoices for this subscription.\n fee_percent = (Rails.application.secrets.fee_percentage * 100).to_i\n begin\n if user.stripe_customer_id\n customer = Stripe::Customer.retrieve(user.stripe_customer_id)\n customer.coupon = 'ahip200off'\n customer.save\n\n customer.subscriptions.create({:plan => params[:plan]})\n #customer.application_fee_percent = fee_percent\n # customer.save\n else\n # Create a customer and subscribe them to a plan\n # in one shot.\n # Normally after this you would store customer.id\n # in your database so that you can keep track of\n # the subscription status/etc. Here we're just\n # fire-and-forgetting it.\n customer = Stripe::Customer.create(\n {\n card: params[:token],\n email: current_user.email,\n plan: params[:plan],\n application_fee_percent: fee_percent,\n metadata: {name: user.name},\n # coupon: 'ahip200off',\n },\n user.secret_key\n )\n user.stripe_customer_id = customer.id\n user.save!\n\n end\n flash[:notice] = \"Subscribed! <a target='_blank' rel='app-owner' href='https://dashboard.stripe.com/test/customers/#{customer.id}'>View in dashboard »</a>\"\n\n rescue Stripe::CardError => e\n error = e.json_body[:error][:message]\n flash[:error] = \"Charge failed! #{error}\"\n end\n\n redirect_to user_path( user )\n end",
"def authorise_recurring_payment(reference:, shopper_reference:, amount:, recurring_reference: \"LATEST\", merchant_account: @merchant_account, currency: configuration.default_currency, statement: \"\")\n postJSON(\"/Payment/v12/authorise\",\n reference: reference,\n amount: { value: amount, currency: currency },\n merchantAccount: merchant_account,\n shopperReference: shopper_reference,\n shopperStatement: statement,\n selectedRecurringDetailReference: recurring_reference,\n selectedBrand: \"\",\n recurring: { contract: \"RECURRING\" },\n shopperInteraction: \"ContAuth\"\n )\n end",
"def subscription_params\n params.permit(:stripeEmail, :stripeToken, :plan, :interval)\n end",
"def subscription_params\n params.require(:subscription).permit(:user_id, :plan_id, :last_4, :card_type, :coupon_id, :stripe_card_token)\n end",
"def payment\n # FIXME: please constantize the step numbers!\n @step = 5\n session[:step] = 5 if (session[:step].nil? || session[:step] < 5)\n @tipsters = Tipster.where(id: tipster_ids_in_cart)\n unless current_subscriber.subscription.present?\n @subscription = current_subscriber.build_subscription(plan_id: session[:plan_id])\n else\n @subscription = current_subscriber.subscription\n end\n @subscription.tipsters = @tipsters unless current_subscriber.already_has_subscription?\n @subscription.plan = selected_plan\n @subscription.using_coupon = true if using_coupon?\n @subscription.active = false\n @subscription.save\n @subscription.set_primary(tipster_ids_in_cart.first.to_i)\n\n if request.post?\n if params[:is_one_shoot] == \"true\"\n @subscription.update_attributes(is_one_shoot: true)\n elsif params[:is_one_shoot] == \"false\"\n @subscription.update_attributes(is_one_shoot: false)\n end\n if params[:method] == Payment::BY_PAYPAL\n ret = @subscription.generate_paykey\n if ret[:success]\n paykey = ret[:paykey]\n @paypal = {\n amount: \"%05.2f\" % @subscription.calculator_price,\n currency: \"EUR\",\n item_number: current_subscriber.id,\n paykey: paykey,\n item_name: \"TIPSTER HERO SUBSCRIPTION\"\n }\n respond_to do |format|\n format.js { render 'paypalinit.js.haml' }\n end\n else\n logger = Logger.new('log/payment_error.log')\n logger.info(\"CREATE PAYKEY FAILER\")\n logger.info(ret[:message])\n render js: 'window.location = '/''\n end\n else\n puts \"FRENCH BANK HERE\"\n end\n end\n\n end",
"def purchase_sub_new_card\n token = params[:stripeToken]\n @plan = params[:plan] #integer corresponding to my_plan_id\n @events_number = params[:events_number] \n @code = params[:code]\n @new_price = params[:new_price]\n\n if update_card_and_new_subscription(token, @plan, @code)\n c = Stripe::Customer.retrieve(current_user.customer_id)\n \n #create new subscription object in my database\n @sub = Subscription.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id, :my_plan_id => @plan, :plan_name => Plan.find_by_my_plan_id(@plan).name, :active => true)\n @sub.events_remaining = @events_number\n @sub.coupon = @code \n @sub.save \n\n #create receipt\n @r = Receipt.new(:user_id => current_user.id, :email => current_user.email, :customer_id => c.id,\n :subscription_id => @sub.id, :sub_my_plan_id => @sub.my_plan_id, :sub_plan_name => @sub.plan_name,\n :sub_events_number => @sub.events_remaining, :sub_reg_monthly_cost_in_cents => Plan.find_by_my_plan_id(@sub.my_plan_id).monthly_cost_cents,\n :sub_actual_monthly_cost_in_cents => @new_price, :sub_coupon_name => @sub.coupon) \n @r.save\n\n #mail receipt\n UserMailer.sub_receipt(current_user, @r).deliver\n\n flash[:success] = \"Thank you for subscribing to the #{Plan.find_by_my_plan_id(@plan).name.titleize} plan!\"\n redirect_to current_user\n\n else\n redirect_to purchase_sub_existing_path\n end \n\n\nend",
"def test_successful_purchase_encryption_credit_card_recurring_webhook_metadata\n test_successful_purchase_credit_card_recurring_webhook_metadata(true)\n end",
"def create\n # retrieve the request's body and parse it as JSON\n event_json = JSON.parse(request.body.read) \n\n # for extra security\n parsed_params = Stripe::Event.retrieve(event_json['id'])\n \n # worked\n # parsed_params = Stripe::Event.retrieve(\"evt_kMHeF9JmNG0nNx\")\n \n \n if Subscription.where(:stripe_customer_token => parsed_params[\"data\"][\"object\"][\"customer\"]).exists?\n\n \n subscription = Subscription.where(:stripe_customer_token => parsed_params[\"data\"][\"object\"][\"customer\"]).first\n if parsed_params[\"type\"] == 'charge.succeeded'\n payment_notification = PaymentNotification.create!(:raw_response => parsed_params, :amount => parsed_params[\"data\"][\"object\"][\"amount\"].to_i, :status => parsed_params[\"type\"], :plan_id => subscription.plan_id, :user_id => subscription.user_id, :stripe_id => parsed_params[\"id\"])\n Notifier.recurring_pledge_user(payment_notification).deliver\n elsif parsed_params[\"type\"] == 'charge.failed'\n payment_notification = PaymentNotification.create!(:raw_response => parsed_params, :amount => parsed_params[\"data\"][\"object\"][\"amount\"].to_i, :status => parsed_params[\"type\"], :plan_id => subscription.plan_id, :user_id => subscription.user_id, :stripe_id => parsed_params[\"id\"])\n Notifier.recurring_payment_failed_us(payment_notification).deliver\n Notifier.recurring_payment_failed_user(payment_notification).deliver\n elsif parsed_params[\"type\"] == 'charge.disputed'\n payment_notification = PaymentNotification.create!(:raw_response => parsed_params, :amount => parsed_params[\"data\"][\"object\"][\"amount\"].to_i, :status => parsed_params[\"type\"], :plan_id => subscription.plan_id, :user_id => subscription.user_id, :stripe_id => parsed_params[\"id\"])\n Notifier.payment_disputed_us(payment_notification).deliver\n # TODO: send an email to the user and maybe the artist too\n elsif parsed_params[\"type\"] == 'customer.subscription.deleted'\n #turns out this block doesn't get called because the subscription is already deleted at this point and customer ID isn't found\n payment_notification = PaymentNotification.create!(:raw_response => parsed_params, :amount => parsed_params[\"data\"][\"object\"][\"plan\"][\"amount\"].to_i, :status => parsed_params[\"type\"], :plan_id => subscription.plan_id, :user_id => subscription.user_id, :stripe_id => parsed_params[\"id\"])\n # Notifier.subscription_deleted_us(payment_notification).deliver\n # TODO: send confirmation to the user and maybe an update to the artist\n else\n # unrecognized event\n PaymentNotification.create!(:raw_response => parsed_params, :status => parsed_params[\"type\"], :plan_id => subscription.plan_id, :user_id => subscription.user_id, :stripe_id => parsed_params[\"id\"])\n end\n \n else\n # user not found\n if parsed_params[\"type\"] == 'customer.created' || parsed_params[\"type\"] == 'customer.subscription.deleted'\n # these are common reasons why the user might not be found on the webhook\n payment_notification = PaymentNotification.create!(:raw_response => parsed_params, :status => parsed_params[\"type\"], :stripe_id => parsed_params[\"id\"])\n else\n # get notified of any weird reasons why a user isn't found\n payment_notification = PaymentNotification.create!(:raw_response => parsed_params, :status => parsed_params[\"type\"], :stripe_id => parsed_params[\"id\"])\n Notifier.user_not_found_us(payment_notification).deliver\n end\n end\n \n render :nothing => true\n \n \n end",
"def stripe_subscription_params\n params.require(:stripe_subscription).permit(:event_order_id, :stripe_token, :amount)\n end",
"def payment\n {\n :credit_card => credit_card\n }\n end",
"def subscription_payment\n\n\n @sub = Subscription.where(return_token: params[:id]).first\n\n @amount = 0\n if @sub.subscription_type = \"Standard\"\n @amount = 3\n end\n \n if @sub.subscription_type = \"Pro\"\n @amount = 5\n end\n\n if @sub.subscription_type = \"Enterprise\"\n @amount = 10\n end\n\n @sub.payment_status = \"Paid\"\n @sub.save\n\n @sub_payment = SubscriptionPayment.new\n @sub_payment.subscription_type = @sub.subscription_type\n @sub_payment.amount = @amount\n @sub_payment.date_from = @sub.date_from\n @sub_payment.date_to = @sub.date_to\n @sub_payment.payment_for = \"Subscription\"\n @sub_payment.subscription_id = @sub.id\n @sub_payment.payment_date = Date.today\n\n @sub_payment.save\n\n redirect_to :controller => 'backend', :action => 'dashboard'\n\n end",
"def create_recurring_contract(encrypted_card:, reference:, shopper:, merchant_account: @merchant_account, currency: @currency)\n postJSON(\"/Payment/v12/authorise\",\n reference: reference,\n additionalData: { \"card.encrypted.json\": encrypted_card },\n amount: { value: 0, currency: currency },\n merchantAccount: merchant_account,\n shopperEmail: shopper[:email],\n shopperIP: shopper[:ip],\n shopperReference: shopper[:reference],\n recurring: { contract: \"RECURRING\" }\n )\n end",
"def subscription_params\n params.require(:subscription).permit(:stripe_plan_id,\n :cancel_at_period_end, :quantity, :sub_start, :sub_end, :status,\n :canceled_at, :current_period_start, :current_period_end,\n :ended_at, :trial_start, :trial_end, :coupon_code)\n end",
"def test_create_and_cancel_recurring_profile\n response = @gateway.recurring(1000, @credit_card, :periodicity => :monthly)\n \n return if user_authentication_failed?(response)\n \n assert_success response\n assert !response.params['profile_id'].blank?\n assert response.test?\n \n response = @gateway.cancel_recurring(response.params['profile_id'])\n assert_success response\n assert response.test?\n end",
"def purchase\n if express_token.include?(\"paykey=AP\")\n\n else\n\n #processes payment for express payment and on site with credit card.\n response = process_purchase\n #creates a transaction to store info from express payment and paywith Credit card\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\n #cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end\n end",
"def test_successful_purchase_without_account_set_up_and_repeat_payments\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert response.authorization.to_s.split(';')[2].blank?\n end",
"def recurring(authorization, money, options={})\n post = {\n ticketId: authorization\n }\n\n add_order_id(post, options)\n add_amount(post, money ,options)\n add_currency(post, options)\n commit(:authorizeticket, post)\n end",
"def reauthorise_recurring_payment_request(attributes={})\n Adyen::REST::ReauthoriseRecurringPayment::Request.new('Payment.authorise', attributes,\n response_class: Adyen::REST::AuthorisePayment::Response)\n end",
"def test_successful_purchase_without_account_set_up_and_repeat_payments\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert response.authorization.to_s.split(';')[2].blank?\n assert response.test? \n end",
"def successful_purchase_response(refunded = false)\n <<~RESPONSE\n {\n \"id\": \"ch_test_charge\",\n \"object\": \"charge\",\n \"livemode\": false,\n \"currency\": \"jpy\",\n \"description\": \"ActiveMerchant Test Purchase\",\n \"amount\": 400,\n \"amount_refunded\": 0,\n \"customer\": null,\n \"recursion\": null,\n \"created\": 1408585273,\n \"paid\": true,\n \"refunded\": false,\n \"failure_message\": null,\n \"card\": {\n \"object\": \"card\",\n \"exp_year\": #{Time.now.year + 1},\n \"exp_month\": 11,\n \"fingerprint\": \"215b5b2fe460809b8bb90bae6eeac0e0e0987bd7\",\n \"name\": \"LONGBOB LONGSEN\",\n \"country\": \"JP\",\n \"type\": \"Visa\",\n \"cvc_check\": \"pass\",\n \"last4\": \"4242\"\n },\n \"captured\": true,\n \"expire_time\": null,\n \"fees\": [\n {\n \"object\": \"fee\",\n \"transaction_type\": \"payment\",\n \"transaction_fee\": 0,\n \"rate\": 3.25,\n \"amount\": 1300,\n \"created\": 1408585273\n }\n ]\n }\n RESPONSE\n end",
"def payment(params)\n check_token\n\n Request.perform(:post, URI.parse(Urls::PAYMENTS_URL), headers_for_other, params.to_json)\n end",
"def headers\n {\n :subject => \"Subscription Request\"\n }\n end",
"def perform_test_payment\n subscription = user.subscriptions.not_paid.first\n SubscriptionManager.new(subscription: subscription).pay if subscription\n end",
"def subscription_checkout\n\n @code = params[:couponCode]\n\n if [email protected]?\n @discount = @code\n\n if @discount.nil?\n flash[:error] = 'Coupon code is not valid or expired.'\n redirect_to pricing_path\n return\n end\n\n charge_metadata = {\n :coupon_code => @code,\n :coupon_discount => (@discount * 100).to_s + \"%\"\n }\n end\n\n charge_metadata ||= {}\n\n plan_id = params[:plan_id]\n plan = Stripe::Plan.retrieve(plan_id)\n #This should be created on signup.\n customer = Stripe::Customer.create(\n #:description => \"Customer for [email protected]\",\n :source => params[:stripeToken],\n :email => current_user.email\n )\n\n user = current_user\n user.stripe_id = customer.id\n user.subscribed = true\n user.save\n\n # Save this in your DB and associate with the user;s email\n stripe_subscription = customer.subscriptions.create(:plan => plan.id, :coupon => @discount)\n\n flash[:notice] = \"Successfully Subscribed!\"\n redirect_to '/dashboard'\n end",
"def charge!(params)\n params = {\n :amount => amount,\n :currency => currency,\n :invoice_text => invoice_text,\n :options => options\n }.merge(params)\n\n if initial_recurring?\n params = {\n :recurring_typ => 'initial',\n :recurring_frequency => 28, # monthly\n :recurring_expiry => 10.years.from_now.strftime(\"%Y/%m/%d\"), # some future date, get's autocorrected to cc expiry date by recurring_allow_expiry_correction\n :recurring_allow_expiry_correction => 1\n }.merge(params)\n elsif recurring?\n params = {\n :recurring_typ => 'sequencial'\n }.merge(params)\n end\n result = @service.reauth(params)[0]\n \n if result.status == \"SUCCESS\"\n @transaction_number = result.successDetails.retTrxNumber\n @successful = true\n return true\n else\n return false\n end\n end",
"def create_subscription(sender)\n PsegRecurring::Subscription.new(@credentials).send_subscription(sender)\n end",
"def build_recurring_request(action, options = {})\n raise StandardError, \"Invalid Automated Recurring Billing Action: #{action}\" unless RECURRING_ACTIONS.include?(action)\n\n xml = Builder::XmlMarkup.new(indent: 2)\n xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')\n xml.tag!(\"#{RECURRING_ACTIONS[action]}Request\", xmlns: AUTHORIZE_NET_ARB_NAMESPACE) do\n add_merchant_authentication(xml)\n # Merchant-assigned reference ID for the request\n xml.tag!('refId', options[:ref_id]) if options[:ref_id]\n send(\"build_#{action}_subscription_request\", xml, options)\n end\n end",
"def initiate_charge(payload:, subscription_plan:, subscriber:)\n response = Api.charge_onetime(\n credentials,\n payload\n )\n\n if response.code.to_i == 200\n if VALID_STATUSES.include?(response['resultCode'].to_s)\n payment_fee = response['splits']&.find_all { |split| split['type'] == 'PaymentFee' }&.first\n PaymentResult.success(\n AccesstypeAdyen::PAYMENT_GATEWAY,\n payment_token: payload[:payment_token],\n payment_gateway_fee: !payment_fee.nil? ? payment_fee['amount']['value'] : nil,\n payment_gateway_fee_currency: !payment_fee.nil? ? payment_fee['amount']['currency'] || response['amount']['currency'] : nil,\n amount_currency: !response['amount'].nil? ? response['amount']['currency'].to_s : nil,\n amount_cents: !response['amount'].nil? ? response['amount']['value'] : nil,\n metadata: !response['action'].nil? ? response['action']['paymentData'] : nil,\n status: response['resultCode'],\n client_payload: response\n )\n else\n error_response(\n response['refusalReasonCode'],\n response['refusalReason'],\n response['resultCode'],\n payload[:payment_token]\n )\n end\n else\n error_response(\n response['errorCode'],\n response['message'],\n response['status'],\n payload[:payment_token]\n )\n end\n end",
"def recurring(amount, credit_card, options = {})\n options[:credit_card] = credit_card\n options[:amount] = amount\n requires!(options, :description, :start_date, :period, :frequency, :amount)\n commit 'CreateRecurringPaymentsProfile', build_create_profile_request(options)\n end",
"def stripe_subscription\n if stripe_subscription_id\n Stripe::Subscription.retrieve(stripe_subscription_id)\n end\n end",
"def save_withsubscription\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n self.stripe_card_token = customer.id\n save!\n end\n end",
"def create\n plan = params[\"payment\"][\"plan\"]\n plan=\"premium_monthly\" if plan.empty?\n stripe_token = params[:payment][:stripe_customer_token]\n cardHolderName = params[\"cardHolderName\"]\n email = params[\"payment\"][\"email\"]\n flag = false\n\n if stripe_token\n begin\n @payment = current_user.payments.new(payment_params)\n customer = current_user.do_transaction(params[:payment_type], stripe_token, plan, cardHolderName, email)\n if customer\n @payment.stripe_customer_token = customer.id\n subcripted_detail = customer.subscriptions[\"data\"][0]\n flash[:notice] = 'Card charged successfully'\n else\n flag = true\n flash[:alert] = 'Some error happened while charging you, please double check your card details'\n end\n rescue Stripe::APIError => e\n flash[:alert] = e\n flag = true\n end\n else\n flag = true\n flash[:alert] = 'You did not submit the form correctly'\n end\n\n if flag\n render new_payment_path({plan: plan, error: e})\n end\n\n respond_to do |format|\n if @payment.save\n plan = Payment.plans[plan]\n current_user.update_attributes(subscription: plan, remaining_days: -1, stripe_customer_id: customer.id, is_paid_user: true)\n NotificationMailer.monthly_subscription_email(current_user, subcripted_detail).deliver_now\n format.html { redirect_to \"/users/edit\", notice: 'Payment made successfully.'}\n format.json { render json: @payment, status: :created, location: @payment }\n end\n end\n\n end",
"def create_subscription(options)\n # Get the plan.\n plan = Stripe::Plan.retrieve(options[:plan])\n\n # Charge VAT in advance because subscription call will create and pay an invoice.\n # TK actually we need to apply VAT for invoiceitems that are pending and scheduled\n # for the next invoice.\n # Do not charge VAT if the plan or the subscription is still in trial (invoice will come later).\n vat, invoice_item = charge_vat_of_plan(plan) unless \\\n plan.trial_period_days || (options[:trial_end] && options[:trial_end] != 'now')\n\n # Start subscription.\n # This call automatically creates an invoice, always.\n subscription = customer.subscriptions.create(options)\n\n [subscription, last_invoice]\n rescue Stripe::StripeError, Stripe::CardError => e\n # Something failed in Stripe, if we already charged for VAT,\n # we need to rollback this. As we may charge twice later otherwise.\n invoice_item.delete if invoice_item\n raise e\n end",
"def subs_payment_params\n params.require(:subs_payment).permit(:subscription_id, :customer_number, :network, :payment_type, :transaction_id, :amount, :trans_type, :reference, :callback_url, :status, :trans_status, :trans_ref,:card_name,:card_email)\n end",
"def save_with_subscription\n #If user data passes validations, then call Stripe with user information\n #to get a new subscription created upon charging their card\n if valid?\n customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)\n self.stripe_customer_token = customer.id\n save!\n end\n end",
"def charge_onetime(credentials, payload)\n Client.new(\n AccesstypeAdyen::CONFIG[credentials[:environment].to_sym],\n credentials\n ).charge_onetime(\n payload[:subscription][:additional_data][:dropin_state_data][:paymentMethod],\n payload[:subscription][:payment][:amount_cents],\n payload[:subscription][:payment][:amount_currency].to_s,\n credentials[:merchant_account],\n payload[:attempt_token],\n payload[:subscription][:additional_data][:return_url],\n payload[:subscription][:additional_data][:dropin_state_data][:browserInfo] ? payload[:subscription][:additional_data][:dropin_state_data][:browserInfo].to_enum.to_h : nil,\n payload[:subscription][:additional_data][:origin]\n\n )\n end",
"def create\n @subscription = Subscription.new(subscription_params)\n\n @subscription.sub_create(current_user,subscription_params[:stripe_plan_id],subscription_params[:coupon_code])\n\n # Create a subscription with the following information:\n #\n # 1) Customer Account\n # 2) Subscription Type (GOLD, Silver, etc.)\n # 3) Discount Coupom (if applicable)\n\n if @subscription.save\n redirect_to @subscription, notice: 'Subscription was successfully created.'\n else\n @verrors = @subscription.errors.full_messages\n render 'new'\n end\n end",
"def test_successful_authorize_credit_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(false, true, false)\n end",
"def subscription_params\n params.require(:subscription).permit(:customer_id, :plan_id, :plan_name, :plan_price, :plan_period, :subscribe_date, :expiration_date, :shipping_address, :payment_token)\n end",
"def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end",
"def create\n customer = Stripe::Customer.create({\n :description => current_user.id,\n :email => current_user.email,\n :card => params[:stripeToken],\n })\n\n current_user.stripe_id = customer.id\n current_user.save!\n\n Stripe::Charge.create(\n :customer => current_user.stripe_id,\n :amount => 250,\n :description => 'Fantasy Rocket Monthly Subscription',\n :currency => 'usd',\n )\n\n current_user.create_subscription!\n redirect_to params[:redirect_to] || root_url, notice: \"Thanks! You're now subscribed.\"\n rescue Stripe::CardError => e\n redirect_to new_subscriptions_url, alert: e.message\n end",
"def purchase billing, number\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PUT',\r\n query_url:query_url,\r\n body:\"{\\\"billing_method\\\": #{billing.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def create(options)\n API::request(:post, 'subscription_agreements', options)\n end",
"def set_recurring_payment(params = {})\r\n @PARAM_HASH['REBILLING'] = '1'\r\n @PARAM_HASH['REB_FIRST_DATE'] = params[:reb_first_date]\r\n @PARAM_HASH['REB_EXPR'] = params[:reb_expr]\r\n @PARAM_HASH['REB_CYCLES'] = params[:reb_cycles]\r\n @PARAM_HASH['REB_AMOUNT'] = params[:reb_amount]\r\n end",
"def set_recurring_payment(params = {})\r\n @PARAM_HASH['REBILLING'] = '1'\r\n @PARAM_HASH['REB_FIRST_DATE'] = params[:reb_first_date]\r\n @PARAM_HASH['REB_EXPR'] = params[:reb_expr]\r\n @PARAM_HASH['REB_CYCLES'] = params[:reb_cycles]\r\n @PARAM_HASH['REB_AMOUNT'] = params[:reb_amount]\r\n end",
"def add_recurring_data(request, options)\r\n request.Set(RocketGate::GatewayRequest::REBILL_FREQUENCY, options[:rebill_frequency])\r\n request.Set(RocketGate::GatewayRequest::REBILL_AMOUNT, options[:rebill_amount])\r\n request.Set(RocketGate::GatewayRequest::REBILL_START, options[:rebill_start])\r\n end",
"def subscription\n @result = ChargeBee::Subscription.retrieve(@subscription_id)\n @billing_address = @result.customer.billing_address\n @country_codes = get_country_codes\n \n @shipping_address = retrieve_shipping_address(@subscription_id)\n @invoice_estimate = nil\n if @result.subscription.status != \"cancelled\" && @result.subscription.status != \"non_renewing\"\n @invoice_estimate = ChargeBee::Estimate.renewal_estimate(@subscription_id, {\"use_existing_balances\" => \"true\"}).estimate.invoice_estimate\n end\n \n @subscription_status = subscription_status()[@result.subscription.status]\n end",
"def test_successful_purchase_encryption_credit_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(true)\n end",
"def create_subscription(options)\n # This call automatically creates an invoice, always.\n Stripe::Subscription.create({\n customer: customer.id,\n tax_percent: calculate_vat_rate\n }.merge(options))\n end",
"def create_account_and_subscribe_single_call account_name\n contact = {\n address1: '1051 E Hillsdale Blvd',\n city: 'Foster City',\n country: 'United States',\n firstName: 'John',\n lastName: 'Smith',\n zipCode: '94404',\n state: 'CA'\n }\n #get the rate plans for the product\n product_rate_plan = get_product_rate_plans_for_product 'Medium Monthly Plan'\n myDate = DateTime.now + 10.days;\n #create an account and subscribe to a rate plan at the same time\n subscribe(\n account_name,\n contact,\n DateTime.now.strftime(\"%Y-%m-%d\"),\n myDate.strftime(\"%Y-%m-%d\"),\n product_rate_plan['id']\n )\nend",
"def registerCard\n parameters={user_id: (@current_user[\"id\"]).to_i, number: (params[:number]).to_i, amount: (params[:amount]).to_i, expiration_month: (params[:expiration_month]).to_i, expiration_year: (params[:expiration_year]).to_i}\n puts (parameters)\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.104:3003/credit_cards\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n end",
"def reauthorise_recurring_payment(attributes)\n request = reauthorise_recurring_payment_request(attributes)\n execute_request(request)\n end",
"def add_purchase(post)\n post[:capture] = 'Y'\n end",
"def test_successful_authorize_encryption_credit_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(true, true)\n end",
"def create\n # Each shop can have only one recurring charge per app. When a new recurring application charge is activated for a shop\n # that already has one, the existing recurring charge is canceled and replaced by the new charge.\n # The new recurring charge is then activated.\n\n plan_info = @subscriptions_info[params[:subscription_type]]\n local_charge = @shop.charges.create\n\n shopify_charge = ShopifyAPI::RecurringApplicationCharge.new(\n name: plan_info[\"name\"],\n price: plan_info[\"price\"],\n return_url: \"#{ENV['APP_URL']}/charges/#{local_charge.id}/activate\",\n test: plan_info[\"test\"],\n capped_amount: plan_info[\"capped_amount\"],\n terms: plan_info[\"terms\"]\n )\n if shopify_charge.save\n fullpage_redirect_to shopify_charge.confirmation_url\n else\n # make sure this works\n local_charge.delete\n # recurring charge could not be created\n end\n end",
"def test_successful_authorize_stored_card_recurring_webhook_metadata\n test_successful_purchase_credit_card_recurring_webhook_metadata(false, true, true)\n end",
"def getCardPaymentRequestTemplate\n request = getPaymentRequestTemplate\n request[:payment_method] = PaymentMethods::CARD\n request[:card] = {\n name: '',\n number: '',\n expiry_month: '',\n expiry_year: '',\n cvd: '',\n complete: true\n }\n\n request\n end",
"def as_stripe_subscription(expand = {})\n Stripe::Subscription.retrieve(\n { id: stripe_id, expand: expand }, owner.stripe_options\n )\n end",
"def stripe_customer_subscription_created(event, req)\n stripe_customer_subscription_updated(event, req)\n end",
"def subscription_params\n params.require(:subscription).permit(:payment_token, :customer_id, :product_id)\n end",
"def checkout\n setup_response = gateway.setup_authorization(100,\n :ip => request.remote_ip,\n :return_url => url_for(:action => 'process_payment'),\n :cancel_return_url => url_for(:action => 'cancel'),\n :description => \"subscription\"\n )\n redirect_to gateway.redirect_url_for(setup_response.token)\nend",
"def stripe_payment\n if params[:stripe_token].blank?\n @error = I18n.t('order.stripe_token_blank')\n render \"api/v1/shared/error\"\n return\n end\n\n begin\n if my_stripe_customer = StripeCustomer.where(:token => params[:stripe_token]).first\n my_stripe_customer.params = \"#{my_stripe_customer.params} , #{params.to_s}\"\n my_stripe_customer.save\n else\n stripe_customer = Stripe::Customer.create(\n :description => \"Customer for Pocket Prints: #{params[:name]}, email: #{params[:email]}, phone: #{params[:phone]}\",\n :card => params[:stripe_token]\n )\n\n stripe_customer_attr = {token: params[:stripe_token], stripe_id: stripe_customer.id, \n name: params[:name], email: params[:email], phone: params[:phone], customer_id: @customer.id,\n device_name: params[:device_name], os_version: params[:os_version], params: params.to_s\n }\n\n my_stripe_customer = StripeCustomer.create(stripe_customer_attr)\n\n #@customer.update_attributes({ name: params[:name], email: params[:email], phone: params[:phone] })\n end\n\n @charge = Stripe::Charge.create(\n :customer => my_stripe_customer.stripe_id,\n :amount => (params[:amount].to_f * 100).to_i,\n :description => \"Payment for Pocket Prints order of Customer: #{params[:name]}, email: #{params[:email]}, phone: #{params[:phone]}\",\n :currency => \"AUD\"\n )\n\n rescue Exception => e\n Airbrake.notify_or_ignore(e) if defined?(Airbrake) && Rails.env.production?\n @error = e.message\n my_stripe_customer.update_attributes({error: @error}) if my_stripe_customer\n @error_code = ERROR_CODES[:stripe_paypal_error]\n \n render \"api/v1/shared/error\"\n return\n end\n end",
"def capture(params = {})\n req = WebPay::ChargeRequestWithAmount.create(params)\n raw_response = @client._request(:post, 'charges' + '/' + req.id.to_s + '/' + 'capture', req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def transact\n get_subscription\n token = params[:stripe_token] || raise('Can not transact without stripe token')\n plan = Plan.find(params[:payment][:plan_id])\n \n cs = Ripple::Subscription::CompanySubscription.new(@subscription)\n new_subscription = cs.change_stripe_plan(plan.name, token)\n flash[:notice] = \"Customer was charged, and subscription upgraded.\"\n redirect_to admin_company_path(@company)\n end",
"def create_recurring_with_http_info(sbp_recurring_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VApi#create_recurring ...\"\n end\n \n # verify the required parameter 'sbp_recurring_request' is set\n fail \"Missing the required parameter 'sbp_recurring_request' when calling create_recurring\" if sbp_recurring_request.nil?\n \n # resource path\n path = \"/v1/recurring/create\".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']\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/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(sbp_recurring_request)\n \n\n auth_names = []\n data, status_code, headers = @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 => 'SbpResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VApi#create_recurring\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] | [
"0.672462",
"0.65684134",
"0.6528255",
"0.64397657",
"0.6291405",
"0.6224515",
"0.6172476",
"0.6158918",
"0.6122615",
"0.61010516",
"0.60559887",
"0.6049334",
"0.60405326",
"0.6034719",
"0.60239387",
"0.6019898",
"0.60170716",
"0.60159814",
"0.60136545",
"0.5983511",
"0.5975866",
"0.59707683",
"0.5967811",
"0.5965199",
"0.5957381",
"0.59511447",
"0.5946084",
"0.59381783",
"0.59314346",
"0.5894051",
"0.5888195",
"0.5880848",
"0.5870947",
"0.58603764",
"0.5857166",
"0.5854887",
"0.5853512",
"0.5833405",
"0.58188766",
"0.5792572",
"0.578306",
"0.5779727",
"0.5771467",
"0.5770494",
"0.576461",
"0.5745378",
"0.57447106",
"0.57368207",
"0.5734652",
"0.5733307",
"0.57236713",
"0.5715502",
"0.57061553",
"0.5700556",
"0.5698509",
"0.5684725",
"0.5676594",
"0.5663918",
"0.56628966",
"0.56573623",
"0.56569105",
"0.56523126",
"0.5651956",
"0.56513244",
"0.5642127",
"0.5640416",
"0.5639345",
"0.5630408",
"0.5620704",
"0.56186604",
"0.5617751",
"0.5616582",
"0.56070626",
"0.5597928",
"0.5587135",
"0.5584222",
"0.5583676",
"0.55829036",
"0.5581758",
"0.5579385",
"0.5579385",
"0.5576538",
"0.5575111",
"0.55636895",
"0.55527145",
"0.55511045",
"0.5545484",
"0.55382675",
"0.553663",
"0.55312526",
"0.55233794",
"0.55206037",
"0.5520216",
"0.5517053",
"0.55039334",
"0.55022",
"0.55020535",
"0.5491158",
"0.5488221",
"0.5483691",
"0.54805785"
] | 0.0 | -1 |
Info about the premium charges monthly curl XGET ' | def info_premium
render json: { value: (PropertyBuyer::PREMIUM_COST*100) }, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credits\n return nil unless have_key?\n url = \"/v1/credits\"\n #Hashie::Mash.new(\n self.class.post(url, :headers => headers_for(url)).parsed_response\n end",
"def show(charge_token)\n api_response(api_get(\"#{PATH}/#{charge_token}\"))\n end",
"def billing\n request('billing', :get)\n end",
"def charges(company_number, items_per_page = nil, start_index = nil)\n params = {}\n if items_per_page\n params[:items_per_page] = items_per_page\n end\n if start_index\n params[:start_index] = start_index\n end\n client.get(\"company/#{company_number}/charges/\", params)\n end",
"def fetchInstallations(token)\n url = URI(\"https://api.acceptance.hertekconnect.nl/api/v1/installations\")\n\n http = Net::HTTP.new(url.host, url.port);\n http.use_ssl = true\n request = Net::HTTP::Get.new(url)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Authorization\"] = \"Bearer #{token}\"\n\n response = http.request(request)\n puts response.read_body\nend",
"def pricing\n request('pricing', :get)\n end",
"def cost(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:cost),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def monthly_active(options = {})\n request_model = @request_model_factory.monthly_active_request_model(options)\n response = @network_client.perform_request(request_model)\n parse_point_response(response)\n end",
"def billing\n user_agent = request.env['HTTP_USER_AGENT']\n billing_request_body = Billing.request_body(@session)\n parameter = Parameter.first\n\n request = Typhoeus::Request.new(parameter.billing_url, followlocation: true, body: billing_request_body, headers: {Accept: \"text/xml\", :'Content-length' => billing_request_body.bytesize, Authorization: \"Basic base64_encode('NGSER-MR2014:NGSER-MR2014')\", :'User-Agent' => user_agent})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n #response_body\n #@xml = Nokogiri.XML(Billing.response_body).xpath('//methodResponse//params//param//value//struct//member')\n @xml = Nokogiri.XML(result).xpath('//methodResponse//params//param//value//struct//member') rescue nil\n #render text: Billing.response_body.bytesize\n end",
"def get_openexchangerates(currency_code,base_code,key)\n # this is tested as working and so far is seen as the best in the lot \n # this one when free will only do lookups compared to USD, also limits to 1000 lookup per month so only 1 per hour\n # at $12/month Hourly Updates, 10,000 api request/month\n # at $47/month 30-minute Updates, 100,000 api request/month\n # at $97/month 10-minute Updates, unlimited api request/month + currency conversion requests\n # does lookup more than one currency at a time\n #https://openexchangerates.org/api/latest.json?app_id=xxxxxxx\n # see: https://openexchangerates.org/\n # example usage:\n # result = get_openexchangerates(\"THB\",\"JPY\", openexchangerates_key)\n # puts \"rate: \" + result[\"rate\"].to_s ; rate: 2.935490234019467\n #\n # inputs: \n # currency_code: the currency code to lookup example THB\n # base_code: the currency base to use in calculating exchange example USD or THB or BTC\n # key: the api authentication key obtained from https://openexchangerates.org\n #\n # return results:\n # rate: the calculated rate of exchange\n # timestamp: time the rate was taken in seconds_since_epoch_integer format (not sure how accurate as the time is the same for all asset currency)\n # datetime: time in standard human readable format example: 2016-09-15T08:00:14+07:00\n # base: the base code of the currency being calculated example USD\n # example if 1 USD is selling for 34.46 THB then rate will return 34.46 for base USD\n # example#2 if 1 USD is selling for 101.19 KES then rate will return 101.19 for base of USD\n # example#3 with the same values above 1 THB is selling for 2.901 KES so rate will return 2.901 for base of KES \n puts \"get_openexchangerates started\"\n url_start = \"https://openexchangerates.org/api/latest.json?app_id=\"\n url_end = \"\"\n send = url_start + key\n #puts \"sending: #{send}\"\n begin\n #postdata = RestClient.get send , { :Accept => '*/*', 'accept-encoding' => \"gzip, deflate\", :user_agent => \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0\"}\n postdata = RestClient.get send , { :Accept => '*/*', 'accept-encoding' => \"gzip, deflate\"}\n rescue => e\n puts \"fail in get_openexchangerate at RestClient.get error: #{e}\"\n data_out = {}\n data_out[\"service\"] = \"openexchangerates.org\"\n data_out[\"status\"] = \"fail\"\n return data_out\n end\n #puts \"postdata: \" + postdata\n data = JSON.parse(postdata)\n data_out = {}\n data_out[\"status\"] = \"pass\"\n if (base_code == \"USD\")\n #defaults to USD\n data_out[\"currency_code\"] = currency_code\n data_out[\"base\"] = base_code\n data_out[\"datetime\"] = Time.at(data[\"timestamp\"]).to_datetime.to_s\n #date[\"rate\"] = data[\"rates\"][currency_code]\n data_out[\"rate\"] = (data[\"rates\"][currency_code]).to_s\n data_out[\"ask\"] = data_out[\"rate\"]\n data_out[\"bid\"] = data_out[\"rate\"]\n data_out[\"service\"] = \"openexchangerates.org\"\n puts \"data_out: #{data_out}\"\n return data_out\n end\n puts \"here??\"\n usd_base_rate = data[\"rates\"][currency_code]\n base_rate = data[\"rates\"][base_code]\n rate = base_rate / usd_base_rate\n data_out[\"currency_code\"] = currency_code\n #data_out[\"rate\"] = rate.to_s\n #data_out[\"ask\"] = data_out[\"rate\"]\n #data_out[\"bid\"] = data_out[\"rate\"]\n data_out[\"rate\"] = (1.0 / rate.to_f)\n data_out[\"ask\"] = data_out[\"rate\"].to_f\n data_out[\"bid\"] = data_out[\"rate\"].to_f\n data_out[\"base\"] = base_code\n data_out[\"datetime\"] = Time.at(data[\"timestamp\"]).to_datetime.to_s\n data_out[\"service\"] = \"openexchangerates.org\"\n puts \"data_out: #{data_out}\"\n return data_out\nend",
"def get_openexchangerates(currency_code,base_code,key)\n # this is tested as working and so far is seen as the best in the lot \n # this one when free will only do lookups compared to USD, also limits to 1000 lookup per month so only 1 per hour\n # at $12/month Hourly Updates, 10,000 api request/month\n # at $47/month 30-minute Updates, 100,000 api request/month\n # at $97/month 10-minute Updates, unlimited api request/month + currency conversion requests\n # does lookup more than one currency at a time\n #https://openexchangerates.org/api/latest.json?app_id=xxxxxxx\n # see: https://openexchangerates.org/\n # example usage:\n # result = get_openexchangerates(\"THB\",\"JPY\", openexchangerates_key)\n # puts \"rate: \" + result[\"rate\"].to_s ; rate: 2.935490234019467\n #\n # inputs: \n # currency_code: the currency code to lookup example THB\n # base_code: the currency base to use in calculating exchange example USD or THB or BTC\n # key: the api authentication key obtained from https://openexchangerates.org\n #\n # return results:\n # rate: the calculated rate of exchange\n # timestamp: time the rate was taken in seconds_since_epoch_integer format (not sure how accurate as the time is the same for all asset currency)\n # datetime: time in standard human readable format example: 2016-09-15T08:00:14+07:00\n # base: the base code of the currency being calculated example USD\n # example if 1 USD is selling for 34.46 THB then rate will return 34.46 for base USD\n # example#2 if 1 USD is selling for 101.19 KES then rate will return 101.19 for base of USD\n # example#3 with the same values above 1 THB is selling for 2.901 KES so rate will return 2.901 for base of KES \n puts \"get_openexchangerates started\"\n url_start = \"https://openexchangerates.org/api/latest.json?app_id=\"\n url_end = \"\"\n send = url_start + key\n #puts \"sending: #{send}\"\n begin\n #postdata = RestClient.get send , { :Accept => '*/*', 'accept-encoding' => \"gzip, deflate\", :user_agent => \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0\"}\n postdata = RestClient.get send , { :Accept => '*/*', 'accept-encoding' => \"gzip, deflate\"}\n rescue => e\n puts \"fail in get_openexchangerate at RestClient.get error: #{e}\"\n data_out = {}\n data_out[\"service\"] = \"openexchangerates.org\"\n data_out[\"status\"] = \"fail\"\n return data_out\n end\n #puts \"postdata: \" + postdata\n data = JSON.parse(postdata)\n data_out = {}\n data_out[\"status\"] = \"pass\"\n if (base_code == \"USD\")\n #defaults to USD\n data_out[\"currency_code\"] = currency_code\n data_out[\"base\"] = base_code\n data_out[\"datetime\"] = Time.at(data[\"timestamp\"]).to_datetime.to_s\n #date[\"rate\"] = data[\"rates\"][currency_code]\n data_out[\"rate\"] = (data[\"rates\"][currency_code]).to_s\n data_out[\"ask\"] = data_out[\"rate\"]\n data_out[\"bid\"] = data_out[\"rate\"]\n data_out[\"service\"] = \"openexchangerates.org\"\n puts \"data_out: #{data_out}\"\n return data_out\n end\n puts \"here??\"\n usd_base_rate = data[\"rates\"][currency_code]\n base_rate = data[\"rates\"][base_code]\n rate = base_rate / usd_base_rate\n data_out[\"currency_code\"] = currency_code\n #data_out[\"rate\"] = rate.to_s\n #data_out[\"ask\"] = data_out[\"rate\"]\n #data_out[\"bid\"] = data_out[\"rate\"]\n data_out[\"rate\"] = (1.0 / rate.to_f)\n data_out[\"ask\"] = data_out[\"rate\"].to_f\n data_out[\"bid\"] = data_out[\"rate\"].to_f\n data_out[\"base\"] = base_code\n data_out[\"datetime\"] = Time.at(data[\"timestamp\"]).to_datetime.to_s\n data_out[\"service\"] = \"openexchangerates.org\"\n puts \"data_out: #{data_out}\"\n return data_out\nend",
"def request\n result = {}\n req_xml.blank? ? xml = '' : xml = req_xml\n doc = Hpricot.XML(xml)\n (doc/:RequestAuth/:UserPass/:User).inner_html = 'XXXXXXXX'\n (doc/:RequestAuth/:UserPass/:Password).inner_html = 'XXXXXXXX'\n result[:xml] = ErpHelper.xml2html(doc.to_s)\n result[:street] = (doc/:BillTo/:Address/:Street).inner_text\n result[:city] = (doc/:BillTo/:Address/:City).inner_text\n result[:state] = (doc/:BillTo/:Address/:State).inner_text\n result[:zip] = (doc/:BillTo/:Address/:Zip).inner_text\n result[:country] = (doc/:BillTo/:Address/:Country).inner_text\n result[:amount] = (doc/:PayData/:Invoice/:TotalAmt).inner_text\n result[:safe_cc_number] = (doc/:Tender/:Card/:CardNum).inner_text\n result[:expiration_date] = (doc/:Tender/:Card/:ExpDate).inner_text\n result[:expiration_year] = result[:expiration_date][-4,2]\n result[:expiration_month] = result[:expiration_date][-2,2]\n return result\n end",
"def show_page_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @show_crypto = JSON.parse(@response)\n end",
"def getAccountInfo()\n tokens = session['luna_token']\n result = Hash.new\n\n #get contract ids and account id/name\n endpoint_acct = \"/papi/v0/groups/\"\n endpoint_cont = \"/papi/v0/contracts/\"\n result_acct = makeGetRequest(tokens[:baseurl], endpoint_acct, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n result_cont = makeGetRequest(tokens[:baseurl], endpoint_cont, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n\n begin\n jsonObj_acct = JSON.parse(result_acct)\n jsonObj_cont = JSON.parse(result_cont)\n\n account_id = jsonObj_acct[\"accountId\"]\n account_name = jsonObj_acct[\"accountName\"]\n contracts = jsonObj_cont[\"contracts\"]\n\n result[\"account_id\"] = account_id.nil? ? \"Please allow access to PAPI\" : account_id.split(\"_\").last\n result[\"account_name\"] = account_name.nil? ? \"Please allow access to PAPI\" : account_name\n\n if not contracts.nil?\n arr_contracts = Array.new\n contracts[\"items\"].each do |each_contract|\n contract_id = each_contract[\"contractId\"].split(\"_\").last\n arr_contracts.push({\"contractId\" => contract_id})\n end\n result[\"contracts\"] = arr_contracts\n else\n result[\"contracts\"] = \"Please allow access to PAPI\"\n end\n rescue JSON::ParserError => e\n result[\"account_id\"] = \"Please allow access to PAPI\"\n result[\"account_name\"] = \"Please allow access to PAPI\"\n result[\"contracts\"] = \"Please allow access to PAPI\"\n end\n\n #get contract name. only run when there was a contract\n if result[\"contracts\"].class == Array\n endpoint_cont_name = \"/billing-usage/v1/reportSources\"\n result_cont_name = makeGetRequest(tokens[:baseurl], endpoint_cont_name, tokens[:clienttoken], tokens[:secret], tokens[:accesstoken])\n begin\n jsonObj_cont_name = JSON.parse(result_cont_name)\n if jsonObj_cont_name[\"status\"] == \"ok\" and not jsonObj_cont_name[\"contents\"].nil?\n contents = jsonObj_cont_name[\"contents\"]\n contents.each do |each_content|\n result[\"contracts\"].each do |each_contract|\n if each_contract[\"contractId\"] == each_content[\"id\"] then each_contract[\"contractName\"] = each_content[\"name\"] end\n end\n end\n else\n raise JSON::ParserError\n end\n rescue JSON::ParserError => e\n result[\"contracts\"].each do |each_contract|\n each_contract[\"contractName\"] = \"Please allow access to Billing Center API v1\"\n end\n end\n end\n return result\nend",
"def charge_bill_source bill_src_id, bill_id, amount\n url = 'https://%s:@api.omise.co/charges' % [ ENV['OMISE_SECRET_KEY'] ]\n api_uri = URI.parse(url)\n # must convert amout to satang\n data = {'amount' => (amount * 100).to_i.to_s, 'currency' => 'thb', 'source' => bill_src_id.to_s,\n 'description' => 'Charge for bill id ' + bill_id.to_s}\n puts data\n res = Net::HTTP.post_form(api_uri, data)\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n puts res.body\n JSON.parse res.body\n else\n puts res.body\n puts res.error!\n\n nil\n end\n end",
"def get_warranty(serial = \"\", proxy = \"\")\n serial = serial.upcase\n warranty_data = {}\n raw_data = open('https://selfsolve.apple.com/warrantyChecker.do?sn=' + serial.upcase + '&country=USA', :proxy => \"#{proxy}\")\n warranty_data = JSON.parse(raw_data.string[5..-2])\n\n puts \"\\nSerial Number:\\t\\t#{warranty_data['SERIAL_ID']}\\n\"\n puts \"Product Decription:\\t#{warranty_data['PROD_DESCR']}\\n\"\n puts \"Purchase date:\\t\\t#{warranty_data['PURCHASE_DATE'].gsub(\"-\",\".\")}\"\n\n unless warranty_data['COV_END_DATE'].empty?\n puts \"Coverage end:\\t\\t#{warranty_data['COV_END_DATE'].gsub(\"-\",\".\")}\\n\"\n else\n puts \"Coverage end:\\t\\tEXPIRED\\n\"\n end\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def get_current_stock_data(input)\n url = \"https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}\"\n response = RestClient.get(url)\n my_response = JSON.parse(response)\n if my_response[\"Error Message\"] == \"Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY.\" || my_response[\"Note\"] == \"Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day. Please visit https://www.alphavantage.co/premium/ if you would like to target a higher API call frequency.\"\n false\n else\n daily_stock_info = my_response[\"Time Series (Daily)\"][current_date_to_YYYYMMDD]\n end\nend",
"def billing\n user_agent = request.env['HTTP_USER_AGENT']\n #parameter = Parameter.first\n transaction_id = DateTime.now.to_i\n\n request = Typhoeus::Request.new(\"http://37.0.73.3:3778\", followlocation: true, params: {transaction_id: transaction_id, msisdn: @account.msisdn, price: \"50\"})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n return ((result.strip rescue nil) == \"1\" ? true : false)\n end",
"def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend",
"def get_xkcd(number)\n \t\t# This works too\n \t\t# JSON.parse self.class.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \t\tJSON.parse HTTParty.get(\"http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{number}\")\n \tend",
"def show\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @show_crypto = JSON.parse(@response)\n end",
"def info_request\n [:name, :symbol, :ask, :change_and_percent_change, :last_trade_date, :days_range,\n :weeks_range_52, :open, :volume, :average_daily_volume, :market_capitalization,\n :pe_ratio, :dividend_per_share, :dividend_yield, :earnings_per_share, :float_shares,\n :ebitda, :change, :close, :previous_close, :change_in_percent, :short_ratio]\n end",
"def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"def funding_info(symbol = \"fUSD\")\n authenticated_post(\"auth/r/funding/#{symbol}\").body\n end",
"def getmininginfo\n @api.request 'getmininginfo'\n end",
"def net_http_get_package_info\n thread = @thread\n timestamp = Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S\\+0000\")\n\n uri = URI(\"#{@sendsafely_url}/#{API}/package/#{@thread}/\")\n\n req = Net::HTTP::Get.new(uri)\n req['Content-Type'] = 'application/json'\n req['ss-api-key'] = @sendsafely_key_id\n req['ss-request-timestamp'] = timestamp\n req['ss-request-signature'] = OpenSSL::HMAC.hexdigest(\"SHA256\", @sendsafely_key_secret, @sendsafely_key_id+\"/#{API}/package/#{thread}\"+timestamp)\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http|\n http.request(req)\n }\n\n puts res.body\n end",
"def test_monthly_duration_products_are_present_in_summary\n activity = account_activities(:one)\n price = billing_prices(:create_one_month)\n activity.update(activity_type: 'create', price: price)\n\n response = <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <results>\n <Result Type=\"0\" Desc=\"OK\" docid=\"309902\" doctype=\"ARVE\" submit=\"Invoices\"/>\n </results>\n XML\n\n stub_request(:post, ENV['directo_invoice_url']).with do |request|\n body = CGI.unescape(request.body)\n body.include? 'month(s)'\n end.to_return(status: 200, body: response)\n\n assert_difference 'Setting.directo_monthly_number_last' do\n DirectoInvoiceForwardLegacyJob.perform_now(monthly: true, dry: false)\n end\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 get_current_stock_price(input)\n url = \"https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}\"\n response = RestClient.get(url)\n my_response = JSON.parse(response)\n if my_response[\"Error Message\"] == \"Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_DAILY.\" || my_response[\"Note\"] == \"Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day. Please visit https://www.alphavantage.co/premium/ if you would like to target a higher API call frequency.\"\n false\n else\n my_response[\"Time Series (Daily)\"][current_date_to_YYYYMMDD][\"1. open\"].to_f\n end\nend",
"def credits\n authenticated_post(\"credits\").body\n end",
"def set_prepaid_constants\n\n @atm_owner_fee = 2.50 #fee charged by ATM owners\n\n @direct_dep = false #true -- has direct depoist. Values: true or false, case doesn't matter\n @wkly_trans = 8 #number of signature transactions\n @wkly_atm_in_net = 1 #number of atm in network cash withdrawels\n @wkly_atm_out_net = 0 #number of atm out of network cash withdrawals \n @mthly_load = 1000 #average cash loaded to card\n @mthly_loads = 0 #number of loads\n @wkly_atm_inq = 0 #number of atm balance inquiries\n @calls = 0 #live customer service per month \n @prepaid_duration = 24 #numner of months keeping the card \n\n @max_wkly_purchase = 20\n @max_wkly_atm_in_net = 10 #number of atm cash withdrawels\n @max_wkly_atm_out_net = 10 #number of atm cash withdrawels \n @max_mthly_load = 4000 # total amount of cash loaded onto card\n @max_mthly_loads = 8 #number of loads\n @max_wkly_atm_inq = 10 #number of atm balance inquiries\n @max_calls = 10 #number of calls to customer service per month\n @max_prepaid_duration = 48 #length of ownership\n\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end",
"def request_token(*args)\n args_options = args.extract_options!\n uri = '/api_paynow/api_paynow.asmx/api_paynow_authentication_new'\n\n options ={\n body: {\n psbID: self.preferred_psbid, \n username: self.preferred_username, \n secureCode: self.preferred_securecode,\n inv: args_options[:invoice],\n itm: '1', \n amt: args_options[:amount],\n paypal_amt: '',\n curr_type: 'TH',\n com: '',\n method: 1,\n language: args_options[:lang],\n resp_front_url: \"#{self.preferred_domain}/orders/#{args_options[:order_id]}/checkout/paysbuy_return\",\n resp_back_url: \"#{self.preferred_domain}/paysbuy_callbacks/notify?encryted_order_number=#{self.class.encrypt args_options[:invoice]}\",\n opt_fix_redirect: 1,\n opt_fix_method: '',\n opt_name: args_options[:name],\n opt_email: args_options[:email],\n opt_mobile: '',\n opt_address: \"\",\n opt_detail: \"\"\n }\n }\n\n result = self.class.post(base_uri + uri, options)\n attempt = 0\n\n # if have got an unexpected result, try to get the correct result again\n # from API document, return result should start with '00'\n # if not start with '00' should try again (then, try 5 times)\n while(!(result.parsed_response[\"string\"] =~ /^00/) && \n (attempt <= 5)) do\n\n result = self.class.post(base_uri + uri, options)\n attempt += 1\n end\n\n result.parsed_response[\"string\"].gsub(/^00/, \"\")\n end",
"def get_charges_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChargesApi.get_charges ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ChargesApi.get_charges, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ChargesApi.get_charges, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/charges'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'GetChargesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"ChargesApi.get_charges\",\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: ChargesApi#get_charges\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def history_usd\n rest.get stats_path(:historyUSD) do |response|\n response_handler response\n end\n end",
"def get_exchange\n params_hash = {\n # Mandatory\n 'x_login' => @x_login_for_webpaystatus,\n 'x_trans_key' => @x_trans_key_for_webpaystatus,\n 'x_country' => country,\n 'x_amount' => amount\n }\n\n astro_curl(@astro_urls['exchange'], params_hash)\n end",
"def price action\n result = api_customers_command\n exchange_rate = result[:exchange_rate]\n exchange_rate.to_f\n end",
"def getinfo\n @api.request 'getinfo'\n end",
"def get_meta_year \n send_cmd(\"get_meta_year\")\n end",
"def billing\n @data[:billing]\n end",
"def get_revenue_income_msn\n year = Time.new.year\n puts \"Getting Revenue and Income for #{ticker}\"\n\n url = \"http://investing.money.msn.com/investments/stock-income-statement/?symbol=US%3a#{ticker}\"\n\n doc = open_url_or_nil(url)\n\n if doc\n tr = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['id'] == \"TotalRevenue\" }\n tr = tr.xpath('./td') if tr\n\n ni = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['id'] == \"NetIncome\" }\n ni = ni.xpath('./td') if ni\n else\n puts \"Could not open URL\"\n end\n\n # Msn gives numbers in millions, so we will multiply by 1000000\n if tr && ni\n\n (1..5).each do |i|\n # get eps for year\n is = eps.select{ |s| s.year.to_i == (year - i).to_i }.first\n\n if is\n revenue = (clean_string(tr[i].text).to_f.round * MILLION).to_s\n income = (clean_string(ni[i].text).to_f.round * MILLION).to_s\n if is.update_attributes( :revenue => revenue, :net_income => income)\n puts \"updated #{ticker} with revenue: #{revenue} and income #{income} for year #{ (year - i).to_s}\"\n end\n else\n puts \"eps not exist for #{ticker} for year #{ (year -i).to_s } and I am not going to create it\"\n end\n end\n end\n\n end",
"def options ()\n\t\tres = with_auth_query nil do |options|\n\t\t\tself.class.get('/api/v1/market/symbols', options)\n\t\tend\n\t\tcontracts = []\n\t\tres.each do |symbol|\n\t\t\tcontracts.push symbol if symbol[\"exp\"]\n\t\tend\n\t\tcontracts\n\tend",
"def getwalletinfo\n @api.request 'getwalletinfo'\n end",
"def main_page_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @coins = JSON.parse(@response)\n @my_coins = [\"XLM\", \"BTC\", \"ADA\", \"STEEM\", \"ETH\"] \n end",
"def purchase billing, number\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PUT',\r\n query_url:query_url,\r\n body:\"{\\\"billing_method\\\": #{billing.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def get(access_token)\n payload = { access_token: access_token }\n @client.post_with_auth('credit_details/get', payload)\n end",
"def set_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @lookup_crypto = JSON.parse(@response)\n @gain_loss = 0\n end",
"def getnettotals\n @api.request 'getnettotals'\n end",
"def fetch_currency_exchange_data\n Hash.from_xml(Net::HTTP.get(URI.parse(EXCHANGE_URL)))\n end",
"def gross\n unescape params['x_amount']\n end",
"def credits(params={})\n Request.new(params).credits(params)\n end",
"def premium_paid\n wizard_step(returns_lbtt_tax_npv_url) { { after_merge: :update_npv_calculation, cache_index: LbttController } }\n end",
"def bytestotal\r\n\t\t\t`#{BITS::BITSADMIN} /getbytestotal {#{@id}}`\r\n\t\tend",
"def get_bs_from_msn\n\n if (balance_sheets.count >= 5) && (balance_sheets.detect{ |b| b.year == YEAR-1 } ) # no need to update\n puts \"Balance sheets for #{ticker} up to date - not going to download\"\n return true\n end\n\n url = \"http://investing.money.msn.com/investments/stock-balance-sheet/?symbol=us%3A#{ticker}&stmtView=Ann\"\n\n doc = open_url_or_nil(url)\n\n if doc\n ca = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['id'] == \"TotalCurrentAssets\" }\n ca = ca.xpath('./td') if ca\n\n ta = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['id'] == \"TotalAssets\" }\n ta = ta.xpath('./td') if ta\n\n cl = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['id'] == \"TotalCurrentLiabilities\" }\n cl = cl.xpath('./td') if cl\n\n tl = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['id'] == \"TotalLiabilities\" }\n tl = tl.xpath('./td') if tl\n\n ltd = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['id'] == \"TotalLongTermDebt\" }\n ltd = ltd.xpath('./td') if ltd\n\n bv = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['id'] == \"TotalEquity\" }\n bv = bv.xpath('./td') if bv\n else\n puts \"Could not open URL\"\n end\n\n # Msn gives numbers in millions, so we will multiply by 1000000\n if ca && cl\n #puts ca\n update_attributes!( :has_currant_ratio => true)\n\n (1..5).each do |i|\n BalanceSheet.create(:stock_id => self.id,\n :year => YEAR - i,\n :current_assets => (clean_string(ca[i].text).to_f.round * MILLION).to_s,\n :total_assets => (clean_string(ta[i].text).to_f.round * MILLION).to_s,\n :current_liabilities => (clean_string(cl[i].text).to_f.round * MILLION).to_s,\n :total_liabilities => (clean_string(tl[i].text).to_f.round * MILLION).to_s,\n :long_term_debt => (clean_string(ltd[i].text).to_f.round * MILLION).to_s,\n :net_tangible_assets => (( clean_string(ca[i].text).to_f - clean_string(cl[i].text).to_f ).round * MILLION ).to_s,\n :book_value => (clean_string(bv[i].text).to_f.round * MILLION).to_s )\n end\n\n else\n if ta && ltd # if could only retrive data for total assets and liabilities\n update_attributes!( :has_currant_ratio => false)\n (1..5).each do |i|\n # puts \"Adding - (total only) balance sheet for #{YEAR - i}\"\n BalanceSheet.create(:stock_id => self.id,\n :year => YEAR - i,\n :total_assets => (clean_string(ta[i].text).to_f.round * MILLION).to_s,\n :total_liabilities => (clean_string(tl[i].text).to_f.round * MILLION).to_s,\n :long_term_debt => (clean_string(ltd[i].text).to_f.round * MILLION).to_s,\n :book_value => (clean_string(bv[i].text).to_f.round * MILLION).to_s )\n end\n end\n end\n end",
"def retrieve_payment_data(pay_key)\n api.execute(:PaymentDetails, pay_key: pay_key) do |response|\n if response.success?\n response.payment_info_list.payment_info.each do |payment|\n p \"Receiver: #{payment.receiver.email}\"\n p \"Amount: #{payment.receiver.amount.to_f}\"\n p \"Transaction status: #{payment.transaction_status}\".green\n end\n else\n p \"#{response.ack_code}: #{response.error_message}\".red\n end\n return response\n end\nend",
"def gross\n unescape params['x_amount']\n end",
"def credits_left\n @options[:method] = 'GetCreditsLeft'\n response = ta_response(base_params)\n return response\n end",
"def index\n @cryptocurrencies = Cryptocurrency.all\n\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_crypto = JSON.parse(@response)\n\n @profit_loss = 0\n end",
"def top_ten\n Rails.cache.fetch('top_ten_resp', expires_in: 1.minutes) do\n conn = Faraday.new(url: @base_url) do |faraday|\n faraday.adapter(Faraday.default_adapter)\n end\n\n resp = conn.get do |req|\n req.url '/v1/cryptocurrency/listings/latest'\n req.headers['X-CMC_PRO_API_KEY'] = @api_key\n req.params['start'] = 1\n req.params['limit'] = 10\n req.params['convert'] = 'USD'\n req.params['sort'] = 'market_cap'\n req.params['sort_dir'] = 'desc'\n end\n\n raise 'Cannot parse response body' unless resp.body\n\n resp.body\n end\n end",
"def livequote(ticker)\n\tfunction = 'TIME_SERIES_INTRADAY'\n\tsymbol = ticker\n\tinterval = '1min' \n\tapikey = '4528' #provided at registration\n\turl = \"http://www.alphavantage.co/query?function=#{function}&symbol=#{symbol}&interval=#{interval}&apikey=#{apikey}\"\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tinfo = JSON.parse(response)\n\treturn info.values[1].values[0].values[3].to_f.round(2)\nend",
"def expiration_get\n @conn.get('/api/v1/backup-expiration/')\n end",
"def charge(company_number, charge_id)\n client.get(\"company/#{company_number}/charges/#{charge_id}/\")\n end",
"def getXMLTicket(path)\n resp2 = @@conn.get do |req|\n req.url path\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make this a param\n req.headers['Content-Type'] = 'application/xml'\n end\n # puts \"Responce : \" + resp2['body'].inspect\n # puts \"Responce2 : \" + resp2.body.to_s()\n \n return resp2.body.to_s()\n end",
"def request_get(token)\n url = \"https://api.spotify.com/v1/browse/new-releases?limit=2\"\n\n options = {\n headers: {\n \"Content-Type\": 'application/json',\n \"Accept\": 'application/json',\n \"Authorization\": \"Bearer #{token}\"\n }\n }\n\n return my_request = HTTParty.get(url, options)\nend",
"def get_remote_quotas\n begin\n response = @client.call(\"one.user.info\",@credentials, -1)\n xmlrpc_fault_exception\n end\n\n doc = Nokogiri::XML.parse(response[1])\n\n cpu = doc.xpath(\"//VM_QUOTA//CPU\").text\n cpu_used = doc.xpath(\"//VM_QUOTA//CPU_USED\").text\n memory = doc.xpath(\"//VM_QUOTA//MEMORY\").text\n memory_used = doc.xpath(\"//VM_QUOTA//MEMORY_USED\").text\n\n # These could be used for fixed and instance-based monitoring modes. Leaving them for possible future usage\n\n cpu = cpu.to_i * 100\n cpu_used = cpu_used.to_i * 100\n memory = memory.to_i * 1024\n memory_used = memory_used.to_i * 1024\n\n quotas = \"TOTALMEMORY=#{memory}\\n\"\n quotas << \"TOTALCPU=#{cpu}\\n\"\n # quotas << \"USEDMEMORY=0\\n\"\n # quotas << \"USEDCPU=0\\n\"\n # quotas << \"USEDMEMORY=#{memory_used}\\n\"\n # quotas << \"USEDCPU=#{cpu_used}\\n\"\n # quotas << \"FREEMEMORY=#{(memory - memory_used)}\\n\"\n # quotas << \"FREECPU=#{cpu - cpu_used}\\n\"\n end",
"def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end",
"def recurring_charges\n data.recurring_charges\n end",
"def call_api\n url = \"#{@base_uri}/stock\"\n params = {symbol: @symbol, api_token: @api_key}\n\n if @exchange\n params[:stock_exchange] = @exchange\n end\n\n Lita.logger.debug \"call_api: #{url} #{params.inspect}\"\n\n @response = RestClient.get url, {params: params}\n\n Lita.logger.debug \"response: #{@response}\"\n end",
"def index\n billing_logs = Atmosphere::BillingLog.last_year\n\n @user = Atmosphere::User.find params[:user_id] if params[:user_id]\n billing_logs = billing_logs.where(user: @user) if @user\n\n billing_logs = billing_logs.sum_currency_by_month\n billing_logs = billing_logs.group_by { |x| x[0][0] }\n\n @data_series =\n if billing_logs.present?\n billing_logs.map do |bl_currency|\n {\n name: bl_currency.first,\n data: Atmosphere::BillingLog.month_data_series(bl_currency.second)\n }\n end\n else\n [{\n name: 'No consumption',\n data: [0] * 12\n }]\n end.to_json\n\n render partial: 'atmosphere/admin/funds/billing', format: :html\n end",
"def credit\n handle_response(self.class.get(\"/credit.json\"))\n end",
"def get_ticker_tape_info \n yahoo_client = YahooFinance::Client.new\n @ticker_data = yahoo_client.quotes([\"^GSPC\", \"^IXIC\", \"CL=F\", \"GC=F\", \"EURUSD=X\"], [:last_trade_price, :change, :change_in_percent])\n respond_to do |format|\n format.json { render json: @ticker_data, status: :ok }\n format.html { @ticker_data }\n end\n end",
"def request_active_report\n begin\n #both of these return some info include the report request id..\n @active_report = @client.request_report(\"_GET_MERCHANT_LISTINGS_DATA_\").parse\n\n rescue Excon::Errors::ServiceUnavailable\n puts \"the active report had an issue\"\n sleep 2 and retry\n \n else\n puts \"The active report was requested fine\"\n end\n \n if @difference < 1800\n find_report_status_just_active\n end\n \n end",
"def xres\n get \"xres\"\n end",
"def call(url, request, xml = '', *args)\n # Alma throttles for both overall\n # requests per day as well as per second\n #\n # These are PER INSTITUTION, not per conncoection / api key\n # so even if our throttling is working we might get warnings\n # about exceeding either threshold.\n #\n # If it's the daily , we'll want to do a warning\n # and sleep for the rest of the day...\n #\n # if it's the per_second threshold, we should\n # just wait a second (and issue a warning)\n\n \n throttled_result = true\n response = nil\n while throttled_result do\n \n #header neeeds to be Authorization: apikey {APIKEY}\n request['Authorization'] = 'apikey ' + @config['api_key']\n \n response = Net::HTTP.start(url.hostname,\n url.port,\n :use_ssl => true) { | http |\n http.request( request )\n }\n \n raw_xml = response.body\n \n xml = Nokogiri::XML( raw_xml ) \n\n # see daily_threshold.xml for an example of what is returend\n # when we hit the daily threshold (not clear what http code\n # this is relative to midnight GMT\n # see concurrent_threshold.xml (also called per_second_threshold in docs) for example of taht\n # this will be returned w/ a code of 429\n\n\n # will need to investigate to see if namespace is actually returned in errors unlike some of the other stuff...\n \n # daily_threshold_xpath = '\n daily_threshold_xpath = '//ae:web_service_result'\n\n\n # since results are normally not namespaced, we may be better off just doing xml.remove_namespaces!\n # rather than trusting the docs that these are actually namespaced\n \n # check for daily limit, sleep til midnight GMT if found\n if !xml.xpath( '/ae:web_service_result/ae:errorList/ae:error/ae:errorCode[contains(text(),\"DAILY_THRESHOLD\")]',\n { 'ae' => \"http://com/exlibris/urm/general/xmlbeans\"} ).empty?\n puts \"Warning - reached daily limit for API, going to sleep\"\n sleep_till_midnight()\n \n # check for second limit, sleep till next second if found. Don't need to check body, docs say this always returns 429 if it is triggered\n elsif response.code == '429'\n puts \"Warning - reached per-second threshold, going to sleep and try again\"\n sleep(1)\n \n else\n throttled_result = false\n end\n end\n \n # for now returning response, api only cares about throttle, not errors, etc atm\n # puts \"Ok, got a response that wasn't throttled, going to return that\"\n response\n end",
"def get_monthly_usage_attribution_with_http_info(start_month, fields, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_monthly_usage_attribution ...'\n end\n # verify the required parameter 'start_month' is set\n if @api_client.config.client_side_validation && start_month.nil?\n fail ArgumentError, \"Missing the required parameter 'start_month' when calling UsageMeteringAPI.get_monthly_usage_attribution\"\n end\n # verify the required parameter 'fields' is set\n if @api_client.config.client_side_validation && fields.nil?\n fail ArgumentError, \"Missing the required parameter 'fields' when calling UsageMeteringAPI.get_monthly_usage_attribution\"\n end\n # verify enum value\n allowable_values = ['api_usage', 'api_percentage', 'apm_fargate_usage', 'apm_fargate_percentage', 'appsec_fargate_usage', 'appsec_fargate_percentage', 'apm_host_usage', 'apm_host_percentage', 'apm_usm_usage', 'apm_usm_percentage', 'appsec_usage', 'appsec_percentage', 'browser_usage', 'browser_percentage', 'ci_visibility_itr_usage', 'ci_visibility_itr_percentage', 'container_excl_agent_usage', 'container_excl_agent_percentage', 'container_usage', 'container_percentage', 'cspm_containers_percentage', 'cspm_containers_usage', 'cspm_hosts_percentage', 'cspm_hosts_usage', 'custom_timeseries_usage', 'custom_timeseries_percentage', 'custom_ingested_timeseries_usage', 'custom_ingested_timeseries_percentage', 'cws_containers_percentage', 'cws_containers_usage', 'cws_hosts_percentage', 'cws_hosts_usage', 'dbm_hosts_percentage', 'dbm_hosts_usage', 'dbm_queries_percentage', 'dbm_queries_usage', 'estimated_indexed_logs_usage', 'estimated_indexed_logs_percentage', 'estimated_ingested_logs_usage', 'estimated_ingested_logs_percentage', 'estimated_indexed_spans_usage', 'estimated_indexed_spans_percentage', 'estimated_ingested_spans_usage', 'estimated_ingested_spans_percentage', 'fargate_usage', 'fargate_percentage', 'functions_usage', 'functions_percentage', 'infra_host_usage', 'infra_host_percentage', 'invocations_usage', 'invocations_percentage', 'npm_host_usage', 'npm_host_percentage', 'obs_pipeline_bytes_usage', 'obs_pipeline_bytes_percentage', 'profiled_container_usage', 'profiled_container_percentage', 'profiled_fargate_usage', 'profiled_fargate_percentage', 'profiled_host_usage', 'profiled_host_percentage', 'snmp_usage', 'snmp_percentage', 'estimated_rum_sessions_usage', 'estimated_rum_sessions_percentage', 'universal_service_monitoring_usage', 'universal_service_monitoring_percentage', 'vuln_management_hosts_usage', 'vuln_management_hosts_percentage', 'sds_scanned_bytes_usage', 'sds_scanned_bytes_percentage', '*']\n if @api_client.config.client_side_validation && !allowable_values.include?(fields)\n fail ArgumentError, \"invalid value for \\\"fields\\\", must be one of #{allowable_values}\"\n end\n allowable_values = ['desc', 'asc']\n if @api_client.config.client_side_validation && opts[:'sort_direction'] && !allowable_values.include?(opts[:'sort_direction'])\n fail ArgumentError, \"invalid value for \\\"sort_direction\\\", must be one of #{allowable_values}\"\n end\n allowable_values = ['api_usage', 'api_percentage', 'apm_fargate_usage', 'apm_fargate_percentage', 'appsec_fargate_usage', 'appsec_fargate_percentage', 'apm_host_usage', 'apm_host_percentage', 'apm_usm_usage', 'apm_usm_percentage', 'appsec_usage', 'appsec_percentage', 'browser_usage', 'browser_percentage', 'ci_visibility_itr_usage', 'ci_visibility_itr_percentage', 'container_excl_agent_usage', 'container_excl_agent_percentage', 'container_usage', 'container_percentage', 'cspm_containers_percentage', 'cspm_containers_usage', 'cspm_hosts_percentage', 'cspm_hosts_usage', 'custom_timeseries_usage', 'custom_timeseries_percentage', 'custom_ingested_timeseries_usage', 'custom_ingested_timeseries_percentage', 'cws_containers_percentage', 'cws_containers_usage', 'cws_hosts_percentage', 'cws_hosts_usage', 'dbm_hosts_percentage', 'dbm_hosts_usage', 'dbm_queries_percentage', 'dbm_queries_usage', 'estimated_indexed_logs_usage', 'estimated_indexed_logs_percentage', 'estimated_ingested_logs_usage', 'estimated_ingested_logs_percentage', 'estimated_indexed_spans_usage', 'estimated_indexed_spans_percentage', 'estimated_ingested_spans_usage', 'estimated_ingested_spans_percentage', 'fargate_usage', 'fargate_percentage', 'functions_usage', 'functions_percentage', 'infra_host_usage', 'infra_host_percentage', 'invocations_usage', 'invocations_percentage', 'npm_host_usage', 'npm_host_percentage', 'obs_pipeline_bytes_usage', 'obs_pipeline_bytes_percentage', 'profiled_container_usage', 'profiled_container_percentage', 'profiled_fargate_usage', 'profiled_fargate_percentage', 'profiled_host_usage', 'profiled_host_percentage', 'snmp_usage', 'snmp_percentage', 'estimated_rum_sessions_usage', 'estimated_rum_sessions_percentage', 'universal_service_monitoring_usage', 'universal_service_monitoring_percentage', 'vuln_management_hosts_usage', 'vuln_management_hosts_percentage', 'sds_scanned_bytes_usage', 'sds_scanned_bytes_percentage', '*']\n if @api_client.config.client_side_validation && opts[:'sort_name'] && !allowable_values.include?(opts[:'sort_name'])\n fail ArgumentError, \"invalid value for \\\"sort_name\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/usage/monthly-attribution'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'start_month'] = start_month\n query_params[:'fields'] = fields\n query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil?\n query_params[:'sort_direction'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil?\n query_params[:'sort_name'] = opts[:'sort_name'] if !opts[:'sort_name'].nil?\n query_params[:'tag_breakdown_keys'] = opts[:'tag_breakdown_keys'] if !opts[:'tag_breakdown_keys'].nil?\n query_params[:'next_record_id'] = opts[:'next_record_id'] if !opts[:'next_record_id'].nil?\n query_params[:'include_descendants'] = opts[:'include_descendants'] if !opts[:'include_descendants'].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;datetime-format=rfc3339'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'MonthlyUsageAttributionResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_monthly_usage_attribution,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsageMeteringAPI#get_monthly_usage_attribution\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_basic_info\n yahoo_client = YahooFinance::Client.new\n @data = yahoo_client.quotes([@stock.ticker_symbol], [:open, :high, :low, :close, :last_trade_price, :change, :change_in_percent, :dividend_yield])\n respond_to do |format|\n format.json { render json: @data, status: :ok }\n format.html { @data }\n end\n url = \"https://www.quandl.com/api/v3/datasets/SF0/\" + @stock.ticker_symbol + \"_BVPS_MRY.json?api_key=rWvJtw9jPu2px-yskKZ4\"\n resp = HTTP.get(url)\n @history = JSON.parse(resp, symbolize_keys: true)\n\n end_date = Date.today\n start_date = Date.today.prev_month \n\n fred_url = \"https://api.stlouisfed.org/fred/series/observations?series_id=DGS5&api_key=d9f592689a18d841cab93825d4e060c7&file_type=json&observation_start=\" + start_date.strftime('%Y-%m-%e') + \"&observation_end=\" + end_date.strftime('%Y-%m-%e') + \"\"\n fred_resp = HTTP.get(fred_url)\n five_year_interest_rates = JSON.parse(fred_resp, symbolize_keys: true)\n interest_rate = five_year_interest_rates[\"observations\"].last[\"value\"].to_f\n\n if @history[\"dataset\"].nil?\n @derivative_fypm = \"N/A\"\n @linear_fypm = \"N/A\"\n @rate_fypm = \"N/A\"\n else\n book_values = @history[\"dataset\"][\"data\"]\n # derivative FYPM values\n v1 = book_values[3][1].to_f - book_values[4][1].to_f\n v2 = book_values[2][1].to_f - book_values[3][1].to_f\n v3 = book_values[1][1].to_f - book_values[2][1].to_f\n v4 = book_values[0][1].to_f - book_values[1][1].to_f\n @div = @data[0].dividend_yield.to_f\n price = @data[0].last_trade_price.to_f\n five_year_div_yield = ((((@div * 0.01) + 1.0) ** 5.0) - 1.0) * 100.0\n five_year_interest_rate_yield = 100 * ((((interest_rate/100) + 1) ** 5) - 1)\n # variables for derivative book value linear fit\n sigma_x = 6.0\n sigma_x_squared = 14.0\n sigma_y = v1 + v2 + v3 + v4\n sigma_xy = v2 + v3*2.0 + v4*3.0\n n = 4.0\n # derivative book value linear fit\n a = ((sigma_y*sigma_x_squared) - (sigma_x*sigma_xy))/((n*sigma_x_squared)-(sigma_x**2))\n b = ((n*sigma_xy) - (sigma_x*sigma_y))/((n*sigma_x_squared)-(sigma_x**2))\n five_year_book_value_added = (6.5*b + a)*5.0\n five_year_book_value_yield = (five_year_book_value_added/price)*100\n # derivative FYPM final calc\n @derivative_fypm = ((five_year_book_value_yield + five_year_div_yield)/five_year_interest_rate_yield)\n\n # non- derivative FYPM values\n v1 = book_values[4][1].to_f\n v2 = book_values[3][1].to_f\n v3 = book_values[2][1].to_f\n v4 = book_values[1][1].to_f\n v5 = book_values[0][1].to_f\n # variables for non-derivative book value linear fit\n sigma_x = 10.0\n sigma_x_squared = 30.0\n sigma_y = v1 + v2 + v3 + v4 + v5\n sigma_xy = v2 + v3*2.0 + v4*3.0 + v5*4.0\n n = 5.0\n # non-derivative book value linear fit\n a = ((sigma_y*sigma_x_squared) - (sigma_x*sigma_xy))/((n*sigma_x_squared)-(sigma_x**2))\n b = ((n*sigma_xy) - (sigma_x*sigma_y))/((n*sigma_x_squared)-(sigma_x**2))\n five_year_book_value_added_linear = (10.0*b + a) - v5\n five_year_book_value_added_rate = 5.0*b\n five_year_book_value_yield_linear = (five_year_book_value_added_linear/price)*100\n five_year_book_value_yield_rate = (five_year_book_value_added_rate/price)*100\n # non-derivative FYPM final calc\n @linear_fypm = ((five_year_book_value_yield_linear + five_year_div_yield)/five_year_interest_rate_yield)\n @rate_fypm = ((five_year_book_value_yield_rate + five_year_div_yield)/five_year_interest_rate_yield)\n\n # get change from previous day\n last_fypm = StockDatum.where(ticker_symbol: @stock.ticker_symbol).order(\"created_at DESC\").first\n if last_fypm.nil?\n @linear_change = nil\n @rate_change = nil\n @derivative_change = nil\n else\n @linear_change = ((@linear_fypm / last_fypm.linear_fypm ) - 1.0) * 100.0\n @rate_change = ((@rate_fypm / last_fypm.rate_fypm ) - 1) * 100\n @derivative_change = ((@derivative_fypm / last_fypm.derivative_fypm ) - 1) * 100\n end\n\n end\n end",
"def puppet_catalog_api\n {\n 2 => {\n url: \"https://#{@options[:puppet_master]}/#{@options[:branch]}/catalog/#{@node}\",\n parameters: {\n 'facts_format' => 'pson',\n 'facts' => CGI.escape(@facts.fudge_timestamp.without('trusted').to_pson),\n 'transaction_uuid' => SecureRandom.uuid\n }\n },\n 3 => {\n url: \"https://#{@options[:puppet_master]}/puppet/v3/catalog/#{@node}\",\n parameters: {\n 'environment' => @options[:branch],\n 'facts_format' => 'pson',\n 'facts' => CGI.escape(@facts.fudge_timestamp.without('trusted').to_pson),\n 'transaction_uuid' => SecureRandom.uuid\n }\n }\n }\n end",
"def exchange_info\n request :public, :get, :exchangeInfo\n end",
"def list_nightly_recharge_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NightlyRechargeApi.list_nightly_recharge ...'\n end\n # resource path\n local_var_path = '/v3/users/nightly-recharge'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NightlyRechargeApi#list_nightly_recharge\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show_single(options = {})\n\n\tif options[:open_curr] != nil\n\t\tlink = \"http://www.floatrates.com/daily/#{options[:open_curr].downcase}.xml\"\n\telse\n\t\tlink = \"http://www.floatrates.com/daily/usd.xml\"\n\tend\n\t\n\tdoc = CurrencyGetter.get_doc(link)\n\n\tparsed = RexmlDocParser.parse(doc)\n\n\tvisual = RexmlDocParser.view(parsed, options)\n\n\tif options[:limit] != nil\n\t\tvisual = visual.split(\"\\n\")[..options[:limit]].join(\"\\n\")\n\tend\n\n\tvisual\n\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 url\n response = ::RestClient.post(Pxpay::Base.pxpay_request_url, post )\n response_text = ::Nokogiri::XML(response)\n puts \"**PXPAY post**\"\n puts post.to_s\n puts \"**PXPAY response**\"\n puts response_text.to_s\n if response_text.at_css(\"Request\").attributes[\"valid\"].value == \"1\"\n url = response_text.at_css(\"URI\").inner_html\n else\n if Pxpay::Base.pxpay_user_id && Pxpay::Base.pxpay_key\n raise Pxpay::Error, response_text.at_css(\"Request\").inner_html\n else\n raise Pxpay::MissingKey, \"Your Pxpay config is not set up properly, run rails generate pxpay:install\"\n end\n end\n return URI::extract(url).first.gsub(\"&\", \"&\")\n end",
"def prepare_http_requests\n {\n label: :lyft_prices,\n url: @lyft_api_service.price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @lyft_api_service.headers \n }\n }\n end",
"def fetch_report(report_code, date_par)\n def academic_year(date_par) # converts the month/year into the academic year\n if date_par.month >= 6\n date_par.year\n else\n date_par.year-1\n end\n end\n \n uri = URI.parse(\"http://www.amion.com/cgi-bin/ocs?Lo=#{@login}&Rpt=#{report_code}\" +\n \"&Month=#{date_par.month}&year=#{academic_year( date_par )}\")\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n @report_code = report_code\n @report_raw_csv = http.request(request).body\n end",
"def show\n @net_investment = 0\n @stock = Stock.find(params[:id])\n @investments = Investment.where(stock_id: @stock.id).limit(10)\n @my_investments = Investment.where(stock_id: @stock.id, member_id: current_member.id)\n @my_investments.each do |investment|\n @net_investment += investment.share_change\n end \n @stock.price = StockQuote::Stock.quote(@stock.ticker).last_trade_price_only\n @stock.save\n require 'net/http'\n\n begin\n @url = 'http://chart.finance.yahoo.com/z?s=%{ticker}' % {ticker: @stock.ticker}\n @resp = Net::HTTP.get_response(URI.parse(@url)) # get_response takes an URI object\n rescue\n print \"Connection error.\"\n end \n end",
"def getinfo\n request :getinfo\n end",
"def getSalesReport(year, month)\n #url = sprintf('https://market.android.com/publish/salesreport/download?report_date=%04d_%02d', year, month)\n url = sprintf('https://play.google.com/apps/publish/salesreport/download?report_date=%04d_%02d&report_type=payout_report&dev_acc=%s', year, month, @dev_acc)\n try_get(url)\n return @agent.page.body\n end",
"def get_rebilling_cycle_status(rebill_id)\r\n @PARAM_HASH[\"TRANS_TYPE\"] = \"GET\"\r\n @PARAM_HASH[\"REBILL_ID\"] = rebill_id\r\n @api = \"bp20rebadmin\"\r\n end",
"def get_rebilling_cycle_status(rebill_id)\r\n @PARAM_HASH[\"TRANS_TYPE\"] = \"GET\"\r\n @PARAM_HASH[\"REBILL_ID\"] = rebill_id\r\n @api = \"bp20rebadmin\"\r\n end",
"def all(params = {})\n req = WebPay::ChargeListRequest.create(params)\n raw_response = @client._request(:get, 'charges', req)\n WebPay::ChargeResponseList.new(raw_response)\n end",
"def credits(count = 10)\n params = { command: 'account_credits', count: count }\n get('/json.php', params)\n end",
"def real_time_quote\n response = Unirest.get(\"http://www.24hgold.com/english/gold_silver_prices_charts.aspx/GetLastValue?sCurrency=USD\", \n headers: { \"Content-Type\" => \"application/json\" }, \n parameters: { :age => 23, :foo => \"bar\" })\n \n response.code # Status code\n response.headers # Response headers\n response.body # Parsed body\n response.raw_body # Unparsed body\n gold_silver_price = JSON.parse(response.raw_body)\n #puts \"from service: \" + gold_silver_price.to_s\n gold_price = gold_silver_price[\"d\"][1][0] + gold_silver_price[\"d\"][1][2..7].gsub(\",\",\".\") \n silver_price = gold_silver_price[\"d\"][6].gsub(/\\s+/,\"\").gsub(\",\",\".\")\n puts gold_price\n #puts silver_price\n [::Forecasting::Quote::from_symbol_and_price(\"GOLD\",gold_price),::Forecasting::Quote::from_symbol_and_price(\"SILVER\",silver_price)]\n end",
"def pivotal_tracker(server)\n clnt = HTTPClient.new\n clnt.get(server[:url], nil, { \"X-TrackerToken\" => server[:token] })\nend",
"def book_ticker(options)\n request :public, :get, :bookTicker, options\n end",
"def get_credit_information(member, credit_number, expiration_month, expiration_year, cvv)\n {\n :first_name => member[:first_name],\n :last_name => member[:last_name],\n :credit_card_number => credit_number,\n :expiration_month => expiration_month,\n :expiration_year => expiration_year,\n :cvv_code => cvv\n }\n end",
"def request(method, params)\n response = PARSER.xml_in(http_get(request_url(method, params)), { 'keeproot' => false,\n 'forcearray' => %w[List Campaign Subscriber Client SubscriberOpen SubscriberUnsubscribe SubscriberClick SubscriberBounce],\n 'noattr' => true })\n response.delete('d1p1:type')\n response\n end",
"def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end",
"def getex\n url = prefix + \"getex\"\n return response(url)\n end"
] | [
"0.56957513",
"0.56536996",
"0.5617652",
"0.55346733",
"0.54489124",
"0.54278827",
"0.54152215",
"0.5404938",
"0.5353512",
"0.53332824",
"0.53332824",
"0.5309007",
"0.5282927",
"0.52481157",
"0.5220851",
"0.5192615",
"0.5178005",
"0.51483846",
"0.5146838",
"0.51355654",
"0.51355654",
"0.51354325",
"0.51305455",
"0.5122978",
"0.5105721",
"0.50868756",
"0.5085202",
"0.5082112",
"0.50766224",
"0.5070944",
"0.5066143",
"0.5054277",
"0.5045573",
"0.5045573",
"0.50171083",
"0.50125563",
"0.50114673",
"0.50082356",
"0.50055295",
"0.5002486",
"0.49680996",
"0.49588487",
"0.4951512",
"0.4951191",
"0.49495643",
"0.49369955",
"0.4930687",
"0.4930189",
"0.4929489",
"0.49280256",
"0.49264902",
"0.49154297",
"0.49073246",
"0.49034134",
"0.49032485",
"0.4896685",
"0.4881098",
"0.4880997",
"0.4873326",
"0.4869503",
"0.4864078",
"0.48550493",
"0.48518407",
"0.48478216",
"0.48422235",
"0.48406583",
"0.48399094",
"0.48366177",
"0.48364815",
"0.4835046",
"0.48339516",
"0.48318774",
"0.48301363",
"0.48295698",
"0.48286626",
"0.48258367",
"0.4823164",
"0.48220807",
"0.482115",
"0.4820535",
"0.48036632",
"0.48023137",
"0.48001888",
"0.47997642",
"0.47995004",
"0.47951466",
"0.4788755",
"0.47842255",
"0.47764006",
"0.47751713",
"0.47751713",
"0.47746328",
"0.4771941",
"0.47657192",
"0.47655872",
"0.47655863",
"0.4758086",
"0.4750788",
"0.47500512",
"0.47448182"
] | 0.56641144 | 1 |
Buyer's calendar events curl XGET H "ContentType: application/json" H "Authorization: zbdxhsaba" ' | def buyer_calendar_events
buyer = @current_user
calendar_events = AgentCalendarUnavailability.where(buyer_id: buyer.id)
render json: { calendar_events: calendar_events }, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end",
"def events(param = nil)\n request = new_request Net::HTTP::Report do |request|\n request.body = CalendarQuery.new.event(param).to_xml\n end\n response = perform_request request\n \n events = []\n \n body = Nokogiri::XML.parse(response.body)\n namespaces = { 'dav' => \"DAV:\", 'caldav' => 'urn:ietf:params:xml:ns:caldav' }\n \n body.search(\"./dav:multistatus/dav:response\", namespaces).each do |element|\n calendar_data = element.search(\"./dav:propstat/dav:prop/caldav:calendar-data\", namespaces)\n calendar = Icalendar::Parser.new(calendar_data.text).parse.first\n calendar.events.each do |event|\n event.caldav = {\n :etag => element.search(\"dav:propstat/dav:prop/dav:getetag\", namespaces).text, \n :href => element.search(\"dav:href\", namespaces).text\n }\n events += calendar.events\n end\n end\n \n events\n end",
"def search_for_future_calendar_events\n uri = URI.parse(\"https://www.googleapis.com/calendar/v3/calendars/ufbobbo%40gmail.com/events?orderBy=startTime&singleEvents=true&timeMin=#{Time.now.strftime(\"%FT%T%:z\")}&fields=items(id%2Cstart)&key=#{ENV['GOOGLE_API_KEY']}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request).body\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def city_events(city)\n response = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?city=' + city + '&apikey=' + $ticket_master_api_key)\n jason_response = JSON.parse(response)\nend",
"def get_events_from_api(name)\n #make the web request\n name1 = name\n performer_link = \"https://app.ticketmaster.com/discovery/v2/events.json?keyword=#{name1}&countrycode=US&apikey=ShI4Sd340EJ32f1k6rUgkYPocLSO2qTq\"\n response_string = RestClient.get(performer_link)\n response_hash = JSON.parse(response_string)\nend",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def get_events_get(startdate,\r\n events = nil,\r\n sort = nil,\r\n enddate = nil,\r\n offset = 0,\r\n limit = 10,\r\n subject = nil,\r\n xapiheader = nil,\r\n fromaddress = nil,\r\n email = nil)\r\n # Prepare query url.\r\n _path_url = '/events'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'startdate' => startdate,\r\n 'events' => events,\r\n 'sort' => sort,\r\n 'enddate' => enddate,\r\n 'offset' => offset,\r\n 'limit' => limit,\r\n 'subject' => subject,\r\n 'xapiheader' => xapiheader,\r\n 'fromaddress' => fromaddress,\r\n 'email' => email\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise APIException.new(\r\n 'API Response',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise APIException.new(\r\n 'API Response',\r\n _context\r\n )\r\n elsif _context.response.status_code == 403\r\n raise APIException.new(\r\n 'API Response',\r\n _context\r\n )\r\n elsif _context.response.status_code == 405\r\n raise APIException.new(\r\n 'Invalid input',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def events_request(next_page_token = nil)\n params = {:calendarId => calendar_id}\n params.merge!(:pageToken => next_page_token) if next_page_token\n\n JSON.parse(client.execute(\n :api_method => calendar.events.list,\n :parameters => params).response.body)\n end",
"def state_events(state)\n api_return = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?stateCode=' + state + '&apikey=' + $ticket_master_api_key)\n JSON.parse(api_return)\nend",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def send_events_request(path_and_query_string, method, content = '')\n @connection.send(\"/calendars/#{CGI::escape @id}/events#{path_and_query_string}\", method, content)\n end",
"def index\n @events = Event.order(:time).order(:date)\n \n fetch_calendar '[email protected]'\n end",
"def get_calendars\r\n http = Net::HTTP.new(@google_url, 80)\r\n response, data = http.get(\"http://#{@google_url}/calendar/feeds/\" + @user_id, @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n redirect_response, redirect_data = http.get(response['location'], @headers)\r\n case response\r\n when Net::HTTPSuccess, Net::HTTPRedirection\r\n doc = REXML::Document.new redirect_data\r\n \t doc.elements.each('//entry')do |e|\r\n \t title = e.elements['title'].text\r\n \t url = e.elements['link'].attributes['href']\r\n \t @calendars << GCalendar.new(title, url.sub!(\"http://#{@google_url}\",''))\r\n \t end\r\n return redirect_response\r\n else\r\n response.error!\r\n end\r\n else\r\n response.error!\r\n end\r\n end",
"def calendar_list\n\t\t logger.info(\"-- get_calendar_list_responce st --\") if logger\n\t\t auth unless @auth\n\t\t uri = URI.parse(CALENDAR_LIST_PATH)\n\t\t res = do_get(uri, {})\n\t\t logger.info(\"-- get_calendar_list_responce en(#{res.message}) --\") if logger\n\t\t res\n\t\tend",
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def events\n client = Signet::OAuth2::Client.new(client_options)\n client.update!(session[:authorization])\n\n service = Google::Apis::CalendarV3::CalendarService.new\n service.authorization = client\n #controllo se non ho mai loggato con google\n if(!session[:authorization])\n client = Signet::OAuth2::Client.new(client_options)\n redirect_to client.authorization_uri.to_s\n else\n #controllo se il token è scaduto\n response = Net::HTTP.get(URI.parse('https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='+(session[:authorization].first[1])))\n if(response.split[2][1,13] == \"invalid_token\")\n client =●●●●●● Signet::OAuth2::Client.new(client_options)\n redirect_to client.authorization_uri.to_s\n else\n @event_list = service.list_events(params[:calendar_id])\n end\n end\n end",
"def test_canvas_api_studenta_upcoming_events_headers\n skip(\"verify that studenta has appropriate events\")\n refute_nil @w\n ## this requires self in url\n #request_url = \"/users/self/upcoming_events?as_user_id=sis_login_id:studenta\"\n request_url = @@dummy_host+\"/users/self/upcoming_events\"\n request_parameters = {:params => {:as_user_id => 'sis_login_id:studenta'}}\n full_request_url = RestClient::Request.new(:method => :get, :url => request_url, :headers => request_parameters).url\n #full_request_url.gsub!(/%3A/, ':')\n\n # puts \"full_request_url: #{full_request_url}\"\n result_as_json = run_and_get_ruby_result(full_request_url)\n #puts \"result: \"+result_as_json.inspect\n assert_operator result_as_json.length, \">=\", 1, \"got some upcoming events back\"\n end",
"def vendor_calendar_events\n vendor = @current_user\n calendar_events = VendorCalendarUnavailability.where(vendor: vendor.id)\n render json: { calendar_events: calendar_events }, status: 200\n end",
"def events(service, url, args)\n events = []\n ret = service.send_request(GData4Ruby::Request.new(:get, url, nil, nil, args))\n REXML::Document.new(ret.body).root.elements.each(\"entry\"){}.map do |entry|\n entry = GData4Ruby::Utils.add_namespaces(entry)\n e = GCal4Ruby::Event.new(service)\n if e.load(entry.to_s)\n events << e\n end\n end\n return events\nend",
"def calendar_events(calendar_id)\n records \"/calendars/#{calendar_id}/calendar_events.xml\", :method => :get\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def fetch_events(calendar_id)\n response = service.list_events(calendar_id,\n max_results: 5,\n single_events: true,\n order_by: \"startTime\",\n time_min: Time.now.iso8601,\n time_max: Date.today.+(1).to_time.iso8601)\n\n # filter out any declined events – they normally represent a clash or room release\n response.items.reject { |event|\n next if event.attendees.nil?\n event.attendees.all? { |attendee| attendee.response_status == \"declined\" }\n }\n end",
"def send_calendar_request(path_and_query_string, method, content = '')\n @connection.send(\"/calendars#{path_and_query_string}\", method, content)\n end",
"def get_calendar_list()\n\t\tif([email protected]?)\n\t\t\tresponse = @client.execute(api_method: @service.calendar_list.list)\n\t\t\tcalendars = JSON.parse(response.body)\n\t\telse\n\t\t\tputs \"Client No Calendar boi\"\n\t\tend\n\tend",
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def download_events(apiEngine)\n @events = []\n results = []\n results = apiEngine.client.execute!(\n :api_method => apiEngine.api.events.list,\n :parameters => {\n :calendarId => @ident,\n :singleEvents => true,\n :orderBy => 'startTime',\n :timeMin => @dateMin.iso8601,\n :timeMax => @dateMax.iso8601 })\n\n results.data.items.each do |event|\n if event.start.date_time\n fulldate = event.start.date_time.strftime(\"%B, %d, %Y\")\n month = fulldate.split(',')[0]\n day = fulldate.split(',')[1]\n year = fulldate.split(',')[2]\n else\n fulldate = event.start.date.to_s\n month = fulldate.split('-')[1].to_i\n month = I18n.t(\"date.month_names\")[month]\n day = fulldate.split('-')[2]\n year = fulldate.split('-')[0]\n end\n @events.push(Event.new(event.creator.email, year, month, day, :summary => event.summary))\n end\n end",
"def calendar_list\r\n logger.info(\"-- calendar list st --\") if logger\r\n auth unless @auth\r\n uri = URI.parse(CALENDAR_LIST_PATH)\r\n res = do_get(uri, {})\r\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\r\n res\r\n end",
"def index\n respond_with(events) do |format|\n format.ics { send_data(events_as_ical, filename: \"#{current_user.username}-#{current_instance.subdomain}-calendar.ics\", type: Mime::Type.lookup_by_extension('ics')) }\n format.json { render json: fullcalendar_events_json }\n end\n end",
"def index\n @items = Item.recent\n respond_to do |format|\n format.html\n format.json\n format.ics do\n calendar = Icalendar::Calendar.new\n calendar.append_custom_property('X-WR-CALNAME', \"amzn-ics\")\n @items.each do |item|\n calendar.add_event(item.to_ics(request.host))\n end\n calendar.publish\n render text: calendar.to_ical\n end\n end\n end",
"def all(params = {})\n req = WebPay::EventListRequest.create(params)\n raw_response = @client._request(:get, 'events', req)\n WebPay::EventResponseList.new(raw_response)\n end",
"def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end",
"def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end",
"def request_events(access_token, my_email, calendar_id, calendar_zone)\n service = build_service(access_token)\n\n # Return each google api calendar as an ActiveRecord Calendar model\n events = get_calendar_events(service, calendar_id).map do |item|\n upsert_service_event_item(my_email, calendar_zone, item)\n end\n\n # upsert_service_event_item sometimes returns nils, when an event doesn't\n # get made\n events.reject(&:nil?)\n end",
"def http_after_get(request, response)\n return unless response.header('Content-Type').index('text/calendar')\n\n result = Http::Util.negotiate(\n request.header('Accept'),\n ['text/calendar', 'application/calendar+json']\n )\n\n unless result == 'application/calendar+json'\n # Do nothing\n return\n end\n\n # Transforming.\n vobj = VObject::Reader.read(response.body)\n\n json_body = vobj.json_serialize.to_json\n response.body = json_body\n\n # Destroy circular references so PHP will garbage collect the object.\n vobj.destroy\n\n response.update_header('Content-Type', 'application/calendar+json')\n response.update_header('Content-Length', json_body.bytesize)\n end",
"def calendar\n get '/gtfs/calendar'\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def calendar_list\n logger.info(\"-- calendar list st --\") if logger\n auth unless @auth\n uri = URI.parse(CALENDAR_LIST_PATH + @email)\n res = do_get(uri, {})\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\n res\n end",
"def index\n @events = User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).events.upcoming.order(:start)\n\n render json: @events \n end",
"def index\n @events = @calendar.events.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n\t@events = @calendar.events(:order => 'created_at ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end",
"def test_canvas_api_studenta_calendar_events\n skip(\"verify that studenta has appropriate events\")\n refute_nil @w\n ## this requires self in url\n request_url = \"/users/self/upcoming_events?as_user_id=sis_login_id:studenta\"\n result_as_json = run_and_get_ruby_result(request_url)\n assert_operator result_as_json.length, \">=\", 1, \"got some upcoming events back\"\n end",
"def scrape_calendar\n begin\n objects = objects_from_event_api\n objects.select! {|o| DateTime.strptime(o['start'],'%Y-%m-%d') > DateTime.now }\n activities = objects_to_activities(objects)\n return process_calendar(activities)\n rescue Exception => e\n return format_error(e)\n end\n end",
"def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def calendars\n if @event.travels_done?\n if current_user.expired == 1\n render :nothing => true, :status => :unauthorized\n else\n render :json => @event.to_json, :status => :ok\n end\n elsif @event.canceled?\n render :nothing => true, :status => :gone\n else\n render :nothing => true, :status => :not_found\n end\n end",
"def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end",
"def events_feed\n @group = Group.find_by(id: params[:id]) || not_found\n not_found unless @group.status?\n raise 'NotGroupMember' unless @group.member?(current_user)\n @events = @group.events.confirmed.by_date\n\n feed = []\n @events.each do |event|\n next if event.date_tba == true\n event_link = url_for(\n controller: 'events', action: 'show', group_id: @group.id,\n id: event.id\n )\n feed << {\n date: event.start_time.strftime('%Y-%m-%d'),\n title: \"#{event.time != '' ? event.time : 'TBA'} - #{event.event_name}\",\n url: event_link,\n ticket_stats: event.ticket_stats(@group, current_user)\n }\n end\n render json: feed\n end",
"def events *args\n Xmlstats::Endpoints::Events.fetch *args\n end",
"def events(dbname, &block)\n # can't use RestClient.get b/c of :block_response\n RestClient::Request.execute(:method => :get,\n :url => root_url('events', @storage, dbname),\n :headers => {:accept => \"text/event-stream\"},\n :block_response => block, &HANDLE_RESPONSE)\n end",
"def http_message\n {\n data: {\n type: \"events\",\n id: event.id,\n attributes: {\n updated_at: event.updated_at,\n }\n }\n }.to_json\n end",
"def api_v11_events_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_events_get ...\"\n end\n \n # resource path\n path = \"/api/v11/events\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'maxResults'] = opts[:'max_results'] if opts[:'max_results']\n query_params[:'resultOffset'] = opts[:'result_offset'] if opts[:'result_offset']\n query_params[:'query'] = opts[:'query'] if opts[:'query']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\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 = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_events_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @events = Event.upcoming.order(:start_time)\n @events_cal = Event.ical(@events) if params[:format] == 'ics'\n end",
"def events\n results = @client.execute(\n :api_method => @calendar.events.list,\n :authenticated => false,\n :parameters => {\n 'calendarId' => @config[:calendar_id],\n 'fields' => 'items(start,end,summary)',\n 'singleEvents' => true,\n 'orderBy' => 'startTime',\n 'timeMin' => DateTime.now.to_s,\n 'timeMax' => (DateTime.now + 7).to_s,\n 'q' => 'LIVE'\n }\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end",
"def render_events(events)\n respond_to do |format|\n format.html # *.html.erb\n format.kml # *.kml.erb\n format.ics { ical_export(yield_events(events)) }\n format.atom { render :template => 'events/index' }\n format.xml { render :xml => yield_events(events).to_xml(:include => :venue) }\n format.json { render :json => yield_events(events).to_json(:include => :venue), :callback => params[:callback] }\n end\n end",
"def index\n respond_to do |format|\n @events = event_finder\n @title = Radiant::Config['event_calendar.feed_title'] || \"#{Radiant::Config['admin.title']} Events\"\n @description = list_description\n @description = \"All future events\" if @description.blank?\n format.js {\n @venues = @events.map(&:event_venue).uniq\n @venue_events = {}\n @events.each do |e|\n @venue_events[e.event_venue.id] ||= []\n @venue_events[e.event_venue.id].push(e)\n end\n }\n format.rss {\n @version = params[:rss_version] || '2.0'\n @link = list_url\n }\n format.ics {\n headers[\"Content-disposition\"] = %{attachment; filename=\"#{list_filename}.ics\"}\n }\n end\n end",
"def get_team_event_list ( team_key, year )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/#{year}/events\"\n end",
"def make_api_call \n Artist.all.each do |artist|\n request = RestClient.get(\"https://api.songkick.com/api/3.0/artists/#{artist.song_kick_id}/calendar.json?apikey=zIDG2c72WHINjQ8Y\")\n artist_data = JSON.parse(request)\n create_event(artist_data, artist.id)\n end \n \nend",
"def get_events_date_guest\n city_id = params[:city_id].to_i\n character_id = params[:character_id].to_i\n return render :json => [] if city_id == 0 or character_id == 0\n getEventByCityAndCharacterWithDate(city_id, character_id, @arg_date)\n end",
"def getEventForDates(event_names, data_type, unit, from_date, to_date) \n\tputs \"rafi\"\n\tputs \"event names: \" + event_names.to_s\n\tputs \"data_type:\" + data_type.to_s\n\tputs \"unit:\" + unit.to_s\n\tdata = @client.request(\n\t\t'events',\n\t\tevent: event_names,\n\t\ttype: data_type,\n\t\tunit: unit,\n\t\tfrom_date: from_date,\n\t\tto_date: to_date,\n\t)\n\treturn data\nend",
"def events(args = nil)\n events = if args.nil? || args.eql?(:all)\n events = decode_response connection.get \"/calendar/feeds/#{id}/private/full\"\n events = events[\"feed\"][\"entry\"]\n events.map{ |event| Event.build_event(event, self)}\n elsif args.is_a?(String)\n Event.new({:id => args, :calendar => self}).fetch\n elsif args.is_a?(Hash)\n if args.is_a?(Hash) && args.has_key?(:id)\n Event.new({:id => args[:id], :calendar => self}).fetch\n else\n params = { \"start-min\" => args[:from],\n \"start-max\" => args[:to]}\n events = decode_response connection.get \"/calendar/feeds/#{id}/private/full\", params\n events = events[\"feed\"][\"entry\"]\n events = events.nil? ? [] : events.map{ |event| Event.build_event(event, self)}\n end\n else\n raise ArgumentError.new \"Invalid argument type #{args.class}\"\n end\n\n end",
"def get_next_calendar_events\n next_events = JSON.parse search_for_future_calendar_events\n next_events[\"items\"]\n end",
"def index\n set_upcoming_events\n respond_with @upcoming_events, each_serializer: Api::V1::CompactContractSerializer, :current_user => current_user\n end",
"def upcoming_events(order_by: self.class::START_OLDEST_FIRST,\n status: self.class::ALL)\n EventbriteSDK::ResourceList.new(\n url_base: \"#{path}/events\",\n object_class: EventbriteSDK::Event,\n key: 'events',\n query: {\n order_by: order_by,\n status: status\n }\n )\n end",
"def get_events\n events = [] \n @log ||= Rails.logger\n Appsterdam::Application.ical_subscriptions.each do |options|\n @log.info \"getting events from #{options[:url]}\"\n components = parse_ical(options[:url])\n events.concat(extract_events(components.first))\n end\n @log.info \"done importing iCal events.\"\n \n events\n end",
"def get_org_unit_calendar_event(org_unit_id, event_id)\n path = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/calendar/event/#{event_id}\"\n _get(path)\nend",
"def get_calendar_json(url)\n require 'open-uri'\n require 'iconv'\n\n open(url) do |page|\n calendarJson = page.read\n end\n end",
"def show\n @calendar = Calendar.find(params[:id])\n @events = Event.find(@calendar.event_ids)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @calendar }\n end\n end",
"def events\n data[\"events\"]\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end",
"def events_with_http_info(events, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EventsApi.events ...\"\n end\n # verify the required parameter 'events' is set\n if @api_client.config.client_side_validation && events.nil?\n fail ArgumentError, \"Missing the required parameter 'events' when calling EventsApi.events\"\n end\n # resource path\n local_var_path = \"/events\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'input'] = opts[:'input'] if !opts[:'input'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(events)\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'EventsReturn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def events_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EventsApi.events_get ...\"\n end\n # resource path\n local_var_path = \"/events\"\n\n # query parameters\n query_params = {}\n query_params[:'context_id'] = opts[:'context_id'] if !opts[:'context_id'].nil?\n query_params[:'keywords'] = opts[:'keywords'] if !opts[:'keywords'].nil?\n query_params[:'transform'] = opts[:'transform'] if !opts[:'transform'].nil?\n query_params[:'report'] = opts[:'report'] if !opts[:'report'].nil?\n query_params[:'cache'] = opts[:'cache'] if !opts[:'cache'].nil?\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'index'] = opts[:'index'] if !opts[:'index'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#events_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_json_bitbucket_action header\n header['x-event-key'][0]\n end",
"def events_for target, event_types\n url = GITHUB_EVENT_API_END_POINT % target\n etag = @etag_hash[target]\n last_event = @last_event_hash[target]\n\n events_to_send = []\n page = 1\n while page <= 10\n result = @clnt.get(url, {client_id: @client_id, client_secret: @client_secret}, {\"If-None-Match\" => etag})\n break unless result.status_code == 200\n events = JSON.load result.body\n if page == 1 # etag and last event should be set when querying the very first page\n @etag_hash[target] = result.header[\"etag\"]\n @last_event_hash[target] = events[0]\n end\n\n events.each do |event|\n return events_to_send if last_event == event # no need to proceed\n events_to_send << event if event_types.accept? event\n end\n\n page += 1\n end\n\n events_to_send\n end",
"def calendars\n page_token = nil\n result = execute(:api_method => service.calendar_list.list)\n entries = []\n while true\n entries += result.data.items\n if !(page_token = result.data.next_page_token)\n break\n end\n result = execute(:api_method => service.calendar_list.list,\n :parameters => {'pageToken' => page_token})\n end\n\n entries\n end",
"def reply_calendar_contents\n \"BEGIN:VCALENDAR\nPRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN\nCALSCALE:GREGORIAN\nVERSION:2.0\nMETHOD:REPLY\nBEGIN:VTIMEZONE\nTZID;X-RICAL-TZSOURCE=TZINFO:America/Argentina/Buenos_Aires\nBEGIN:STANDARD\nDTSTART:20090314T230000\nRDATE:20090314T230000\nTZOFFSETFROM:-0200\nTZOFFSETTO:-0300\nTZNAME:ART\nEND:STANDARD\nEND:VTIMEZONE\nBEGIN:VEVENT\nCREATED;VALUE=DATE-TIME:20091217T155557Z\nDTEND;TZID=America/Argentina/Buenos_Aires;VALUE=DATE-TIME:20091227T010000\nSTATUS:CONFIRMED\nLAST-MODIFIED;TZID=America/Argentina/Buenos_Aires;VALUE=DATE-TIME:2009121\n 7T173400\nDTSTART;TZID=America/Argentina/Buenos_Aires;VALUE=DATE-TIME:20091227T0000\n 00\nATTENDEE;CN=PoketyPoke;PARTSTAT=ACCEPTED;ROLE=REQ-PARTICIPANT:barbarazopp\n [email protected]\nUID:1693CA3B-C528-4E5A-87FB-CDFAEC0EC662\nORGANIZER:mailto:[email protected]\nDESCRIPTION:\nSUMMARY:testing.. Event\nSEQUENCE:3\nLOCATION:\nEND:VEVENT\nEND:VCALENDAR\".strip\nend",
"def index_for_calendar\n # build_calendar_data --> AppointmentsHelper method\n render json: build_calendar_data, status: 200\n end",
"def index\n @agenda = HTTParty.get('http://fake-co-calendar.herokuapp.com/api/v1/events?offset=-730')['events']['list']\n @agenda.each do |meeting|\n meeting['start_time'] = DateTime.strptime(meeting['start_time'] + Time.now.getlocal.zone, \"%Y-%m-%d %H:%M:%S %z\")\n meeting['end_time'] = DateTime.strptime(meeting['end_time'] + Time.now.getlocal.zone, \"%Y-%m-%d %H:%M:%S %z\")\n end\n end",
"def get_district_events ( district_key, year )\n get_api_resource \"#{@@api_base_url}district/#{district_key}/#{year}/events\"\n end",
"def test\n company_event_page = @agent.get(\"https://abakus.no/event/company/\")\n events_list = company_event_page.search(\"#eventlist\")\n events_array = []\n events_list.css(\"li\").each do |li|\n title_node = li.css(\"h2>a\").first\n title = title_node.text\n url = ABAKUS_ROOT + title_node.attr(\"href\")\n events_array.push({:title => title, :url => url})\n end\n events_array.each do |event|\n puts event[:title]\n puts event[:url]\n end\n end",
"def test_succeed_no_calendars\n # Deleting calendars\n @caldav_backend.delete_calendar(1)\n @caldav_backend.delete_calendar(2)\n\n @server.http_request = Http::Request.new(\n 'POST',\n '/calendars/user1/outbox',\n 'Content-Type' => 'text/calendar'\n )\n\n body = <<ICS\nBEGIN:VCALENDAR\nMETHOD:REQUEST\nBEGIN:VFREEBUSY\nORGANIZER:mailto:[email protected]\nATTENDEE:mailto:[email protected]\nDTSTART:20110101T080000Z\nDTEND:20110101T180000Z\nEND:VFREEBUSY\nEND:VCALENDAR\nICS\n\n @server.http_request.body = body\n\n # Lazily making the current principal an admin.\n @acl_plugin.admin_principals << 'principals/user1'\n\n refute(\n @plugin.http_post(@server.http_request, @response)\n )\n\n assert_equal(200, @response.status)\n assert_equal(\n { 'Content-Type' => ['application/xml'] },\n @response.headers\n )\n\n strings = [\n '<d:href>mailto:[email protected]</d:href>',\n '<cal:request-status>2.0;Success</cal:request-status>'\n ]\n\n strings.each do |string|\n assert(\n @response.body.index(string),\n \"The response body did not contain: #{string} Full response: #{@response.body}\"\n )\n end\n end",
"def ical_export(events=nil)\n events = events || Event.find_future_events\n render(:text => Event.to_ical(events, :url_helper => lambda{|event| event_url(event)}), :mime_type => 'text/calendar')\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def events_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EventsApi.events_list ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling EventsApi.events_list, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling EventsApi.events_list, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling EventsApi.events_list, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/sample/v1/events'\n\n # query parameters\n query_params = {}\n query_params[:'eventType'] = opts[:'event_type'] if !opts[:'event_type'].nil?\n query_params[:'extLineItemId'] = opts[:'ext_line_item_id'] if !opts[:'ext_line_item_id'].nil?\n query_params[:'extProjectId'] = opts[:'ext_project_id'] if !opts[:'ext_project_id'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.events+json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml', 'application/gob', 'application/x-gob'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jwt']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Events')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#events_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n verify_owner(params[:gcal_id])\n\n calendar_list = @current_user.calendar_list\n calendar = calendar_list.calendars.find_or_create_by(gcal_id: params[:gcal_id])\n calendar.sync!(@current_user.access_token) if not calendar.synced?\n\n render json: calendar.json_data\n end",
"def index\n @user = AuthorizeApiRequest.call(params).result\n @host_events = Event.where(host_id: @user.id)\n render :host_events, status: :ok\n end",
"def response\n @response ||= self.class.get(@events_url, @options)\n end",
"def fetch\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_time, \"tags\" => \"miq.event_type|*\", \"thin\" => true)\n @start_time = new_events.max_by(&:ctime).ctime + 1 unless new_events.empty? # add 1 ms to avoid dups with GTE filter\n new_events\n rescue => err\n $mw_log.info \"Error capturing events #{err}\"\n []\n end",
"def get_busy_times(calendar_ids, min_date, max_date, access_token)\n form_data = {\n \"items\" => [{:id => calendar_ids}],\n \"timeMin\" => \"#{min_date.year}-#{min_date.month}-#{min_date.day}T00:00:00+00:00\",\n \"timeMax\" => \"#{max_date.year}-#{max_date.month}-#{max_date.day}T23:59:00+00:00\" \n }\n uri = URI.parse(\"https://www.googleapis.com/calendar/v3/freeBusy?access_token=#{access_token}\")\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.body = form_data.to_json\n request['Content-Type'] = 'application/json'\n response = http.request(request)\n response_json = JSON.parse(response.body) \n busy_times = []\n response_json[\"calendars\"].keys.each do |calendar|\n unless response_json[\"calendars\"][calendar][\"busy\"].blank?\n response_json[\"calendars\"][calendar][\"busy\"].each do |busy|\n busy_times.push([busy[\"start\"], busy[\"end\"]])\n end\n end\n end\n busy_times\n end",
"def get_event(event_id)\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events/#{event_id}\"))[0]\n end",
"def events\n results = @cal_service.list_events(\n @calendar_id,\n order_by: 'startTime',\n q: 'LIVE',\n single_events: true,\n time_max: (DateTime.now + 7).to_s,\n time_min: DateTime.now.to_s,\n fields: 'items(start,end,summary)',\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end",
"def get(name = nil, token = :last, not_found = :wait, found = :return, options = {})\n @raw = send_get_request(@conn, ['/v1/event/list'], options, use_named_parameter('name', name))\n body = JSON.parse(@raw.body)\n # TODO: deal with unknown symbols, invalid indices (find_index will return nil)\n idx = case token\n when :first then 0\n when :last then body.length - 1\n when :next then body.length\n else body.find_index { |e| e['ID'] == token } + 1\n end\n if JSON.parse(@raw.body).count.zero? || idx == body.length\n case not_found\n when :reject\n raise Diplomat::EventNotFound, name\n when :return\n event_name = ''\n event_payload = ''\n event_token = :last\n when :wait\n @raw = wait_for_next_event(['/v1/event/list'], options, use_named_parameter('name', name))\n @raw = parse_body\n # If it's possible for two events to arrive at once,\n # this needs to #find again:\n event = @raw.last\n event_name = event['Name']\n event_payload = Base64.decode64(event['Payload'])\n event_token = event['ID']\n end\n else\n case found\n when :reject\n raise Diplomat::EventAlreadyExits, name\n when :return\n event = body[idx]\n event_name = event['Name']\n event_payload = event['Payload'].nil? ? nil : Base64.decode64(event['Payload'])\n event_token = event['ID']\n end\n end\n\n {\n value: { name: event_name, payload: event_payload },\n token: event_token\n }\n end",
"def get_user_calendar_xml # :nodoc:\n response = session.get(USER_FEED)\n Nokogiri::XML(response.body)\n end",
"def show\n @calendar_event = CalendarEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calendar_event }\n end\n end",
"def get_events_guest\n city_id = params[:city_id].to_i\n character_id = params[:character_id].to_i\n return render :json => [] if city_id == 0 or character_id == 0\n getEventByCityAndCharacter(city_id, character_id)\n end",
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end",
"def get_google_calendar\n result = Gandalf::GoogleApiClient.get_google_calendar(self.apps_cal_id)\n result.data\n end"
] | [
"0.6930128",
"0.6919274",
"0.6847805",
"0.68208474",
"0.6750647",
"0.6661014",
"0.66247123",
"0.65484726",
"0.6530007",
"0.65281224",
"0.6480053",
"0.64560646",
"0.64541453",
"0.638245",
"0.63778245",
"0.63722247",
"0.63270223",
"0.6212991",
"0.61797464",
"0.6168183",
"0.6156219",
"0.61539125",
"0.612095",
"0.61170876",
"0.61036944",
"0.61008084",
"0.6095607",
"0.6090073",
"0.60787886",
"0.60751015",
"0.60603225",
"0.60545325",
"0.60329926",
"0.6012322",
"0.59917796",
"0.5990078",
"0.5975744",
"0.5934563",
"0.59335154",
"0.59070474",
"0.58673936",
"0.5861723",
"0.5858485",
"0.58570844",
"0.5812176",
"0.5792875",
"0.57714653",
"0.5769829",
"0.5748067",
"0.5747426",
"0.5683317",
"0.5677396",
"0.5677368",
"0.5671409",
"0.56499827",
"0.5640237",
"0.56401753",
"0.5638737",
"0.563762",
"0.56316096",
"0.56288415",
"0.56226224",
"0.5619415",
"0.560988",
"0.5609569",
"0.55930567",
"0.5587727",
"0.55871177",
"0.5567629",
"0.555659",
"0.55471444",
"0.5543566",
"0.55254596",
"0.55174327",
"0.5513986",
"0.55139154",
"0.5510597",
"0.55050284",
"0.55044585",
"0.5496857",
"0.5485541",
"0.5478064",
"0.5477008",
"0.5475409",
"0.5455124",
"0.5449849",
"0.54474163",
"0.5441948",
"0.54324776",
"0.5426386",
"0.539823",
"0.53910476",
"0.53888434",
"0.53745425",
"0.53732127",
"0.5372218",
"0.5370321",
"0.5369816",
"0.5351707",
"0.53507125"
] | 0.61791736 | 19 |
Create a new Response object for the given Net::SFTP::Request instance, and with the given data. If there is no :code key in the data, the code is assumed to be FX_OK. | def initialize(request, data={}) #:nodoc:
@request, @data = request, data
@code, @message = data[:code] || FX_OK, data[:message]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_with_code(code, subcode)\n OpenStruct.new(name: code_name(code), code: code, subcode: subcode)\n end",
"def initialize(data, status_code)\n @data = data\n @statusCode = status_code\n end",
"def _success(data,code)\n status code\n response.headers['Content-Type'] = 'application/json'\n body(data.to_json)\n end",
"def initialize(code, object = nil, status = nil, aditional_data = nil, data_root = :message)\n aditional_data = {} unless aditional_data\n response = {\n :status => status || \"success\",\n :code => code,\n :message => Response::message(code)\n }.merge(aditional_data)\n\n if object\n @_object = object\n response[:data] = {data_root => @_object}\n end\n\n @object = OpenStruct.new(response)\n end",
"def rest_ok_response(data = nil, opts = {})\n data ||= {}\n if encode_format = opts[:encode_into]\n # This might be a misnomer in taht payload is still a hash which then in RestResponse.new becomes json\n # for case of yaml, the data wil be a string formed by yaml encoding\n data =\n case encode_format\n when :yaml then encode_into_yaml(data)\n else fail Error.new(\"Unexpected encode format (#{encode_format})\")\n end\n end\n\n payload = { status: :ok, data: data }\n payload.merge!(datatype: opts[:datatype]) if opts[:datatype]\n\n # set custom messages in response\n [:info, :warn, :error].each do |msg_type|\n payload.merge!(msg_type => opts[msg_type]) if opts[msg_type]\n end\n\n RestResponse.new(payload)\n end",
"def api_response(*args) # :nodoc:\n code = args.first\n args.shift\n\n err = @@ERROR_CODES[code] || @@ERROR_CODES[:unknown]\n render :json => {\n :error => {\n :code => err[0],\n :message => err[1],\n },\n :content => args.first,\n }, :status => err[2]\n end",
"def send_by_code request, response, code, headers = {}\n\t\t\t\tbegin\n\t\t\t\t\tresponse.status = code\n\t\t\t\t\theaders.each {|k, v| response[k] = v}\n\t\t\t\t\treturn ErrorCtrl.new(request, response).index\n\t\t\t\trescue => e\n\t\t\t\t\tPlezi.error e\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend",
"def success_response code, meta, data\n render status: code,\n json: {\n meta: meta,\n data: data\n }\n end",
"def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend",
"def generic(code)\n {}.tap do |data|\n data[:errors] = { code: code, message: status.fetch(code.to_s.to_sym) }\n end\n end",
"def success_with_data(data)\n\n # Allow only Hash data to pass ahead\n data = {} unless Util::CommonValidator.is_a_hash?(data)\n\n OstKycSdkRuby::Util::Result.success({data: data})\n\n end",
"def response code, desc, media_type = nil, data: { }, type: nil\n self[:responses][code] = ResponseObj.new(desc) unless (self[:responses] ||= { })[code].is_a?(ResponseObj)\n self[:responses][code].add_or_fusion(media_type, { data: type || data })\n end",
"def response code=nil, body=nil, headers=nil\n args = [code, body, headers].compact\n\n headers = {'Content-Type' => DEFAULT_CONTENT_TYPE}\n code = 200\n body = \"\"\n\n args.each do |arg|\n case arg\n when Hash then headers.merge!(arg)\n when String then body = arg\n when Integer then code = arg\n end\n end\n\n [code, headers, body]\n end",
"def initialize(code)\n raise StatusCodeError, \"Invalid status code: #{code}\" unless StatusCode.valid_code?(code)\n case code\n when String\n if (code =~ /^[\\d]{3}/).nil? # wildcards or idk\n @code = code.downcase\n @exact = @code == 'idk'\n else # whole number\n @code = code.to_i\n @exact = true\n end\n when Recluse::StatusCode\n @code = code.code\n @exact = code.exact\n when Integer\n @code = code\n @exact = true\n end\n end",
"def raw_data_to_response_object(data)\n case data['status']\n when 'success'\n if data['flags']['paginated'] && data['data'].is_a?(Array)\n MoonropeClient::Responses::PaginatedCollection.new(self, data)\n else\n MoonropeClient::Responses::Success.new(self, data)\n end\n when 'parameter-error' then MoonropeClient::Responses::ParameterError.new(self, data)\n when 'access-denied' then MoonropeClient::Responses::AccessDenied.new(self, data)\n when 'validation-error' then MoonropeClient::Responses::ValidationError.new(self, data)\n else\n MoonropeClient::Response.new(self, data)\n end\n end",
"def build_success_output(data)\n\t \t{data: data, code: 200, result: \"success\"}\n\t end",
"def structure_with_code(code)\n structure = Baps::Responses::Structures.structure(code)\n structure.nil? ? unknown_response(code) : structure.clone\n end",
"def responder(code=:ok, message=nil, args=nil)\n message ||= default_message[code]\n args ||= {}\n if code == :ok\n return render json: {status: 'success', success: true, message: message}.merge(args), status: code\n else\n return render json: {status: 'error', errors: message, success: false, message: message}.merge(args), status: code\n end\n end",
"def response code, desc, media_type = nil, hash = { }\n (self[:responses] ||= { })[code] = ResponseObj.new(desc, media_type, hash)\n end",
"def generate_response(code, format)\n @message = \"Returning code #{code} in #{format} format\"\n response_data = case format\n when \"txt\"\n content_type 'text/plain'\n @message\n when \"json\"\n content_type 'application/json'\n { message: @message }.to_json\n when \"xml\"\n content_type 'application/xml'\n erb :'status.xml', layout: false\n else\n erb :status\n end\n [code.to_i, response_data]\nend",
"def challenge_response(challenge_code)\n {\n :body => challenge_code,\n :status => 200\n }\n end",
"def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end",
"def prepare_status_response( request, status_info )\n\t\tstatus_code, message = status_info.values_at( :status, :message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\trequest.notes[:status_info] = status_info\n\t\tresponse = request.response\n\t\tresponse.reset\n\t\tresponse.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it. Append the\n\t\t# message for those that allow one.\n\t\tunless request.verb == :HEAD || response.bodiless?\n\t\t\tself.log.debug \"Writing plain-text response body: %p\" % [ message ]\n\t\t\tresponse.content_type = 'text/plain'\n\t\t\tresponse.puts( message )\n\t\tend\n\n\t\t# Now assign any headers to the response that are part of the status\n\t\tif status_info.key?( :headers )\n\t\t\tstatus_info[:headers].each do |hdr, value|\n\t\t\t\tresponse.headers[ hdr ] = value\n\t\t\tend\n\t\tend\n\n\t\treturn response\n\tend",
"def status(code)\n response.status = code\n end",
"def initialize(status = nil, message = nil, data = nil, code = nil)\n @status = status\n @message = message\n @data = data\n @code = code\n end",
"def create_success_response\n response = {\n body: {\n status: \"ok\"\n },\n status: 200\n }\n return response\n end",
"def type\n case code\n when 100..199 then :informational_response\n when 200..299 then :success\n when 300..399 then :redirection\n when 400..499 then :client_error\n when 500..599 then :server_error\n else :unknown\n end\n end",
"def check_response(code = :success, expected_msg = nil, line = nil)\n line = line ? \" [*_test:\" + line.to_s + \"]\" : \"\"\n assert_response code, \"expected \" + code.to_s + \", server response: \" + response.body.to_s + line\n if (code.class == Symbol)\n # Not sure why this list isn't the right one: (has :ok instead). Should fix once...\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:success] = 200\n Rack::Utils::SYMBOL_TO_STATUS_CODE[:redirect] = 302\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code]\n end\n return if (code == 302) # redirect, html body\n\n body = JSON.parse(response.body)\n #Success payloads should contain one of these.\n assert (body[0] && body[0][\"server_time\"]) ||\n body[\"status\"] == code ||\n body[\"status\"] == \"destroyed\" ||\n body[\"server_time\"] ||\n body[\"device_id\"] ||\n body[\"key_data\"] ||\n body[\"authtoken\"], \"success payload not one of the usual patterns\" + line\n return if ! expected_msg\n\n if expected_msg.class == Symbol\n expected_msg = ApplicationController.MESSAGES[expected_msg]\n assert expected_msg != nil, \"oops, your check_response passed a non-existant expected message symbol!\" + line\n end\n\n if (code == 200)\n return assert body[\"message\"] = expected_msg, \"wrong message\" + line\n end\n\n # Simple generic check against message template to see that we got\n # the right one - there will be at least 12 chars without a\n # substitution at either start or end in all our MESSAGES strings.\n # Or a whole string without formatting anywhere (when array of validation errors is stringified).\n len = 12\n ret_msg = body[\"error\"]\n # Handle short expected strings (INVALID_PARAM)\n assert ret_msg.start_with?(expected_msg.first(len)) ||\n ret_msg.end_with?(expected_msg.last(len)) ||\n ret_msg.include?(expected_msg),\n \"reply error message doesn't match:\\\"\" + ret_msg + \"\\\"!=\\\"\"+ expected_msg + \"\\\"\" + line\n end",
"def code\n response&.code\n end",
"def prepare_status_response( txn, status_code, message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\ttxn.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it.\n\t\tunless BODILESS_HTTP_RESPONSE_CODES.include?( status_code )\n\t\t\ttxn.content_type = 'text/plain'\n\t\t\treturn message.to_s\n\t\tend\n\n\t\t# For bodiless responses, just tell the dispatcher that we've handled \n\t\t# everything.\n\t\treturn true\n\tend",
"def _create_http_response(mock_response, code, message)\n mock_response.stub!(:code).and_return(code)\n mock_response.stub!(:message).and_return(message)\n mock_response.stub!(:is_a?).and_return(true) if [\"200\", \"201\"].member?(code)\nend",
"def create_success_response(message='')\n message = message.present? ? message : 'ok'\n response = {\n body: {\n status: message\n },\n status: 200\n }\n return response\n end",
"def response_message message, code\n render json: {message: message, code: code}\n end",
"def success_response(data={}, opts={})\n status = opts.delete(:status) || 200 # Status code is 200 by default\n \n {\n status: status,\n json: {\n status: \"success\",\n data: data\n }\n }\n end",
"def structureResponse(code, codeMessage, file, contentType)\n # grab file contents\n data = getFileContents(file);\n\n # Return response\n \"HTTP/1.1 #{code}\\r\\n\" +\n \"Content-Length: #{data.size}\\r\\n\" +\n \"\\r\\n\" +\n \"#{data}\\r\\n\";\nend",
"def create_response(request)\n response = Response.new\n end",
"def initialize(args={})\n @code = args.fetch :code, 1\n @message = args.fetch :message, ''\n @data = args.fetch :data, nil\n end",
"def create_json_request(code)\n parameters = {\n \t\"code\" => code,\n\t\"level\" => self.level,\n\t\"format\" => \"json\",\n\t\"info\" => self.op\n }\n end",
"def code\n @response.code\n end",
"def initialize(code, message)\n @code = code\n @message = message\n end",
"def status code=nil\n @response.status = code if code\n @response.status\n end",
"def respond(message, code: :ok)\n code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code] || code\n [code, { 'Content-Type' => 'application/json' }, [Oj.dump('result' => message)]]\n end",
"def initialize(status_code, result)\n @status_code = status_code\n @result = result\n end",
"def initialize(xml_data = nil, code = nil, error_message = nil)\n @response_attributes = Hash.new;\n @params = Hash.new;\n @tables = Hash.new;\n\n if(!code.nil? && !error_message.nil?)\n @response_attributes['Code'] = code;\n @response_attributes['ErrorMessage'] = error_message;\n @response_attributes['FullError'] = error_message;\n end\n\n if(!xml_data.nil?)\n parser = XML::SaxParser.string(xml_data);\n parser.callbacks = CallBacks.new(self);\n parser.parse;\n end\n end",
"def status(code)\n @response.status = code\n end",
"def build_fail_output(data)\n\t \t{data: nil, code: 401, result: \"fail\"}\n\t end",
"def code\n @raw_response.code\n end",
"def initialize(message, type, code, error_subcode)\n @message = message\n @type = type\n @code = code\n @error_subcode = error_subcode\n end",
"def response_code; end",
"def response_code; end",
"def response_code; end",
"def response_code; end",
"def success_response(data={}, opts={})\n status = 200 # Status code is 200 by default\n\n json_response = {}\n \n # Check if an ActiveRecord object or collection was passed, and if so, serialize it\n if data.is_a?(ActiveRecord::Relation) \n json_response = package_collection(data, opts)\n elsif data.is_a?(Array)\n json_response = package_array(data, opts)\n elsif data.is_a?(ActiveRecord::Base)\n json_response = package_record(data, opts)\n else\n json_response = data\n end\n \n json_response[:status] = \"success\"\n \n # Return a JSend-compliant hash\n {\n status: status,\n json: json_response\n }\n end",
"def set_status(code)\n new(\n status: code\n )\n end",
"def json_response (status, data, message)\n\t\t{\n\t\t\t\tstatus: status,\n\t\t\t\tdata: data,\n\t\t\t\tmessage: message\n\t\t}\n\tend",
"def code\n @response.code.to_i\n end",
"def code\n @response.code.to_i\n end",
"def status_code\n response_value(:code)\n end",
"def sample_fund_account_response(success)\n if success\n raw_response = OpenStruct.new(\n parsed_response: {\"success\"=>true, \"fund_id\"=>\"RF13-09261098-12\", \"amount\"=>5000},\n code: 200\n )\n else\n raw_response = OpenStruct.new(\n parsed_response: {\n \"success\"=>false,\n \"error_message\"=>\"The supplied input entity was invalid.\",\n \"invalid_inputs\"=>[\n {\n \"field\"=>\"credit_card.billing_address.zip\",\n \"error\"=>\"integer value found, but a string is required \"\n }\n ]\n },\n code: 403\n )\n end\n Tangocard::Response.new(raw_response)\n end",
"def parse_command(raw_code)\n code, subcode = raw_code.split\n @expected = structure_with_code(code)\n @response = response_with_code(code, subcode)\n end",
"def process_response(response)\n case response.code.to_i\n when 200, 404\n parse_message response.body\n when 401, 500\n error_message = parse_message response.body\n raise \"Unauthorized: #{error_message['error']['message']}\"\n else\n raise \"Response code #{response.code} not recognized\"\n end\n end",
"def create(code: nil, to: :unset)\n data = Twilio::Values.of({'Code' => code, 'To' => to,})\n\n payload = @version.create(\n 'POST',\n @uri,\n data: data\n )\n\n VerificationCheckInstance.new(@version, payload, service_sid: @solution[:service_sid],)\n end",
"def create_response(response)\r\n\r\n#\r\n#\tSetup default response values.\r\n#\r\n message = nil\r\n authorization = nil\r\n success = false\r\n exception = nil\r\n#\r\n#\tExtract key elements from the response.\r\n#\r\n reasonCode = response.Get(RocketGate::GatewayResponse::REASON_CODE);\r\n message = @@response_codes[('r' + reasonCode).to_sym] || \"ERROR - \" + reasonCode\r\n responseCode = response.Get(RocketGate::GatewayResponse::RESPONSE_CODE);\r\n if ((responseCode != nil) && (responseCode == \"0\"))\r\n success = true; # Transaction succeeded\r\n authorization = response.Get(RocketGate::GatewayResponse::TRANSACT_ID);\r\n else\r\n exception = response.Get(RocketGate::GatewayResponse::EXCEPTION);\r\n end\r\n\r\n#\r\n#\tExtract values that are not dependent up success/failure.\r\n#\r\n avsResponse = response.Get(RocketGate::GatewayResponse::AVS_RESPONSE)\r\n cvv2Response = response.Get(RocketGate::GatewayResponse::CVV2_CODE)\r\n fraudResponse = response.Get(RocketGate::GatewayResponse::SCRUB_RESULTS)\r\n\r\n#\r\n#\tCreate the response object.\r\n#\r\n card_hash = response.Get(RocketGate::GatewayResponse::CARD_HASH)\r\n Response.new(success, message, {:result => responseCode, :exception => exception, :card_hash => card_hash},\r\n :test => test?,\r\n :authorization => authorization,\r\n :avs_result => {:code => avsResponse},\r\n :cvv_result => cvv2Response,\r\n :fraud_review => fraudResponse\r\n )\r\n end",
"def initialize(message=nil, code=nil)\n super(message)\n @code = code\n end",
"def handle_response(response) # :nodoc:\n case response.code\n when 400\n #IN CASE WE WANT MORE PRECISE ERROR NAMES\n #data = response.parsed_response\n #case data['code']\n #when 230\n # raise ParameterDataInvalid.new data\n #else\n # raise BadRequest.new data\n #end\n raise BadRequest.new(response.parsed_response)\n when 403\n raise Unauthorized.new(response.parsed_response)\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new\n when 500...600\n raise ServerError.new\n else\n response.parsed_response\n end\n end",
"def parse_res(res, default, success_code='200')\n if res && res.code == success_code\n begin\n JSON.parse res.body\n rescue JSON::ParserError\n default\n end\n else\n default\n end\n end",
"def initialize success, body\n @success = success || false\n @body = body.fetch('RESPONSE', {})\n end",
"def parse_result(code, body, message, nfg_method)\n return_value = Hash.new\n if code == '200'\n parsed = REXML::Document.new(body)\n # Build return hash parsing XML response\n if parsed.root.nil?\n return_value['StatusCode'] = 'MissingParameter'\n return_value['Message'] = body\n return_value['ErrorDetails'] = nil\n else\n return_value = parsed.root.elements['soap:Body'].elements[\"#{nfg_method}Response\"].elements[\"#{nfg_method}Result\"]\n end\n else\n return_value['StatusCode'] = 'UnexpectedError'\n return_value['Message'] = message\n return_value['ErrorDetails'] = body\n end\n return_value\n end",
"def verify_code\n invitation = verify_code_validity\n invitation_status = invitation.status if invitation\n invitor_name = User.find(invitation.user_id).name if invitation_status == PENDING_INVITATION_STATUS\n respond_to do |format|\n #format.html { redirect_to invitations_url, notice: 'Invitation was successfully destroyed.' }\n if invitor_name\n \tformat.json { render :json => {:invitor_name => invitor_name, :status => true } }\n else\n format.json { render :json => { :error => 'Invalid or taken code.', :status => false } }\n end\n end\n end",
"def error code, body=nil\n code, body = 500, code if code.respond_to? :to_str\n @response.body = body unless body.nil?\n halt code\n end",
"def sample_create_account_response(success)\n if success\n raw_response = OpenStruct.new(\n parsed_response: {\n \"success\"=>true,\n \"account\"=> {\n \"identifier\"=>\"asdfasdfasdf\",\n \"email\"=>\"[email protected]\",\n \"customer\"=>\"bonusly\",\n \"available_balance\"=>0\n }\n },\n code: 200\n )\n else\n raw_response = OpenStruct.new(\n parsed_response: {\n \"success\"=>false,\n \"error_message\"=>\"The account already exists for the platform.\"\n },\n code: 403\n )\n end\n Tangocard::Response.new(raw_response)\n end",
"def response(object, code = 200)\n @lunetas_headers['Content-Type'] ||= self.class.lunetas_content_type\n if @lunetas_redirect\n code, object = @lunetas_redirect\n end\n [code, @lunetas_headers, [object.to_s]]\n end",
"def send_error(code, status = :bad_request, error = nil, data = nil)\n error_hash = {\n code: code\n }\n\n error_hash[:message] = error if error\n error_hash[:data] = data if data\n\n render json: error_hash, status: status\n end",
"def respond(request, data)\n return unless data\n request[\"result\"] = data\n @lock.synchronize do\n send_data(request.to_json + \"\\x00\")\n end\n end",
"def respond(status_code, body = nil, **headers)\n # Log response\n log = \"RESPONSE [#{ status_code }] #{ body }\"\n Yake.logger&.send(status_code.to_i >= 400 ? :error : :info, log)\n\n # Set headers\n content_length = (body&.bytesize || 0).to_s\n to_s_downcase = -> (key) { key.to_s.downcase }\n headers = {\n 'content-length' => content_length,\n **(@headers || {}),\n **headers,\n }.transform_keys(&to_s_downcase).compact\n\n # Send response\n { statusCode: status_code, headers: headers, body: body }.compact\n end",
"def response_proc(code=nil,&blk)\n Proc.new do | message |\n if code.nil? or code.empty? or code == message\n @logger.debug \"Calling proc. code: #{code} message: #{message}\"\n blk.call(message)\n end\n end\n end",
"def status_code\n params[:code] || 500\n end",
"def status_code\n params[:code] || 500\n end",
"def status_code\n return manual_status_code if manual_status_code\n return 422 if errors.present?\n return 200 if result\n return 400\n end",
"def create_Found_Response(request_path)\n\tbody = File.read(request_path)\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(body)\n\tgeneric_Generate_Response(initial,headers,body)\nend",
"def purchase_offsite_response(data)\n requires!(@options, :secure_hash)\n\n response_hash = parse(data)\n\n expected_secure_hash = calculate_secure_hash(response_hash, @options[:secure_hash])\n raise SecurityError, 'Secure Hash mismatch, response may be tampered with' unless response_hash[:SecureHash] == expected_secure_hash\n\n response_object(response_hash)\n end",
"def response\n result = {}\n res_xml.blank? ? xml = '' : xml = res_xml\n doc = Hpricot.XML(xml)\n case status\n when 'REQUEST'\n result[:status] = 'BEGIN'\n when 'UPDATE'\n result[:status] = 'NORMAL'\n when 'EXCEPTION'\n result[:status] = 'ERROR'\n end\n result[:xml] = ErpHelper.xml2html(doc.to_s)\n case (doc/:IAVSResult).inner_text\n when 'Y'\n result[:avsresult] = 'Match'\n when 'N'\n result[:avsresult] = 'No Match'\n when 'X'\n result[:avsresult] = 'No Provide'\n end\n result[:zipmatch] = (doc/:AVSResult/:ZipMatch).inner_text\n result[:streetmatch] = (doc/:AVSResult/:StreetMatch).inner_text\n pfp_res_code_msg = open(RAILS_ROOT+\"/db/pfp_transaction_result_code_and_message.yml\") {|f| YAML.load(f)}\n pfp_res_code_msg[res_code].blank? ? result[:pfp_res_code_msg] = 'Credit Card Processing Gateway Error.' : result[:pfp_res_code_msg] = pfp_res_code_msg[res_code]\n return result\n end",
"def fail_response(data={})\n status = data.delete(:status) || 400\n {\n status: status,\n json: {\n status: \"fail\",\n data: data\n }\n }\n end",
"def respond_with(status_code)\n response.status = status_code\n response.write ''\n nil\n end",
"def unknown_response(code)\n fail(Rapid::Common::Exceptions::InvalidPlayoutResponse, code.to_s(16))\n end",
"def reply(data)\n res.json(Satz.serializer.dump(data))\n end",
"def code\n if [email protected]_key? 'RESPONSE'\n if has_errors? \n raise PayTrace::Exceptions::ValidationError, get_error_response\n else\n raise PayTrace::Exceptions::ValidationError, \"missing response field\"\n end\n end\n code = parse_code(@values[\"RESPONSE\"])\n code.first\n end",
"def status_code; 422; end",
"def status_code; 422; end",
"def status_code; 422; end",
"def status_code; 422; end",
"def exec_post(req, data, exit_on_fail = false)\n response_hash = exec_api_call('POST', req, data, exit_on_fail)\n response_hash[:response]\n end",
"def verify_security_code(security_code)\r\n # Prepare query url.\r\n _path_url = '/verify-security-code'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'output-case' => 'camel',\r\n 'security-code' => security_code\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: _parameters\r\n )\r\n CustomQueryAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n VerifySecurityCodeResponse.from_hash(decoded)\r\n end",
"def some_method(request, _unused_call)\n # Write you own logic here how to handle the request\n ProtobufRubyExample::Proto::ResponsePb.new(status: 'ok')\n end",
"def create_response(response, first_response=nil)\n message = message_from(response)\n\n # This allows the second response to grab the auth info from the first\n first_response ||= response\n\n Response.new(!response.has_key?(:ErrCode), message, response,\n :test => test?,\n # The AccessPass and AccessID are used for all alterations to a\n # transaction, so we store that as the authorization instead of TranID\n :authorization => \"#{first_response[:AccessID]}-#{first_response[:AccessPass]}\"\n )\n end",
"def _handle_response(response)\n \n \n # -- MAJOR EXCEPTION handling (authentication)\n \n if (response == Net::HTTPUnauthorized || response.message == 'Unauthorized') ||\n (response && response['status'].to_i == 403 && response['message'] == \"Access to group-memberships denied\")\n raise APIAuthError.new\n \n \n # -- STANDARD handling\n \n else\n \n hashed_response = nil\n \n # Check if the 'response.body' starts with an '<?xml' tag -> indicating it's XML structure\n if response.body =~ /\\A<\\?xml/ \n hashed_response = Hash.from_xml(response.body)\n else\n hashed_response = hash_a_json(response.body)\n end\n \n # -- Bad request (e.g. posting duplicate content)\n \n \n \n _res = { :response_http_object => response }\n \n \n # -- Bad request (e.g. posting duplicate content)\n \n if response == Net::HTTPBadRequest || response.message == \"Bad Request\" || response.code == 400\n _res[:status] = \"bad_request\"\n _res[:response_object] = hashed_response\n \n \n # -- API SERVICE ERROR\n \n elsif response == Net::HTTPInternalServerError || response.message == 'Internal Server Error' || response.code == 500\n _res[:status] = \"api_service_error\"\n _res[:response_object] = hashed_response\n \n \n # -- FORBIDDEN -> trying to use a resource the user is not allowed, store the 'body' as plain XML at this point\n \n elsif response == Net::HTTPForbidden || response.message == 'Forbidden'\n _res[:status] = \"denied_access\" # e.g. post to LinkedIn group required moderation by an admin\n _res[:response_object] = hashed_response\n \n # Check if additional permissions are required (SHARING)\n if _res[:response_object]['error']['message'] == 'Access to posting shares denied'\n raise APIAuthError.new\n end\n \n \n # -- POST / PUT\n \n elsif response.body.blank? || (response.body.nil? && response.code == 204) # A response without content -> successful \n _res[:status] = \"updated_successfully\"\n \n if response.body.blank?\n _res[:response_object] = {}\n else\n _res[:response_object] = hashed_response\n end\n \n \n # -- GET\n \n else\n _res[:status] = \"retrieved_successfully\"\n _res[:response_object] = hashed_response\n \n end\n \n end\n \n \n _res\n \n end",
"def respond_with(status_code)\n response.status = status_code\n response.write \"\"\n nil\n end",
"def void(response_code, _source, _gateway_options)\n protected_request do\n result = braintree.transaction.void(response_code)\n Response.build(result)\n end\n end",
"def initialize(error_code, error_message = \"\", user_message = \"\", data = nil)\n super()\n @error_code = error_code\n @error_message = error_message\n @user_message = user_message\n @data = data\n end",
"def status_code\n @status_code || errors.empty? ? 200 : 422\n end"
] | [
"0.6052174",
"0.55225223",
"0.5418228",
"0.5374258",
"0.5374032",
"0.5334785",
"0.53197",
"0.530625",
"0.5239993",
"0.5202389",
"0.51979333",
"0.5196144",
"0.5151053",
"0.5093738",
"0.5084425",
"0.5067291",
"0.50454336",
"0.4987059",
"0.49779797",
"0.4945318",
"0.49262756",
"0.491224",
"0.4896716",
"0.48784178",
"0.48720744",
"0.48579836",
"0.48528826",
"0.48324132",
"0.48228306",
"0.4819088",
"0.4806405",
"0.47982118",
"0.4779512",
"0.47758383",
"0.47701988",
"0.47683412",
"0.47616816",
"0.47490212",
"0.4743948",
"0.47407606",
"0.47354713",
"0.47193128",
"0.47188196",
"0.47157297",
"0.47068048",
"0.46883947",
"0.4686556",
"0.46766225",
"0.46655777",
"0.46655777",
"0.46655777",
"0.46655777",
"0.465581",
"0.46498707",
"0.46484077",
"0.464162",
"0.464162",
"0.4634206",
"0.4631556",
"0.46306694",
"0.46275526",
"0.46247068",
"0.4623964",
"0.4615426",
"0.45977372",
"0.45927596",
"0.45903963",
"0.45863956",
"0.45840356",
"0.45774335",
"0.4575151",
"0.4575044",
"0.45716986",
"0.45710185",
"0.45709816",
"0.45694977",
"0.4563877",
"0.4563877",
"0.45564646",
"0.45556048",
"0.4542961",
"0.45422092",
"0.45407045",
"0.45359713",
"0.45307183",
"0.45259234",
"0.45240065",
"0.45239994",
"0.45239994",
"0.45239994",
"0.45239994",
"0.4512508",
"0.45101535",
"0.45018566",
"0.44973472",
"0.4494157",
"0.44892207",
"0.44773006",
"0.44665077",
"0.4455733"
] | 0.57564694 | 1 |
Retrieve the data item with the given +key+. The key is converted to a symbol before being used to lookup the value. | def [](key)
data[key.to_sym]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n return @data[key.to_s]\n end",
"def get_item(key)\n self[key]\n end",
"def [](key)\n return nil unless key\n @data[key.to_s] || @data[key.to_sym]\n end",
"def [](key)\n @data[key.to_sym]\n end",
"def [](key)\n @data[key.to_sym]\n end",
"def [](key)\n @data[key.to_s]\n end",
"def [](key)\n data[key.to_s]\n end",
"def generic_get(key)\n data[key]\n end",
"def get(key)\n (self.data ||= {})[key.to_s]\n end",
"def get_data(key) \n return @data[key]\n end",
"def [](key)\n @data[key]\n end",
"def [](key)\n @data[key]\n end",
"def [](key)\n @data[key]\n end",
"def [](key)\n @data[key]\n end",
"def [](key)\n @data[key]\n end",
"def [](key)\n @data[key]\n end",
"def [](key)\n @data[key]\n end",
"def [](key)\n return @data[key]\n end",
"def [](key)\n data[key]\n end",
"def [](key)\n data[key]\n end",
"def get(key)\n @hash[key]\n end",
"def get(key)\n response = db.get_item(@table_name, {'HashKeyElement' => {'S' => key}})\n get_item_from_body(response.body)\n end",
"def get(key)\n @hash.get(key)\n end",
"def get_value(key)\n self[key]\n end",
"def get_item_value(key)\n @attributes[key] = get_item_record(key) unless @attributes.has_key?(key)\n @attributes[key]\n end",
"def get(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key \n return ele[1]\n end\n end\n end",
"def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end",
"def value_for_data(key, item, value_key = :value)\n if item and item[:data] and item[:data][key]\n return item[:data][key][value_key]\n end\n return nil\n end",
"def get(key)\n key = normalize(key) or return\n table[key]\n end",
"def [](key)\n return nil unless @data.is_a?(Hash)\n\n @data[compatible_key(key)]\n end",
"def [](key)\n result = (db_data ? db_data[key.to_s] : nil)\n result ||= raw_data.has_key?(key.to_s) ? raw_data[key.to_s] : self.send(key.to_s, nil); nil\n result\n end",
"def [](key)\n\n lookup(key.to_s)\n end",
"def getValue(key)\r\n \r\n return @aHash[key]\r\n end",
"def [](key)\n @data[key]\n end",
"def get(key)\n return nil unless @items.key?(key)\n @items[key].call\n end",
"def [](key)\n raise ArgumentError, \"#{key.inspect} should be a Symbol\" unless Symbol === key\n if has_key? key\n @data[key].is_a?(Proc) ? @data[key].call : @data[key]\n else\n raise NoKey, key.to_s\n end\n end",
"def [](key)\n return @item[key]\n end",
"def [](key)\n key = key.to_s if key.is_a? Symbol\n self.old_fetch(key) rescue return nil\n end",
"def get(key)\n case key\n when Symbol\n return instance_variable_get(\"@#{key}\")\n when String\n return instance_variable_get(\"@#{key}\")\n end\n\n end",
"def get(key)\n @first.get(key)\n end",
"def get( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && get_k( key )\n end",
"def [](key)\n @hash[key.to_s]\n end",
"def [](key)\n @_hash[key.to_sym]\n end",
"def get(key)\n position = search(key)\n return nil if (key <=> @keys[position]) != 0\n @values[position]\n end",
"def read(key)\n exists?(key) ? @data[key] : nil\n end",
"def value(key)\n @hash[key]\n end",
"def get(key)\n self.send(key)\n end",
"def value_for_key(key)\n if respond_to?(key)\n send key\n elsif attributes.include? key\n attributes[key]\n else\n row.send key\n end\n end",
"def [](key)\n fetch(key)\n end",
"def [](key)\n if @result.include?(key)\n @result[key]\n else\n data[key]\n end\n end",
"def [] key\n @data[key]\n end",
"def get(key)\n get_all(key).first\n end",
"def get key\n\t\t@data_base[ key ]\n\tend",
"def [](key)\n find_value(key)\n end",
"def [](key)\n self.get(key)\n end",
"def get(key)\n value = @data[key]\n validate!(key, value)\n end",
"def get(key)\n if @data.has_key?(key)\n return @data[key]\n else\n return false\n end\n end",
"def read_attribute(key)\n @hash[key.to_s]\n end",
"def lookup(key)\n if key_pair = pair(key, hash(key))\n key_pair[1]\n end\n end",
"def [](key)\n raise ArgumentError unless BASE_DATA_KEYS.include?(key)\n\n public_send(key.to_sym)\n end",
"def [](key)\n send(\"#{key}\") rescue nil\n end",
"def get(key)\n @@list[key]\n end",
"def []( key )\n hash = load_hash\n hash[key]\n end",
"def [](key)\n @map[key.to_sym]\n end",
"def get(key)\n index = key_index(key)\n if( index )\n self.values.get(index)\n else\n nil\n end\n end",
"def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend",
"def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def [](key)\n @data[@aliases[key]]\n end",
"def [](key)\n if !@data\n raise \"No data spawned on object.\"\n end\n \n if [email protected]?(key)\n raise \"No such key: '#{key}'. Available keys are: '#{@data.keys.sort.join(\", \")}'.\"\n end\n \n return @data[key]\n end",
"def [] key\n @data[key]\n end",
"def [] key\n @data[key]\n end",
"def [](k) data[k.to_sym] end",
"def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend",
"def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend",
"def get(key)\n val = @db[key.to_s.downcase]\n if !val.nil?\n val.to_sym\n else\n nil\n end\n end",
"def [](key)\n self.internal_object[key.to_s]\n end",
"def getRubyData(key)\n @data[key]\n end",
"def find(key)\n # TODO(himanshujaju) - possible improvement by not checking for contains.\n if contains?(key)\n return @key_data[key].value\n end\n\n return nil\n end",
"def get(key)\n end",
"def get(key)\n return do_get(key, false)\n end",
"def get_key(key)\n return self.has_key?(key) ? self[key] : nil\n end",
"def [](key)\n @map[key.to_sym]\n end",
"def value_by_key(hash, key)\n hash[key.to_s] || hash[key.to_sym]\n end",
"def [](key)\n @data ||= restore\n @data[key]\n end",
"def get_by_key(key)\n @store_[key] || YakvdConstants.key_not_found\n end",
"def fetch_value( oid, key )\n\t\toid = normalize_oid( oid )\n\t\tkey = normalize_key( key )\n\t\tdata = @storage[ oid ] or return nil\n\n\t\treturn data[ key ]\n\tend",
"def [](key)\n self.send key.to_sym\n end",
"def [](key)\n @adapter[key.to_s]\n end",
"def get(key)\n @map[key]\n end",
"def fetch(key)\n result.fetch(key)\n end",
"def [](key)\n @hash[key]\n end",
"def [](key)\n @hash[key]\n end",
"def [](key)\n @hash[key]\n end",
"def [](key)\n @hash[key]\n end",
"def [](key)\n @raw[utf8(key)]\n end",
"def read_attribute(key)\n @attributes[key.to_sym]\n end"
] | [
"0.7909084",
"0.76764816",
"0.7557976",
"0.74991965",
"0.74991965",
"0.73280144",
"0.7325387",
"0.7305599",
"0.71363986",
"0.71012944",
"0.70948505",
"0.70274526",
"0.70274526",
"0.70274526",
"0.70274526",
"0.70274526",
"0.70274526",
"0.6990239",
"0.6977794",
"0.6977794",
"0.6927584",
"0.6913883",
"0.6911875",
"0.6901659",
"0.68416774",
"0.6825016",
"0.6813774",
"0.6802837",
"0.6799549",
"0.6794377",
"0.67931956",
"0.6786616",
"0.6781533",
"0.67809117",
"0.67672455",
"0.6765817",
"0.67582977",
"0.67516506",
"0.6740698",
"0.67395407",
"0.6680969",
"0.66572875",
"0.662591",
"0.6601536",
"0.65652025",
"0.65612906",
"0.6559721",
"0.65595216",
"0.65481603",
"0.65442735",
"0.6533569",
"0.65326893",
"0.6530776",
"0.6521971",
"0.6509301",
"0.64957476",
"0.64916795",
"0.64833343",
"0.6483114",
"0.64686644",
"0.6467335",
"0.64592594",
"0.6458259",
"0.6443667",
"0.6442366",
"0.6439078",
"0.6439078",
"0.6434455",
"0.6434455",
"0.6434455",
"0.6434455",
"0.64325315",
"0.64298743",
"0.64242375",
"0.64242375",
"0.6420027",
"0.64192295",
"0.64192295",
"0.6414972",
"0.64098895",
"0.6400155",
"0.6397838",
"0.6395753",
"0.63922936",
"0.6390379",
"0.63826656",
"0.63764966",
"0.6367308",
"0.6361529",
"0.63573956",
"0.63572055",
"0.63369143",
"0.6331314",
"0.6330866",
"0.63220507",
"0.63220507",
"0.63220507",
"0.63220507",
"0.63193613",
"0.6315411"
] | 0.7449856 | 5 |
Returns a textual description of this response, including the status code and name. | def to_s
if message && !message.empty? && message.downcase != MAP[code]
"#{message} (#{MAP[code]}, #{code})"
else
"#{MAP[code]} (#{code})"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n \"<Response(#{status})>\"\n end",
"def to_s\n response = \"#{@status_line}\\n#{@header_fields}\\n#{@body}\"\n end",
"def response_status\n @response[:status]\n end",
"def response_message(response)\n @last_response = response\n 'HTTP Response status: [' + response.code.to_s + '] ' + reason_phrase(response.code)\n end",
"def response_message(response)\n @last_response = response\n 'HTTP Response status: [' + response.code.to_s + '] ' + reason_phrase(response.code)\n end",
"def status\n response.status\n end",
"def status_code\n @response.status\n end",
"def status\n response.status\n end",
"def status\n response.status\n end",
"def status_message\n data.status_message\n end",
"def code\n self.response_code # .to_s\n end",
"def response_message(response)\n @last_response = response\n \"HTTP Response status: [#{response.code.to_s}] #{reason_phrase(response.code)}\"\n end",
"def error_message\n @response.reason_phrase\n end",
"def status_message; end",
"def ai_response_description\n case ai_response\n when 0 then \"Unable to respond\"\n when 1 then \"Reception acknowledged\"\n when 2 then \"Response to follow\"\n when 3 then \"Able to respond but currently inhibited\"\n else\n \"Reserved for future use\"\n end\n end",
"def response_message response\n \"%s %s: %s %s (%f)\\n%s\" % [\n *response[:_response_meta].slice(\n :request_method, :request_url, :status_code, :status_message, :total_time\n ).values,\n Yajl::Encoder.encode(response.except(:_response_meta))\n ]\n end",
"def http_status_line(code = 200)\n \"#{HTTP_VERSION} #{code} #{Shelf::Utils::HTTP_STATUS_CODES[code]}\"\n end",
"def message\n \"#{super}: #{response.body}\"\n end",
"def http_status\n self[:status_code]\n end",
"def status_code\n response_value(:code)\n end",
"def status_message\n @data[:status_message]\n end",
"def code\n @raw_response.code\n end",
"def status_line\n @response_impl.status_line\n end",
"def to_s\n @status_code.to_s\n end",
"def status\n @status ||= raw_response['responseHeader']['status']\n end",
"def code\n @response.code\n end",
"def status_description\n self.status::DESCRIPTION\n end",
"def inspect_details\n\t\treturn %Q{%s -- %d headers, %0.2fK body (%p)} % [\n\t\t\tself.status_line,\n\t\t\tself.headers.length,\n\t\t\t(self.get_content_length / 1024.0),\n\t\t\tself.body,\n\t\t]\n\tend",
"def response_line\n \"#{Protocol::NAME}/#{@version} #{@code} #{@message}#{Protocol::CRLF}\"\n end",
"def reason\n response&.response&.msg\n end",
"def index\n head params[:response_status]\n end",
"def to_s\n \"#<Asana::HttpClient::Response status=#{@status} body=#{@body}>\"\n end",
"def response_status(kind)\n response.headers['status'] = kind.to_s\n end",
"def response_code\n @response.code\n end",
"def status_code\n STATUS_CODE\n end",
"def status_text\n if skipped?\n 'skipped'\n elsif error?\n 'error'\n else\n 'success'\n end\n end",
"def status_code; end",
"def message\n read_content :status\n end",
"def response_code\n if @response.code.to_i != 404 && is_fake_404?\n return \"#{@response.code.to_s} Possible fake 404\"\n else\n return @response.code.to_s\n end\n end",
"def build_response(response)\n \"HTTP/1.1 #{response[:status_code]} #{response[:status_message]}\\r\\n\" +\n \"Content-Type: text/plain\\r\\n\" +\n \"Content-Length: #{response[:bytesize]}\\r\\n\" +\n \"Connection: close\\r\\n\"\n end",
"def status\n self.operation.response.statusCode\n end",
"def response_code_message(response_code)\n case response_code\n when 1\n \"Success\"\n when 2\n \"Error\"\n when 3\n \"Server Too Busy\"\n when 4\n \"Protocol Error\"\n when 5\n \"Operation Not Supported\"\n when 6\n \"Recursion Count Too High\"\n when 7\n \"Server Read-only\"\n when 100\n \"Handle Not Found\"\n when 101\n \"Handle Already Exists\"\n when 102\n \"Invalid Handle\"\n when 200\n \"Values Not Found\"\n when 201\n \"Value Already Exists\"\n when 202\n \"Invalid Value\"\n when 300\n \"Out of Date Site Info\"\n when 301\n \"Server Not Responsible\"\n when 302\n \"Service Referral\"\n when 303\n \"Prefix Referral\"\n when 400\n \"Invalid Admin\"\n when 401\n \"Insufficient Permissions\"\n when 402\n \"Authentication Needed\"\n when 403\n \"Authentication Failed\"\n when 404\n \"Invalid Credential\"\n when 405\n \"Authentication Timed Out\"\n when 406\n \"Authentication Error\"\n when 500\n \"Session Timeout\"\n when 501\n \"Session Failed\"\n when 502\n \"Invalid Session Key\"\n when 504\n \"Invalid Session Setup Request\"\n when 505\n \"Session Duplicate Msg Rejected\"\n else\n \"Response Code Message Missing!\"\n end\n end",
"def message\n if http_context\n message = \"#{http_context[:method]} #{http_context[:path]} completed with \" \\\n \"#{status} #{status_description} \"\n\n if content_length\n message << \", #{content_length} bytes, \"\n end\n\n message << \"in #{time_ms}ms\"\n else\n message = \"Completed #{status} #{status_description} \"\n\n if content_length\n message << \", #{content_length} bytes, \"\n end\n\n message << \"in #{time_ms}ms\"\n end\n end",
"def response\n return format_response(:invalid, 'Transaction not found') unless exists?\n return format_response(:invalid, 'Security check failed') unless signature_ok?\n return format_response(:error, 'Sage Pay reported an error') if status == 'ERROR'\n return format_response(:invalid, 'Unexpected status') if %w{AUTHENTICATED REGISTERED}.include?(status)\n return format_response(:invalid, \"Invalid status: #{status}\") unless %w{OK NOTAUTHED ABORT REJECTED}.include?(status)\n format_response(:ok)\n end",
"def raise_api_error_msg(res)\n \"HTTP status code: #{res.status}, \" \\\n \"Error message: #{res.body['message']}, \" \\\n \"Reference: #{res.body['reference']}\"\n end",
"def status_line\n\t\tst = self.status || self.derived_status_code\n\t\treturn STATUS_LINE_FORMAT % [ st, HTTP::STATUS_NAME[st] ]\n\tend",
"def description\n description = I18n.t \"http.status.description.#{symbol}\"\n description = nil if description =~ /translation missing/\n description\n end",
"def code\n @http_response.code.to_i\n end",
"def status_code\n data.status_code\n end",
"def status\n inspect\n end",
"def response_code; end",
"def response_code; end",
"def response_code; end",
"def response_code; end",
"def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end",
"def info() \n \treturn self.response.info()\n\tend",
"def status_line\n # First line is 'Status-Line' from RFC2616 section 6.1\n # Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF\n # etc...\n return \"HTTP/#{version} #{status} #{reason}\"\n end",
"def friendly_status\n\n case self.status\n when \"no response\"\n \"You have not responded\"\n when \"reserve\"\n \"Reserved\"\n when \"decline\"\n \"Declined\"\n else\n \"Unknown\"\n end\n\n end",
"def status_code\n @parser.status_code\n end",
"def get_response_status\n @response_status\n end",
"def generate_response(code = 503, text)\n \"HTTP/1.1 #{code} #{CODES[code]}\\r\\nContent-type: text/plain\\r\\nContent-length: #{text.length}\\r\\n\\r\\n#{text}\"\n end",
"def inspect\n \"#<Rapture::HTTP::HTTPException @code=#{@code} @message=#{message.inspect}>\"\n end",
"def status_description\n\t\treturn case self.status\n\t\t\twhen 'M' then 'modified'\n\t\t\twhen 'A' then 'added'\n\t\t\twhen 'R' then 'removed'\n\t\t\twhen 'C' then 'clean'\n\t\t\twhen '!' then 'missing'\n\t\t\twhen '?' then 'not tracked'\n\t\t\twhen 'I' then 'ignored'\n\t\t\telse\n\t\t\t\traise \"unknown status %p\" % [ self.status ]\n\t\t\tend\n\tend",
"def description\n grpc.description\n end",
"def last_http_response\n resp = last_response.response\n out = \"HTTP/#{resp.http_version} #{resp.code} #{resp.message}\\n\"\n resp.each_header do |header, value|\n out += header.capitalize.gsub(/\\-([a-z])/) { |m| \"-#{m[1].chr.upcase}\" }\n out += \": #{value}\\n\"\n end\n\n out += \"\\n#{resp.body}\"\n end",
"def to_s\n result = \"Response header: \" + @response_version.to_s + \" \"+ @response_code.to_s + \" \"+ @response_message.to_s + \"\\n\"\n result += \"Content-length: \" + @content_length + \"\\n\" if ! @content_length.nil?\n result += \"Spam: \"+ @spam.to_s + \"\\n\"+ @score.to_s + \"/\"+ @threshold.to_s + \"\\n\" if ! @spam.nil?\n result += @tags.join(\"\\n\") if ! @tags.nil?\n result += @report.to_s if ! @report.nil?\n end",
"def code\n @response.code.to_i\n end",
"def code\n @response.code.to_i\n end",
"def name\n response[\"name\"]\n end",
"def status\n \"#{@description} #{@status}\"\n end",
"def status\n head :ok\n end",
"def status\n head :ok\n end",
"def to_s\n @response.body\n end",
"def code_symbol\n HTTP_STATUS_CODES[status]\n end",
"def response\n get_header_and_body\n end",
"def text\n @grpc.description\n end",
"def status\n http_client.status\n end",
"def text\n @grpc.description\n end",
"def status\n @message\n end",
"def status_phrase(status_symbol = :ok)\n Rack::Utils::HTTP_STATUS_CODES[status_code(status_symbol)]\n end",
"def to_s\n \"#{represent_status} : #{description}\"\n end",
"def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end",
"def get_http_response_code\n raise 'To be implemented in child classes'\n end",
"def code\n response&.code\n end",
"def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end",
"def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end",
"def get_response()\n if has_errors?\n return get_error_response()\n end\n @values[\"RESPONSE\"]\n end",
"def status(code)\n response.status = code\n end",
"def node_description\n\t\tdesc = \"%s %s %s/%s\" % [\n\t\t\tself.http_method,\n\t\t\tself.uri,\n\t\t\tself.app_protocol.upcase,\n\t\t\tself.http_version,\n\t\t]\n\n\t\tif body && !body.empty?\n\t\t\tdesc << \" {%s} (%s)\" % [ self.body, self.body_mimetype ]\n\t\tend\n\n\t\tdesc << ' -> %d response' % [ self.expected_status.to_i ]\n\n\t\treturn desc\n\tend",
"def http_response(response)\n status_code, headers, body = response\n http_response = status_line(status_code)\n DefaultResponseHeaders.merge(headers).each do |k,v|\n http_response << \"#{k}: #{v}\\r\\n\"\n end\n http_response << \"\\r\\n\"\n body.each do |s|\n http_response << s\n end\n http_response\n end",
"def status\n @json_body['status']\n end",
"def getStatusCode\n @_statusCode\n end",
"def info\n if @succeeded then 'Success' else \"Failure message='#{@message}'\" end\n end",
"def to_s\n return \"\\nStatus:\\t\\t#{@status}\\nTitle:\\t\\t#{@title}\\n\" + \n \"Message:\\t#{@message}\\nHelp:\\t\\t#{@help}\"\n end",
"def formatted_response\n self.response\n end",
"def error_message(response)\n \"#{response.body['error']}: #{response.body['error_description']}\"\n end",
"def description\n data['Description']\n end",
"def description\n self[:message]\n end",
"def http_code\n '000'\n end",
"def status\n STATUSES[code] || 'Unknown'\n end",
"def result_status_text\n {\n \"success\" => \"查询成功\",\n \"failed\" => \"查询失败\"\n }.fetch(notify_state, \"无结果\")\n end"
] | [
"0.7910374",
"0.7110447",
"0.6915804",
"0.68945146",
"0.68945146",
"0.68792117",
"0.6873165",
"0.682058",
"0.682058",
"0.67896783",
"0.6770691",
"0.67387325",
"0.67046636",
"0.67014253",
"0.6668569",
"0.66589165",
"0.66547424",
"0.66528654",
"0.66178256",
"0.6589557",
"0.65860534",
"0.6498592",
"0.64869577",
"0.64754075",
"0.64752656",
"0.64695257",
"0.64639276",
"0.6462843",
"0.6435158",
"0.64140666",
"0.64011544",
"0.6382928",
"0.6381997",
"0.6366868",
"0.6362313",
"0.6361091",
"0.6348917",
"0.6338435",
"0.6311285",
"0.6307898",
"0.62962466",
"0.6288544",
"0.6288514",
"0.62801796",
"0.6266587",
"0.6265189",
"0.62590235",
"0.62584186",
"0.62489337",
"0.624227",
"0.6239683",
"0.6239683",
"0.6239683",
"0.6239683",
"0.62358207",
"0.62229824",
"0.6222545",
"0.6202926",
"0.6202487",
"0.6200962",
"0.6196314",
"0.6195942",
"0.617745",
"0.6176476",
"0.61763036",
"0.61760014",
"0.6171598",
"0.6171598",
"0.6128774",
"0.6110413",
"0.60767585",
"0.60767585",
"0.6071989",
"0.6058308",
"0.60540926",
"0.60406935",
"0.60284597",
"0.60178465",
"0.6013967",
"0.59974915",
"0.59938854",
"0.59921813",
"0.59846026",
"0.59750736",
"0.5952661",
"0.5952661",
"0.5946977",
"0.5946522",
"0.5943143",
"0.5939042",
"0.5936908",
"0.59295124",
"0.59198785",
"0.59157515",
"0.5905889",
"0.59005827",
"0.5900486",
"0.58980197",
"0.58909386",
"0.58782715",
"0.5872676"
] | 0.0 | -1 |
Returns +true+ if the status code is FX_OK; +false+ otherwise. | def ok?
code == FX_OK
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ok?\n @status == OK\n end",
"def is_ok?\n code == OK_CODE\n end",
"def success?\n (status_code.to_s =~ /2../) ? true : false\n end",
"def ok?\n @status == 200\n end",
"def is_successful?\n status_code == '0'\n end",
"def success?\n\t\t!!( @status and @status.exitstatus == 0 )\n\tend",
"def success?\n status == \"ok\"\n end",
"def successful?\n status_code == 0 ? true : false\n end",
"def ok?\n @result.code.to_i != 200\n end",
"def check\n @response = get_fixity_response_from_fedora\n status.match(\"SUCCESS\") ? true : false\n end",
"def success?\n @status.between?(200, 299) if @status\n end",
"def success?\n @data[:status_code] == '200' || @data[:status_code] == '201' || @data[:status_code] == '407'\n end",
"def success?\n code == 200\n end",
"def success?\n status < 400\n end",
"def success?\n response.message == 'OK'\n end",
"def complete?\n status_code == 'OK'\n end",
"def ok?\n @result.retval == 0\n end",
"def successful?\n (200...300).include?(@status_code)\n end",
"def success?\n [200, 201, 204, 280, 281].include?(code)\n end",
"def success?\n status == 200\n end",
"def is_ok?\n return (self.status == HostResult::STATUS_OK)\n end",
"def ok?\n return @data[\"stat\"] == \"ok\" ? true : false\n end",
"def is_ok\n [\"OK\", \"QueuedForProcessing\"].include?(code);\n end",
"def status\n return false if [email protected]?(200)\n \n true\n end",
"def success?\n 200 <= code && code < 300\n end",
"def successful?\n @code == 0\n end",
"def ok?(code)\n [200, 201, 202, 204, 206].include?(code)\n end",
"def success?\n @status == SUCCESS_FLAG\n end",
"def successful?\n !!get_status_method\n end",
"def success?\n @status >= 200 && @status < 300\n end",
"def success?\n exit_status == 0\n end",
"def valid?\n code == 200\n end",
"def success?\n reply_code == 0\n end",
"def success?\n exit_code == 0\n end",
"def success?\n (200..299).include?( code )\n end",
"def successful?\n status == :successful\n end",
"def successful?\n status == :successful\n end",
"def ok?\n run unless ran?\n\n @status.success?\n end",
"def is_request_status_ok\n get_request_status == MA500Functions::MA500::ILV_OK.hex\n end",
"def success?\n (200..299).cover?(code)\n end",
"def status_ok?\n [1, 6, 7, 8, 9].include?(status)\n end",
"def ok?\n @ok\n end",
"def valid_status?(response)\n response.is_a?(Net::HTTPSuccess)\n end",
"def http_success?(code)\n http_status?(:success, code)\n end",
"def ok?\n\n if @http_raw_response.kind_of? Net::HTTPNoContent\n #if there is no content expected, use HTTP code\n 204 == @http_status_code\n else\n # otherwise use API status\n @http_raw_response.kind_of? Net::HTTPOK and 0 == @api_status.to_i\n end\n end",
"def valid?\n status == 200\n end",
"def successful?\n exit_code == 0\n end",
"def success?\n status == 'success'\n end",
"def successful?\n status == \"successful\"\n end",
"def ok?\n return @ok\n end",
"def valid?\n (200..299).include? status\n end",
"def successful?\n @status.success?\n end",
"def successful?\n status == 'successful'\n end",
"def is_success?\n @code.in? 200..299\n end",
"def success?\n @response.code == \"200\"\n end",
"def isSuccess\n return @_statusCode == 200 || @_statusCode == 201? true : false\n end",
"def success?\n type == :ok\n end",
"def success?\n !soap_fault? && !http_error?\n end",
"def success?\n @status && @status.success?\n end",
"def success?\n @status && @status.success?\n end",
"def success?\n @code.to_i == 0\n end",
"def success?\n return nil unless success_code\n response.code == success_code.to_s\n end",
"def success?\n status.nil?\n end",
"def is_successful?\n code.to_i >= 200 && code.to_i <= 299\n end",
"def ok?(response)\n case response\n when Net::HTTPSuccess\n true\n else\n false\n end\n end",
"def response_code_is_ok?\n return true if %w(00 24).include? response_code\n\n false\n end",
"def status_success?()\n return true if (@status == TAC_PLUS_ACCT_STATUS_SUCCESS)\n return false\n end",
"def success?\n response.status == 200\n end",
"def ok?\n @ok\n end",
"def success?\n status == 'success'\n end",
"def success?\n return nil unless @success_code\n response.code == @success_code.to_s\n end",
"def healthy?\n return false if status <= 199 || status >= 400\n true\n end",
"def is200\n (Net::HTTPSuccess === response)\n end",
"def success?\n # note that Linux ruby returns nil when exitstatus is nil and a termsig\n # value is set instead.\n return @exitstatus ? (0 == @exitstatus) : nil\n end",
"def complete?\n %w[success failure exception].include?(status)\n end",
"def status_error?()\n return true if (@status == TAC_PLUS_ACCT_STATUS_ERROR)\n return false\n end",
"def ok_status_code\n _undefined\n end",
"def healthy?\n return false if status <= 199 || status >= 400\n\n true\n end",
"def success?\n return true\n end",
"def success?\n false\n end",
"def success?\n false\n end",
"def success?\n status( @params['TxId'], @params['amount'] ) == 'success'\n end",
"def status_is_successful?\n\t\treturn self.status_category == 2\n\tend",
"def success?\n CODES[:success].include?(code.to_i)\n end",
"def success?\n %w[1 2 3].include?(@status.to_s[0])\n end",
"def failing?\n @status.exitstatus & (1 << 3) != 0\n end",
"def successful?\n returned_parameters['status'] == 'success'\n end",
"def success?\n @code.nil? && @error.nil?\n end",
"def success?\n status( @params['txnid'], @params['amount'] ) == 'success'\n end",
"def success?\n status == Process::EXIT_SUCCESS\n end",
"def request_succeeded?\n @errors.blank? && [200,0].member?(@response_code)\n end",
"def silverpop_successful?(doc)\n %w[true success].include?(result_dom(doc)['SUCCESS'].downcase) rescue false\n end",
"def call_ok?(response = {})\n response['showapi_res_code'] == 1 && response['showapi_res_error'] == 'ok'\n rescue StandardError\n false\n end",
"def success?\n (200..399).include? code\n end",
"def prefail?\n @status.exitstatus & (1 << 4) != 0\n end",
"def failing?\n @status.exitstatus & (1 << 3) != 0\n end",
"def rsuccess(response)\n response[:body][:statuscode].to_i == 0\n end",
"def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end",
"def client_error?\n @status.between?(400, 499) if @status\n end",
"def successful?\n @code.nil?\n end"
] | [
"0.74520737",
"0.7108859",
"0.7098609",
"0.7043127",
"0.7035813",
"0.6967889",
"0.6966165",
"0.6905255",
"0.6896311",
"0.6857539",
"0.6839474",
"0.6802789",
"0.6788055",
"0.6776196",
"0.6763993",
"0.6753299",
"0.6742513",
"0.6727451",
"0.6726015",
"0.6707289",
"0.6688147",
"0.6682339",
"0.6676614",
"0.66712093",
"0.66592515",
"0.6651976",
"0.66371024",
"0.66367567",
"0.66174257",
"0.66072327",
"0.6604968",
"0.65922433",
"0.65642595",
"0.655731",
"0.6537042",
"0.65356165",
"0.65356165",
"0.6531438",
"0.65226936",
"0.6520903",
"0.6485396",
"0.6483738",
"0.6465084",
"0.64623356",
"0.64615655",
"0.6457535",
"0.64389026",
"0.64169806",
"0.64124376",
"0.6407769",
"0.6403984",
"0.6390443",
"0.63903487",
"0.6389779",
"0.63879657",
"0.6375807",
"0.6365818",
"0.63636756",
"0.63392353",
"0.6327908",
"0.6322558",
"0.63140136",
"0.6313055",
"0.6293078",
"0.6282858",
"0.6281487",
"0.62804425",
"0.627439",
"0.6273532",
"0.6249318",
"0.62424606",
"0.62391067",
"0.6236044",
"0.6232771",
"0.62309545",
"0.62223285",
"0.62103724",
"0.6206504",
"0.6198218",
"0.6194374",
"0.6194374",
"0.6182589",
"0.61788905",
"0.6174925",
"0.61673975",
"0.6166979",
"0.6161282",
"0.61591387",
"0.6140064",
"0.61257726",
"0.6107855",
"0.6103971",
"0.6089392",
"0.6087071",
"0.6077841",
"0.6075979",
"0.6066862",
"0.6064038",
"0.6058677",
"0.6047436"
] | 0.83634627 | 0 |
Returns +true+ if the status code is FX_EOF; +false+ otherwise. | def eof?
code == FX_EOF
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n @io.eof?\n end",
"def eof?\n return @stream.eof?\n end",
"def eof?\n io.eof?\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n if @buffer.size > 0\n false\n else\n @io.eof?\n end\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @eof\n end",
"def eof?\n @stream.eof?\n end",
"def eof?\n @io.closed? || @io.eof?\n end",
"def eof_found?\n @eof_found\n end",
"def eof?\r\n false\r\n end",
"def eof?\n raise IOError, 'not opened for reading' if closed?\n @total == @size && @buffer.empty?\n end",
"def eof?\n wait_for_chars(1)\n @cursor == @buffer.length && @eof_found\n end",
"def eof_flag\n @eof_flag\n end",
"def eof?\n ready_token\n if @buffer\n @buffer.empty? && @io.eof?\n else\n @io.eof?\n end\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?\n @stdin.eof?\n end",
"def eof?\n !@io || (@io.closed? || @io.eof?) && @buffer.empty?\n end",
"def eof?\n !@io || (@io.closed? || @io.eof?) && @buffer.empty?\n end",
"def eof?\n stream = @_st_stream\n stream and stream.eof?\n end",
"def eof?\n @pos == @data.bytesize\n end",
"def eof?()\n #This is a stub, used for indexing\n end",
"def eof?\n end",
"def eof?\n @input.eof?\n end",
"def eof?\n if @stdin.wait_readable(0.00001)\n c = @stdin.getc\n result = c.nil? ? true : false\n @stdin.ungetc(c) unless c.nil?\n result\n else # buffer is empty\n false\n end\n end",
"def eof?\n not busy?\n end",
"def eof?\n @read >= @size\n end",
"def eof?\n @sock.closed?\n end",
"def eof?\n @socket.eof?\n rescue IOError, SystemCallError\n true\n end",
"def eof?() end",
"def eof?() end",
"def eof?() end",
"def end_of_stream?\n @next_chunk.nil?\n end",
"def at_end?\n peek.type == :eof\n end",
"def eof?\n\t\t\t\tfill_read_buffer if !@eof && @read_buffer.empty?\n\t\t\t\t\n\t\t\t\treturn @eof && @read_buffer.empty?\n\t\t\tend",
"def eof?\n $stdin.closed?\n end",
"def eof\n\t\trequest = Packet.create_request('core_channel_eof')\n\n\t\trequest.add_tlv(TLV_TYPE_CHANNEL_ID, self.cid)\n\n\t\tbegin\n\t\t\tresponse = self.client.send_request(request)\n\t\trescue\n\t\t\treturn true\n\t\tend\n\n\t\tif (response.has_tlv?(TLV_TYPE_BOOL))\n\t\t\treturn response.get_tlv_value(TLV_TYPE_BOOL)\n\t\tend\n\n\t\treturn false\n\tend",
"def eof?\n @position >= @size\n end",
"def haspdueof?; return !@pdus[\"EOF\"].nil? end",
"def prim_eof?\n false\n end",
"def eof?\n fill_rbuff if !@eof && @rbuffer.empty?\n @eof && @rbuffer.empty?\n end",
"def fin?\n Capp::TCP_FIN == flags & Capp::TCP_FIN\n end",
"def track_eof?\n true if track_eof\n end",
"def handle_eof\n # do this check again for thread safety\n if @state.eof_reached?\n STDOUT.flush\n @callback[:end_of_file].call\n @state.handle_eof\n end\n true\n end",
"def eof?\n @state.eof_reached? && get_player_output.size < 1\n end",
"def stream_is_done?\n @stream.nil? || @stream.closed? || @stream.eof?\n end",
"def eof?; @io.size == @rio end",
"def eof\n if @sio_closed_read ; __require_readable ; end\n @sio_pos >= @sio_string.length\n end",
"def eof?\n @stmt.done?\n end",
"def end?\n @status == :end\n end",
"def eof?\n ref_line.nil? && output_line.nil?\n end",
"def eof?\n peek_lit(nil).nil?\n end",
"def ok?\n code == FX_OK\n end",
"def readable_after_eof?\n false\n end",
"def readable_after_eof?\n false\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def eof_flag=(value)\n @eof_flag = value\n end",
"def is_partition_eof?\n code == :partition_eof\n end",
"def eof?; end",
"def eof?; end",
"def done?\n return status if [true, false].include? status\n\n status == :DONE\n end",
"def eof\n @pushback.nil? and (@input.nil? or @input.eof)\n end",
"def done?\n !!@exitstatus\n end",
"def gets_eof\n script.gets_channel_eof(self)\n end",
"def do_status( code, message, language )\n if code == FX_EOF\n @log.debug \"[#{@id}] got EOF\" if @log.debug?\n @callback[ OK, @data ]\n else\n super\n end\n end",
"def eos?; end",
"def eof; @file.eof; end",
"def eof?\n\t\tnot peak\n\tend",
"def eof!; end",
"def finished?\n\t\t\t\t@finished && @body.length >= @headers['CONTENT_LENGTH']\n\t\t\tend",
"def eof\n end",
"def final_chunk?\n ::HttpParser.http_body_is_final(self) > 0\n end",
"def eof() end",
"def eof() end",
"def eof() end",
"def complete?\n status_code == 'OK'\n end",
"def done_headers?\n [:body_identity, :body_chunked, :body_chunked_tail, :done].include?(@state)\n end",
"def capture_eof\n yield\n false\nrescue SystemExit\n true\nend",
"def done?\n return false if status.nil?\n \"done\".casecmp(status).zero?\n end",
"def ok?\n @status == OK\n end",
"def error?\n @status == ERROR_FLAG\n end",
"def done?\n\t\tstatus == DONE\n\tend",
"def alive?\n if Kernel::select([ self ], nil, nil, 0)\n !eof? rescue false\n else\n true\n end\n rescue IOError\n false\n end",
"def end?()\n END_MARKER.equal? _next_element\n end",
"def alive?\n return false if closed?\n\n if IO.select([self], nil, nil, 0)\n !eof? rescue false\n else\n true\n end\n rescue IOError\n false\n end",
"def alive?\n return false if closed?\n\n if IO.select([self], nil, nil, 0)\n !eof? rescue false\n else\n true\n end\n rescue IOError\n false\n end",
"def incomplete?\r\n ![BatchStatus::OUTPUT_READY, BatchStatus::OUTPUT_GENERATED, BatchStatus::OUTPUT_EXCEPTION].include?(status)\r\n end"
] | [
"0.7336073",
"0.7336073",
"0.7336073",
"0.72984815",
"0.72851884",
"0.7255248",
"0.7255248",
"0.7255248",
"0.72539973",
"0.7221933",
"0.7221933",
"0.7221933",
"0.7211516",
"0.71952873",
"0.71592677",
"0.7016629",
"0.6980623",
"0.6976482",
"0.69627213",
"0.69623184",
"0.6924465",
"0.6924465",
"0.6924465",
"0.69140244",
"0.69140244",
"0.69095737",
"0.6903747",
"0.6900224",
"0.68684834",
"0.683556",
"0.68310326",
"0.6808461",
"0.68081295",
"0.6744591",
"0.6694472",
"0.6693108",
"0.6693108",
"0.6693108",
"0.6686065",
"0.66788167",
"0.66439486",
"0.6629028",
"0.661856",
"0.65378314",
"0.6532331",
"0.65161556",
"0.64599866",
"0.6426125",
"0.64049745",
"0.63854706",
"0.63834053",
"0.636012",
"0.6298784",
"0.627563",
"0.6255953",
"0.6244956",
"0.62128174",
"0.61749774",
"0.6154431",
"0.6142602",
"0.6142602",
"0.6122425",
"0.6122425",
"0.6122425",
"0.6090289",
"0.6090289",
"0.6090289",
"0.6090289",
"0.6090289",
"0.60620874",
"0.5966093",
"0.59517187",
"0.59517187",
"0.5917694",
"0.59002566",
"0.58888507",
"0.5854233",
"0.5845376",
"0.5815649",
"0.58037955",
"0.57998705",
"0.57890296",
"0.57695436",
"0.5752283",
"0.56950784",
"0.56312686",
"0.56312686",
"0.56312686",
"0.5625099",
"0.56175286",
"0.55776584",
"0.557509",
"0.55713254",
"0.5558953",
"0.5553956",
"0.55491227",
"0.5548618",
"0.55090886",
"0.55090886",
"0.55032706"
] | 0.8081804 | 0 |
accessors (with input checking) | def temperature=(temperature)
raise ArgumentError unless temperature.is_a?(Data::Temperature)
@temperature = temperature
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input; end",
"def input; end",
"def input; end",
"def input?; @input; end",
"def get_input;\t@input \t\tend",
"def input; @input; end",
"def input; @input; end",
"def read_input; end",
"def input=(_arg0); end",
"def read_input\n end",
"def get_input\n #Get input from the user\nend",
"def user_input\n\tgets\nend",
"def text_input; end",
"def get_user_input\n user_input_valid gets.chomp\n end",
"def get_input\n @input = gets.chomp\n end",
"def input_string; end",
"def prepare_input(prompt); end",
"def get_input_main\n input = gets.chomp.downcase\n case input\n when 'all'\n flight_list \n when 'year'\n year\n when 'rocket'\n rocket\n when 'success'\n success_failure\n when 'number'\n flight_number\n when 'mission'\n mission_name\n when 'random'\n random\n when 'exit'\n exit\n else \n begin\n raise Error\n rescue Error => error\n Error.invalid_input\n get_input_main\n end\n end\n end",
"def get_input\n input = gets\n return input\nend",
"def initialize(input)\n @user_input = input\n end",
"def input\n @input ||= STDIN.readlines\nend",
"def process_input\n if state.user_input == :star\n input_star\n elsif state.user_input == :star2\n input_star2\n elsif state.user_input == :target\n input_target\n elsif state.user_input == :target2\n input_target2\n elsif state.user_input == :remove_wall\n input_remove_wall\n elsif state.user_input == :remove_wall2\n input_remove_wall2\n elsif state.user_input == :add_hill\n input_add_hill\n elsif state.user_input == :add_hill2\n input_add_hill2\n elsif state.user_input == :add_wall\n input_add_wall\n elsif state.user_input == :add_wall2\n input_add_wall2\n end\n end",
"def argument?; end",
"def get_input\n @input = gets.strip\n end",
"def input\n @input ||= Input.new\n end",
"def stdinput\n @input\n end",
"def get_input\n gets.strip #chomp was also used..\nend",
"def get_input\n gets.chomp \nend",
"def question\n puts \"What kind of maths would you like to do?\"\n @input = gets.chomp.downcase\nend",
"def input\n @input ||= args.dig(:input)\n end",
"def get_user_input\n input = gets.chomp\n #input\nend",
"def get_input\n gets.chomp\n end",
"def get_input\n\t#Get input from the user.\n return gets.chomp\nend",
"def readInput\r\n puts 'Please enter a valid Temperature: '\r\n input = gets.to_s\r\n anArray = input.split(' ')\r\n self.myDegrees = anArray[0].to_f\r\n self.myScale = anArray[1].upcase\r\n checkIfValid(self.myDegrees, self.myScale)\r\n end",
"def input=(_input)\n end",
"def get_input input\n\n case input\n\n # avancar\n when 'a'\n case menu\n when 'do_inicio',\n 'continuar' then line_forth\n when 'escrevendo' then next_char\n when 'ler' then @filelist.rotate!\n else next_option\n end\n\n # voltar\n when 'v'\n case menu\n when 'do_inicio',\n 'continuar' then line_back\n when 'escrevendo' then last_char\n when 'ler' then @filelist.rotate! -1\n else last_option\n end\n\n # fim\n when 'f'\n case menu\n when 'escrevendo' then end_of_text\n end\n\n # enter\n when 'e'\n case menu\n\n when 'ler'\n @filename = @filelist.first[:file]\n seleciona_ler_modo\n\n when 'principal',\n 'ler_modo'\n self.send \"seleciona_#{@options.first.gsub(\" \",\"_\")}\"\n\n when 'escrever'\n @writer = Writer.new('nota')\n @options = ['nota']\n seleciona_escrevendo\n\n when 'escrevendo' then end_of_line\n\n when 'salvar' then save_action\n\n end\n\n # backspace\n when 'b'\n case menu\n when 'escrevendo' then delete_char\n end\n\n # esc\n when 's'\n case menu\n when 'ler','escrever' then seleciona_principal\n when 'ler_modo',\n 'do_inicio',\n 'continuar' then seleciona_ler\n when 'escrevendo'\n save_options\n seleciona_salvar\n end\n\n # inputs de dados\n else\n case menu\n when 'escrevendo' then insert_char(input)\n end\n end\n\n end",
"def getInput(_name)\n return getInputTable()[_name] ;\n end",
"def fetch_input(question_to_user)\n print question_to_user\n gets.chomp # return not needed\nend",
"def input_name\n\tname = gets.chomp\nend",
"def handle_input(input)\n return \"Invalid input\" unless self.respond_to? input\n self.send input\n end",
"def value_read=(_arg0); end",
"def process_input\n if state.current_input == :star\n input_star\n elsif state.current_input == :target\n input_target\n elsif state.current_input == :remove_wall\n input_remove_wall\n elsif state.current_input == :add_wall\n input_add_wall\n end\n end",
"def get_input\n user = Input.new\n loop do\n input = user.get_input\n return loss(input) if self[input].value == \"O\"\n return reveal_adjacent_cells(input) if !self[input].show\n puts \"Invalid input\"\n end\n end",
"def get_user_input\n gets.chomp\nend",
"def get_user_input\n gets.chomp\nend",
"def initialize(input)\n @input = input\n end",
"def input\n @all[:input]\n end",
"def gets\n @input.gets\n end",
"def basic_analysis_input!\n self.buying_price = DefaultInput.buying_price.base\n self.deposit = DefaultInput.deposit.base\n self.interest = DefaultInput.interest.base\n self.tenure = DefaultInput.tenure.base\n self.selling_price = DefaultInput.selling_price.base\n self.holding_period = DefaultInput.holding_period.base\n return true\n end",
"def user_input\n input = gets.chomp\n end",
"def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend",
"def begin_input\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"hard\", \"h\" then :hard\n\t\t\twhen \"medium\", \"m\" then :medium\n\t\t\twhen \"mom\" then :mom\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid input!\" if not input\n\t\tend\n\t\tinput\n\tend",
"def user_input\n user_input = gets.chomp\nend",
"def get_input(name, default)\n if default\n $stderr.puts \"#{name}: #{default}\"\n default\n else\n Readline.readline(\"#{name}: \", true)\n end\nend",
"def inspect(input); end",
"def initialize(input)\n @input = input\n fail 'Bad input. All characters must be ( or ).' unless valid_input?\n end",
"def do_input\n prompted, item = input_prompt\n print '? ' unless prompted\n val = $stdin.gets.chomp\n\n # All digits (and decimal point)\n val = (val.include?('.') ? val.to_f : val.to_i) if val =~ NUMBER_REGEX\n\n @variables[item.value] = val\n end",
"def user_input\n gets.chomp\nend",
"def user_input\n gets.chomp\nend",
"def data()\n\t\tputs(\"Please enter the name of the employee\")\n\t\t@name = gets\n\t\tputs(\"Now the age\")\n\t\t@age = gets\n\t\tputs(\"Finally his social number\")\n\t\t@social_n = gets\n\tend",
"def input(input)\n cleaned_input = sanatise_input input\n\n if valid_input? cleaned_input\n process_input cleaned_input\n else\n # Return error message\n return AppConfig.msg_place_args\n end\n end",
"def readIn\n puts(\"The format is xxx.xx A where xxx.xx is a real value\\n\")\n puts(\"and A is a character representing a unit system (F, R, C, K)\\n\")\n\n val = -460.00\n unit = 'F'\n until isValid( val, unit)\n print(\"Enter here: \")\n # The input string can have a space => slice it out\n # It also has a '\\n' at the end (important for indexing)\n inputStr = gets \n inputStr.slice!(\" \")\n val = inputStr[0..-3].to_f\n unit = inputStr[-2, 1].upcase\n if not isValid( val, unit ) then \n puts(\"Value and unit do not constitute a valid\")\n puts(\"Temperature. Please try again.\")\n end \n end\n\n @value = val\n @unit = unit\n self \n end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def input(thing)\n print \"Enter #{thing}: \"\n gets.chomp\nend",
"def get_input(symbol)\r\n\tprint \"#{symbol} - \"\r\n\tinput = gets.chomp\r\n\tif symbol == \"name\" || symbol == \"theme\"\r\n\t\treturn input\r\n\telsif symbol == \"cats\" \r\n\t\tif input == \"y\"\r\n\t\t\treturn true\r\n\t\telse return false\r\n\t\tend\r\n\telse return input.to_i\r\n\tend\r\nend",
"def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend",
"def input_type; end",
"def name_of_person\n\tputs 'What is you name?'\n\ttheir_name = gets\nend",
"def valid; end",
"def preprocess_input(input)\n input\nend",
"def input(applied_action_as_symbol_or_string = :inspect)\r\n gets.send(applied_action_as_symbol_or_string)\r\nend",
"def read_thing(thing)\n print input_prompt(thing[:text], thing[:default])\n validate_input(read_input, thing[:default], thing[:test])\n end",
"def get_input\n input = DefaultInput.new\n # basic input\n input.buying_price.base = self.buying_price\n input.selling_price.base= self.selling_price\n input.deposit.base = self.deposit\n input.interest.base = self.interest\n input.tenure.base = self.tenure\n input.holding_period.base= self.holding_period\n\n # advance input\n input.sell_transaction_cost.base = self.sell_transaction_cost\n input.purchase_transaction_cost.base = self.purchase_transaction_cost\n input.rental.base= self.rental\n input.rental_period.min = self.rental_start\n input.rental_period.max = self.rental_end\n\n return input\n end",
"def get_input\n begin\n inp = gets.chomp\n raise Error unless %w{s h d}.include?(inp)\n rescue\n retry\n end\n inp\n end",
"def source=(input); end",
"def get_input(prompt)\n #get a message to display to the user and return the entered value\n print prompt\n gets.chomp\nend",
"def get_user_input\n print \">> \"\n input = gets.chomp\n begin\n parse_user_input(input)\n rescue StandardError\n invalid_command\n end\n end",
"def get_input\n story = gets.chomp\nend",
"def validation; end",
"def validation; end",
"def request_operations_numbers(user_input, valid_operators)\n puts \"What operation would you like to perform?\"\n operation = gets.chomp\n if valid_operators.values.flatten.include?(operation)\n user_input[:operation] = operation\n else\n puts \"Whoa nelly! You don't make sense. You can add, subtract, multiply, or divide.\"\n exit\n end\n puts \"What's the first number you would like to use?\"\n num_1 = gets.chomp\n user_input[:num_1] = num_1\n\n puts \"What's the second number you would like to use?\"\n num_2 = gets.chomp\n user_input[:num_2] = num_2\nend",
"def preprocess_input(input)\nend",
"def put_in_user\n #setting variables\n name, cohort, city, hobby = placeholder\n #prompting the user for input and receiving it\n puts \"Hey there, type your name\".center(50)\n name = STDIN.gets.chomp\n\n puts \"Put your cohort\".center(50)\n cohort_input = STDIN.gets.chomp\n cohort = cohort_input.downcase\n\n puts \"Put your city\".center(50)\n city = STDIN.gets.chomp\n\n puts \"Put your hobby\".center(50)\n hobby = STDIN.gets.chomp\n\n validation_of_user_input(name, cohort, city, hobby)\n\nend",
"def ask_for(detail)\n puts \"Enter #{detail}\"\n STDIN.gets.chomp \nend",
"def _input(*a)\n Input.new(self, *a)\n end",
"def get_input(original_input, msg)\n if original_input.nil?\n puts \"#{msg}: \\n\"\n new_input = STDIN.gets.chomp\n if !new_input.nil? && new_input.length > 0\n return new_input\n else\n # keep bugging the user until they answer or despair\n puts \"Please enter a valid response\"\n get_input(nil, msg)\n end\n else\n return original_input\n end\nend",
"def cartman(input)\nend",
"def gets(*rest) end",
"def gets(*rest) end",
"def user_input\n Rushmate::UserInput\n end",
"def set_player(input) \n print \"Please enter your name : \"\n @name[0] = input.gets\n print \"Please enter your name : \"\n @name[1] = input.gets \n end",
"def gets_input\n\tgets.strip\nend",
"def reading(var, var_type) #method\n user_input = $stdin.gets.chomp\n user_input_type = get_type(user_input)\n user_input_class = user_input_type.class\n type = digest_type(var_type, user_input)\n if user_input_class.to_s == type\n @current_context[var] = user_input_type\n else\n puts \"Fatal Error: semantic cube error, expected #{var_type} and got #{user_input_class}.\"\n exit\n end\n end",
"def get_input \n puts \"to save this game, input 's,filename'\"\n puts \"to load a game, input 'l,filename'\"\n puts \"input a coordinate to access. prefix with r for reveal or f for flag\"\n puts \"example 'f,1,2' places a flag at 1,2\"\n input = gets.chomp\n \n args = input.split(',')\n end",
"def set_text_input(input); end",
"def get_user_input\n gets.strip\nend",
"def issn; end"
] | [
"0.749392",
"0.749392",
"0.749392",
"0.7253445",
"0.714534",
"0.7074125",
"0.7074125",
"0.6940484",
"0.68478554",
"0.6809061",
"0.6761475",
"0.65394133",
"0.65347874",
"0.6514947",
"0.6431825",
"0.638621",
"0.63433737",
"0.6277592",
"0.6253407",
"0.62345976",
"0.62123156",
"0.62068236",
"0.6150449",
"0.6127013",
"0.6126979",
"0.6114558",
"0.61139077",
"0.61038554",
"0.6079738",
"0.60532343",
"0.60520023",
"0.60421807",
"0.6025791",
"0.59931904",
"0.5988209",
"0.5988078",
"0.5985774",
"0.5983667",
"0.5977343",
"0.5969671",
"0.59684485",
"0.5949931",
"0.5935035",
"0.5928304",
"0.5928304",
"0.59204763",
"0.59195447",
"0.59130824",
"0.5911496",
"0.5900999",
"0.5895734",
"0.5869639",
"0.5863033",
"0.58542836",
"0.5852003",
"0.58421785",
"0.58392286",
"0.5836933",
"0.5836933",
"0.58369297",
"0.5836856",
"0.58343256",
"0.5830038",
"0.5830038",
"0.5830038",
"0.5830038",
"0.5830038",
"0.5828982",
"0.5828083",
"0.58266556",
"0.581725",
"0.5807254",
"0.580665",
"0.58051026",
"0.5798322",
"0.5797307",
"0.5791924",
"0.5791142",
"0.5776574",
"0.5772495",
"0.57714295",
"0.57669055",
"0.5760538",
"0.5760538",
"0.57432747",
"0.57423645",
"0.5733049",
"0.573057",
"0.57238114",
"0.57077926",
"0.57031596",
"0.5697699",
"0.5697699",
"0.5695066",
"0.56938297",
"0.5690933",
"0.5682531",
"0.56799144",
"0.5676598",
"0.5676442",
"0.56631774"
] | 0.0 | -1 |
creates "?" helpers for all attributes (which maps to nil?) | def method_missing(method,*args)
# if the method ends in ?, then strip it off and see if we
# respond to the method without the ?
if (call_method = method.to_s.chomp!("?")) && respond_to?(call_method)
return send(call_method).nil? ? false : true
else
super(method,*args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nil_if_blank\n NULL_ATTRS.each { |attr| self[attr] = nil if self[attr].blank? }\n end",
"def defaulted_attrs\n given_attrs.reject {|attr| send(\"given_#{attr}?\")}\n end",
"def normalize_blank_values\n attributes.each do |column, value|\n self[column].present? || self[column] = nil\n end\n end",
"def empty_to_null\n attributes_before_type_cast.each do | key, value |\n write_attribute(key, nil) if value.kind_of?( String ) && value.empty?\n end\n end",
"def non_empty_attr\n attributes.reject {|x,y| x == 'id' or y.blank?}\n end",
"def normalize_blank_strings\n attributes.each do |column, value|\n self[column] = nil if value.is_a? String and value.blank?\n end\n end",
"def read_present\n @attrs.select { |k,v| !v.nil? }\n end",
"def aggregate_treat_undefined_attributes_as_default_value?; end",
"def optional_attributes\n fail NotImplementedError 'Please define #optional_attributes as a list of the '\\\n 'attributes on this resource that may not be present and thus should return nil' \\\n 'instead of raising a NoMethodError.'\n end",
"def matterful_attributes(options={})\n options = options.dup\n default = options[:default].nil? ? true : options[:default]\n foreign_key = options[:foreign_key].nil? ? true : options[:foreign_key]\n sti = options[:sti].nil? ? true : options[:sti]\n polymorphic = options[:polymorphic].nil? ? true : options[:polymorphic]\n # Set compare_blank_values to false only if you, DO NOT want to update existing information with nil information from the new object\n # For example, sometimes your table has historical data, while source, may only have current. You may want to keep historical data\n # for reference, or if some process relies on it. It's generally not a good idea to delete good data, unless you have to.\n compare_blank_values = options[:compare_blank_values].nil? ? true : options[:compare_blank_values]\n\n # extra keys supplied as array of strings to ignore in comparison\n attributes_to_ignore = options[:extra].nil? ? [] : options[:extra]\n\n # Let's check for and add typical attributes that sti & polymorphic models have, override\n # this by sti: false, polymorphic: false, foreign_key: false\n # by default when looking to compare two objects\n # Customer.find(1).shipping_address.same_as? Address.new(city: 'Chicago')\n # we really only want to see if any of the 'matterfule information changed', like address_line_1 or city.\n # TODO: I guess I could do some smart checking on the model to see what kind of attributes it has.\n # For now we'll just check for all that we want to remove\n if default\n attributes_to_ignore += ['id', 'created_at', 'updated_at']\n end\n # By default we want foreign keys like caegory_id as they provide useful information about current record.\n # Let's say you import a bunch of addresses\n # and they ony matterful change was from shipping to billing category.\n unless foreign_key\n # This will skip polymorphic style foreign keys and only deal with belongs_to style keys\n attributes_to_ignore += attributes.keys.keep_if{|k| k.match(/_id\\z/) && !k.match(/able_id\\z/) }\n end\n if sti\n attributes_to_ignore += ['type']\n end\n # If you are looking at a model that is polymorphic than most like you want to update something\n # like city for an Address , not addressable_id or addresable_type\n # That is more likely type of information to be updated on external import.\n if polymorphic\n attributes_to_ignore += attributes.keys.keep_if{|k| k.match(/able_id\\z/) }\n attributes_to_ignore += attributes.keys.keep_if{|k| k.match(/able_type\\z/) }\n end\n\n # This will only be invoked on blank values\n # Since this gem is used only in the context of ActiveRecord, safe to use blank?, from ActionPack\n # KEEP IN MIND THIS THI WILL NOT CHECK for blanks in sti, foreign, and default attributes\n # it will only check for blank values in keys not in attributes_to_ignore already!!!!\n unless compare_blank_values\n attributes.except(*attributes_to_ignore).keys.each do |key|\n if self.send(key).blank?\n attributes_to_ignore += [key]\n end\n end\n end\n attributes.except(*attributes_to_ignore)\n end",
"def has_attributes?; end",
"def convert_empty_id_attributes_to_nil(attributes)\n attributes.each do |key, value|\n if key =~ /^.*_id$/ && value.blank?\n attributes[key] = nil\n end\n end\n attributes\n end",
"def is_attribute?; end",
"def method_missing(name, *args, &block)\n @attributes ? @attributes[name.to_s] : nil\n end",
"def optionalize\n without_values(nil)\n end",
"def convert_blank_to_nil\n all_fields = self.get_array_of_symbolic_keys\n # updating record's field with nil for blank values\n all_fields.each do |field|\n if self[field].blank?\n self[field] = nil;\n end\n end\n end",
"def attr_falsey_or_empty?(key)\n !@attrs[key] || @attrs[key].respond_to?(:empty?) && @attrs[key].empty?\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def noop?\n local_attributes.empty?\n end",
"def optional_attributes\n [:student_number, :state_id, :location, :gender, :dob, :grade, :frl_status,\n :race, :hispanic_ethnicity, :email, :credentials]\n end",
"def helper_attr(*attrs); end",
"def define_attribute_methods\n if super\n define_nilify_blank_methods\n end\n end",
"def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end",
"def flex_attributes; nil end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def nullables\r\n []\r\n end",
"def null?; false end",
"def skip_conversion?(obj, attr, value)\n value.nil? || !obj.class.attributes.key?(attr)\n end",
"def attributes_exist?\n\tend",
"def nullable\n self['nullable']\n end",
"def attributes(options={:strip => true, :null_if_blank => true})\n\t\t\treturn @attributes if @attributes\n\t\t\t@attributes = {}\n\t\t\[email protected] do |value|\n\t\t\t\t@attributes[value[:name]] = value.evaluate(@node, :attrs => true)\n\t\t\t\t@attributes[value[:name]].strip! if options[:strip]\n\t\t\t\t@attributes[value[:name]] = nil if @attributes[value[:name]].blank? && options[:null_if_blank]\n\t\t\tend\n\t\t\t@attributes\n\t\tend",
"def nullify_fields\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def nils?\n [@passphrase, @plain, @encrypted].each do |attribute|\n return true if attribute.nil?\n end\n return false\n end",
"def attributes_nil_hash\n @_attributes_nil_hash ||= {}.tap do |attr_hash|\n registered_properties.each_pair do |k, prop_obj|\n val = prop_obj.default_value\n attr_hash[k.to_s] = val\n end\n end.freeze\n end",
"def empty?\n attributes.except('id', 'created_at', 'updated_at', 'order_id', 'country_id', 'user_id').all? { |_, v| v.nil? }\n end",
"def domain_attrs\n attributes.symbolize_keys.select {|_k, v| !v.nil? }\n end",
"def method_missing( sym, *args )\n\t\tplainsym = sym.to_s.sub( /[=\\?]$/, '' ).to_sym\n\t\treturn super unless self.valid_attribute_oids.include?( plainsym )\n\n\t\tif sym.to_s[ -1 ] == ?=\n\t\t\treturn self[ plainsym ] = args\n\t\telsif sym.to_s[ -1 ] == ??\n\t\t\tif self.directory.schema.attribute_types[ plainsym ].single?\n\t\t\t\treturn self[ plainsym ] ? true : false\n\t\t\telse\n\t\t\t\treturn self[ plainsym ].first ? true : false\n\t\t\tend\n\t\telse\n\t\t\treturn self[ plainsym ]\n\t\tend\n\tend",
"def nil?; false; end",
"def build_optionals?(opt)\n opt.each do |attr, value|\n return true unless value.blank?\n end\n\n return false\n end",
"def attributes_no_helpers(attrs)\n\t\t\[email protected]! attrs\n\t\t\tyield self if block_given?\n\t\t\treturn self\n\t\tend",
"def attributes_as_elements?\n false\n end",
"def attrs_or_default(attrs)\n options = attrs.extract_options!\n attrs = yield if attrs.blank?\n attrs << options\n end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def empty?\n @attrs.empty?\n end",
"def method_missing(name, *args)\n return @values[name] if @values.key? name\n return nil if optional_attributes.include? name\n super\n end",
"def filter_attributes(attrs)\n attributes = attrs.each_with_object({}) do |name, inst|\n next unless validates?(name)\n inst[name] = get_field(name)\n end\n\n optional_fields = _optional\n if optional_fields.present?\n optional_fields.each do |field|\n next unless validates?(field)\n attributes[field] = get_field(field)\n end\n end\n\n associated_fields = _associations\n if associated_fields.present?\n associated_fields.each do |assoc|\n next unless validates?(assoc)\n attributes[assoc] = get_association(assoc)\n end\n end\n\n attributes\n end",
"def nil_blank_values\n\t\tself.description = nil if !self.description.nil? && self.description.blank?\n\t\tself.creator = nil if !self.creator.nil? && self.creator.blank?\n\tend",
"def typecast_attributes\n @attributes.each_pair do |name,value|\n # skip primary key columns\n # ajay Singh --> skip the loop if attribute is null (!name.present?)\n next if (name == \"id\") or (!name.present?)\n attr_type = attr_type_for(name)\n \n # empty attributes should stay empty (e.g. an empty int field shouldn't be typecast as 0)\n if [:datetime, :datetimecombo, :int].include? attr_type && (value.nil? || value == '')\n @attributes[name] = nil\n next\n end\n \n case attr_type\n when :bool\n @attributes[name] = (value == \"1\")\n when :datetime, :datetimecombo\n begin\n @attributes[name] = DateTime.parse(value)\n rescue\n @attributes[name] = value\n end\n when :int\n @attributes[name] = value.to_i\n end\n end\n @attributes\n end",
"def blank_to_nil_params\n record_params.merge!(record_params){|k, v| v.blank? ? nil : v}\n end",
"def allow_unknown_attributes!\n define_method :handle_unknown_attribute do |*|\n end\n end",
"def null?\n false\n end",
"def null?\n false\n end",
"def method_missing(sym, *args, &block)\n return attribute(sym.to_s) if not sym.to_s =~ /\\?$/\n super\n end",
"def fix_nil_time_values\n if params[:response] && params[:response][:answers_attributes]\n params[:response][:answers_attributes].each do |key, attribs|\n if attribs[\"time_value(4i)\"].blank? && attribs[\"time_value(5i)\"].blank?\n %w[1 2 3].each { |i| params[:response][:answers_attributes][key][\"time_value(#{i}i)\"] = \"\" }\n end\n end\n end\n end",
"def sanitize_for_mass_assignment(attrs)\n return attrs\n end",
"def nil?() true; 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 assert_no_nils_or_0s_in_att reclist, att \n assert_no_0_values reclist, att\n assert_no_nils reclist, att\n end",
"def helper_attr(*attrs)\n attrs.flatten.each { |attr| helper_method(attr, \"#{attr}=\") }\n end",
"def helper_attr(*attrs)\n attrs.flatten.each { |attr| helper_method(attr, \"#{attr}=\") }\n end",
"def optionals\n\t\tHash[ select {|i,f| f.required? } ]\n\tend",
"def null_track\n Attributes.new\n end",
"def nil?() end",
"def nil?() end",
"def define_predicate_methods_for_attributes\n @attributes.each do |key, _|\n method_name = \"#{key}?\"\n\n next if self.class.method_defined?(method_name.to_sym)\n\n self.class.send :define_method, method_name do\n @attributes[key].present?\n end\n end\n end",
"def helper_attr(*attrs)\n attrs.flatten.each { |attr| helper_method(attr, \"#{attr}=\") }\n end",
"def add_on_blank(attributes, msg = @@default_error_messages[:blank])\n for attr in [attributes].flatten\n value = @base.respond_to?(attr.to_s) ? @base.send(attr.to_s) : @base[attr.to_s]\n add(attr, msg) if value.blank?\n end\n end",
"def safe_attrs\n controller.request.get? ? {} : call(:attrs)\n end",
"def factorygirl_attributes\n symbolize_attributes!\n @attributes.each do |key, value|\n next unless respond_to?(method = method_name(key))\n if (result = send method, value) || value.nil?\n @attributes[key] = result if @attributes.key? key\n else\n @attributes.delete key\n end\n end\n end",
"def attributes_protected_by_default\n []\n end",
"def nullify_fields\n user_fields = %W(\n comment\n )\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end",
"def search_attributes\n nil\n end",
"def attributes_string_map\n @_attributes_string_map ||= {}.tap do |attr_hash|\n attributes_nil_hash.each_key { |k| attr_hash[k.to_sym] = k }\n end.freeze\n end",
"def default_attrs\n attrs = model_class.column_names.collect(&:to_sym)\n attrs - [:id, :position, :password]\n end",
"def nullable?\n @nullable\n end",
"def nullable?\n @nullable\n end",
"def nullable?\n @nullable\n end",
"def ignore_if_not_exists\n attributes.fetch(:ignoreIfNotExists)\n end",
"def attribute_info(opts = {})\n attr = opts[:attr] || @attr\n attr.update_object!(:data_type, :hidden)\n remove_nil_values(\n ref: attr_display_name(attr, @print_level),\n datatype: attr[:data_type],\n hidden: attr[:hidden],\n legal_values: opts[:legal_values]\n )\n end",
"def method_missing(method, *args, &block)\n result = fields[:\"#{method.to_s.camelize(:lower)}\"]\n # we need to pull out any Contentful::Link references, and also things which don't have any fields at all\n # because they're newly created\n if result.is_a?(Array)\n result.reject! {|r| r.is_a?(Contentful::Link) || (r.respond_to?(:invalid) && r.invalid?)}\n elsif result.is_a?(Contentful::Link)\n result = nil\n elsif result.respond_to?(:fields) && result.send(:fields).empty?\n result = nil\n elsif result.respond_to?(:invalid?) && result.invalid?\n result = nil\n end\n\n if result.nil?\n # if self.class.rescue_from_no_attribute_fields.member?()\n # end\n if self.class.return_nil_for_empty_attribute_fields && self.class.return_nil_for_empty_attribute_fields.include?(method)\n return nil\n else\n raise ContentfulModel::AttributeNotFoundError, \"no attribute #{method} found\"\n end\n else\n self.class.coerce_value(method, result)\n end\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"
] | [
"0.6737692",
"0.6613082",
"0.6535803",
"0.6324057",
"0.6153298",
"0.60936314",
"0.6088683",
"0.6067056",
"0.60546",
"0.6001157",
"0.5961988",
"0.5954428",
"0.59314656",
"0.590819",
"0.58942467",
"0.5890935",
"0.5877964",
"0.586465",
"0.584416",
"0.58357567",
"0.58221275",
"0.58039284",
"0.58018625",
"0.5800798",
"0.5794764",
"0.5794764",
"0.5794764",
"0.5794764",
"0.5794764",
"0.5794764",
"0.5794764",
"0.5794764",
"0.5794764",
"0.5794764",
"0.5788657",
"0.5783353",
"0.57749134",
"0.57582825",
"0.5718055",
"0.5708787",
"0.5688057",
"0.5688057",
"0.5688057",
"0.5688057",
"0.5683355",
"0.567474",
"0.56714606",
"0.5653376",
"0.5630688",
"0.5630164",
"0.56260335",
"0.562134",
"0.5616864",
"0.55735594",
"0.55710083",
"0.55710083",
"0.5562496",
"0.55609006",
"0.55565685",
"0.55502194",
"0.55373967",
"0.5535142",
"0.5535045",
"0.55248535",
"0.55248535",
"0.5521904",
"0.5512074",
"0.5510369",
"0.55101055",
"0.5504296",
"0.5504296",
"0.5504296",
"0.5504296",
"0.5504296",
"0.5504296",
"0.5504296",
"0.5504296",
"0.54960024",
"0.54940253",
"0.54940253",
"0.5487537",
"0.5464772",
"0.54611814",
"0.54611814",
"0.54577094",
"0.5451851",
"0.5438786",
"0.54360366",
"0.5429182",
"0.54252017",
"0.5421672",
"0.54172647",
"0.541166",
"0.54094404",
"0.5407188",
"0.5407188",
"0.5407188",
"0.5404997",
"0.5403436",
"0.54033875",
"0.54000473"
] | 0.0 | -1 |
Faire une copie de sauvegarde sans destruction du fichier | def make_rescue path
FileUtils::cp path, path_rescue(path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy\n \n end",
"def copy(io, context)\n super\n if io.respond_to?(:path) && io.path && delete_raw? && context[:delete] != false\n begin\n File.delete(io.path)\n rescue Errno::ENOENT\n # file might already be deleted by the moving plugin\n end\n end\n end",
"def cop; end",
"def cop; end",
"def execute()\r\n FileUtils.cp(@FilePath, @CopiedFilePath)\r\n File.delete(@FilePath) if File.exist?(@FilePath)\r\n end",
"def make_copy\n\t\t\tMarshal.load(Marshal.dump(self))\n\t\tend",
"def dup() end",
"def dumpme!(filename)\n File.unlink(filename) if File.exists?(filename)\n File.open(filename, \"w\") {|f| f << Marshal.dump(self)}\n end",
"def dest; end",
"def copy\n new_attributes = self.attributes\n new_attributes.delete(:id)\n file = WSFile.create(new_attributes)\n owner = self.permissions(level: 'owner').user.first\n Permission.create(user: owner, file: file, level: \"owner\")\n self.assets.each do |asset|\n file.assets.push asset\n end\n self.children.each do |child|\n file.children.push child.copy\n end\n file.save\n file.data = self.data\n file\n end",
"def dup\n obj = super\n obj.duplicated_from = self\n obj.resource = self.resource_file\n uhook_duplicated_object(obj)\n\n obj\n end",
"def dup; end",
"def dup; end",
"def dup; end",
"def dup; end",
"def tmpSaver (chemin)\n File.open(chemin, \"wb\") { |f| f.write(Marshal.dump(@dico) ) }\n @dico = Marshal.load( File.binread(chemin) )\n end",
"def pre_conversion(file)\n # puts \"===== PRE ====\"\n tmp_file = tmp_filepath(file)\n FileUtils.cp(file, tmp_file)\n # puts \"Copied #{file} to #{tmp_file}\"\n end",
"def copy_to_backup\n FileUtils.cp(@original_file_path, @new_file_path)\n end",
"def copy\n move(:copy)\n end",
"def copy(cleanse = true)\n a = dup\n a.cleanse if cleanse\n a\n end",
"def copy(cleanse = true)\n a = dup\n a.cleanse if cleanse\n a\n end",
"def copy(cleanse = true)\n a = dup\n a.cleanse if cleanse\n a\n end",
"def copy\n self.class.load export\n end",
"def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end",
"def dup( )\n\t\t\tMarshal.load(Marshal.dump(self))\n\t\tend",
"def undo \n if(@hasExecuted==true and (File::exist?(@newPath)))\n FileUtils.cp_r(@newPath, @ogPath)\n FileUtils::rm_r(@newPath)\n @hasExecuted=false\n end\n end",
"def overwrite?; end",
"def asset_file_id_to_copy; @asset_file_id_to_copy; end",
"def copy\n dup\n end",
"def filename() @fn.dup end",
"def test_ut_original_file_01\n assert @original_file.save\n original_file_copy = OriginalFile.find(@original_file.id)\n assert_equal @original_file.normal_result_id, original_file_copy.normal_result_id\n assert @original_file.valid?\n assert @original_file.destroy\n end",
"def dup! ; self ; end",
"def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end",
"def tempfile; end",
"def tempfile; end",
"def dup\n end",
"def dup\n end",
"def copy!(new_path)\n if exists?\n FileUtils.cp(path, new_path) unless new_path == path\n else\n File.open(new_path, \"wb\") { |f| f.write(read) }\n end\n end",
"def fback (fname)\n fcont = File.read(fname)\n File.new(fcont)\n end",
"def destroy\n\t\tFile.delete @filepath\n\t\t@data_base = nil\n\t\t@data_base.freeze\n\t\tself.freeze\n\tend",
"def deco_file; end",
"def cop=(_); end",
"def cop=(_); end",
"def backup_custom(_add_name)\r\n puts 'It seems the content is empty'.colorize(:red) + \"\\nTry to establish a empty custom container\".colorize(:light_black)\r\n hash = { \"Custom\": [] }\r\n # helper\r\n save_custom_file(hash)\r\n end",
"def force_copy\n add option: \"-force-copy\"\n end",
"def dup\n copy(false)\n end",
"def file=(_); end",
"def copy_assets; end",
"def persist!\n ::File.write(self.path, Marshal.dump(self))\n rescue => e\n puts e.message\n exit\n end",
"def replace(src)\n src = self.class.new(src)\n src.temp_path(src.dirname) do |temp|\n src.copy(temp)\n temp.write(read)\n temp.rename(src.to_s)\n end\n end",
"def replace(src)\n src = self.class.new(src)\n src.temp_path(src.dirname) do |temp|\n src.copy(temp)\n temp.write(read)\n temp.rename(src.to_s)\n end\n end",
"def copy_file(src, dest, preserve = false, dereference = true)\r\n ent = Entry_.new(src, nil, dereference)\r\n ent.copy_file dest\r\n ent.copy_metadata dest if preserve\r\n end",
"def copy_file(src, dest, preserve = false, dereference = true)\r\n ent = Entry_.new(src, nil, dereference)\r\n ent.copy_file dest\r\n ent.copy_metadata dest if preserve\r\n end",
"def copy_data_file\n copy_or_move(@file_data_to_write, file_path)\n end",
"def copy_data_file\n copy_or_move(@file_data_to_write, file_path)\n end",
"def copie_of_css\n suivi('--> Copie des fichiers CSS')\n ['styles','analyse','styles_mobi7_kf8'].each do |affixe|\n src = File.join(folder_templates,\"#{affixe}.css\")\n dst = File.join(film.folder_products, \"#{affixe}.css\")\n FileUtils.copy_entry(src, dst, false, false, true)\n end\nend",
"def copy_script\n\n end",
"def clone; end",
"def clone; end",
"def clone; end",
"def drop\n File.unlink @file if File.exist?(@file)\n self\n end",
"def notify_file_cp(src, dst)\r\n if @files.key?(src)\r\n @files[dst] = @files[src].clone\r\n else\r\n @files[src] = { exist: true }\r\n @files[dst] = { exist: true }\r\n end\r\n register_file_in_dirs(dst)\r\n end",
"def undo\n\t\tremake = CreateFileCommand.new(filePath, fileContent)\n\t\tremake.execute\n\tend",
"def clone\n Marshal.load(Marshal.dump self)\n end",
"def make_copy(src, dest)\n#\tcommandz(\"cp -p #{src} #{dest}\")\n\n\t#Now with Ruby :)\n\tFileUtils.cp(\"#{src}\", \"#{dest}\", :preserve => true )\nend",
"def rc_file_copy(sp, fn = '')\n if sp.is_a? String\n fn = sp.dup\n sp = sp.split(File::SEPARATOR)\n end\n if sp.length == 1\n # remove_file sp[0]\n copy_file sp[0]\n else\n inside sp.shift do\n rc_file_copy(sp, fn)\n end\n end\nend",
"def copy_file(src, dest, preserve = false, dereference = true)\n ent = Entry_.new(src, nil, dereference)\n ent.copy_file dest\n ent.copy_metadata dest if preserve\n end",
"def undo()\r\n oldname = @FilePath.basename\r\n @CopiedFilePath = \"#{@CopiedFilePath}/#{oldname}\"\r\n origfolder = @FilePath.dirname\r\n @FilePath = origfolder\r\n FileUtils.mv(@CopiedFilePath, @FilePath)\r\n end",
"def dup\n Marshal::load(Marshal.dump(self))\n end",
"def do_not_overwrite!\n @overwrite = false\n end",
"def clone() end",
"def copy(to_object, identifier = '')\n validate_object(to_object)\n\n begin\n debug \"Initialized Uv::Storage::File#copy\"\n debug \"Trying to download the file, and write it to a tempfile\"\n\n tmp_file_name = ::File.join(RAILS_ROOT, 'tmp', self.filename)\n tmp_file = ::File.new(tmp_file_name, 'w+')\n tmp_file.write(self.read)\n\n debug \"Tempfile written to: #{tmp_file_name}\"\n debug \"Creating a new file to copy to.\"\n\n new_file = Uv::Storage::File.new(tmp_file, :object => to_object, :identifier => identifier)\n new_file.save\n\n ::File.unlink(tmp_file_name) rescue nil\n\n return true\n rescue => e\n fatal \"An error occured in Uv::Storage::File#copy\"\n fatal \"Error was: #{e}\"\n\n return false\n end\n end",
"def save!\n delete_file\n save\n end",
"def clone\n begin\n Marshal.load(Marshal.dump(self))\n rescue\n self.class.new.read(self.to_s)\n end\n end",
"def copy(from, to)\n \n end",
"def reopen_file!\n @file_contents = FileContents.new(file_path, @file_metadata)\n end",
"def save(name, src=nil)\n raise ArgumentError, \"template name not given\" unless name\n\n src = src || Dir.pwd\n dir = Quarry.bank_folder + \"#{name}\" # silo_folder\n copier = Copier.new(src, dir, :backup=>false)\n copier.copy\n copyfile = dir + '.ore/copy.rb'\n if !copyfile.exist?\n File.open(copyfile, 'w'){ |f| f << 'copy all' }\n end\n dir\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def save_backup_on_dup\n if self.duplicated_from && self.duplicated_from.restorable? && self.keep_backup\n FileUtils.mkdir_p( File.dirname( self.backup_path ))\n FileUtils.cp( self.duplicated_from.backup_path, self.backup_path )\n end\n end",
"def copy\n self.public_send('|', 'pbcopy')\n self\n end",
"def restore; end",
"def post_process(file)\n if File.basename(file.to_s).match(/library/)\n oldfile = file\n file = file.to_s.sub(\"library\", @options[:lib_name_u])\n FileUtils.mv(oldfile, file)\n end\n if File.dirname(file.to_s).split(\"/\").last == \"library\"\n origdir = File.dirname(file.to_s)\n dirarr = origdir.split(\"/\")\n dirarr[dirarr.size-1] = @options[:lib_name_u]\n new_dir = File.join(dirarr)\n mkdir(new_dir)\n oldfile = file\n file = File.join(new_dir, File.basename(file))\n FileUtils.mv(oldfile, file)\n FileUtils.rmdir(origdir)\n end\n if file.to_s.match(/\\.seed$/)\n out_file = Pathname.new(file.to_s.sub(/\\.seed$/, ''))\n # Don't overwrite a file of the same name, unless they --force\n if copy_check(out_file)\n template = ::ERB.new(File.read(file))\n # This binding has access to any instance variables of\n # the ProjectCreator instance\n result = template.result(binding)\n File.open(file.to_s.sub(/\\.seed$/,''), 'w+') do |io|\n io.puts result\n end\n end\n # Remove the seed file whether we copied or not\n FileUtils.rm_f(file)\n end\n end",
"def replace_file(filename, data)\n remove_file filename\n create_file filename, data\nend",
"def replace_file(filename, data)\n remove_file filename\n create_file filename, data\nend",
"def clean_tab(dir_source)\n\t#creer nouveau repertoire dans un niveau antérieur au répertoire source\n\tDir.chdir(dir_source)\n\tDir.chdir(\"../\")\n\tdir_dest_name = \"modif_DVS_#{Time.now.strftime('%Y-%m-%d_%H-%M-%S')}\"\n\t\n\tDir.mkdir dir_dest_name\n\tdir_dest_name_absolute = \"#{Dir.pwd}/#{dir_dest_name}\"\n\tputs dir_dest_name_absolute.to_s\n\t\n\t#copier les fichiers originaux DVS dans nouveau repertoire daté\n\tFileUtils.cp_r \"#{dir_source}/.\", \"#{dir_dest_name}\"\n\n=begin\n\t#copie des .TAB\n\tDir.glob(\"*{TAB}*\").each do |file_name|\n\t\tFileUtils.cp(\"#{file_name}\", \"../#{dir_dest_name}/#{file_name}\")\n\tend\n=end\n\t\n\t#positionner le programme dans le nouveau repertoire\n\tDir.chdir(\"#{dir_dest_name}\")\n\tputs \"#{Dir.pwd}\"\n\n\ttemp_file_name = \"temp.txt\" #fichier temp\n\t\n\t#modification de chaque fichier .TAB ou .tab\n\tDir.glob(\"*.{tab,TAB}*\").each do |file_name|\n\t\t# donner les droit d'écriture sur les fichiers .tab\n\t\tFile.chmod(0777, file_name)\n\t\t#vider le fichier temp\n\t\tFile.open(temp_file_name, 'w') {|file| file.truncate(0) }\n\t\t#supprimer les en-tete DVS (Ansaldo, version DVS, nom projet) et lignes du type \"|___|___|_____|\"\n\t\ttext = File.read(file_name)\n\t\ttext = text.gsub(Regexp.new(@@REGEX1), \"\")\n\t\ttext = text.gsub(Regexp.new(@@REGEX2), \"\")\n\t\ttext = text.gsub(Regexp.new(@@REGEX3), \"\")\n\t\ttext = text.gsub(Regexp.new(@@REGEX4), \"\")\n\t\ttext = text.gsub(Regexp.new(@@REGEX5), \"\")\n\t\t\n\t\tFile.open(temp_file_name, \"w\") {|file| file.puts text }\n \n\t\t#supprimer lignes vides et en-tete sauf le premier en-tête (TABLEAU 03.03: ...)\t\t\n\t\ttext_tab = IO.readlines(temp_file_name) #copie le text dans un tableau\n\t\tFile.open(file_name, 'w') {|file| file.truncate(0) } #supprimer le contenu du fichier de destination (DVSxxx.tab)\n\t\t\n\t\tfound_first = false\n\t\ti=0\n\t\twhile (text_tab[i])\n\t\t\tif ((text_tab[i].index(/^.+TABLEAU /)) && (found_first == true))\n\t\t\t\t#supprime 2 lignes avant l'entete et 5 lignes apres\n\t\t\t\tfor ligne in -(@@DELETE_NB_LIGNE_BEFORE)..(@@DELETE_NB_LIGNE_AFTER)\n\t\t\t\t\ttext_tab[i+ligne] = \"\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tif ((text_tab[i].index(/^.+TABLEAU /)) && (found_first == false))\n\t\t\t\tfound_first = true\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\tfile = File.open(file_name, \"a\")\n\t\ti=0\n\t\twhile (text_tab[i])\n\t\t\tfile.puts text_tab[i] unless ((text_tab[i].chomp.empty?) || \n\t\t\t(text_tab[i].codepoints.to_a[0].eql?(12)))\n\t\t\ti = i+1\n\t\tend\n\t\tfile.close\n\tend\n\tFile.delete(temp_file_name)\n\treturn dir_dest_name_absolute\nend",
"def destroy_copies\n return unless is_standard?\n\n if self.class.log_replication?\n lines = []\n lines << \"***** DESTROYING COPIES BEFORE DESTROYING STANDARD ***************************************\"\n lines << \"Source obj: #{self}\"\n Rails.logger.debug(lines.join(\"\\n\"))\n end\n\n copies(true).each{|c| c.destroy}\n return true\n end",
"def destroy_dirty_file!(file)\n system(\"trashtrash #{file}\")\n end",
"def copy\n FileUtils.cp_r(@src, @dest)\n end",
"def file=(v); @file = v;end",
"def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end",
"def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end",
"def save(src_file, dst_file)\n src_file.save_and_close\n dst_file.save_and_close\n end",
"def copyFile_epubmaker(source, dest, logkey='')\n\tMcmlln::Tools.copyFile(source, dest)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def delete_file\n @file = []\n end",
"def foorth_copy(name)\r\n copy = self.clone\r\n copy.reinitialize(name)\r\n copy\r\n end",
"def copyProcessedFile(pitstop_full_filepath, input_filename, logkey='')\n FileUtils.cp(pitstop_full_filepath, input_filename)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def clean\n self.dup.clean!\n end",
"def dup(*) end",
"def duplicate\n super do |cloned_resource|\n cloned_resource.title = \"Copy #{@resource.title}\"\n end\n end"
] | [
"0.6650017",
"0.6411355",
"0.6312308",
"0.6312308",
"0.6194134",
"0.6085993",
"0.60720146",
"0.60692465",
"0.6059849",
"0.60560054",
"0.60504955",
"0.5918213",
"0.5918213",
"0.5918213",
"0.5918213",
"0.5902717",
"0.58884114",
"0.5834196",
"0.58204716",
"0.5771379",
"0.5771379",
"0.5771379",
"0.5746202",
"0.5726728",
"0.5710755",
"0.56997895",
"0.56939435",
"0.5660656",
"0.5655539",
"0.5640343",
"0.5639478",
"0.56178993",
"0.5604984",
"0.5601372",
"0.5601372",
"0.5597751",
"0.5597751",
"0.55841863",
"0.55495626",
"0.55426",
"0.5499009",
"0.5497919",
"0.5497919",
"0.54861355",
"0.5485076",
"0.54782456",
"0.54641956",
"0.5461213",
"0.5456935",
"0.5454949",
"0.5454949",
"0.54505986",
"0.54505986",
"0.54218346",
"0.54218346",
"0.54216176",
"0.54148316",
"0.54146963",
"0.54146963",
"0.54146963",
"0.5400232",
"0.53930086",
"0.53810394",
"0.53810096",
"0.53718495",
"0.5369017",
"0.5368848",
"0.5361672",
"0.535315",
"0.53517276",
"0.5348686",
"0.53409463",
"0.5330703",
"0.53293276",
"0.53292596",
"0.5324268",
"0.5318933",
"0.5318292",
"0.5318292",
"0.5318292",
"0.53100586",
"0.53070277",
"0.5303933",
"0.53035605",
"0.5299029",
"0.5299029",
"0.5295262",
"0.5290686",
"0.5286954",
"0.52866286",
"0.5281598",
"0.52806544",
"0.5278779",
"0.52737856",
"0.52731305",
"0.5273068",
"0.5269483",
"0.52689224",
"0.5267286",
"0.5267262",
"0.52671576"
] | 0.0 | -1 |
GET /polling_sessions/1 GET /polling_sessions/1.json | def show
@polling_session = PollingSession.find(params[:id])
@polls = @polling_session.polls
authorize! :read, PollingSession
respond_to do |format|
format.html # show.html.erb
format.json { render json: @polling_session }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_poll_sessions_for_poll(poll_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def list_opened_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/opened\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def new\n @polling_session = PollingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polling_session }\n end\n end",
"def list_closed_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/closed\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end",
"def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/sessions\"\n ).body\n end\n styled_header(\"OAuth Sessions\")\n styled_array(sessions.map { |session|\n [session[\"description\"], session[\"id\"]]\n })\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def index\n active_sessions = []\n my_sessions = []\n history_sessions = []\n join_sessions = current_user.join_sessions\n Session.all.each { |session|\n if session.user_id == current_user.id\n my_sessions.push session_srz(session)\n elsif join_sessions.any? {|js| js.session_id == session.id} and session.close\n history_sessions.push session_srz(session)\n else\n active_sessions.push session_srz(session)\n end\n }\n\n\n json_object = {\n data: {\n active_sessions: active_sessions,\n my_sessions: my_sessions,\n history_sessions: history_sessions\n #history_sessions: current_user.join_sessions\n }\n }\n\n render json: json_object,\n status: :ok,\n include: %w(session.lock)#nil\n\n #ok_request render_json#, %w(user)\n end",
"def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end",
"def get_session(options = {})\n resp = @connection.post do |req|\n req.headers = { :Accept => 'application/json'}\n req.url 'v1/sessions'\n req.body = options.to_json\n end\n check_response_for_errors resp.body\n end",
"def active_sessions\n render json: Session.where(\"active = ?\", true)\n end",
"def get_session_status keys\n @con.call 'core.get_session_status', keys, {}\n end",
"def show\n @session = Sso::Session.find(sso_session_id)\n render json: @session, serializer: Sso::SessionSerializer\n end",
"def getSessions(hostname,username)\n\n client.railgun.add_function('netapi32', 'NetSessionEnum', 'DWORD',[\n ['PWCHAR','servername','in'],\n ['PWCHAR','UncClientName','in'],\n ['PWCHAR','username','in'],\n ['DWORD','level','in'],\n ['PDWORD','bufptr','out'],\n ['DWORD','prefmaxlen','in'],\n ['PDWORD','entriesread','out'],\n ['PDWORD','totalentries','out'],\n ['PDWORD','resume_handle','inout']\n ])\n\n buffersize = 500\n result = client.railgun.netapi32.NetSessionEnum(hostname,nil,username,10,4,buffersize,4,4,nil)\n if result['return'] == 5\n if @verbose == true\n print_error(\"Access Denied when trying to access host: #{hostname}\")\n end\n return nil\n elsif result['return'] == 53\n if @verbose == true\n print_error(\"Host not found or did not respond: #{hostname}\")\n end\n return nil\n elsif result['return'] == 123\n if @verbose == true\n print_error(\"Invalid host: #{hostname}\")\n end\n return nil\n elsif result['return'] == 0\n if @verbose == true\n print_status(\"#{hostname} Session identified\")\n end\n elsif result['return'] == 2221 #username not found\n return nil\n else\n if result['return'] != 234\n if @verbose == true\n print_status(\"Unaccounted for error code: #{result['return']}\")\n end\n return nil\n end\n end\n\n while result['return'] == 234\n buffersize = buffersize + 500\n print_status(\"Buff me\")\n result = client.railgun.netapi32.NetSessionEnum(hostname,nil,username,10,4,buffersize,4,4,nil)\n end\n\n netsessions = read_session_struct(result['bufptr'],result['totalentries'])\n if netsessions.size > 0\n netsessions.each do |x|\n if username != nil\n print_good(\"#{username} is logged in at #{hostname} and has been idle for #{x[:idletime]} seconds\")\n @sessions = @sessions + 1\n else\n print_good(\"#{x[:username]} logged in at #{hostname} and has been idle for #{x[:idletime]} seconds\")\n end\n \n end\n end\n end",
"def start_session(nick)\n usr = User.first(:nickname=>params[:nickname])\n p User.all\n if usr != nil\n sid = gen_sessionid\n\n #associate nick with sid & IP & communication password\n $sessions[nick] = {:ip=>@env['REMOTE_ADDR'], :sid=> sid, :lastrequest=> Time.now.to_i}\n\n #return JSON with sessionid\n return {:sid => sid}\n end\n return 'error'\nend",
"def index\n @sessions = Session.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end",
"def get_all_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_all_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/all\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Session>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_all_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get\n params.required(:id)\n\n # Grab the device that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n @session = service.sessions.find(params[:id])\n end",
"def show\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end",
"def list_sessions(user_id:)\n path = '/users/{userId}/sessions'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::SessionList\n )\n end",
"def list_my_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FrontendApi.list_my_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling FrontendApi.list_my_sessions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].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 header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil?\n header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Session>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FrontendApi.list_my_sessions\",\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: FrontendApi#list_my_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @polling_session = PollingSession.new(params[:polling_session])\n\n respond_to do |format|\n if @polling_session.save\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }\n format.json { render json: @polling_session, status: :created, location: @polling_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @current_session = CurrentSession.find(params[:id])\n\n render json: @current_session\n end",
"def show\n begin\n if m = params[:id].match(/([^\\.]+)/)\n uid = m.captures.first\n else\n uid = params[:id]\n end\n sso_session = params[:session]\n\n # Check if session is valid\n @valid_session = (!uid.blank? && !sso_session.blank? && User.where(uid:uid,sso_session:sso_session).count > 0)\n\n # Build response\n response_hash = {\n valid: @valid_session,\n recheck: 3.minutes.from_now.utc\n }\n\n logger.info(\"INSPECT: session_hash => #{response_hash}\")\n\n render json: response_hash\n rescue Exception => e\n logger.error(e)\n raise e\n end\n end",
"def get_results_for_single_poll_session(poll_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end",
"def get_today_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_today_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/today\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_today_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def check_session\n data = { :account => Encryptor.encrypt({:id => id, :phone => phone, :password => password}.to_json, :key => $secret_key) }\n\n response = RestClient.post \"#{$service_url}/api/account/check_session\", data, { :content_type => :json, :accept => :json }\n\n JSON.parse(response)\n rescue => error\n { :session => false }\n end",
"def get(url)\n setup_or_refresh_rest_session\n @session.get(url: url)\n end",
"def filter_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.filter_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/filter\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'trip_id'] = opts[:'trip_id'] if !opts[:'trip_id'].nil?\n query_params[:'ticket_id'] = opts[:'ticket_id'] if !opts[:'ticket_id'].nil?\n query_params[:'package_id'] = opts[:'package_id'] if !opts[:'package_id'].nil?\n query_params[:'course_id'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#filter_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ykt_session }\n end\n end",
"def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end",
"def current_session(env=Thread.current[:env])\n return nil unless env\n setup_env(env)\n key = session['user_credentials']\n if @sessions[key]\n @refresh_sessions[key] = true\n else\n @session_mutex.synchronize do\n unless @previous_sessions[key]\n oldkey = key\n s = find_session\n key = session['user_credentials']\n @previous_sessions[oldkey] = key\n @sessions[key] = s\n @refresh_sessions[key] = true\n Thread.new do\n sleep Config::PreviousSessionTimeout\n @previous_sessions.delete(oldkey)\n end\n Thread.new do\n while @refresh_sessions[key] do\n @refresh_sessions.delete(key)\n sleep Config::SessionTimeout\n end\n @sessions.delete(key)\n end\n params['_need_cookie_update'] = true if full_path == '/ajax/poll'\n else\n key = @previous_sessions[key]\n end\n end\n end\n @sessions[key]\n end",
"def sess\n self.http_get(self.session_uri)#.tap{|t| STDERR.puts \"Trace: #{caller[1]}: returning #{t}\"}\n end",
"def reset_session_clock\n render json: { status: 'ok' }\n end",
"def connected\n Rails.logger.debug \"Status#status session[:client] #{session[:client].inspect}\"\n render :json => (session[:client] != nil)\n end",
"def index\n @workout_sessions = WorkoutSession.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workout_sessions }\n end\n end",
"def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end",
"def open_poll_session(poll_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}/open\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def sessionList\n if (\n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n @sessionlist = @experiment.ute_ex_sessions.where(:is_active => true).pluck(:session_code)\n #[ \n # UteExSession.where(:'ute_experiment.experiment_code' => params[:experiment_code], :is_active => true).pluck(:session_code)\n #].collect { |aoc| aoc.to_a}.flatten\n\n respond_to do |format|\n format.html { render text: 'Session list: <br/>' + { 'sessions' => @sessionlist }.to_json }\n format.json { \n render json: { 'sessions' => @sessionlist }.to_json \n }\n end\n end",
"def _get_session(env, sid)\n logger.debug \"Getting session info for #{sid.inspect}\"\n if sid\n ses_obj = sessions.find_one( { :_id => sid } )\n if ses_obj \n logger.debug \"Found session object on #{sid.inspect}\"\n else\n logger.debug \"Unable to find session object #{sid.inspect}\"\n end\n session = MongoRack::SessionHash.new( deserialize(ses_obj['data']) ) if ses_obj and fresh?( ses_obj )\n end\n \n unless sid and session\n logger.warn \"Session ID not found - #{sid.inspect} - Creating new session\"\n session = MongoRack::SessionHash.new\n sid = generate_sid\n ret = sessions.save( { :_id => sid, :data => serialize(session) } )\n raise \"Session collision on '#{sid.inspect}'\" unless ret\n end\n merged = MongoRack::SessionHash.new.merge(session)\n logger.debug \"Setting old session #{merged.inspect}\" \n session.instance_variable_set( '@old', merged )\n return [sid, session]\n rescue => boom \n logger.error \"#{self} Hoy! something bad happened loading session data\"\n logger.error $!.inspect\n boom.backtrace.each{ |l| logger.error l } \n return [ nil, MongoRack::SessionHash.new ]\n end",
"def index\n @tutoring_sessions = TutoringSession.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutoring_sessions }\n end\n end",
"def refresh_session_token\n session_signature = Digest::MD5.hexdigest(@toodle_uid + Babar::Base.toodle_app_token) \n session_token_url = \"http://api.toodledo.com/2/account/token.php?\" + self.parse_params({:userid => @toodle_uid, :appid => Babar::Base.toodle_app_id , :sig => session_signature,})\n puts session_signature, session_token_url\n @session_token = JSON.parse(Typhoeus::Request.get(session_token_url).body)[\"token\"]\n @toodle_token_death = Time.now + Babar::Base.toodle_app_token_lifetime\n [@session_token, @toodle_token_death]\n end",
"def list_my_sessions(opts = {})\n data, _status_code, _headers = list_my_sessions_with_http_info(opts)\n data\n end",
"def fetch_active_session\n Rails.logger.debug \"SessionService::fetch_active_session::BEGIN\" \n current_time = Time.now\n active_session = @company.active_sessions.where(:company_id => @company.id).where(\" ? > start_time and ? < end_time\", current_time, current_time).first\n end",
"def retrieve_session(session_id)\n @mutex.synchronize {\n @timestamps[session_id] = Time.now\n @sessions[session_id]\n }\n end",
"def show\n #logger.debug( cookies.inspect )\n logger.debug( \"Authorization header: #{request.headers['Authorization']}\" )\n @session = Session.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml\n format.json do\n render :json => {\n :session => {\n :token => @session.token,\n :link => {\n :rel => 'session',\n :uri => session_path(@session)\n }\n }\n }\n end\n end\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def get_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_session ...\"\n end\n # resource path\n local_var_path = \"/session\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20043')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def profile\n _uuid = uuid.gsub(/-/, '')\n url = \"https://sessionserver.mojang.com/session/minecraft/profile/#{_uuid}\"\n response = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(response.body)\n end",
"def web_session()\n get(:signed, {:method => \"auth.getWebSession\"})\n end",
"def destroy\n @polling_session = PollingSession.find(params[:id])\n @polling_session.destroy\n\n respond_to do |format|\n format.html { redirect_to polling_sessions_url }\n format.json { head :no_content }\n end\n end",
"def sessions\n @sessions\n end",
"def index\n @lift_sessions = LiftSession.all\n end",
"def show\n @session = Session.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end",
"def show\n @session = Session.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end",
"def get_sessions\n\t\tsessions = Session.get_week(self.user_id, self.start_date)\n\t\tget_nice_array(sessions)\n\tend",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def session_from_redis\n redis_handler.get\n end",
"def get_session\n begin\n if session[:user_id].present? && session[:user_name].present? && current_user.present?\n unless session[:comp_id].present?\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name]} \n else\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name] , :comp_id=> session[:comp_id]}\n end \n render :json=>@result\n else \n reset_session \n @result = {flag:false}\n render :json=>@result\n end \n rescue Exception=> e\n reset_session \n @result = {flag:false}\n render :json=>@result\n end\n \n end",
"def sessions\n PokerSession.find(:all)\n end",
"def get_session(env, sid)\n raise '#get_session not implemented.'\n end",
"def show\n render json: @session_resource\n end",
"def session_last_open_tab\n res = session[:last_open_tab]\n respond_to do |format|\n format.html { render json: res }\n end\n end",
"def session_last_open_tab\n res = session[:last_open_tab]\n respond_to do |format|\n format.html { render json: res }\n end\n end",
"def sessions\n SockJS.debug \"Refreshing sessions\"\n\n if @sessions\n @sessions.delete_if do |_, session|\n unless session.alive?\n SockJS.debug \"Removing closed session #{_}\"\n end\n\n !session.alive?\n end\n else\n @sessions = {}\n end\n end",
"def sessions\n @sessions.each_key.to_a\n end",
"def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def create_single_poll_session(poll_id,poll_sessions__course_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :poll_sessions__course_id__ => poll_sessions__course_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end",
"def session\n @current_user = User.find_by_access_token(params[:access_token])\n \n # Fetch content for current user\n # find_friends_for_facebook_id(@current_user.facebook_id, since = nil)\n \n # return new friends\n # We want to send the entire friendslist hash of id, name to the client\n # friend_array = Friendship.find(:all, :select=>\"friend_id, friend_name\", :conditions=>\"user_id = #{@current_user.id}\").map {|f| {:friend_id=>f.friend_id.to_i, :friend_name=>f.friend_name}}\n # friend_id_array = friend_array.map do |f| f[:friend_id] end\n # \n # # The response should include the current user ID and name for the client to cache\n # session_response_hash = {\n # :access_token => @current_user.access_token,\n # :facebook_id => @current_user.facebook_id,\n # :name => @current_user.name,\n # :friends => friend_array\n # }\n \n session_response_hash = {\n :access_token => @current_user.access_token\n }\n\n respond_to do |format|\n format.xml { render :xml => session_response_hash.to_xml }\n format.json { render :json => session_response_hash.to_json }\n end\n end",
"def index\n @user_sessions = UserSession.all\n end",
"def get_session\n if session[:user_id].present? && session[:user_name].present?\n @result = {flag:true , session_id: session[:user_id] , :user_name=> session[:user_name]}\n render :json=>@result\n else \n @result = {flag:false}\n render :json=>@result\n end\n end",
"def index\n @sessions = active_conference.sessions.order('title')\n @tags = @sessions.tag_counts_on(:tags)\n \n sessions = @sessions.collect { |s| project_one_session(s) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { sessions: sessions }, :except => exceptions }\n format.js { render json: { sessions: sessions }, :except => exceptions, :callback => params[:callback] }\n end\n end",
"def get_session\n @session = Session.find(@blocker.session_id)\n end",
"def get_session(env, sid)\n\n # Start each HTTP request with a fresh view of the repository.\n Maglev.abort_transaction\n\n session = @sessions[sid] if sid\n unless sid and session\n session = Hash.new\n sid = generate_sid\n @sessions[sid] = session # Rely on the commit_transaction in set_session\n end\n return [sid, session]\n rescue Exception => e\n puts \"== Get Session: EXCEPTION: #{e}\"\n return [nil, {}]\n end",
"def find_session(env, sid); end",
"def check\n begin\n return RestHelper.get(@@session_uri,{:cookies => @cookie})\n rescue RestClient::ResourceNotFound => e\n return nil\n end\n end",
"def get_okta_session_token\n url = \"#{APP_CONFIG['okta_base_url']}/api/v1/authn\"\n body = { username: APP_CONFIG['okta_username'], password: APP_CONFIG['okta_password'] }.to_json\n result = HTTParty.post(url, body: body, headers: {\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json'\n })\n result['sessionToken']\n end",
"def get_session( params )\n LastFM.get( \"auth.getSession\", params, :secure )\n end",
"def show\n render json: @heartbeat\n end",
"def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end",
"def index\n @training_sessions = TrainingSession.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_sessions }\n end\n end",
"def api_v11_users_sessions_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_users_sessions_get ...\"\n end\n \n # resource path\n path = \"/api/v11/users/sessions\".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 = []\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 = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_users_sessions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def session\n @connection.request('session-get') do |resp|\n if resp == :connection_error\n yield :connection_error\n else\n yield Session.new(resp)\n end\n end\n end",
"def get_status(session_id, type)\n raise ArgumentError, \"Type: \\\"#{type}\\\" is invalid\" unless %w[signature authentication].include? type.downcase\n\n url = status_url(session_id, type)\n res = HTTParty.get(url)\n\n res = HTTParty.get(url) while res.parsed_response['state'] == 'RUNNING'\n\n check_for_error(res)\n\n res.parsed_response\n end",
"def index\n @timers = Timer.all\n\n render json: @timers\n end",
"def get_application_sessions_with_http_info(application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_application_sessions ...'\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_application_sessions\"\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_application_sessions, 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_application_sessions, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"open\", \"closed\", \"partially_returned\", \"cancelled\"]\n if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])\n fail ArgumentError, \"invalid value for \\\"state\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}/sessions'.sub('{' + 'applicationId' + '}', CGI.escape(application_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 query_params[:'profile'] = opts[:'profile'] if !opts[:'profile'].nil?\n query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?\n query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?\n query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?\n query_params[:'coupon'] = opts[:'coupon'] if !opts[:'coupon'].nil?\n query_params[:'referral'] = opts[:'referral'] if !opts[:'referral'].nil?\n query_params[:'integrationId'] = opts[:'integration_id'] if !opts[:'integration_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(['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] || 'InlineResponse20026' \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_application_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def who_is_online\n time_window = Time.now.utc - 30.minutes.to_i\n online_sessions = CGI::Session::ActiveRecordStore::Session.find(:all,\n :select => \"user_id, last_url_visited, updated_at\",\n :conditions => [ \"updated_at > ? and user_id is not null\", time_window ],\n :limit => 50 )\n online_users = []\n online_sessions.each do |session|\n online_users << User.find(session.user_id)\n end\n online_users\n end",
"def index\n @session_times = SessionTime.all\n end",
"def sessions=(value)\n @sessions = value\n end",
"def get_tommorow_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_tommorow_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/tommorow\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_tommorow_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def all_state(id)\n $app_sessions[id][:state]\nend",
"def get_all_sessions(opts = {})\n data, _status_code, _headers = get_all_sessions_with_http_info(opts)\n return data\n end",
"def show\n @room = Room.find(params[:id])\n\n config_opentok\n\n @tok_token = @opentok.generate_token :session_id =>\n @room.sessionId\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room }\n end\n end",
"def get_all_message_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_all_message_sessions ...'\n end\n # resource path\n local_var_path = '/api/v2/sessions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetAllMessageSessionsPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_all_message_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_all_with_trashed_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.get_all_with_trashed_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/all-with-trashed\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Session>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#get_all_with_trashed_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end"
] | [
"0.6730336",
"0.6657565",
"0.65170884",
"0.64331716",
"0.6379616",
"0.633456",
"0.63025635",
"0.62377775",
"0.6209552",
"0.6168578",
"0.6120831",
"0.60957116",
"0.6078542",
"0.60583705",
"0.60091716",
"0.598851",
"0.59638804",
"0.59597915",
"0.5951662",
"0.5948003",
"0.59361804",
"0.59132147",
"0.5912743",
"0.5892135",
"0.5889154",
"0.5858626",
"0.5815277",
"0.5810957",
"0.578597",
"0.57662225",
"0.57567537",
"0.57464415",
"0.57449454",
"0.5742871",
"0.5734377",
"0.57328427",
"0.57257825",
"0.5718294",
"0.57113206",
"0.5696853",
"0.56308",
"0.56306434",
"0.5627652",
"0.5626778",
"0.5618215",
"0.5614577",
"0.5606673",
"0.5594595",
"0.5594595",
"0.5594595",
"0.5594595",
"0.55921364",
"0.5591748",
"0.5585617",
"0.55789185",
"0.5577537",
"0.55775195",
"0.5575741",
"0.5575741",
"0.5569829",
"0.55573785",
"0.55537194",
"0.55437154",
"0.55395293",
"0.552859",
"0.55249447",
"0.5508738",
"0.5508738",
"0.550384",
"0.54945415",
"0.5493633",
"0.5466609",
"0.54611135",
"0.5460486",
"0.54571617",
"0.5456866",
"0.54521686",
"0.5452135",
"0.54453313",
"0.54415625",
"0.54330057",
"0.5432333",
"0.5421843",
"0.54179466",
"0.54124254",
"0.5412144",
"0.54119605",
"0.5406961",
"0.5404253",
"0.5401397",
"0.53946406",
"0.53937334",
"0.53892606",
"0.5384254",
"0.53654456",
"0.5361255",
"0.53605485",
"0.5360403",
"0.5354929",
"0.53530365"
] | 0.6612596 | 2 |
GET /polling_sessions/new GET /polling_sessions/new.json | def new
@polling_session = PollingSession.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @polling_session }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @polling_session = PollingSession.new(params[:polling_session])\n\n respond_to do |format|\n if @polling_session.save\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }\n format.json { render json: @polling_session, status: :created, location: @polling_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @session = Session.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end",
"def new\r\n @session = Session.new\r\n @session.state = 'waiting'\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @session }\r\n format.json { render :json => @session }\r\n end\r\n end",
"def new\n @session = Session.new\n\n respond_to do |format|\n format.json { render json: @session }\n format.html # new.html.erb\n end\n end",
"def new\n @user_session ||= UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_session }\n end\n end",
"def new\n @ykt_session = YktSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ykt_session }\n end\n end",
"def new\n @session_type = SessionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session_type }\n end\n end",
"def new\n @yoga_session = YogaSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yoga_session }\n end\n end",
"def new\n @heartbeat = Heartbeat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heartbeat }\n end\n end",
"def new\n @discovery_session = DiscoverySession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discovery_session }\n end\n end",
"def new\n @session = Session.new\n\n render 'sessions/login'\n #respond_to do |format|\n # format.html # new.html.erb\n #format.json { render json: @session }\n # end\n end",
"def new\n @session_info = SessionInfo.new\n @downloads = Download.all(order: 'name')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session_info }\n end\n end",
"def new\n @tutoring_session = TutoringSession.new\n #@tutoring_session = TutoringSession.new\n @tutoring_session.user_id = current_user.id if !current_user.nil?\n @tutoring_session.start_time = Time.now\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutoring_session }\n end\n end",
"def create\n @current_session = CurrentSession.new(params[:current_session])\n\n if @current_session.save\n render json: @current_session, status: :created, location: @current_session\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def new\n @training_session = TrainingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_session }\n end\n end",
"def new\n return false if !userCan :timer\n @timer = Timer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timer }\n end\n end",
"def generateSession\n sessionId = SecureRandom.base58(24)\n @test.update(session_id: sessionId)\n\n # set expiry date to 15 minutes from now\n @test.update(session_expired_at: Time.now + 15*60)\n\n render json: sessionId\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 @chatroom = Chatroom.new\n @user = User.find(session[:user_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chatroom }\n end\n end",
"def new\n session[:guests] = nil\n @guest_response = GuestResponse.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guest_response }\n end\n end",
"def new\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n @timetable = Timetable.new\n puts @timetable.to_json\n end",
"def new \n unless current_user.nil?\n redirect_to backend_root_url\n return\n end\n \n @user_session = UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_session }\n end\n end",
"def new\n debugger\n flash[:failure_provider] = request.env['omniauth.error.strategy'].name\n flash[:failre_type] = request.env['omniauth.error.type']\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end",
"def new\n @user_session = UserSession.new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\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 end",
"def create\n config_opentok\n session = @opentok.create_session request.remote_addr\n params[:room][:sessionId] = session.session_id\n \n @room = Room.new(params[:room])\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render json: @room, status: :created, location: @room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @session = Session.new\n end",
"def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end",
"def new\n @title = \"Create a New Training Session\"\n session[:interval_order] = nil\n @trainingsession = Trainingsession.new\n @trainingsession.interval.build\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trainingsession }\n end\n end",
"def new\n @session = Session.new('')\n end",
"def new\n @session = Session.new\n @speakers = active_conference.speakers\n \n respond_to do |format|\n format.html { render layout: 'admin' }\n format.json { render json: @session }\n end\n end",
"def new\n if session && session[:current_user_id]\n @user = User.find_by_id(session[:current_user_id])\n end\n @user ||= User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n if(params[\"session\"] == 'nil')\n session[:mailid] = nil\n end\n @loginuser = Loginuser.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loginuser }\n end\n \n end",
"def new\n\tif !checklogin? then return end\n\n @message = Message.new(:member_id => session[:login].id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def get_session\n session = Session.create!(key: Random.rand(0xFFFFFFFF).to_s)\n render json: { id: session.id, key: session.key }\n end",
"def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end",
"def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end",
"def new\n @session = User::Session.new\n end",
"def new\n @sleep = Sleep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sleep }\n end\n end",
"def create_single_poll_session(poll_id,poll_sessions__course_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :poll_sessions__course_id__ => poll_sessions__course_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end",
"def new\n\t\t@user_session = UserSession.new\n\tend",
"def create\n @session = @event.sessions.new(params[:session])\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render json: [@event, @session], status: :created, location: [@event, @session] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if Rails.env == 'development'\n Rails.logger.debug \"Cookies:\\n\" + cookies.to_yaml\n Rails.logger.debug \"Session:\\n\" + session.to_yaml\n end\n \n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n @user_session.user.reset_appearance!\n \n # Make sure any stale forum logins are cleared\n cookies[\"Vanilla\"] = {:value => \"\", :domain => \".worlize.com\"}\n cookies[\"Vanilla-Volatile\"] = {:value => \"\", :domain => \".worlize.com\"}\n\n # default_url = enter_room_url(@user_session.user.worlds.first.rooms.first.guid)\n default_url = enter_room_url(Room.gate_room_guid)\n\n format.html { redirect_back_or_default(default_url) }\n format.json do\n render :json => {\n :success => true,\n :redirect_to => get_redirect_back_or_default_url(default_url)\n }\n end\n else\n format.html { render :action => \"new\" }\n format.json do\n render :json => {\n :success => false\n }\n end\n end\n end\n end",
"def new\n @user_session = UserSession.new\n\n respond_to do |format|\n if current_user\n format.html { redirect_to :users }\n format.json { redirect_to :users }\n else\n format.html # new.html.erb\n format.json { render :json => @user_session }\n end\n end\n end",
"def new_session expire = 1.year\n init_redis\n begin\n name = SecureRandom.uuid.to_s.gsub('-', '')\n if @redis.set(name, Hash.new.to_json, ex: expire) == \"OK\"\n return name\n end\n rescue\n end\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n @user_session = UserSession.new\n end",
"def new\n p session\n if session[:user].nil? \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n else \n respond_to do |format|\n format.html { redirect_to_back }\n format.json { head :ok }\n end\n end\n \n \n end",
"def new\n @push_notification = PushNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @push_notification }\n end\n end",
"def new\r\n @ss_class_session_note = SsClassSessionNote.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @ss_class_session_note }\r\n end\r\n end",
"def new\n @request_status = RequestStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request_status }\n end\n end",
"def new\n @ongoing = Ongoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ongoing }\n end\n end",
"def new\n @shoppinglist = Shoppinglist.new\n @current_user = User.find_by_id(session[:user_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shoppinglist }\n end\n end",
"def new_session\n IntegrationSession.new\n end",
"def create\n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n format.html { redirect_to(:home, :notice => 'Login successful.') }\n format.json { render :json => @user_session, :status => :created, :location => @user_session }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_session.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_session(options={})\n if supports_sessions?\n api.rest_method('ADD_AUTHORIZATION', {\n :scope => 'session',\n :note => \"RHC/#{RHC::VERSION::STRING} (from #{Socket.gethostname rescue 'unknown'} on #{RUBY_PLATFORM})\",\n :reuse => true\n }, options)\n end\n end",
"def new\n if current_user\n redirect_to(:action=>'logged_in')\n else\n @user_session = UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_session }\n end\n end\n\n end",
"def new\n if params[:create_user] == '1' or session[:id]\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n else\n flash[:error] = \"You will need to Sign In to view this page.\"\n redirect_to :controller => 'system', :action => 'index'\n end\n end",
"def new\n @user_session = UserSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_session }\n end\n end",
"def new\n @session = Session.new\n end",
"def new\n \n respond_to do |format|\n # unregistered users or admin can create new users\n if session[:user_id].nil? || User.find(session[:user_id]).status == 'admin'\n @user = User.new\n \n format.html # new.html.erb\n format.json { render json: @user }\n else\n @user = User.find(session[:user_id])\n format.html { redirect_to @user, notice: 'loged in as ' + @user.lname }\n format.json { render json: @user, status: :in, location: @user }\n end\n end\n end",
"def create\n @session = Session.new(session_params)\n @session.created_by = current_user.id\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to game_session_path(@session), notice: 'Session was successfully created.' }\n format.json { render action: 'show', status: :created, location: @session }\n else\n format.html { render action: 'new' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if current_user\n redirect_to root_url\n end\n @user_session = UserSession.new\n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def new\n @sessionmap = Sessionmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sessionmap }\n end\n end",
"def new\n @now = Time.zone.now\n @now = @now.change(:hour=>18, :min=>0, :sec=>0)\n @meeting = Meeting.new(:datetime=>@now)\n\t\t@alltopics = Topic.where(:meeting_id => nil)\n\t\t@title = \"Nowe spotkanie\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting }\n end\n end",
"def new\n @event = Event.new\n @userId = session[:user_id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"def create\n @ykt_session = YktSession.new(params[:ykt_session])\n\n respond_to do |format|\n if @ykt_session.save\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully created.' }\n format.json { render json: @ykt_session, status: :created, location: @ykt_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @username_cookie = UsernameCookie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @username_cookie }\n end\n end",
"def new\n @livestock = Livestock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @livestock }\n end\n end",
"def new\n @waiting_list = WaitingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @waiting_list }\n end\n end",
"def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @online_store = OnlineStore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_store }\n end\n end",
"def new\n if session[:user_id]\n @listing = Listing.new\n # @listing[:u_id]=session[:user_id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n else\n redirect_to \"/log_in\", :notice => \"You need to be logged in for viewing list\"\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 @subscription = current_user.subscriptions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscription }\n end\n end",
"def create\n @session = SessionService.new(current_user).create_from_web! session_params\n\n respond_to do |format|\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created }\n end\n end",
"def new\n @timetable = Timetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timetable }\n end\n end",
"def create\n return if Settings.readonly \n\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to sessions_url, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @session = Session.new\n @session.machine = @machine\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @session }\n end\n end",
"def new\n @serverroom = Serverroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serverroom }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def new\n authenticate_user!\n @server = Server.new\n @rackspace_servers = Server.rackspace_servers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end",
"def new\n @user = User.find(params[:user_id])\n @clock_time = @user.clock_times.new(:in => Time.now)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clock_time }\n end\n end",
"def show\n @polling_session = PollingSession.find(params[:id])\n @polls = @polling_session.polls\n authorize! :read, PollingSession\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @polling_session }\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 @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end",
"def new\n @protocol = Protocol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protocol }\n end\n end",
"def new\n @game_watch = GameWatch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_watch }\n end\n end",
"def new\n @usuario = Usuario.new\n if current_user\n session[:admin_new] = true\n else\n session[:admin_new] = false\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usuario }\n end\n end",
"def new\n @channel_status = ChannelStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel_status }\n end\n end",
"def new\n @presence = Presence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presence }\n end\n end",
"def new\n @jetty = Jetty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jetty }\n end\n end",
"def new\n @api_tracking = ApiTracking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_tracking }\n end\n end",
"def get_new_token\n auth = 'Basic ' + Base64.strict_encode64( session[:client_id] + \":\" + session[:client_secret]).chomp\n \n rcResultJson = RestClient.post(\n session[:token_url],\n {\n grant_type: 'refresh_token', \n refresh_token: session[:refresh_token], \n },\n {\n :Authorization => auth\n }\n )\n rcResult = JSON.parse(rcResultJson)\n\n session[:patient_id] = rcResult[\"patient\"]\n session[:access_token] = rcResult[\"access_token\"]\n session[:refresh_token] = rcResult[\"refresh_token\"]\n session[:token_expiration] = (Time.now.to_i + rcResult[\"expires_in\"].to_i )\n rescue StandardError => exception\n # binding.pry \n err = \"Failed to refresh token: \" + exception.message\n redirect_to root_path, alert: err\n end",
"def create\n if request.get? && params[:action] == 'new' && @open_auth\n @open_auth.open_authentication.connection_established\n log_in @open_auth.open_authentication.user\n redirect_back_or_default user_newsfeed_url(@open_auth.open_authentication.user)\n end\n end",
"def new\n @online_service = OnlineService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_service }\n end\n end"
] | [
"0.7200673",
"0.6922426",
"0.68400216",
"0.679016",
"0.66888666",
"0.6647991",
"0.63777757",
"0.63396496",
"0.6328666",
"0.6305696",
"0.6293725",
"0.62511176",
"0.6195757",
"0.61729836",
"0.6103391",
"0.60841775",
"0.6060703",
"0.6017639",
"0.59978026",
"0.5979473",
"0.59757984",
"0.5970026",
"0.5963199",
"0.59619206",
"0.59495044",
"0.5942145",
"0.5937317",
"0.5936691",
"0.59267014",
"0.5923181",
"0.5919991",
"0.59136987",
"0.59050745",
"0.5896557",
"0.5891817",
"0.5890796",
"0.5890796",
"0.5873115",
"0.5851461",
"0.5828386",
"0.58269054",
"0.5819933",
"0.58175796",
"0.58082694",
"0.579162",
"0.57848907",
"0.57848907",
"0.57848907",
"0.57848907",
"0.57848907",
"0.5781052",
"0.57776415",
"0.57773185",
"0.576352",
"0.574736",
"0.5742797",
"0.5736129",
"0.5729854",
"0.5729171",
"0.5727265",
"0.5717721",
"0.57137686",
"0.5706144",
"0.57059944",
"0.5697621",
"0.56961083",
"0.5690663",
"0.56901306",
"0.5689404",
"0.56888336",
"0.5685596",
"0.5680238",
"0.5677629",
"0.56760955",
"0.5668",
"0.5667181",
"0.56621665",
"0.5658108",
"0.5646123",
"0.56409985",
"0.5640462",
"0.5635632",
"0.5634416",
"0.5632557",
"0.56321937",
"0.56313145",
"0.56277424",
"0.562623",
"0.562584",
"0.56209266",
"0.561775",
"0.5614314",
"0.56134844",
"0.5612509",
"0.5611599",
"0.56075585",
"0.5598853",
"0.5594699",
"0.5594128",
"0.559206"
] | 0.80017734 | 0 |
POST /polling_sessions POST /polling_sessions.json | def create
@polling_session = PollingSession.new(params[:polling_session])
respond_to do |format|
if @polling_session.save
format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }
format.json { render json: @polling_session, status: :created, location: @polling_session }
else
format.html { render action: "new" }
format.json { render json: @polling_session.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @polling_session = PollingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polling_session }\n end\n end",
"def create_single_poll_session(poll_id,poll_sessions__course_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :poll_sessions__course_id__ => poll_sessions__course_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def start_session(nick)\n usr = User.first(:nickname=>params[:nickname])\n p User.all\n if usr != nil\n sid = gen_sessionid\n\n #associate nick with sid & IP & communication password\n $sessions[nick] = {:ip=>@env['REMOTE_ADDR'], :sid=> sid, :lastrequest=> Time.now.to_i}\n\n #return JSON with sessionid\n return {:sid => sid}\n end\n return 'error'\nend",
"def list_opened_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/opened\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def generateSession\n sessionId = SecureRandom.base58(24)\n @test.update(session_id: sessionId)\n\n # set expiry date to 15 minutes from now\n @test.update(session_expired_at: Time.now + 15*60)\n\n render json: sessionId\n end",
"def list_poll_sessions_for_poll(poll_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def index\n active_sessions = []\n my_sessions = []\n history_sessions = []\n join_sessions = current_user.join_sessions\n Session.all.each { |session|\n if session.user_id == current_user.id\n my_sessions.push session_srz(session)\n elsif join_sessions.any? {|js| js.session_id == session.id} and session.close\n history_sessions.push session_srz(session)\n else\n active_sessions.push session_srz(session)\n end\n }\n\n\n json_object = {\n data: {\n active_sessions: active_sessions,\n my_sessions: my_sessions,\n history_sessions: history_sessions\n #history_sessions: current_user.join_sessions\n }\n }\n\n render json: json_object,\n status: :ok,\n include: %w(session.lock)#nil\n\n #ok_request render_json#, %w(user)\n end",
"def submitSessionInfos\n # check if data submission is offline\n is_offline_sensor_data_collection = false\n\n # not having valid device id or device type. \n if params.has_key?(:uid) == true && !params[:uid].empty?\n @deviceType = nil\n if (\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil || \n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n if (\n params.has_key?(:sensor_infos) == false || params[:sensor_infos].empty? || \n params[:sensor_infos].kind_of?(Array) == false || params[:sensor_infos].count == 0\n )\n render json: { 'status' => 'OK' }.to_json\n end\n\n # check device pairing. \n @deviceId = params[:did]\n if isPairedDeviceValid(@deviceId, params[:uid]) == false\n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n needToCreateSession = false\n if params.has_key?(:is_initiator) && params[:is_initiator] == true\n needToCreateSession = true\n else\n # check if devicepairconnotp is not expired yet\n @devicepairconnections = @devicepairs.ute_device_pair_connections.where(\n :expire_by.gte => Time.now.getutc.to_f, \n :is_active => true\n )\n firststartdate = params[:sensor_infos][0][:t]\n @devicepairconnections.each do |devicepairconnection|\n si = devicepairconnection.ute_ex_session\n unless si.nil?\n if firststartdate > si.range_start_at && firststartdate < si.range_end_at \n #found the paired connection\n @devicepairconnection = devicepairconnection\n @session = @devicepairconnection.ute_ex_session\n break\n end\n end\n end\n\n if @devicepairconnection == nil && @session == nil \n #session to pair is not found\n render json: { 'status' => 'FAILED', 'code' => 404 }.to_json\n return\n end\n end\n\n if needToCreateSession \n # create new session\n @sessionId = generateNewSessionId\n\n while isSessionIdAlreadyExist(@experiment.experiment_code, @sessionId) do\n @sessionId = generateNewSessionId\n end\n\n @session = @experiment.ute_ex_sessions.create!(\n session_code: @sessionId,\n is_active: true,\n initiated_by_device_id: @deviceId,\n is_created_offline: true\n )\n end\n\n if @session\n @sessionConnection = @session.ute_ex_session_connections.create!(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: params[:sensor_infos][0][:t])\n \n @devicepairconnotp = generateNewDevicePairConnOtp\n\n while isActiveDevicePairConnOtpAlreadyExist(@devicepairs, @devicepairconnotp) do\n @devicepairconnotp = generateNewDevicePairConnOtp\n end\n\n dpc = @devicepairs.ute_device_pair_connections.new(\n is_active: true,\n otp: @devicepairconnotp,\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME, \n ute_ex_session: @session\n )\n dpc.save! \n\n @session.ute_device_pair_connection = dpc\n @session.save!\n\n is_offline_sensor_data_collection = true\n end\n end \n\n if isDataSubmissionInvalidForExpAndSession(request, params) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n begin\n if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n UteDataSubmissionService.delay.handlesensorinfos(@session, @sessionConnection, params)\n end\n rescue => e\n puts(e.message)\n raise 'an error has occured'\n #puts(e.backtrace.join(\"\\n\"))\n end\n\n #begin\n # if params.has_key?(:sensor_infos) && params[:sensor_infos].empty? == false\n # puts('receiving first item: ' + params[:sensor_infos][0][:t].to_s)\n # end\n #rescue => e\n # puts('TRY TO RESCUE')\n #\n # puts(e.message)\n # raise 'an error has occured'\n # #puts(e.backtrace.join(\"\\n\"))\n #end\n\n if @devicepairconnection != nil && is_offline_sensor_data_collection \n #otp needs to be renewed\n @devicepairconnection.update_attributes(\n expire_by: Time.now.getutc.to_f + OTP_DEVICE_PAIR_CONN_LIFETIME\n )\n end \n \n if is_offline_sensor_data_collection\n render json: { 'status' => 'OK', 'otp' => @devicepairconnotp, 'session_id' => @session.session_code }.to_json\n else\n render json: { 'status' => 'OK' }.to_json\n end\n end",
"def list_closed_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/closed\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def create\n @session = @event.sessions.new(params[:session])\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render json: [@event, @session], status: :created, location: [@event, @session] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def on_new_session(session)\n self.session_count += 1\n self.successful = true\n end",
"def refresh_session_token\n session_signature = Digest::MD5.hexdigest(@toodle_uid + Babar::Base.toodle_app_token) \n session_token_url = \"http://api.toodledo.com/2/account/token.php?\" + self.parse_params({:userid => @toodle_uid, :appid => Babar::Base.toodle_app_id , :sig => session_signature,})\n puts session_signature, session_token_url\n @session_token = JSON.parse(Typhoeus::Request.get(session_token_url).body)[\"token\"]\n @toodle_token_death = Time.now + Babar::Base.toodle_app_token_lifetime\n [@session_token, @toodle_token_death]\n end",
"def create\n session = Session.new\n session.name = params[:name]\n session.description = params[:description]\n session.start_time = params[:date]\n # TODO: need date\n # TODO: need topic\n session.active = true;\n # add ot_session.id\n ot_session = @@opentok.create_session({media_mode: :routed})\n session.session_id = ot_session.session_id\n # try and save the session\n saved = session.save\n # add moderators\n params[:moderators].each do |moderator|\n SessionUser.create(session_id: session.id, user_id: moderator[:id], role: 'moderator', center_stage: true)\n end\n # add subscribers\n params[:subscribers].each do |subscriber|\n puts subscriber\n SessionUser.create(session_id: session.id, user_id: subscriber[:id], role: 'publisher', center_stage: false)\n end\n if saved\n render json: {message: \"Event: #{session.name} successfully added\"}, status: 200\n else\n render json: {errors: session.errors.to_json}, status: 500\n end\n end",
"def check_session\n data = { :account => Encryptor.encrypt({:id => id, :phone => phone, :password => password}.to_json, :key => $secret_key) }\n\n response = RestClient.post \"#{$service_url}/api/account/check_session\", data, { :content_type => :json, :accept => :json }\n\n JSON.parse(response)\n rescue => error\n { :session => false }\n end",
"def create\n @session = Session.new(session_params)\n\n newYear = session_params[\"sessionDate(1i)\"]; # year\n newMonth = session_params[\"sessionDate(2i)\"]; # month\n newDay = session_params[\"sessionDate(3i)\"]; # day\n newHour = session_params[\"sessionDate(4i)\"]; # hour\n newMin = session_params[\"sessionDate(5i)\"]; # minute\n sessionLen = session_params[\"sessionLength\"]; # session length\n sessionLen = (sessionLen.to_i + 15)/60; # 15 minute break between sessions\n \n newDate = Time.new(newYear, newMonth, newDay, newHour, newMin);\n \n #temporarily hardcoding open/close times. \n openHour = Time.new(newYear, newMonth, newDay, 9, 0);\n closeHour = Time.new(newYear, newMonth, newDay, 21, 0);\n \n #temporarily hardcoding lunch hours\n lunchHour = Time.new(newYear, newMonth, newDay, 12, 0);\n \n validSessionTime = isValidSessionTime(newDate, openHour, closeHour, lunchHour, sessionLen)\n \n respond_to do |format|\n if validSessionTime\n format.html { render :new }\n flash[:alert] = \"Session unavailable at that time.\"\n else\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def reset_session_clock\n render json: { status: 'ok' }\n end",
"def create\n config_opentok\n session = @opentok.create_session request.remote_addr\n params[:room][:sessionId] = session.session_id\n \n @room = Room.new(params[:room])\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render json: @room, status: :created, location: @room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end",
"def create\n \n # remove any existing session of this user\n # TODO: update custom validations in model to work with this\n @session = Session.where(\"sender_id = #{session_params[:sender_id]} OR recipient_id = #{session_params[:sender_id]}\").first\n @session.destroy if @session\n \n @session = Session.new(session_params)\n \n if @session.valid?\n @session.session_id = Session.createSession(request.remote_addr).to_s\n @session.sender_token = Session.generateToken(@session.session_id, @session.sender.id.to_s)\n @session.recipient_token = Session.generateToken(@session.session_id, @session.recipient.id.to_s)\n end\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render action: 'show', status: :created, location: @session }\n else\n format.html { render action: 'new' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return unless restrict_to_hosts\n\n @session = @event.sessions.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: [@event, @session] }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ykt_session = YktSession.new(params[:ykt_session])\n\n respond_to do |format|\n if @ykt_session.save\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully created.' }\n format.json { render json: @ykt_session, status: :created, location: @ykt_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @session = SessionService.new(current_user).create_from_web! session_params\n\n respond_to do |format|\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created }\n end\n end",
"def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end",
"def create\n if Rails.env == 'development'\n Rails.logger.debug \"Cookies:\\n\" + cookies.to_yaml\n Rails.logger.debug \"Session:\\n\" + session.to_yaml\n end\n \n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n @user_session.user.reset_appearance!\n \n # Make sure any stale forum logins are cleared\n cookies[\"Vanilla\"] = {:value => \"\", :domain => \".worlize.com\"}\n cookies[\"Vanilla-Volatile\"] = {:value => \"\", :domain => \".worlize.com\"}\n\n # default_url = enter_room_url(@user_session.user.worlds.first.rooms.first.guid)\n default_url = enter_room_url(Room.gate_room_guid)\n\n format.html { redirect_back_or_default(default_url) }\n format.json do\n render :json => {\n :success => true,\n :redirect_to => get_redirect_back_or_default_url(default_url)\n }\n end\n else\n format.html { render :action => \"new\" }\n format.json do\n render :json => {\n :success => false\n }\n end\n end\n end\n end",
"def create\n @current_session = CurrentSession.new(params[:current_session])\n\n if @current_session.save\n render json: @current_session, status: :created, location: @current_session\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def refresh_session\n \t@watson_message = RoomMessage.create user: current_user,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\troom: @room,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twatsonmsg: true,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"The session has expired. Starting a new chat.\",\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: @room.params\n\t\tRoomChannel.broadcast_to @room, @watson_message\n\n\t\tauthenticator = Authenticators::IamAuthenticator.new(\n\t\t\tapikey: @room.apikey\n\t\t)\n\t\tassistant = AssistantV2.new(\n\t\t\tversion: \"2019-02-28\",\n\t\t\tauthenticator: authenticator\n\t\t)\n\t\tassistant.service_url = @room.serviceurl\t\n\t\tresponse = assistant.create_session(\n\t\t\tassistant_id: @room.assistantid\n\t\t)\n\t\[email protected] = response.result[\"session_id\"]\n\t\[email protected]\n\t\t\n\t\t@welcome_message = RoomMessage.create user: current_user,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\troom: @room,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twatsonmsg: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"Welcome to Movie On Rails! How can I help you?\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: @room.params\n\t\tRoomChannel.broadcast_to @room, @welcome_message\n end",
"def start_session(endpoint); end",
"def create\n @manager_session = ManagerSession.create(ManagerSession.all_sessions_endpoint)\n respond_to do |format|\n format.html { redirect_to manager_sessions_path }\n format.json { render :show, status: :created, location: @manager_session }\n end\n if @manager_session.count > 50000000\n @manager_session.first.delete\n end\n end",
"def post_params(path, params, session)\n post path, params, {\"rack.session\" => {\"uid\" => session['uid']}}\n end",
"def createSession\n # not having valid device id or device type. \n @deviceType = nil\n if (\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil || \n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id], :is_active => true).first) == nil\n ) \n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n @sessionId = generateNewSessionId\n\n while isSessionIdAlreadyExist(@experiment.experiment_code, @sessionId) do\n @sessionId = generateNewSessionId\n end\n\n #create sessionid\n @deviceId = params[:did]\n puts('device id:'+@deviceId)\n begin\n @newsession = @experiment.ute_ex_sessions.create!(\n session_code: @sessionId,\n is_active: true,\n initiated_by_device_id: @deviceId,\n is_created_offline: false\n )\n rescue => e\n puts(e.message)\n end\n\n puts('creating new session object')\n if @newsession\n @newsession.ute_ex_session_connections.create!(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: Time.now.getutc.to_f)\n \n #torender = { \n # 'sessionId' => @sessionId,\n # 'created_at' => @newsession.created_at.to_time.to_f,\n # 'settings' => {\n # 'version' => 1.0,\n # 'maximumRecordingDuration' => 0,\n # 'sensors' => [\n # { :name => 'accelerometer', :freq => 50 },\n # { :name => 'magnetometer', :freq => 50 },\n # { :name => 'gyroscope', :freq => 50 },\n # { :name => 'gps', :freq => 1 }\n # ],\n # 'label' => {\n # 'type' => 'interval',\n # 'schema' => [\n # { 'set' => [ 'standing', 'sitting', 'walking', 'running' ], 'is_nullable' => true, 'only_can_select_one' => true }\n # ]\n # }\n # }\n #}.to_json \n\n @settings = @experiment.read_attribute(:settings)\n\n torender = { \n 'status' => 'OK',\n 'sessionId' => @newsession.session_code,\n 'created_at' => @newsession.created_at.to_time.to_f,\n 'settings' => @settings\n }.to_json \n\n respond_to do |format|\n\n format.html { render text: 'Your Session: ' + @sessionId + ', json details: <br/>' + torender }\n format.json { \n #{'foo' => 'bar'}.to_json\n # render :json => '{ \"\\\"sessionId\\\"\": \"TEST001\" }' \n render json: torender\n }\n end\n else \n # reply with invalid session created\n respond_to do |format|\n format.html { render text: 'There is an error creating a new session.' }\n format.json { \n #{'foo' => 'bar'}.to_json\n # render :json => '{ \"\\\"sessionId\\\"\": \"TEST001\" }' \n render json: { 'error' => 'Error creating new session' }.to_json \n }\n end\n end\n end",
"def test_checking_complete_session_data\n\n post '/save-values', :value1 => '1', :value2 => '2', :value3 => '3'\n token_json = JSON.parse(last_response.body)\n prev_id = token_json['id']\n\n get '/complete-session-data'\n token_json2 = JSON.parse(last_response.body)\n next_id = JSON.parse(token_json2[0])['_id']\n\n assert_equal prev_id, next_id\n end",
"def opentok_session\n opentok.create_session(request.remote_addr).to_s\n end",
"def filter_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.filter_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/filter\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'trip_id'] = opts[:'trip_id'] if !opts[:'trip_id'].nil?\n query_params[:'ticket_id'] = opts[:'ticket_id'] if !opts[:'ticket_id'].nil?\n query_params[:'package_id'] = opts[:'package_id'] if !opts[:'package_id'].nil?\n query_params[:'course_id'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#filter_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end",
"def sessions=(value)\n @sessions = value\n end",
"def check_session\n session.delete(\"accepted\") if session[:updated_at].present? && session[:updated_at].to_time <= 10.minutes.ago\n end",
"def connectSession\n # not having valid device id or session number or device type. \n if (params.has_key?(:session_id) == false || params[:session_id].empty? ||\n params.has_key?(:did) == false || params[:did].empty? || \n params.has_key?(:dtype) == false || params[:dtype].empty? ||\n params.has_key?(:experiment_id) == false || params[:experiment_id].empty? ||\n (@experiment = UteExperiment.where(:experiment_code => params[:experiment_id]).first) == nil ||\n (@deviceType = DeviceType.where(name: params[:dtype]).first) == nil ||\n (@session = @experiment.ute_ex_sessions.where(:session_code => params[:session_id], :is_active => true).first) == nil)\n respond_to do |format|\n format.html { render text: 'Unauthorized', :status => :unauthorized }\n format.json { \n render :json => [], :status => :unauthorized \n }\n end\n return\n end\n\n @deviceId = params[:did]\n @sessionconnection = @session.ute_ex_session_connections.where(:device_id => @deviceId, :device_type => @deviceType.id).first\n if(@sessionconnection == nil)\n @sessionconnection = @session.ute_ex_session_connections.create(device_id: @deviceId, device_model: params[\"model\"], device_type: @deviceType.id, is_active: true, connected_at: Time.now.getutc.to_f);\n else\n @sessionconnection.is_active = true\n @sessionconnection.connected_at = Time.now.getutc.to_f\n @sessionconnection.save!\n end\n \n #torender = { \n # 'status' => 'OK',\n # 'created_at' => @session.created_at.to_time.to_f,\n # 'settings' => {\n # 'version' => 1.0,\n # 'maximumRecordingDuration' => 0,\n # 'sensors' => [\n # { :name => 'accelerometer', :freq => 50 },\n # { :name => 'magnetometer', :freq => 50 },\n # { :name => 'gyroscope', :freq => 50 },\n # { :name => 'gps', :freq => 1 }\n # ],\n # 'label' => {\n # 'type' => 'interval',\n # 'schema' => [\n # { 'set' => [ 'standing', 'sitting', 'walking', 'running' ], 'is_nullable' => true, 'only_can_select_one' => true }\n # ]\n # }\n # }\n # }.to_json \n torender = { \n 'status' => 'OK',\n 'created_at' => @sessionconnection.connected_at,\n 'settings' => @experiment.read_attribute(:settings)\n }.to_json \n respond_to do |format|\n format.html { render text: 'Session Status: Connected<br/>' + torender }\n format.json { \n render json: torender\n }\n end\n end",
"def create\n # respond_to do |format|\n # if @user_session.save\n # format.html { redirect_to @user_session, notice: 'User session was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @user_session }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @user_session.errors, status: :unprocessable_entity }\n # end\n # end\n\n #binding.pry\n user = User.get_user(user_session_params[:username], user_session_params[:password])\n if user != nil\n session = UserSession.login(user)\n response = {\n html: '',\n json: { username: user.username, token: session.key, status: 200 }\n }\n end\n respond_to do |format|\n if user != nil\n cookies[:auth] = {\n value: response[:json],\n expires: 1.year.from_now\n }\n format.html { render text: response[:html] }\n format.json { render json: response[:json] }\n else\n format.html { render text: '', status: :unauthorized }\n format.json { render text: '', status: :unauthorized }\n end\n end\n\n\n end",
"def send_sessions\n sessions = []\n counts = @session_counts\n @session_counts = Concurrent::Hash.new(0)\n counts.each do |min, count|\n sessions << {\n :startedAt => min,\n :sessionsStarted => count\n }\n end\n deliver(sessions)\n end",
"def valid_session\r\n {}\r\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end",
"def valid_session\n {}\n end"
] | [
"0.6141677",
"0.6007205",
"0.59136736",
"0.59000343",
"0.58953667",
"0.58930206",
"0.58599037",
"0.58243406",
"0.5788784",
"0.57812786",
"0.5772482",
"0.5752685",
"0.5741058",
"0.57021147",
"0.57020754",
"0.56545407",
"0.56434214",
"0.5627708",
"0.5618583",
"0.55769926",
"0.5556405",
"0.5540935",
"0.5533976",
"0.5524472",
"0.55227447",
"0.55197316",
"0.54965997",
"0.54944587",
"0.5492625",
"0.54366267",
"0.5393173",
"0.53881544",
"0.5387062",
"0.53776765",
"0.537202",
"0.5364096",
"0.535602",
"0.5350034",
"0.5347913",
"0.534766",
"0.5343955",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718",
"0.5342718"
] | 0.6964131 | 0 |
PUT /polling_sessions/1 PUT /polling_sessions/1.json | def update
@polling_session = PollingSession.find(params[:id])
respond_to do |format|
if @polling_session.update_attributes(params[:polling_session])
format.html { redirect_to @polling_session, notice: 'Polling session was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @polling_session.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_single_poll_session(poll_id,id,poll_sessions__course_id__,poll_sessions__course_section_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n raise \"poll_sessions__course_section_id__ is required\" if poll_sessions__course_section_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id,\n :poll_sessions__course_id__ => poll_sessions__course_id__,\n :poll_sessions__course_section_id__ => poll_sessions__course_section_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end",
"def create\n @polling_session = PollingSession.new(params[:polling_session])\n\n respond_to do |format|\n if @polling_session.save\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully created.' }\n format.json { render json: @polling_session, status: :created, location: @polling_session }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @current_session = CurrentSession.find(params[:id])\n\n if @current_session.update(params[:current_session])\n head :no_content\n else\n render json: @current_session.errors, status: :unprocessable_entity\n end\n end",
"def update\n @session = Session.find_by_id(params[:id])\n\n if @session.nil?\n render json: {message: \"404 Not Found\"}, status: :not_found\n else\n @session.update(session_params)\n end\n end",
"def update\r\n @session = Session.find(params[:id])\r\n\r\n\r\n json = ActiveSupport::JSON.decode(request.raw_post)\r\n logger.debug json\r\n\r\n #@session.pla\r\n\r\n #json = ActiveSupport::JSON.decode(request.raw_post)\r\n #@session.state = json['state']\r\n\r\n respond_to do |format|\r\n if @session.save\r\n format.html { redirect_to(@session, :notice => 'Session was successfully updated.') }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\r\n format.json { render :json => @session.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @session_resource = SessionResource.find(params[:id])\n\n if @session_resource.update(session_resource_params)\n head :no_content\n else\n render json: @session_resource.errors, status: :unprocessable_entity\n end\n end",
"def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end",
"def update\n if @session\n @session.update_session(marshalize(@data))\n end\n end",
"def update\n @session = Session.find(params[:id])\n authorize @session\n @session.update(session_params)\n redirect_to trainings_path\n end",
"def _session_update sid = \"\", uid = 0\n\t\tds = DB[:_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend",
"def update\n params[:trainingsession][:existing_interval_attributes] ||= {}\n @trainingsession = Trainingsession.find(params[:id])\n\n respond_to do |format|\n if @trainingsession.update_attributes(params[:trainingsession])\n flash[:notice] = 'Trainingsession was successfully updated.'\n format.html { redirect_to(@trainingsession) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trainingsession.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def reset_session_clock\n render json: { status: 'ok' }\n end",
"def update\n @sessions = SessionEvent.find(params[:id])\n if @sessions.update_attributes(session_event_params)\n flash[:success] = \"Your session has been updated\"\n redirect_to @sessions\n end\n respond_to do |format|\n if @session_event.update(session_event_params)\n format.html { redirect_to @session_event, notice: 'Session event was successfully updated.' }\n format.json { render :show, status: :ok, location: @session_event }\n else\n format.html { render :edit }\n format.json { render json: @session_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lift_session.update(lift_session_params)\n format.html { redirect_to @lift_session, notice: 'Lift session was successfully updated.' }\n format.json { render :show, status: :ok, location: @lift_session }\n else\n format.html { render :edit }\n format.json { render json: @lift_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ykt_session = YktSession.find(params[:id])\n\n respond_to do |format|\n if @ykt_session.update_attributes(params[:ykt_session])\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ykt_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @otg_sess.update(otg_sess_params)\n format.html { redirect_to @otg_sess, notice: 'Otg sess was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_sess }\n else\n format.html { render :edit }\n format.json { render json: @otg_sess.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_session(data)\n connection = self.class.session_connection\n if @id\n # if @id is not nil, this is a session already stored in the database\n # update the relevant field using @id as key\n if SmartSession::SqlSession.locking_enabled?\n self.class.query(\"UPDATE #{SmartSession::SqlSession.table_name} SET `updated_at`=NOW(), `data`=#{self.class.quote(data)}, lock_version=lock_version+1 WHERE id=#{@id}\")\n @lock_version += 1 #if we are here then we hold a lock on the table - we know our version is up to date\n else\n self.class.query(\"UPDATE #{SmartSession::SqlSession.table_name} SET `updated_at`=NOW(), `data`=#{self.class.quote(data)} WHERE id=#{@id}\")\n end\n else\n # if @id is nil, we need to create a new session in the database\n # and set @id to the primary key of the inserted record\n self.class.query(\"INSERT INTO #{SmartSession::SqlSession.table_name} (`created_at`, `updated_at`, `session_id`, `data`) VALUES (NOW(), NOW(), '#{@session_id}', #{self.class.quote(data)})\")\n @id = connection.last_id\n @lock_version = 0\n end\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_session(env, sid, session, options); end",
"def update\n return unless restrict_to_hosts\n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: [@event, @session] }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session_time.update(session_time_params)\n format.html { redirect_to @session_time, notice: 'Session time was successfully updated.' }\n format.json { render :show, status: :ok, location: @session_time }\n else\n format.html { render :edit }\n format.json { render json: @session_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @polling_session = PollingSession.find(params[:id])\n @polling_session.destroy\n\n respond_to do |format|\n format.html { redirect_to polling_sessions_url }\n format.json { head :no_content }\n end\n end",
"def update\n @yoga_session = YogaSession.find(params[:id])\n\n respond_to do |format|\n if @yoga_session.update_attributes(params[:yoga_session])\n format.html { redirect_to @yoga_session, notice: 'Yoga session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @yoga_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refresh_session_token\n session_signature = Digest::MD5.hexdigest(@toodle_uid + Babar::Base.toodle_app_token) \n session_token_url = \"http://api.toodledo.com/2/account/token.php?\" + self.parse_params({:userid => @toodle_uid, :appid => Babar::Base.toodle_app_id , :sig => session_signature,})\n puts session_signature, session_token_url\n @session_token = JSON.parse(Typhoeus::Request.get(session_token_url).body)[\"token\"]\n @toodle_token_death = Time.now + Babar::Base.toodle_app_token_lifetime\n [@session_token, @toodle_token_death]\n end",
"def refresh_session\n \t@watson_message = RoomMessage.create user: current_user,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\troom: @room,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twatsonmsg: true,\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"The session has expired. Starting a new chat.\",\n\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: @room.params\n\t\tRoomChannel.broadcast_to @room, @watson_message\n\n\t\tauthenticator = Authenticators::IamAuthenticator.new(\n\t\t\tapikey: @room.apikey\n\t\t)\n\t\tassistant = AssistantV2.new(\n\t\t\tversion: \"2019-02-28\",\n\t\t\tauthenticator: authenticator\n\t\t)\n\t\tassistant.service_url = @room.serviceurl\t\n\t\tresponse = assistant.create_session(\n\t\t\tassistant_id: @room.assistantid\n\t\t)\n\t\[email protected] = response.result[\"session_id\"]\n\t\[email protected]\n\t\t\n\t\t@welcome_message = RoomMessage.create user: current_user,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\troom: @room,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twatsonmsg: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmessage: \"Welcome to Movie On Rails! How can I help you?\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tparams: @room.params\n\t\tRoomChannel.broadcast_to @room, @welcome_message\n end",
"def update\n authorize @session\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refresh_session\n update_session(30.days.from_now)\n update_last_session\n end",
"def new\n @polling_session = PollingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polling_session }\n end\n end",
"def update\n @bohconf_session = BohconfSession.find(params[:id])\n params[:bohconf_session][:starts_at] = params[:bohconf_session][:starts_at].to_time\n params[:bohconf_session][:ends_at] = params[:bohconf_session][:ends_at].to_time\n if @bohconf_session.update_attributes(session_params)\n redirect_to bohconf_path, notice: 'Session was successfully updated.'\n end\n end",
"def update\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ergo_session.update(ergo_session_params)\n format.html { redirect_to @ergo_session, notice: 'Ergo session was successfully updated.' }\n format.json { render :show, status: :ok, location: @ergo_session }\n else\n format.html { render :edit }\n format.json { render json: @ergo_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session_operation.update(session_operation_params)\n format.html { redirect_to @session_operation, notice: 'Session operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sevone_session.update(sevone_session_params)\n format.html { redirect_to @sevone_session, notice: 'Sevone session was successfully updated.' }\n format.json { render :show, status: :ok, location: @sevone_session }\n else\n format.html { render :edit }\n format.json { render json: @sevone_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to game_session_path(@session), notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_single_poll_session(poll_id,poll_sessions__course_id__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :poll_sessions__course_id__,\n :poll_sessions__course_section_id__,\n :poll_sessions__has_public_results__,\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"poll_sessions__course_id__ is required\" if poll_sessions__course_id__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :poll_sessions__course_id__ => poll_sessions__course_id__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end",
"def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _set_session(env, sid, new_session, options)\n logger.debug \"Setting session #{new_session.inspect}\" \n ses_obj = sessions.find_one( { :_id => sid } )\n if ses_obj\n logger.debug \"Found existing session for -- #{sid.inspect}\"\n session = MongoRack::SessionHash.new( deserialize( ses_obj['data'] ) )\n else\n logger.debug \"Unable to find session for -- #{sid.inspect}\"\n session = MongoRack::SessionHash.new\n end\n \n if options[:renew] or options[:drop]\n sessions.remove( { :_id => sid } )\n return false if options[:drop]\n sid = generate_sid\n sessions.insert( {:_id => sid, :data => {} } )\n end\n old_session = new_session.instance_variable_get('@old') || MongoRack::SessionHash.new\n logger.debug \"Setting old session -- #{old_session.inspect}\" \n merged = merge_sessions( sid, old_session, new_session, session )\n\n expiry = options[:expire_after]\n expiry = expiry ? Time.now + options[:expire_after] : 0\n\n # BOZO ! Use upserts here if minor changes ?\n logger.debug \"Updating session -- #{merged.inspect}\" \n sessions.save( { :_id => sid, :data => serialize( merged ), :expire => expiry } )\n return sid\n rescue => boom \n logger.error \"#{self} Hoy! Something went wrong. Unable to persist session.\"\n logger.error $!.inspect\n boom.backtrace.each{ |l| logger.error l }\n return false\n end",
"def update\n @session_info = SessionInfo.first\n\n respond_to do |format|\n if @session_info.update_attributes(params[:session_info])\n format.html { redirect_to session_information_path, notice: 'Session Info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sessions=(value)\n @sessions = value\n end",
"def update_session(data)\n update_attribute('data', data) \n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def start_session(nick)\n usr = User.first(:nickname=>params[:nickname])\n p User.all\n if usr != nil\n sid = gen_sessionid\n\n #associate nick with sid & IP & communication password\n $sessions[nick] = {:ip=>@env['REMOTE_ADDR'], :sid=> sid, :lastrequest=> Time.now.to_i}\n\n #return JSON with sessionid\n return {:sid => sid}\n end\n return 'error'\nend",
"def put(path, params={}) # :nodoc:\n handle_response(@session.put(path, MultiJson.dump(params)))\n end",
"def write_session(req, sid, session, options)\n @lock.set_session_data(req.env, sid, session, options)\n end",
"def edit_session_with_http_info(id, start, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.edit_session ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling SessionApi.edit_session\" if id.nil?\n # verify the required parameter 'start' is set\n fail ArgumentError, \"Missing the required parameter 'start' when calling SessionApi.edit_session\" if start.nil?\n # resource path\n local_var_path = \"/session/edit\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = id\n query_params[:'start'] = start\n query_params[:'boat_id'] = opts[:'boat_id'] if !opts[:'boat_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20044')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#edit_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_poll_sessions_for_poll(poll_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions\",\n :poll_id => poll_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def refresh_session\n self.update_attributes(session_expires_in: 30.days.from_now)\n end",
"def update\n respond_to do |format|\n if @admin_session.update(session_params)\n format.html { redirect_to @admin_session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_session }\n else\n format.html { render :edit }\n format.json { render json: @admin_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return if Settings.readonly \n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to sessions_url, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: @session }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def open_poll_session(poll_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}/open\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def user_session_update sid = \"\", uid = 0\n\t\tds = Sdb[:user_sess].filter(:sid => sid, :uid => uid.to_i)\n\t\tds.update(:changed => Time.now) if ds.count > 0\n\tend",
"def update\n\t\tself.log.debug \"Updating session data for key %s\" % @id\n\t\tyield( self.serialized_data )\n\t\t@modified = false\n\tend",
"def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n end",
"def show\r\n @session = Session.find(params[:id])\r\n\r\n if((@session.state == \"won\") && (@session.updated_at.to_i + 3 < Time.now.to_i))\r\n @session.state = \"nextQuestion\"\r\n @session.save\r\n end\r\n\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @session }\r\n #format.json { render :json => @session }\r\n format.json { render_for_api :in_progress_session, :json => @session, :root => :session }\r\n\t\t\r\n end\r\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\n @tutoring_session = TutoringSession.find(params[:id])\n\n respond_to do |format|\n if @tutoring_session.update_attributes(params[:tutoring_session])\n format.html { redirect_to @tutoring_session, notice: 'Tutoring session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutoring_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n status_key = STATUS[rand(STATUS.length)]\n\n n = Spooge.update_all_on_redis(:touch_date, DateTime.now)\n n = Spooge.update_all_on_redis(:status, status_key)\n resp = {:updated => n, :status_key => status_key}\n render :json => resp\n end",
"def update\n respond_to do |format|\n if @game_session.update(game_session_params)\n format.html { redirect_to @game_session, notice: 'Game session was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_session }\n else\n format.html { render :edit }\n format.json { render json: @game_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invalidate_all_sessions!\n update(session_token: SecureRandom.hex)\n end",
"def update_user_token\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).update(last_used_at: Time.zone.now)\n end\n end",
"def update\n @training_session = TrainingSession.find(params[:id])\n\n respond_to do |format|\n if @training_session.update_attributes(params[:training_session])\n format.html { redirect_to @training_session, notice: 'Training session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_session.update(user_session_params)\n format.html { redirect_to @user_session, notice: 'User session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @session_note.update(session_note_params)\n format.html { redirect_to @session_note, notice: 'Session note was successfully updated.' }\n format.json { render :show, status: :ok, location: @session_note }\n else\n format.html { render :edit }\n format.json { render json: @session_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @training_session.update(training_session_params)\n format.html { redirect_to @training_session, notice: 'Training session was successfully updated.' }\n format.json { render :show, status: :ok, location: @training_session }\n else\n format.html { render :edit }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generateSession\n sessionId = SecureRandom.base58(24)\n @test.update(session_id: sessionId)\n\n # set expiry date to 15 minutes from now\n @test.update(session_expired_at: Time.now + 15*60)\n\n render json: sessionId\n end",
"def markStreamKeyOver30Seconds(streamKey, streamServerID, songID, songQueueID, songQueueSongID)\n request('markStreamKeyOver30Seconds', {'streamKey' => streamKey, 'streamServerID' => streamServerID, 'songID' => songID, 'songQueueID' => songQueueID, 'songQueueSongID' => songQueueSongID})\nend",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n if @heartbeat.update(heartbeat_params)\n head :no_content\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"def update_session(parsed, session)\n session ||= Session.new\n session.id = parsed[parsed.keys.first][\"customerSessionId\"] if parsed[parsed.keys.first]\n end",
"def update_session_key\n @parameters['sessionKey'] = get_session_key\n end",
"def on_new_session(session)\n self.session_count += 1\n self.successful = true\n end",
"def list_opened_poll_sessions(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/poll_sessions/opened\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n response\n \n end",
"def update\n respond_to do |format|\n if @session_login.update(session_login_params)\n format.html { redirect_to @session_login, notice: \"Session login was successfully updated.\" }\n format.json { render :show, status: :ok, location: @session_login }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @session_login.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exercise_session.update(exercise_session_params)\n format.html { redirect_to @exercise_session, notice: 'Exercise session was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise_session }\n else\n format.html { render :edit }\n format.json { render json: @exercise_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n store = OpenID::Store::Filesystem.new(RAILS_ROOT + '/tmp')\n consumer = OpenID::Consumer.new(session, store)\n response = consumer.complete(params.reject { |k, v| k !~ /^openid\\./ }, session_url)\n if response.status == :success\n # Awesome! Set the user identity url in the session\n session[:url] = response.identity_url\n # redirect somewhere useful\n redirect_to '/'\n else\n flash[:notice] = 'Failure signing in with OpenID.'\n redirect_to new_session_path\n end\n end",
"def start_session(endpoint); end",
"def update\n java_session = @java_request.getSession(true)\n hash = @session_data.dup\n hash.delete_if do |k,v|\n if String === k\n case v\n when String, Numeric, true, false, nil\n java_session.setAttribute k, v\n true\n else\n if v.respond_to?(:java_object)\n java_session.setAttribute k, v\n true\n else\n false\n end\n end\n end\n end\n unless hash.empty?\n marshalled_string = Marshal.dump(hash)\n marshalled_bytes = marshalled_string.to_java_bytes\n java_session.setAttribute(RAILS_SESSION_KEY, marshalled_bytes)\n end\n end",
"def update\n playlist = Playlist.find_by(uuid: params[:id])\n if playlist[:user_id] == session[:user_id]\n change_playlist_title(playlist, params['playlist']['title'])\n update_playlist(playlist[:id], params['playlist']['tiktoks'])\n render json: { status: 200, playlist: playlist }\n else\n render json: { status: 500 }\n end\n end",
"def update\n @session_type = SessionType.find(params[:id])\n\n respond_to do |format|\n if @session_type.update_attributes(params[:session_type])\n format.html { redirect_to @session_type, notice: 'Session type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_session(session_id, data)\n @mutex.synchronize {\n @timestamps[session_id] = Time.now\n @sessions[session_id] = data\n }\n end",
"def update\n respond_to do |format|\n if @tsession.update(tsession_params)\n format.html { redirect_to @tsession, notice: 'Tsession was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tsession.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n config_opentok\n session = @opentok.create_session request.remote_addr\n params[:room][:sessionId] = session.session_id\n \n @room = Room.new(params[:room])\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render json: @room, status: :created, location: @room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @obsession.update(obsession_params)\n format.html { redirect_to @obsession, notice: 'Obsession was successfully updated.' }\n format.json { render :show, status: :ok, location: @obsession }\n else\n format.html { render :edit }\n format.json { render json: @obsession.errors, status: :unprocessable_entity }\n end\n end\n end",
"def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end",
"def session_api_key\n api_keys.active.session.create\n end",
"def update\n respond_to do |format|\n if @pairing_session.update(pairing_session_params)\n format.html { redirect_to @pairing_session, notice: 'Pairing session was successfully updated.' }\n format.json { render :show, status: :ok, location: @pairing_session }\n else\n format.html { render :edit }\n format.json { render json: @pairing_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_session_event\n @session_event = SessionEvent.find(params[:id])\n end",
"def update\n @pool_session = PoolSession.find(params[:id])\n if @pool_session.player1 == @pool_session.player2\n flash[:error] = \"You must specifify 2 separate players in a session\"\n render :action => \"edit\" \n else\n respond_to do |format|\n if @pool_session.update_attributes(params[:session])\n update_player_scores\n format.html { redirect_to(@pool_session, :notice => 'Session was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pool_session.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @help_session_request.update(help_session_request_params)\n format.html { redirect_to @help_session_request, notice: 'Help session request was successfully updated.' }\n format.json { render :show, status: :ok, location: @help_session_request }\n else\n format.html { render :edit }\n format.json { render json: @help_session_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_session(jid, attrs)\n @sessions.save(jid, attrs)\n end",
"def update\n @session = Session.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n flash[:notice] = 'Session was successfully updated.'\n format.html { \n if @session.course\n redirect_to(admin_course_session_path(@session.course, @session))\n else\n redirect_to(admin_session_path(@session))\n end\n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @session.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.62015176",
"0.6142145",
"0.6055531",
"0.6052481",
"0.5942413",
"0.59289163",
"0.58133686",
"0.5766334",
"0.5756454",
"0.57487214",
"0.57074255",
"0.5697528",
"0.56855774",
"0.5656672",
"0.5631655",
"0.56300336",
"0.5626987",
"0.56072384",
"0.56072384",
"0.5606675",
"0.5598127",
"0.5575571",
"0.5563653",
"0.5542502",
"0.55388033",
"0.553751",
"0.5536306",
"0.55294555",
"0.5524289",
"0.5522743",
"0.5494261",
"0.5492819",
"0.5489458",
"0.5483462",
"0.54788035",
"0.5476134",
"0.5476134",
"0.5476134",
"0.5476134",
"0.5444036",
"0.54435897",
"0.54257214",
"0.54251087",
"0.5417024",
"0.5413671",
"0.5389245",
"0.5326706",
"0.53195727",
"0.53133285",
"0.531215",
"0.5311667",
"0.5305758",
"0.52651536",
"0.526099",
"0.525904",
"0.5254188",
"0.524993",
"0.5249792",
"0.5240289",
"0.5235513",
"0.52354276",
"0.52121216",
"0.5211123",
"0.52042425",
"0.5200075",
"0.5196789",
"0.51890737",
"0.51871216",
"0.51810163",
"0.51778734",
"0.5165255",
"0.5154902",
"0.515481",
"0.5145651",
"0.51452094",
"0.51436806",
"0.5137499",
"0.5120948",
"0.51155645",
"0.5115557",
"0.511419",
"0.5107251",
"0.5102951",
"0.5094057",
"0.5093073",
"0.50891113",
"0.5087623",
"0.5087557",
"0.5087165",
"0.5080585",
"0.5055742",
"0.5053142",
"0.50530785",
"0.50522125",
"0.50380284",
"0.5037942",
"0.5034565",
"0.5029582",
"0.50249416",
"0.5020103"
] | 0.68678343 | 0 |
DELETE /polling_sessions/1 DELETE /polling_sessions/1.json | def destroy
@polling_session = PollingSession.find(params[:id])
@polling_session.destroy
respond_to do |format|
format.html { redirect_to polling_sessions_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def destroy\n @yoga_session = YogaSession.find(params[:id])\n @yoga_session.destroy\n\n respond_to do |format|\n format.html { redirect_to yoga_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ykt_session = YktSession.find(params[:id])\n @ykt_session.destroy\n\n respond_to do |format|\n format.html { redirect_to ykt_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_session\n\n if @session.destroy\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, notice: t(\"dashboard.batch_connect_sessions_status_blurb_delete_success\") }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_back allow_other_host: false, fallback_location: batch_connect_sessions_url, alert: t(\"dashboard.batch_connect_sessions_status_blurb_delete_failure\") }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n begin\n obj = User.find(params[:id])\n\n unless session.user.id == obj.id\n response.status = 403\n render json: {}\n return\n end\n\n # This is what slows down the response.\n # Big DB transactions that delete by foreign key.\n obj.time_sessions.destroy_all\n obj.login_sessions.destroy_all\n\n obj.destroy\n response.status = 20\n render json: {msg: obj.time_sessions.methods}\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: {msg: e}\n end\n\n end",
"def delete(url)\n setup_or_refresh_rest_session\n @session.delete(url: url)\n end",
"def destroy\n @user=User.where(:authentication_token=>params[:api_key]).first\n @user.reset_authentication_token!\n render :json => { :message => [\"Session deleted.\"] }, :success => true, :status => :ok\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @discovery_session = DiscoverySession.find(params[:id])\n @discovery_session.destroy\n\n respond_to do |format|\n format.html { redirect_to discovery_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Session.delete(params[:id])\n reset_session\n\n if request.format.html?\n redirect_to \"/sessions/new\"\n elsif requeset.format.json?\n render json: {success: true}\n end\n end",
"def delete_session(env, sid, options); end",
"def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_session2_id\n url = \"https://208.65.111.144/rest/Session/logout/{'session_id':'#{get_session2}'}\"\n begin\n apiRequest(url)\n rescue Restclient::InternalServerError => e\n error_message = e.response[e.response.index('faultstring')+14..-3]\n if error_message != \"Session id is expired or doesn't exist\"\n puts \"Something went wrong trying to logout\"\n end\n end\n @@session_id = nil\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tsession.destroy\n respond_to do |format|\n format.html { redirect_to tsessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 @heartbeat.destroy\n\n head :no_content\n end",
"def destroy\n @session_info = SessionInfo.first\n @session_info.destroy\n\n respond_to do |format|\n format.html { redirect_to session_infos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n return if Settings.readonly \n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session_operation.destroy\n respond_to do |format|\n format.html { redirect_to session_operations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @session = Session.find(params[:id])\r\n @session.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(sessions_url) }\r\n format.xml { head :ok }\r\n format.json { head :ok }\r\n\r\n end\r\n end",
"def destroy\n @session_replica.destroy\n respond_to do |format|\n format.html { redirect_to session_replicas_url }\n format.json { head :no_content }\n end\n end",
"def delete_sessions(node)\n @sessions.delete_all(node)\n end",
"def destroy\n @session_time.destroy\n respond_to do |format|\n format.html { redirect_to session_times_url, notice: 'Session time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_poll_session(poll_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"poll_id is required\" if poll_id.nil?\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :poll_id => poll_id,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{poll_id}/poll_sessions/{id}\",\n :poll_id => poll_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end",
"def destroy\n id = shift_argument ||\n raise(Heroku::Command::CommandFailed, \"Usage: sessions:destroy [ID]\")\n session = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :delete,\n :path => \"/oauth/sessions/#{CGI.escape(id)}\"\n ).body\n end\n puts %{Destroyed \"#{session[\"description\"]}\".}\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @tutoring_session = TutoringSession.find(params[:id])\n @tutoring_session.destroy\n\n respond_to do |format|\n format.html { redirect_to tutoring_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study_session = StudySession.find(params[:id])\n @study_session.destroy\n\n respond_to do |format|\n format.html { redirect_to study_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pool_session = PoolSession.find(params[:id])\n @pool_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessions_url) }\n format.xml { head :ok }\n end\n end",
"def delete_session(session_id)\n delete(\"session:#{session_id}\")\n end",
"def delete(path, params={}) # :nodoc:\n handle_response(@session.delete(path, MultiJson.dump(params)))\n end",
"def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to(sessions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n @session = @event.sessions.find(params[:id])\n\n #when destroying the last session, also destroy the related event\n #i know i can refactor this\n # event = Event.find(@session.event_id)\n # if event.sessions.count == 1\n # event.destroy\n # end\n \n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to event_sessions_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @ergo_session.destroy\n respond_to do |format|\n format.html { redirect_to ergo_sessions_url, notice: 'Ergo session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteSession(sessionID)\n call :deleteSession, :sessionID => sessionID\n end",
"def destroy\n @lift_session.destroy\n respond_to do |format|\n format.html { redirect_to lift_sessions_url, notice: 'Lift session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def destroy\n logout\n render json: {:ok => true}\n end",
"def destroy\n @sevone_session.destroy\n respond_to do |format|\n format.html { redirect_to sevone_sessions_url, notice: 'Sevone session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.destroy\n redirect_to '/fitness_sessions/',notice: \"\"\n #respond_to do |format|\n #format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n #format.json { head :no_content }\n #end\n end",
"def destroy\n session[:flybuys_number] = nil\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session_login.destroy\n respond_to do |format|\n format.html { redirect_to session_logins_url, notice: \"Session login was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session_event.destroy\n respond_to do |format|\n format.html { redirect_to session_events_url, notice: 'Session event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @current_session = CurrentSession.find(params[:id])\n @current_session.destroy\n\n head :no_content\n end",
"def destroy\n @user_session.destroy\n respond_to do |format|\n format.html { redirect_to user_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy_session\n response_handler(rest_delete('/rest/login-sessions'))\n self\n end",
"def delete_sessions(user_id:)\n path = '/users/{userId}/sessions'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\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 @session_resource.destroy\n\n head :no_content\n end",
"def logout\n response = @session.delete\n @auth_token = nil\n @rest.default_headers = { 'Content-Type' => 'application/json' }\n response\n end",
"def kill_session\n# DEBUG\n# logger.debug \"\\r\\n!! ------ in kill_session -----\"\n# logger.debug params\n if params[:id]\n logger.debug \"\\r\\n!! Killing session #{params[:id]}...\"\n Session.where( :id => params[:id] ).delete_all\n flash[:notice] = I18n.t(:session_deleted)\n else\n flash[:error] = I18n.t(:unable_to_delete_session)\n end\n redirect_to( whos_online_path() )\n end",
"def log_out\n get '/sessions/destroy'\nend",
"def log_out\n get '/sessions/destroy'\nend",
"def destroy\n if @session.created_by == current_user.id\n @session.destroy\n else\n flash[:notice] = \"Cannot delete session as you did not create it.\"\n end\n respond_to do |format|\n format.html { redirect_to game_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # expire auth token \n\t @user=User.where(:authentication_token=>params[:api_key]).first\n\t if @user.present?\n\t #@user.reset_authentication_token!\n token = Devise.friendly_token[0,20]\n unless @user.authentication_token == token\n @user.update_attributes(:authentication_token => token)\n end\n\t render :json => { :message => [\"Session deleted.\"], :success => true, :status => :ok}\n\t else\n\t\t respond_to do |format|\n format.json{ render :json => { :error => \"Api key is invalid.\" }}\n end\n\t end\n end",
"def destroy\n @session_note.destroy\n respond_to do |format|\n format.html { redirect_to session_notes_url, notice: 'Session note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_session.destroy\n respond_to do |format|\n format.html { redirect_to game_sessions_url, notice: 'Game session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_session.destroy\n respond_to do |format|\n format.html { redirect_to exercise_sessions_url, notice: 'Exercise session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @obsession.destroy\n respond_to do |format|\n format.html { redirect_to obsessions_url, notice: 'Obsession was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n ensure\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n @user_session = UserSession.find(params[:id])\n @user_session.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/signin\", notice: 'Goodbye!' }\n format.json { head :no_content }\n end\n end",
"def delete\n if self.class.exists?(handle.address, handle.use_ssl?, handle.port)\n self.class.session_store.delete(self.class.key(handle.address, handle.use_ssl?, handle.port))\n end\n end",
"def destroy \n session.delete :user_id \n head :no_content \n end",
"def logout\n # delete the session\n session.delete :user_id\n render json: { message: \"Logged Out\" }\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n session[:user_id] = nil\n head(:ok, status: :no_content) \n end",
"def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def log_out \n get '/sessions/destroy'\nend",
"def destroy \n playlist = Playlist.find_by(uuid: params[:id])\n return unless playlist[:user_id] == session[:user_id]\n\n # PlaylistTiktok.where(\"playlist_id = #{playlist[:id]}\").delete_all\n delete_tiktoks_from_playlist(playlist[:id])\n playlist.destroy\n render json: { status: 200, deleted: true }\n end",
"def destroy\n @qa_session = @qa_session_file.qa_session\n @qa_session_file.destroy\n respond_to do |format|\n format.html { redirect_to qa_session_url(@qa_session), notice: 'qa_session file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(user)\n Rails.logger.debug \"Call to poll.delete\"\n reqUrl = \"/api/poll/#{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 session[:user_id] = nil\n response.status=(200)\n render json: {status: \"Success\", message: [\"Successfully Logged Out\"]}\n end",
"def destroy\n @guest_session_association.destroy\n respond_to do |format|\n format.html { redirect_to jam_sessions_path }\n format.json { head :no_content }\n end\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n @shutdown_request.destroy\n respond_to do |format|\n format.html { redirect_to shutdown_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @training_session = TrainingSession.find(params[:id])\n @training_session.destroy\n\n respond_to do |format|\n format.html { redirect_to training_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return unless restrict_to_hosts\n\n @session.destroy\n respond_to do |format|\n format.html { redirect_to sessions_url, notice: 'Session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plateau_session = PlateauSession.find(params[:id])\n @plateau_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(plateau_sessions_url) }\n format.xml { head :ok }\n end\n end",
"def remove_old_sessions\n candidates = find_old_sessions\n candidates.destroy_all\nend",
"def destroy\n @api_state.destroy\n\n head :no_content\n end",
"def destroy\n session.delete :name\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @user_session = UserSession.find\n @user_session.destroy\n\n respond_to do |format|\n format.html { redirect_to(:users, :notice => 'Goodbye!') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session.clear\n end",
"def destroy\n session_user.destroy\n render json: session_user\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end"
] | [
"0.6872393",
"0.6747178",
"0.66962314",
"0.6695935",
"0.66853786",
"0.66851443",
"0.66586506",
"0.6655968",
"0.66477543",
"0.6643424",
"0.66171086",
"0.6616865",
"0.6606987",
"0.6604662",
"0.6598259",
"0.65948504",
"0.65540737",
"0.65282935",
"0.652107",
"0.65035516",
"0.6440746",
"0.64343244",
"0.64159095",
"0.64108646",
"0.64092606",
"0.6396344",
"0.6381303",
"0.63606435",
"0.63606435",
"0.63606435",
"0.63606435",
"0.63592845",
"0.6346689",
"0.63422763",
"0.6333451",
"0.6318548",
"0.6295368",
"0.62916964",
"0.6289435",
"0.6287559",
"0.62741584",
"0.62524045",
"0.62383825",
"0.6232048",
"0.6227092",
"0.6217764",
"0.6209312",
"0.6201527",
"0.6193708",
"0.6181492",
"0.61746943",
"0.6169465",
"0.616499",
"0.6162743",
"0.6140475",
"0.6125509",
"0.6122518",
"0.612213",
"0.6118152",
"0.6111987",
"0.6096043",
"0.6090876",
"0.6090876",
"0.6090855",
"0.60799193",
"0.6079737",
"0.60784256",
"0.6066456",
"0.6061387",
"0.6059225",
"0.6058813",
"0.6057335",
"0.6057318",
"0.6055566",
"0.605533",
"0.6054554",
"0.6054165",
"0.60523725",
"0.60523725",
"0.60523725",
"0.60523725",
"0.60523725",
"0.6052025",
"0.60470724",
"0.6044783",
"0.6040844",
"0.6039266",
"0.6035225",
"0.60326856",
"0.60321057",
"0.60278624",
"0.6018978",
"0.60139364",
"0.600446",
"0.600439",
"0.60010713",
"0.5995075",
"0.5993533",
"0.59920084",
"0.59884053"
] | 0.7535422 | 0 |
Extract url from json and get files | def download
URI.extract(json, ['http', 'https']).each do |url|
get_asset(url)
end
json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def get_file(url); end",
"def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end",
"def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"def handle_links(json) end",
"def extract_links(json)\n json[\"roots\"].collect do |key, children|\n extract_children(children[\"name\"], children[\"children\"])\n end\n end",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def get_json_url(url) \n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url\n\n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n\n begin\n\n res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n\n end\n j = nil\n begin\n j = JSON.parse(res.body)\n rescue OpenURI::HTTPError=>e\n case e.to_s\n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return j\n end",
"def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend",
"def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end",
"def get_file(url)\n get(url).body\n end",
"def return_result(url)\n json_file = open(url) { |f| f.read }\n JSON.parse(json_file)\n end",
"def extract_observations(url)\n\n JSON.load(open(url))\n\n end",
"def parse_url_data(url)\n filename = URI.decode(url).split('/')[-1]\n { filename: filename,\n version: filename.split('-')[-2].split('_')[-1],\n build: filename.split('-')[-1].split('.')[0].split('_')[0] }\n end",
"def url\n data['url']\n end",
"def images_with_urls images\n result_images = []\n\n images.each do |image|\n url = image.file_url\n result = image.as_json\n result[\"url\"] = url\n result_images << result\n end\n result_images\n end",
"def extract_datas_from_json(path)\n file = File.read(path)\n data_details = JSON.parse(file)\n return data_details\nend",
"def directorytraversaltest\n Dir.foreach('./jsons/') do |item|\n next if item == '.' or item == '..'\n\n #print item.pretty_inspect\n puts item\n\n #it doesn't appear to treat 'item' as a file object it is a just a string of the filename..\n obj = JSON.parse(File.read('./jsons/' + item))\n print obj[0][\"_source\"][\"description\"]\n puts \"\\n\"\n end\n end",
"def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end",
"def get_json(url, options = {})\n\t\t\tresponse = get_file(url, options)\n\t\t\traw_json = response.scan(/\\w+\\((.+)\\);\\z/)[0][0]\n\t\t\treturn JSON.parse(raw_json)\n\t\tend",
"def swapi_fetch(url)\n JSON.parse(open(url).read)\nend",
"def href\n link.gsub(\".json\", \"\")\n end",
"def extract_metadata_for_video url\n mfile = metadata_file_for(url)\n unless File.file? mfile\n\n # self << url\n # self << %w[ skip-download write-info-json ignore-errors ]\n # self << { output: mfile.gsub(/\\.info\\.json$/, '') }\n # self.run\n\n # Run directly:\n command = \"#{url} --skip-download --write-info-json --ignore-errors\"\n command += \" -o '#{mfile.gsub(/\\.info\\.json$/, '')}'\"\n delegator.run command\n end\n JSON.parse File.read(mfile) rescue nil\n end",
"def parse_response\n\t\tfile = File.read(\"#{@file_path}/#{@output_json}\")\n\t\tdata = JSON.parse(file)\n\t\tfigures_array = data[\"figures\"]\n\t\tfigures_array.each do |fig|\n\t\t\tfig[\"renderURL\"] = fig[\"renderURL\"]\n\t\t\t\t.gsub(\"public/\",\"\")\n\t\t\t\t.gsub(\"pdf-\",\"\")\n\t\tend\n\t\tfigures_array\n\tend",
"def apartments_urls(url)\n JSON(Net::HTTP.get(URI(url)))['apartments'].map { |value| value['url'] }\n #Net::HTTP.get(URI(url)).scan(/https\\:\\\\\\/\\\\\\/r\\S{10,}.s\\\\\\/\\d{4,7}/).map { |val| val.gsub(\"\\\\\", \"\") }\n end",
"def initialize url\n open(url) {|f| @json = f.read}\n @root = JSON.parse @json\n end",
"def get_file_for_url(url, params)\n selected_files = params[\"selected_files\"].values\n return unless selected_files.map { |a| a[\"url\"] }.include?(url)\n selected_files.select { |a| a[\"url\"] == url }.first[\"file_name\"]\n end",
"def process_file(filename)\n results = {}\n\n begin\n File.foreach(filename) do |line|\n if @options[:debug]\n puts \"processing: #{line}\"\n end\n\n line.gsub!(/\\W+$/,'');\n\n if url_ok(line)\n results[line] = process_url(line)\n\n if @options[:debug]\n puts JSON.pretty_generate(results)\n end\n else\n error \"Not an absolute uri: #{line}\"\n end\n end\n rescue => e\n error \"Error when processing file: #{filename} : #{e.message}!\"\n exit EXIT_UNKNOWN\n end\n\n return results\n end",
"def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend",
"def url_content\n\t file.url\n\tend",
"def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end",
"def download_url(hash)\n _get(\"/files/#{hash}/download_url\") { |json| json }\n end",
"def with_json_doc(url)\n vortex = Vortex::Connection.new(url,:use_osx_keychain => true)\n if(not(vortex.exists?(url)))then\n puts \"Warning: Can't find \" + url\n return -1\n end\n vortex.find(url) do |item|\n begin\n data = JSON.parse(item.content)\n yield item, data\n rescue\n return -1\n end\n end\nend",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end",
"def json_get(url)\n get url, :parse=>true\n end",
"def url\n response[\"url\"]\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend",
"def get_list_file(url)\n\t\tdownload_html_file(url)\n\t\tdoc = Nokogiri::HTML(File.new(@tmp_html))\n\n\t\tlist = []\n\t\t# Parsing each link to find the relevant one\n\t\tdoc.css('a[@href!=\"../\"]').each do |link|\n\t\t\tlist << {\n\t\t\t\t'name' => link.text,\n\t\t\t\t'url' => link['href']\n\t\t\t}\n\t\tend\n\t\treturn list\n\tend",
"def files\n @files=get_endpoint('extra').keys\n end",
"def index\n Dir[\"#{@base_path}/*.json\"].map{|p| File.basename(p)}\n end",
"def json_files\n file_list '**/*.json'\n end",
"def readJSONFromUrl(url)\n # use GET request to retrieve the json\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json = JSON.parse(response)\n return json\nend",
"def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend",
"def get(url)\n p = URI.parse url\n case p.scheme\n when /https?/\n http_get p, @resource[:path]\n when \"file\"\n FileUtils.copy p.path, @resource[:path]\n end\n end",
"def urls\n @urls ||= extract_urls('url')\n end",
"def endpoint_for(path)\n File.join(MemoTomato::ROOT_URL, \"#{path}.json\")\n end",
"def parse_fetched_json(json_from_url)\n JSON.parse(json_from_url)\n end",
"def process_file_versions(json)\n dig_f = {}\n unless json['file_versions'].blank?\n embed_caption = ''\n rep_caption = ''\n json['file_versions'].each do |version|\n version['file_uri'].strip!\n if version.dig('publish') != false && (version['file_uri'].start_with?('http') ||\n version['file_uri'].start_with?('data:'))\n\n if version.dig('xlink_show_attribute') == 'embed'\n dig_f['thumb'] = version['file_uri']\n dig_f['represent'] = 'embed' if version['is_representative']\n # For an embedded file version, if the caption is empty,\n # 1. set the embed_caption to the title\n # 2. set the rep_caption to the title if it is a representative version\n if version['caption'].blank?\n embed_caption = version['title']\n rep_caption = version['title'] if version['is_representative']\n else\n # For an embedded file version, if the caption is not empty,\n # 1. set the embed_caption to the caption\n # 2. set the rep_caption to the caption if it is a representative version\n embed_caption = version['caption']\n rep_caption = version['caption'] if version['is_representative']\n end\n else\n dig_f['represent'] = 'new' if version['is_representative']\n dig_f['out'] = version['file_uri'] if version['file_uri'] != (dig_f['out'] || '')\n # if the caption is empty set the rep_caption to the title\n if version['caption'].blank?\n rep_caption = version['title']\n else\n # if the caption is not empty set the rep_caption to the caption\n rep_caption = version['caption']\n end\n end\n elsif !version['file_uri'].start_with?('http')\n Rails.logger.debug(\"****BAD URI? #{version['file_uri']}\")\n end\n end\n end\n # Use the representative caption for the caption in the PUI if there is a\n # representative caption\n if !rep_caption.blank?\n dig_f['caption'] = rep_caption\n elsif !embed_caption.blank?\n # Use the embed caption for the caption in the PUI if there is isn't a\n # representative caption but there is an embedded caption\n dig_f['caption'] = rep_caption\n end\n dig_f\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def main(json)\n files = JSON.parse(json).fetch('files')\n dupes = get_name_conflicts(files)\n dupes.each do |list|\n # resolve_conflict(list)\n list.each {|file| puts file['path']}\n puts\n end\nend",
"def url\n @url ||= GeoIQ.base_uri + \"#{path}.json\"\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 parse_files_for_download\n files = get_files_for_download # now a hash\n\n unless files.present?\n return \"\"\n else\n files.each_pair do |file, s3_needed|\n # Use Yajl JSON library to parse the log files, as they contain multiple JSON blocks\n parser = Yajl::Parser.new\n @read_from_s3 = s3_needed\n json = get_json_from_log_file_for_download(file)\n parser.parse(json) do |log|\n @jsons << log\n end\n sort_jsons\n end\n end\n end",
"def projectDetails\r\n projectUrl = params[:url]\r\n projectUrl = projectUrl[4..-2]\r\n puts projectUrl\r\n result = Hashie::Mash.new HTTParty.get(\"http://api.ravelry.com/projects/akaemi/progress.json?status=finished&key=0e3904e749b478766294964e01322c78b53ef411\") \r\n \r\n # find the right project\r\n result[\"projects\"].each{|key, value| \r\n thumbnail = key[\"thumbnail\"]\r\n puts thumbnail[\"src\"]\r\n if (thumbnail[\"src\"].eql? projectUrl) \r\n puts \"found a match\"\r\n @project = key;\r\n end\r\n }\r\n \r\n respond_to do |format|\r\n format.json\r\n end\r\n \r\n end",
"def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend",
"def file_by_url(url)\n return file_by_id(url_to_id(url))\n end",
"def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def get_json_result(json, index)\n return json[\"items\"][index][\"pagemap\"][\"cse_image\"][0][\"src\"]\nend",
"def get_vacancies( urls )\n vacancies = []\n urls.each do |url|\n vacancies << parse_json( url )\n end\n\n return vacancies\nend",
"def parse json; return JSON.parse File.read json end",
"def parse json; return JSON.parse File.read json end",
"def fetch_url_data(url)\n open(url).read\n end",
"def fetch_url_data(url)\n open(url).read\n end",
"def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"def get_file(url, options = {})\n\t\t\t\n\t\t\t# better way of doing this?\n\t\t\t# Map custom keys to the HTTP request values\n\t\t\t# TODO add handles for searching based upon stats\n\t\t\treqs = {\n\t\t\t\t:character_name => 'n',\n\t\t\t\t:source => \"fl[source]\", # dungeon, badges, arena, etc\n\t\t\t\t:dungeon => \"fl[dungeon]\", # seems it needs the dungeons id rather than name\n\t\t\t\t:difficulty => \"fl[difficulty]\", # normal, heroic, etc\n\t\t\t\t:item_type => \"fl[type]\", # weapon, armor, trinket, etc\n\t\t\t\t:item_slot => \"fl[slot]\", # head, shoulders, etc\n\t\t\t\t:item_sub_type => \"fl[subTp]\", # leather, mail, etc\n\t\t\t\t:realm => 'r',\n\t\t\t\t:search => 'searchQuery',\n\t\t\t\t:type => 'searchType',\n\t\t\t\t:guild_name => 'gn',\n\t\t\t\t:item_id => 'i',\n\t\t\t\t:team_size => 'ts',\n\t\t\t\t:team_name => 't',\n\t\t\t\t:group => 'group',\n\t\t\t\t:callback => 'callback',\n\t\t\t\t:calendar_type => 'type',\n\t\t\t\t:month => 'month',\n\t\t\t\t:year => 'year',\n\t\t\t\t:event => 'e',\n :now => 'now',\n\t\t\t\t:achievement_category => 'c'\n\t\t\t} \n\t\t\t\n\t\t\tparams = []\n\t\t\toptions.each do |key, value|\n\t\t\t\tparams << \"#{reqs[key]}=#{u(value)}\" if reqs[key]\n\t\t\tend\n\t\t\t\n\t\t\tquery = ''\n\t\t\tquery = query + '?' + params.join('&') if params.size > 0\n\t\t\t#query = '?' + params.join('&') if params.size > 0\n\t\t\t\n\t\t\tbase = self.base_url(options[:locale], options)\n\t\t\tfull_query = base + url + query\n\n\t\t\tif options[:caching]\n\t\t\t\tresponse = get_cache(full_query, options)\n\t\t\telse\n\t\t\t\tresponse = http_request(full_query, options)\n\t\t\tend\n\t\tend",
"def item_url(result)\n query = CGI.parse(env.url.query.to_s)\n url = \"#{env.url.scheme}://#{env.url.host}#{env.url.path.sub(/\\.json\\z/, '')}/#{result['identifiers'][0]['identifier']}.json\"\n if query['key'].any?\n url += \"?key=#{CGI.escape(query['key'][0].to_s)}\"\n end\n url\n end",
"def read_url_file(url)\n uri = URI.parse url\n uri.read\n end",
"def url(options = {})\n file.path\n end",
"def json_to_results(json)\n json.map do |jr|\n uri = URI(jr['url'])\n # ignore the query string, since it may have some randomness\n uri.query = nil\n Result.new(project.name, jr['confidence'], jr['risk'], uri.to_s, jr['param'], jr['alert'])\n end\n end",
"def open_as_json(json_url)\n uri = URI.parse(json_url)\n response = Net::HTTP.get_response(uri)\n return {} unless response.code == \"200\"\n JSON.parse(response.body)\n end",
"def get_file\n\t\t{\n\t\t\tfile_name: File.basename(file.path.to_s),\n\t\t\turl: file.url\n\t\t}\n\tend",
"def presign_get_by_url(url)\n r = HTTPClient.new.get(\n url,\n { contentType: @file.mime_type },\n {},\n follow_redirect: true\n )\n eval_presign_get_by_node_key(r)\n end",
"def download(boards_json, destination, dry_run=false)\n content = @files_and_json.from_file(boards_json)\n email = content[\"leankit\"][\"email\"]\n password = content[\"leankit\"][\"password\"]\n account = content[\"leankit\"][\"account\"]\n\n board_locations = []\n content[\"boards\"].each do |board|\n if !dry_run\n board_locations << download_board(destination, email, password, account, board[0])\n else\n board_location = File.join(destination, board[0])\n if File.exist?(board_location)\n board_locations << board_location\n end\n end\n end\n board_locations\n end",
"def get_json(url)\n JSON.parse(get(url, :json, :json))\n end",
"def load_from_url!(url)\n uri = URI(url)\n req = Net::HTTP::Get.new(uri)\n req['Accept'] = 'application/json'\n\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n\n # TODO: handle redirects\n raise IOError, \"Unable to load URL #{url}\" unless res.is_a?(Net::HTTPOK)\n\n load_from_json!(res.body)\n end",
"def file_url\n end",
"def process_file(file_path, url, deep_level = -1)\n base_uri = URI(url)\n links = process_data(base_uri, file_path)\n process_links(base_uri, links, deep_level)\n\n puts \"\\nProcessed links:\"\n pp @processed_links\n end",
"def file_data\n @client.get_file @file_url\n end",
"def cache_filename(url, json)\n uri = URI(url)\n filename = File.join(uri.host, uri.path)\n filename.sub!(/\\/+$/, \"\") # remove trailing slashes\n filename = \"#{filename}.json\" if json\n filename.gsub!(/[^\\w\\.-_\\/\\\\]/, \"-\")\n # strip bad filename characters\n File.join(cache_directory, filename)\n end",
"def fetch_urls(name, format, size='raw')\n [self::CONTENT_TYPES[format.to_sym], retrieve_image(name, format, size, :url)]\n end",
"def read(gist_id)\n response = request(gist_url % gist_id) { |url| Net::HTTP::Get.new(url.path) }\n case response\n when Net::HTTPOK\n data = JSON.parse(response.body)\n data['files'].map{|name, content| content['content'] }.join(\"\\n\\n\")\n else\n warn \"#{response.code}: #{response.message}\"\n nil\n end\n end",
"def get(path, redirect_limit=5)\n parse_json do |parser|\n @http_client.get(path, redirect_limit) {|chunk| parser << chunk }\n end\n end",
"def get(url); end",
"def get_url_for_filename(filename, params)\n selected_files = params[\"selected_files\"].values\n selected_files.select { |a| a[\"file_name\"] == filename }.first[\"url\"]\n end",
"def get_jsons(dir)\n files = Dir[ File.join(dir, '**', '*') ].reject { |p| File.directory? p }\n files.select{|x| x.end_with?(\".json\")}\nend",
"def parse(url)\n # parse URL\n # URL ends with number then filetype.\n # filetype can be removed by the final [.]. name of file is preceded by final [/].\n # number detection... every example we've seen has something before the number that isn't a number.\n # # of 0's to use as buffer can be read from the filename itself.\n # parts:\n # URL base (everything up to number)\n # filename base (after /, before number)\n # number base\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_url(filename)\n return YAML.load_file(filename)['original-url']\nend",
"def getResourceDir(imprint, json, logkey='')\n data_hash = Mcmlln::Tools.readjson(json)\n arr = []\n # loop through each json record to see if imprint name matches formalname\n data_hash['imprints'].each do |p|\n if p['formalname'] == imprint\n arr << p['shortname']\n end\n end\n # in case of multiples, grab just the last entry and return it\n if arr.nil? or arr.empty?\n path = \"generic\"\n else\n path = arr.pop\n end\n return path\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def fetch_url(body)\n aux = body.split('<link>').last\n aux = aux.split('<pubdate>').first\n aux\n end",
"def fetchURL(url)\n open(url) {|response| response.read}\nend",
"def files\n results\n rescue ApiStruct::EntityError\n result\n end",
"def retrieve_github_files(url)\n\n #create a virtual browser with a Chrome Windows Agent\n agent = Mechanize.new\n agent.user_agent = CHROME_USER_AGENT\n\n #retrieve the page and report if page not found (404)\n begin\n page = agent.get(url)\n rescue Exception => e\n #REPORT THE ERROR\n end\n\n #recursively download all content\n get_files_from_github_page(page)\n\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 urls\n URI.extract(self.script)\n end",
"def load_json(url)\n uri = URI(url)\n response = Net::HTTP.get(uri)\n return JSON.parse(response, symbolize_names: true)\n end"
] | [
"0.67730147",
"0.67432445",
"0.6627193",
"0.66143686",
"0.64659387",
"0.64624846",
"0.6248586",
"0.6248171",
"0.62244123",
"0.6207111",
"0.620166",
"0.609987",
"0.6023666",
"0.6012393",
"0.6009479",
"0.6003042",
"0.5988958",
"0.5979974",
"0.59771436",
"0.59398866",
"0.59390694",
"0.5933244",
"0.5918101",
"0.59119517",
"0.5900305",
"0.58619237",
"0.58492285",
"0.5848503",
"0.5799757",
"0.57967883",
"0.57905084",
"0.5774658",
"0.57707334",
"0.5768326",
"0.57605916",
"0.57490116",
"0.5745078",
"0.5722659",
"0.57146925",
"0.56811255",
"0.56793344",
"0.5676859",
"0.56693006",
"0.56651753",
"0.56473184",
"0.5646794",
"0.56386244",
"0.5635848",
"0.5620684",
"0.56050414",
"0.5598144",
"0.5596036",
"0.5592254",
"0.558202",
"0.55814904",
"0.5558406",
"0.55564594",
"0.55557925",
"0.5551536",
"0.55496144",
"0.55382603",
"0.5508514",
"0.550744",
"0.550744",
"0.5507146",
"0.5507146",
"0.5490266",
"0.5486892",
"0.54703873",
"0.5469487",
"0.5447817",
"0.54373705",
"0.5422437",
"0.5415037",
"0.54098606",
"0.5407298",
"0.53841513",
"0.53728575",
"0.5369989",
"0.53684014",
"0.53679293",
"0.5366457",
"0.5358388",
"0.5351745",
"0.5349696",
"0.534869",
"0.53475547",
"0.53413934",
"0.5331706",
"0.532681",
"0.532681",
"0.53255373",
"0.5324939",
"0.532479",
"0.5314465",
"0.5310424",
"0.5310383",
"0.5306328",
"0.5302853",
"0.53006303"
] | 0.69814074 | 0 |
download a file and writes it | def get_asset(url)
uri = URI.parse(url)
unless File.exists?(File.join(['public', uri.path]))
FileManager.new(['public', uri.path], Downloader.get(url, URI.decode_www_form(uri.query)), true).write!
end
replace_url(url, uri.path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file_from_url(file, url)\n Net::HTTP.start(@download.base_url) do |http|\n begin\n http.request_get(url) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n ensure\n file.close\n end\n end\n end",
"def save_file(url, file)\n puts \"Downloading http://...#{url[-8..-1]} -> #{file}\"\n File.open(file, \"wb\") do |saved_file|\n # the following \"open\" is provided by open-uri\n open(url) do |read_file|\n saved_file.write(read_file.read)\n end\n end\nend",
"def download!(source_url, destination_file); end",
"def download(path)\n if File.exists?(path)\n puts \"#{path} already exists\"\n\n return\n end\n\n File.open(path, \"w\") do |file|\n file.binmode\n HTTParty.get(self['href'], stream_body: true) do |fragment|\n file.write(fragment)\n end\n end\n end",
"def download\n open(download_url, \"rb\")\n end",
"def download\n send_file @cfile.path.to_s\n end",
"def download_file\n info(\"Downloading file \" + @filename + \" started.\")\n \n open(local_file, 'wb') do |file|\n file << open(remote_file).read\n end\n\n info(\"Downloading file \" + @filename + \" completed successfully.\")\n rescue StandardError => e\n error(\"Unable to download file #{@filename} due to following error occurred #{e}\")\n end",
"def download(url, file)\n # First, open the remote file. (FD == 'File Descriptor', a C term)\n #\n # If we first open the remote file, if there are any exceptions in\n # attempting to open it, we won't lose the contents of the local file.\n open(url) do |remoteFD|\n # Open the local file, purging the contents.\n File.open(file, \"w\") do |genericFD|\n remoteFD.each_line do |line|\n # Take each line, stick it in the file.\n genericFD.puts line\n end\n end\n end\n @repo.add(file) # add the file to the list to be committed\nend",
"def download\n path.dirname.mkpath\n\n case io = open(url)\n when StringIO\n begin\n exact_path.open('w', 0o755) { |fd| fd.write(io) }\n rescue StandardError\n exact_path.unlink if exact_path.exist?\n raise\n end\n when Tempfile\n io.close\n iopath = Pathname.new(io.path)\n iopath.chmod(0o755)\n iopath.rename exact_path\n end\n\n path.delete if path.symlink?\n path.make_symlink exact_path\n end",
"def download(file, todir = '.')\r\n begin\r\n puts \"Downloading file #{file} from #{@address}\"\r\n c = open(\"http://#{@address}/#{file}\").read\r\n Dir.mkdir(todir) if not File.directory?(todir)\r\n f = open(\"#{todir}/#{file}\", 'wb')\r\n f.puts c\r\n f.close\r\n rescue => e\r\n if not File.exists?(fullfile)\r\n $stderr.puts \"Could not download file #{file} form #{@address}.\"\r\n $stderr.puts e.to_s\r\n end\r\n end\r\nend",
"def download(url, filename)\n require 'open-uri'\n if File.exists?(\"lib/\" + filename)\n puts \"'#{filename}' is already downloaded... skipped\"\n else\n puts \"'#{filename}' downloading...\"\n File.open(\"lib/\" + filename, \"wb\") do |saved_file|\n open(url + filename, \"rb\") { |read_file| saved_file.write(read_file.read) }\n end\n end\nend",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download_to_file(path, params = {})\n open(path, \"wb\") do |f|\n download_to_io(f, params)\n end\n end",
"def write_to_folder\n File.open(prepare_file_path_to_download, 'w') do |file|\n file.write(response[:content])\n end\n end",
"def download_file(url, dest)\n if File.exist?(dest)\n say \"File already downloaded #{dest}\"\n return dest\n end\n\n say \"Downloading...\"\n FileUtils.mkdir_p(File.dirname(dest)) # ensure parent folder exists\n\n File.open(dest, 'wb') do |saved_file|\n URI.open(url, 'rb') do |read_file|\n saved_file.write(read_file.read)\n end\n end\n dest\n end",
"def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t\t\tf.write(resp.body)\n\t\t\t}\n\t\t\tf.close\n\t\t\treturn path\n\t\tend",
"def download( url )\n image = open( \"#{url}.jpg\" ).read\n File.write @path, image\n end",
"def download_file(test = false)\n @update_file = Tempfile.new(['elasticsearch_update_file', @download.extension])\n\n @log.info('Downloading file from url.')\n\n write_file_from_url(@update_file, @download.url) unless test\n\n @update_file\n end",
"def download(url)\n base.get(url, @file_path)\n end",
"def download(uri)\n target = File.join(@cache_dir, filename(uri))\n @logger.debug \"Downloading file to #{target}\"\n rich_uri = URI(uri)\n Net::HTTP.start(rich_uri.host, rich_uri.port, use_ssl: rich_uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(rich_uri.request_uri)\n http.request request do |response|\n File.open(target, File::CREAT | File::WRONLY) do |file|\n response.read_body do |chunk|\n file.write(chunk)\n end\n end\n end\n end\n rescue => e\n @logger.error \"Unable to download from #{uri}\"\n puts e.backtrace\n end",
"def download(uri, target)\n @logger.debug \"Downloading file to #{target}\"\n rich_uri = URI(uri)\n if File.exist?(uri)\n FileUtils.cp uri, target\n else\n proxy(rich_uri).start(rich_uri.host, rich_uri.port, use_ssl: secure?(rich_uri)) do |http|\n request = Net::HTTP::Get.new(rich_uri.request_uri)\n http.request request do |response|\n File.open(target, File::CREAT | File::WRONLY) do |file|\n response.read_body do |chunk|\n file.write(chunk)\n end\n end\n end\n end\n end\n rescue => e\n @logger.error \"Unable to download from #{uri}\"\n puts e.backtrace\n end",
"def download_file\n tmp_file = Tempfile.new '', SimplyRets.configuration.temp_folder_path\n content_disposition = raw.headers['Content-Disposition']\n if content_disposition\n filename = content_disposition[/filename=['\"]?([^'\"\\s]+)['\"]?/, 1]\n path = File.join File.dirname(tmp_file), filename\n else\n path = tmp_file.path\n end\n # close and delete temp file\n tmp_file.close!\n\n File.open(path, 'w') { |file| file.write(raw.body) }\n SimplyRets.logger.info \"File written to #{path}. Please move the file to a proper folder for further processing and delete the temp afterwards\"\n return File.new(path)\n end",
"def download_and_save_file(url, path)\n options = {}\n\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n if proxy\n uri = URI.parse(proxy)\n proxy_host = uri.scheme + \"://\" + uri.host + \":\" + uri.port.to_s\n proxy_user, proxy_pass = uri.userinfo.split(/:/) if uri.userinfo\n options[:proxy_http_basic_authentication] = [proxy_host,proxy_user,proxy_pass]\n end\n\n open_and_save_file(path, open(url, options).read)\nend",
"def download(args = {})\n\t # \n\t # parse arguments\n\t # \n\t if args.keys.size == 1 and args.values.size == 1\n\t url = args.keys.first\n\t output_path = args.values.first\n\t else\n\t raise \"download() currently only accepts one {URL => location} pair\"\n\t end\n\t \n\t # \n\t # perform the download\n\t # \n\t \n\t # https://stackoverflow.com/questions/2263540/how-do-i-download-a-binary-file-over-http\n\t # instead of http.get\n\t require 'open-uri'\n\t \n\t File.open(output_path, \"wb\") do |saved_file|\n\t # the following \"open\" is provided by open-uri\n\t open(url, \"rb\") do |read_file|\n\t saved_file.write(read_file.read)\n\t end\n\t end\n\t \n\t return output_path\n\tend",
"def file_put_contents( filename, buffer, mode = 'w+' )\n return if downloaded?( filename, buffer )\n\n File.open( filename, mode ) do |f|\n f.write( buffer )\n f.close\n end\n end",
"def download_file(uri, dest_dir)\n begin\n u = URI.parse(uri)\n fname, ext = File.basename(u.path).scan(/(.+)\\.(.+)/).flatten\n dest_file = File.join(dest_dir, \"#{fname}_#{Time.now.to_i}.#{ext}\")\n res = send_http_get_request(uri)\n rescue Net::ReadTimeout, IOError, EOFError, Errno::ECONNRESET,\n Errno::ECONNABORTED, Errno::EPIPE, Net::OpenTimeout,\n Errno::ETIMEDOUT => e\n print_error(\"#{e.message}: #{uri}\")\n return\n end\n\n save_file(res.body, dest_file)\n print_status(\"Download completed for #{uri}\")\n end",
"def save_to_tempfile(url)\n verbose(\"Downloading #{url}\")\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n http.start do |http|\n resp = http.get(uri.path)\n file = Tempfile.new('master.zip')\n file.binmode\n file.write(resp.body)\n file.flush\n file.close\n\n verbose(\"Saved to #{file.path}\")\n\n file\n end\n end",
"def download_to_file(url, path)\n result = false\n\n uri = URI(url)\n if uri.scheme == 'file'\n result = FileUtils.mv uri.path, path\n Rails.logger.info \"Moved to #{path}\" if result == 0\n else\n result = download_url_to_file uri, path\n end\n result\n end",
"def download_file(file_name, skylink, override_options = {}, stream: true)\n options = Helper::Download.default_options\n options = Helper::Download.default_options.merge(override_options) unless override_options.empty?\n\n portal = options[:portal_url]\n skylink = Helper::Download.strip_prefix(skylink)\n url = \"#{portal}#{skylink}?attachment=#{options[:download]}\"\n\n File.open(file_name, 'w') do |file|\n HTTParty.get(url, follow_redirects: true, stream_body: stream) do |chunk|\n file << chunk unless HTTP_REDIRECT_PERMANENT.include? chunk.code\n end\n end\n\n 'Download successful!'\n end",
"def download(save_path=\"\")\n url = prefix + \"download\"\n r = response(url) \n if r.class == String #success\n open(File.join(save_path,@filename), \"wb\").write(open(r).read)\n return r\n else #failed\n return r\n end\n end",
"def download_resource(url, path)\n FileUtils.mkdir_p File.dirname(path)\n the_uri = URI.parse(URI.escape(url))\n if the_uri\n data = html_get the_uri\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end",
"def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end",
"def download_file(file_type)\n temp_file = File.new(public_url.split('/').last, \"wb\")\n remote_data = open(URI.parse(public_url))\n temp_file.write(remote_data.read)\n update_attributes(file_type => temp_file)\n File.delete temp_file\n end",
"def download\n record_activity(\"downloaded \" + params[:file_name])\n send_file Rails.root.join('public', 'uploads', params[:file_name])\n end",
"def download\n\t\tsend_file(params[:path])\n end",
"def download_file(url, destination)\n raw_file = server_api.get_rest(url, true)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def download\n log.warn(log_key) { source[:warning] } if source.key?(:warning)\n\n options = {}\n\n if source[:unsafe]\n log.warn(log_key) { \"Permitting unsafe redirects!\" }\n options[:allow_unsafe_redirects] = true\n end\n\n # Set the cookie if one was given\n options[\"Cookie\"] = source[:cookie] if source[:cookie]\n options[\"Authorization\"] = source[:authorization] if source[:authorization]\n\n download_file!(download_url, downloaded_file, options)\n end",
"def download_file(path, url, size: nil)\n File.open(path, 'wb') do |f|\n uri = URI(url)\n current = 0\n last_print_update = 0\n print_progress = UI.interactive? || U3dCore::Globals.verbose?\n Net::HTTP.start(uri.host, uri.port, http_opts(use_ssl: uri.scheme == 'https')) do |http|\n request = Net::HTTP::Get.new uri\n http.request request do |response|\n begin\n # override with actual results, this should help with\n # innacurrate declared sizes, especially on Windows platform\n size = Integer(response['Content-Length'])\n rescue ArgumentError\n UI.verbose 'Unable to get length of file in download'\n end\n started_at = Time.now.to_i - 1\n response.read_body do |segment|\n f.write(segment)\n current += segment.length\n # wait for Net::HTTP buffer on slow networks\n # FIXME revisits, this slows down download on fast network\n # sleep 0.08 # adjust to reduce CPU\n next unless print_progress\n\n print_progress_now = Time.now.to_f - last_print_update > 0.5\n # force printing when done downloading\n print_progress_now = true if !print_progress_now && size && current >= size\n next unless print_progress_now\n\n last_print_update = Time.now.to_f\n Utils.print_progress(current, size, started_at)\n print \"\\n\" unless UI.interactive?\n end\n end\n end\n print \"\\n\" if print_progress\n end\n end",
"def meeting_recordings_download_file(download_url)\n raise \"You must use JWT client\" unless self.class == Zoom::Clients::JWT\n file=Tempfile.create\n file.binmode\n response = HTTParty.get(\"#{download_url}?access_token=#{access_token}\",\n stream_body: true,\n follow_redirects: true\n ) do |fragment|\n if fragment.code == 200\n file.write(fragment)\n elsif fragment.code != 302\n raise StandardError, \"Non-success status code while streaming #{fragment.code}\"\n end\n end\n file\n end",
"def stream_download_to_file(file_path, url, params={}, headers={}, http_options=@options)\n # Determine if redirection is involved\n url = redirect_url(url, params, headers, http_options)\n # parse the URL\n uri = URI.parse(url)\n \n @logger.debug(\"Streaming Download #{uri} #{headers.inspect}\")\n \n # build the http object\n http = build_http(uri)\n \n # prepare the download\n file = nil\n file_name = File.basename(file_path)\n response_code = nil\n message = nil\n begin\n # stream the attachment\n http.request_get(uri.request_uri, headers) do |response|\n response_code = response.code\n if response_code == \"200\"\n file = File.open(file_path, \"wb\")\n response.read_body { |chunk| file.write(chunk) }\n else\n message = response.body\n break\n end\n end\n if response_code == \"200\"\n @logger.info(\"Exported file attachment: #{file_name} to #{file_path}\")\n else\n @logger.error(\"Failed to export file attachment \\\"#{file_name}\\\": #{message}\")\n end\n rescue StandardError => e\n @logger.error(\"Failed to export file attachment \\\"#{file_name}\\\": (#{e})\")\n ensure\n file.close() unless file.nil?\n end\n message\n end",
"def download_file_to_filename(filename, url)\n puts \"Downloading #{url}...\"\n uri = URI(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: uri.scheme == 'https'\n ) do |http|\n request = Net::HTTP::Get.new uri.request_uri\n\n http.request request do |response|\n if response.is_a?(Net::HTTPRedirection) || response.is_a?(Net::HTTPFound)\n return download_file_to_filename(filename, response['location'])\n end\n\n open filename, 'wb' do |io|\n response.read_body do |chunk|\n io.write(chunk)\n end\n end\n end\n end\nend",
"def download_file(url, destination)\n raw_file = server_api.streaming_request(url)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def download(url)\n filedl = url.split(\"/\").last\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n open(filedl, \"w\") do |file|\n file.write(response.body)\n end\n return filedl\nend",
"def download(id, filename)\n open(filename, \"w\").write(@res[\"/download?id=#{id}\"].get)\n return filename\n rescue\n puts $!\n return nil\n end",
"def download_blob_to(file) #:doc:\n file.binmode\n blob.download { |chunk| file.write(chunk) }\n file.flush\n file.rewind\n end",
"def http_download_uri(uri, filename)\n puts \"Starting HTTP download for: #{uri.to_s}\"\n http_object = Net::HTTP.new(uri.host, uri.port)\n http_object.use_ssl = true if uri.scheme == 'https'\n begin\n http_object.start do |http|\n request = Net::HTTP::Get.new uri.request_uri\n http.read_timeout = 500\n http.request request do |response|\n open filename, 'w' do |io|\n response.read_body do |chunk|\n io.write chunk\n end\n end\n end\n end\n rescue Exception => e\n puts \"=> Exception: '#{e}'. Skipping download.\"\n return\n end\n puts \"Stored download as #{filename}.\"\n end",
"def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item.title\n end",
"def download(save_path=\"\")\n url = prefix + \"download\"\n r = response(url)\n if r.class == String #success\n open(::File.join(save_path,@filename), \"wb\").write(open(r).read)\n return r\n else #failed\n return r\n end\n end",
"def download_file()\n # gets the student we are watching\n @student = Student.find(params[:id]);\n # Here we wanna decrypt the file\n decr_file = decrypt_file(@student)\n # we make the file downloadable\n send_file(decr_file,\n :filename => @student.file,\n :type => @student.file.content_type,\n :disposition => 'attachment',\n :url_based_filename => true)\n end",
"def download!(file)\n login\n warn \"DEBUG: downloading #{file}\" if debug\n if dry_run\n warn \"DEBUG: download skipped for dry run\" if dry_run\n filename = file\n body = \"no body\"\n else\n page = agent.get(file)\n filename = page.filename\n body = page.body\n end\n [ filename, body ]\n end",
"def download(command)\n if command[1].nil? || command[1].empty?\n puts \"please specify item to get\"\n elsif command[2].nil? || command[2].empty?\n puts \"please specify full local path to dest, i.e. the file to write to\"\n elsif File.exists?(command[2])\n puts \"error: File #{dest} already exists.\"\n else\n src = '/' + clean_up(command[1])\n dst = command[2]\n out, metadata = @client.files.download(src)\n pp metadata\n open(dst, 'w') { |f| f.puts out }\n puts \"wrote file #{ dst }.\"\n end\n end",
"def download(path, item)\n Download.download item.link, path\n Logger.instance.info \"Downloaded file #{item.title}\"\n @history.save item\n end",
"def http_download(host, dir, file, ofile, file_log)\n\t\t\tinfo \"* host: \" + host\n\t\t\tinfo \"* dir: \" + dir\n\t\t\tinfo \"* file: \" + file\n\t\t\tinfo \"* ofile: \" + ofile\n\t\t\t\n\t\t\thttp = Net::HTTP.start(host)\n\t\t\treq = Net::HTTP::Get.new(\"/\" + dir + \"/\" + file)\n\t\t\ttransferred = 0\n\t\t\thttp.request(req) do |resp|\n\t\t\t\tfilesize = resp.content_length\n\t\t\t\t\n\t\t\t\tif _check_download_size(ofile, filesize)\n\t\t\t\t\tpb = ProgressBar.new(file, 100)\n\t\t\t\t\tf = File.open(ofile, 'w')\n\t\t\t\t\tresp.read_body do |data|\n\t\t\t\t\t\tif data\n\t\t\t\t\t\t\ttransferred += data.size\n\t\t\t\t\t\t\tif(transferred != 0)\n\t\t\t\t\t\t\t\tpercent_finished = 100 * (transferred.to_f / filesize.to_f)\n\t\t\t\t\t\t\t\tpb.set(percent_finished)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tf.write(data)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\terror \"data returned by server is empty!\"\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tf.close\n\t\t\t\t\tpb.finish\n\t\t\t\telse\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def save_to_disk url, target_name\n from_url = URI.parse url\n Net::HTTP.start(from_url.host) do |http|\n resp = http.get(from_url.path)\n open(target_name, \"wb\") do |file|\n begin\n file.write(resp.body)\n rescue => err # FIXME don't fail on failed write (OTOH it's better it have no image than crash the whole app)\n return nil\n end\n return target_name\n end\n end\n end",
"def download_file(agent, url)\n SouvlakiRS.logger.info \" starting download for #{url}\"\n\n data = agent.get(url)\n unless data\n SouvlakiRS.logger.error ' download failed'\n return nil\n end\n\n filename = get_response_filename(data) || filename_from_url(url)\n [data, filename]\n end",
"def download_file!\n retries = 3\n\n begin\n options = {\n :read_timeout => 300,\n }\n\n open(from_url, options) do |f|\n save_to_cache(f)\n end\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n Timeout::Error,\n OpenURI::HTTPError => e\n if retries != 0\n retries -= 1\n retry\n else\n raise Exceptions::NetworkError.new(from_url, e)\n end\n end\n end",
"def saveToFile(filepath, additionalParams)\n url = self.generateUrl(additionalParams)\n if url\n response = open(url).read\n if response\n File.open(filepath, 'wb') do |fo|\n fo.write response \n return true\n end\n end\n end\n false\n end",
"def download_package\n path = download_path\n remote_file path do\n source URL\n action :create\n only_if { !::File.exist?(PATH) }\n end\n end",
"def download_file\n send_file(@static_page.custom_file.path,\n disposition: 'attachment; filename=\"' + @static_page.custom_file.file.filename + '\"',\n type: @static_page.custom_file.file.content_type,\n url_based_filename: true)\n end",
"def download_and_store(url, filename=\"#{SecureRandom.uuid}\")\n\n # https://ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html\n file = Tempfile.new(filename) # use an array to enforce a format\n\n # set to write in binary mode (kinda weird api, but hey)\n file.binmode\n\n @task_result.logger.log_good \"Attempting to download #{url} and store in #{file.path}\" if @task_result\n\n begin\n\n uri = URI.parse(url)\n\n opts = {}\n if uri.instance_of? URI::HTTPS\n opts[:use_ssl] = true\n opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n # TODO enable proxy\n http = Net::HTTP.start(uri.host, uri.port, nil, nil, opts) do |http|\n http.read_timeout = 15\n http.open_timeout = 15\n http.request_get(uri.path) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n end\n\n rescue URI::InvalidURIError => e\n @task_result.logger.log_error \"Invalid URI? #{e}\" if @task_result\n return nil\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n @task_result.logger.log_error \"Unable to request URI: #{uri} #{e}\" if @task_result\n return nil\n rescue OpenSSL::SSL::SSLError => e\n @task_result.logger.log_error \"SSL connect error : #{e}\" if @task_result\n return nil\n rescue Errno::ECONNREFUSED => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ECONNRESET => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ETIMEDOUT => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Net::HTTPBadResponse => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::BufError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue SocketError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Encoding::InvalidByteSequenceError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue Encoding::UndefinedConversionError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unexpected end of file, consider looking at this file manually: #{url}\" if @task_result\n return nil\n ensure\n file.flush\n file.close\n end\n\n file.path\n end",
"def get_file_via_http url, file_name, try\n\n @config.logger.trace(\"Downloading \" + url + \" to \" + file_name )\n p = URI::Parser.new\n uri = URI.parse( p.escape( url ) )\n req = Net::HTTP::Get.new(uri.request_uri)\n req[\"User-Agent\"] = NicInfo::VERSION_LABEL\n req[\"Accept\"] = NicInfo::JSON_CONTENT_TYPE\n req[\"Connection\"] = \"close\"\n http = Net::HTTP.new( uri.host, uri.port )\n if uri.scheme == \"https\"\n http.use_ssl=true\n http.verify_mode=OpenSSL::SSL::VERIFY_NONE\n end\n res = http.start do |http_req|\n http_req.request(req)\n end\n\n case res\n when Net::HTTPSuccess\n File.write(file_name, res.body)\n else\n if res.code == \"301\" or res.code == \"302\" or res.code == \"303\" or res.code == \"307\" or res.code == \"308\"\n res.error! if try >= 5\n location = res[\"location\"]\n return get_file_via_http( location, file_name, try + 1)\n end\n res.error!\n end\n end",
"def download!\n return download if file.nil?\n\n file.close\n file.unlink\n self.file = nil\n download\n end",
"def download_original ; path_download_file(:original).download end",
"def download(url)\n Net::HTTP.get_response(url)\n end",
"def download_to_io(io, params = {})\n if !self.api_file.download_url\n raise(GoogleDrive::Error, \"Downloading is not supported for this file.\")\n end\n # TODO Use streaming if possible.\n api_result = @session.execute!(:uri => self.api_file.download_url)\n io.write(api_result.body)\n end",
"def http_get(uri, download_path)\n\n # We'll save to a tempfile in case something goes wrong in the download\n # process. This avoids accidentally overwriting an old version, or\n # leaving a partially downloaded file in place\n begin\n tempfile = Tempfile.new('remote_file')\n tempfile.binmode\n response = http(uri) do |resp|\n resp.read_body do |chunk|\n tempfile.write(chunk)\n end\n end\n\n # If download was successful, copy the tempfile over to the resource path.\n if response.kind_of?(Net::HTTPSuccess)\n tempfile.flush\n\n # Try to move the file from the temp location to the final destination.\n # If the move operation fails due to permission denied, try a copy\n # before giving up. On some platforms (Windows) file locking or weird\n # permissions may cause the mv operation to fail but will still allow\n # the copy operation to succeed.\n begin\n FileUtils.mv(tempfile.path, download_path)\n rescue Errno::EACCES\n FileUtils.cp(tempfile.path, download_path)\n end\n\n # If the fileserver supports the last-modified header, make sure the\n # file saved has a matching timestamp. This may be used later to do a\n # very rough ensure=latest kind of check.\n if response.header['last-modified']\n time = Time.parse(response.header['last-modified'])\n File.utime(time, time, download_path)\n end\n end\n ensure\n tempfile.close\n tempfile.unlink\n response\n end\n end",
"def download_file\n @request = Request.find_by_n_request(params[:id])\n send_data(@request.file, type: @request.file_type, filename: @request.file_name,\n disposition: 'attachment')\n end",
"def download_file(url, show_progress = false)\n if show_progress\n pbar = nil\n begin\n require 'progressbar'\n rescue LoadError => e\n Fog::Logger.warning \"progressbar rubygem not found. Install it for fancier progress.\"\n pbar = :noop\n end\n open(\n url,\n :content_length_proc => lambda { |total|\n if pbar != :noop\n if total && 0 < total\n pbar = ProgressBar.new(\"Downloading\", total)\n pbar.file_transfer_mode\n end\n end\n },\n :progress_proc => lambda { |read_size|\n if pbar != :noop\n pbar.set read_size if pbar\n else\n print \"\\rDownloading... #{\"%.2f\" % (read_size/1024.0**2)} MB\"\n end\n }\n )\n else\n open(url)\n end\n end",
"def download(name, destination=nil)\n get(name) do |response|\n File.open(destination || File.join(Dir.pwd, File.basename(name)), \"wb\") do |io|\n response.read_body do |chunk|\n io.write(chunk)\n end\n end\n end\n end",
"def download(path)\n downloader.get do |req|\n req.url path\n end.body\n end",
"def download!(url, path)\n raise CommandFailed unless download(url, path)\n end",
"def create_download_file\n download = initiate_download\n\n File.open(\"#{file_path_and_name}.tmp\", \"wb\") do |file|\n fail Geoblacklight::Exceptions::WrongDownloadFormat unless matches_mimetype?(download)\n file.write download.body\n end\n File.rename(\"#{file_path_and_name}.tmp\", file_path_and_name)\n file_name\n rescue Geoblacklight::Exceptions::WrongDownloadFormat => error\n Geoblacklight.logger.error \"#{error} expected #{@options[:content_type]} \" \\\n \"received #{download.headers[\"content-type\"]}\"\n File.delete(\"#{file_path_and_name}.tmp\")\n raise Geoblacklight::Exceptions::ExternalDownloadFailed, message: \"Wrong download type\"\n end",
"def download(_io, _path)\n false\n end",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def download(id)\n Down.copy_to_tempfile(id, open(id))\n end",
"def save(name = nil)\n puts \"Downloading from #{@url}\"\n name = File.basename(@url) if name.nil?\n open(name, 'wb') do |file|\n file << open(@url).read\n end\n name\n end",
"def http_test_3\n File.open('http_test_3.mp4', 'wb') do |f|\n f.write RestClient.get(URL)\n end\nend",
"def download_file(method, endpoint, params={})\n params.merge!({ :token => self.token })\n request = self.send(\"format_#{method}\", \"#{@url.path}/#{endpoint}\", params)\n file = Tempfile.new(\"crocodoc-download-#{params[:uuid]}\")\n # use streaming to keep memory usage sane\n @http.request(request) do |response|\n response.read_body {|chunk| file.write chunk }\n end\n file.close\n file\n end",
"def download\n return file if file\n\n self.file = retrieve_file\n end",
"def download(file_name)\n remote_file_path = File.join(remote_path, file_name)\n local_file_path = File.join(backup_folder, file_name)\n\n file_from_storage = remote_directory.files.get(remote_file_path)\n\n prepare_local_folder(local_file_path)\n create_local_file(local_file_path, file_from_storage)\n\n local_file_path\n end",
"def download\n @document = Document.find(params[:id])\n @filepath = @document.full_filename\n send_file(@filepath,\n :disposition => 'attachment',\n :encoding => 'utf8',\n :type => 'application/octet-stream') \n end",
"def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end",
"def download(file)\n uri = URI.parse(file)\n id=uri.query.match(/id=(.*)/)[1]\n\n Net::HTTP.start(uri.host) do |http|\n resp = http.get(uri.path + \"?\" + uri.query)\n open(\"docs/#{id}.pdf\", \"wb\") do |file|\n file.write(resp.body)\n end\n end\n id\nend",
"def download_file(file)\n BasicSocket.do_not_reverse_lookup = true\n ftp = Net::FTP.new('server', 'user', 'password')\n ftp.passive = true\n\n begin\n logger.info \"info: Downloading #{file}.\"\n ftp.getbinaryfile(File.basename(file), file, 1024)\n rescue Net::FTPPermError => e\n logger.info \"warning: can't download #{File.basenme(file)} from the remote server (#{e.message.tr(\"\\n\",\"\")}).\"\n end\n\n ftp.close\n\n end",
"def write\n io_or_file = filename || self.class.default_filename\n return io_or_file.write(fetch) if io_or_file.respond_to?(:write)\n open(io_or_file, \"wb+\") { |io| io.write(fetch) }\n end",
"def download( sourceuri, targetfile=nil )\n\toldsync = $stdout.sync\n\t$stdout.sync = true\n\trequire 'open-uri'\n\n\ttargetpath = Pathname.new( targetfile )\n\n\t$stderr.puts \"Downloading %s to %s\" % [sourceuri, targetfile]\n\t$stderr.puts \" connecting...\" if $trace\n\tifh = open( sourceuri ) do |ifh|\n\t\t$stderr.puts \" connected...\" if $trace\n\t\ttargetpath.open( File::WRONLY|File::TRUNC|File::CREAT, 0644 ) do |ofh|\n\t\t\t$stderr.puts \"Downloading...\"\n\t\t\tbuf = ''\n\n\t\t\twhile ifh.read( 16384, buf )\n\t\t\t\tuntil buf.empty?\n\t\t\t\t\tbytes = ofh.write( buf )\n\t\t\t\t\tbuf.slice!( 0, bytes )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t$stderr.puts \"Done.\"\n\t\tend\n\n\tend\n\n\treturn targetpath\nensure\n\t$stdout.sync = oldsync\nend",
"def download_file(source, filename)\n response = HTTParty.get(\"#{@host}/download_file\", query: {\n source_file: \"#{source}:#{filename}\",\n api_key: @api_key\n })\n \n return response.body\n end",
"def download_file(download_file_path, destination_file_path, overwrite = false)\n logger.debug { \"Downloading '#{download_file_path}' -> '#{destination_file_path}' Overwrite: #{overwrite}\" }\n file_existed = 'unknown'\n if overwrite or not (file_existed = File.exists?(destination_file_path))\n File.open(destination_file_path, 'wb') { |tf|\n open(download_file_path) { |sf| tf.write sf.read }\n }\n file_downloaded = true\n else\n file_downloaded = false\n end\n { :download_file_path => download_file_path, :overwrite => overwrite, :file_downloaded => file_downloaded, :destination_file_existed => file_existed, :destination_file_path => destination_file_path }\n end",
"def download(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n PUTIO_BASE_URL + (\"/files/%i/download?oauth_token=%s\" % [id, @access_token])\n end",
"def write_file filename, content\n path = @output_directory + filename\n File.open(path, 'w') {|f| f.write content }\n end",
"def download_file(target_dir_pathname, url_info)\n url = url_info['url']\n\n filename = target_dir_pathname\n if url_info.key?('filename')\n filename += url_info['filename']\n else\n # Use the initial URL's basename, rather than following redirects\n # first, since one of them redirects to a URL with a long unreadable\n # basename.\n filename += Pathname.new(url).basename\n end\n\n puts \"Checking #{filename}...\"\n if filename.exist? && url_info.include?('sha256')\n $sha256.reset\n $sha256.file(filename)\n if $sha256.hexdigest === url_info['sha256']\n puts \"File '#{filename}' up to date.\"\n return\n else\n puts \"File '#{filename}' exists, but the hash did not match. Re-downloading.\"\n end\n end\n\n target_dir_pathname.mkpath\n download_file_to_filename(filename, url)\nend",
"def write_file(resp, path)\n FileUtils.mkdir_p File.dirname(path)\n File.open(path, 'wb') do |output|\n resp.read_body { |chunk| output << chunk }\n end\n true\n ensure\n # cleanup incomplete files, rescue perm errors etc, they're being\n # raised already.\n File.delete(path) rescue nil if $!\n end",
"def download uri, io_or_filename, parameters = [], referer = nil, headers = {}\n page = transact do\n get uri, parameters, referer, headers\n end\n\n io = if io_or_filename.respond_to? :write then\n io_or_filename\n else\n ::File.open(io_or_filename, 'wb')\n end\n\n case page\n when Mechanize::File then\n io.write page.body\n else\n body_io = page.body_io\n\n until body_io.eof? do\n io.write body_io.read 16384\n end\n end\n\n page\n ensure\n io.close if io and not io_or_filename.respond_to? :write\n end",
"def download\n @route.update_last_download_at\n file = @route.gpx\n\n send_file(file)\n end",
"def download_ror_file(url)\n return nil unless url.present?\n\n puts 'Downloading ROR data file...'\n\n headers = {\n host: 'zenodo.org',\n Accept: 'application/zip'\n }\n resp = HTTParty.get(url, headers: headers)\n unless resp.present? && resp.code == 200\n puts(\"Unable to fetch ROR file from Zenodo -- #{url} -- #{resp}\")\n return nil\n end\n resp.parsed_response\n end",
"def download_content(object_url, filename)\n raw_html = open(object_url, :read_timeout => 60).read\n puts object_url\n puts filename\n File.open(filename, \"w\") { |file| file.write(raw_html) }\nend",
"def download_url(url, output_filename, dir_name = \"media/tmp\")\n command = \"wget --quiet '#{url}' -O '#{dir_name}/#{output_filename}'\"\n system(command)\n end",
"def download_file_to_tempdir(url)\n tmpdir = Pathname(Dir.mktmpdir(\"razor-repo-#{filesystem_safe_name}-download\"))\n filename = tmpdir + Pathname(url.path).basename\n\n result = url.open\n unless result.is_a?(File)\n # Create Tempfile to converge code flow.\n tmpfile = Tempfile.new filename.to_s\n tmpfile.binmode\n tmpfile << result.read\n result = tmpfile\n end\n begin\n # Try and get our data out to disk safely before we consider the\n # write completed. That way a crash won't leak partial state, given\n # our database does try and be this conservative too.\n begin\n result.flush\n result.respond_to?('fdatasync') ? result.fdatasync : result.fsync\n rescue NotImplementedError\n # This signals that neither fdatasync nor fsync could be used on\n # this IO, which we can politely ignore, because what the heck can\n # we do anyhow?\n end\n FileUtils.mv(result, filename)\n ensure\n result.close\n end\n\n # Downloading was successful, so save our temporary directory for later\n # cleanup, and return the path of the file.\n self.tmpdir = tmpdir\n self.save\n\n return filename.to_s\n\n rescue Exception => e\n # Try our best to remove the directory, but don't let that stop the rest\n # of the recovery process from proceeding. This might leak files on\n # disk, but in that case there is little else that we could do to\n # resolve the situation -- we already tried to delete the file/dir...\n FileUtils.remove_entry_secure(tmpdir, true)\n raise e\n end",
"def download(url, filename, outputFolder)\r\n loadStatus = true\r\n begin\r\n Net::HTTP.start(url) { |http|\r\n t= Time.now\r\n filedate = t.strftime(\"%m%d%Y\")\r\n\t\tif url == \"downloads.cms.gov\"\r\n\t\t\tresp = http.get(\"/medicare/#{filename}\")\r\n\t\telse\r\n\t\t\tresp = http.get(\"/download/#{filename}\")\r\n\t\tend\r\n\r\n open(\"#{outputFolder}#{filedate}#{filename}\", \"wb\") { |file|\r\n file.write(resp.body)\r\n }\r\n }\r\n\r\n puts \"download of #{filename} complete\"\r\n rescue Exception=>e\r\n loadStatus = false\r\n end\r\n return loadStatus\r\nend",
"def b2_download_file_by_name(file, *folder)\n\n if folder[0] != nil\n file_url = b2_generate_file_url(file, folder[0])\n else\n file_url = b2_generate_file_url(file)\n end\n\n uri = URI(file_url)\n req = Net::HTTP::Get.new(uri)\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then\n res.body\n swapfile = File.new(\"./public/swap/#{file}\", 'wb')\n swapfile.puts(res.body)\n swapfile.close\n when Net::HTTPRedirection then\n fetch(res['location'], limit - 1)\n else\n res.error!\n end\n\nend"
] | [
"0.80339223",
"0.78283",
"0.78141093",
"0.76428866",
"0.7613416",
"0.75650495",
"0.7543139",
"0.75342065",
"0.7490002",
"0.7486346",
"0.7480046",
"0.74708503",
"0.74389774",
"0.73595786",
"0.73448706",
"0.7265237",
"0.7254644",
"0.72170925",
"0.711131",
"0.7100639",
"0.7091122",
"0.7084347",
"0.70714855",
"0.7062144",
"0.7038223",
"0.703258",
"0.7024682",
"0.70077246",
"0.6985242",
"0.6983227",
"0.696672",
"0.6955672",
"0.69482297",
"0.6934495",
"0.69133615",
"0.69098586",
"0.6904962",
"0.69006187",
"0.68894964",
"0.68708706",
"0.6862755",
"0.6841304",
"0.68391734",
"0.6830733",
"0.68264556",
"0.6818433",
"0.6806782",
"0.67918867",
"0.67700934",
"0.67605114",
"0.6752844",
"0.6746966",
"0.67369825",
"0.6735134",
"0.67328423",
"0.66984826",
"0.66954994",
"0.66863",
"0.66843903",
"0.6673713",
"0.66639006",
"0.6652944",
"0.66450894",
"0.66309595",
"0.6609062",
"0.6606311",
"0.65930617",
"0.6577622",
"0.657601",
"0.65743613",
"0.65579",
"0.65501076",
"0.65486556",
"0.65260726",
"0.6507196",
"0.64968365",
"0.649099",
"0.6478412",
"0.646509",
"0.6455765",
"0.645516",
"0.64304936",
"0.64232033",
"0.6423079",
"0.6415769",
"0.64102346",
"0.64061105",
"0.64019144",
"0.64017814",
"0.63962513",
"0.63946366",
"0.6394153",
"0.6387581",
"0.6378924",
"0.63747174",
"0.6364577",
"0.63569367",
"0.63567036",
"0.63497084",
"0.6343102",
"0.63398767"
] | 0.0 | -1 |
get ip address of server | def local_ip
Synchronizer.config['local_url']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ip\n if ifconfig =~ /inet addr:([0-9.]+)/\n $1\n else\n \"0.0.0.0\"\n end\n end",
"def get_ip_address\n request.remote_ip\n end",
"def get_ip_address \t\t\t\n\t\trequest.remote_ip \n\tend",
"def server_ip_address\n $tracer.trace(__method__)\n begin\n return meta.name(\"WT.sv\").content.strip\n rescue\n return \"Unknown IP Address\"\n end\n end",
"def get_ip_address\n rpc_get_fact_direct('host_ip')\n end",
"def ip\n ssh.exec!(\"/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'\").chomp\n end",
"def get_public_ip()\n return open('http://ipinfo.io/ip').read.chomp\n end",
"def ip_address\n Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address\n end",
"def host_ip\n Socket.gethostbyname(@backend.host)[3].unpack('CCCC') rescue [0, 0, 0, 0]\n end",
"def ip\n @ip ||= Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address\n end",
"def get_internal_ip_address\r\n sock = UDPSocket.new\r\n sock.connect('1.0.0.1', 1) #@igd_location.split('//').last.split('/').first.split(':').first\r\n return sock.addr.last\r\n rescue Exception\r\n return \"127.0.0.1\"\r\n end",
"def ip\n TestLab::Utility.ip(self.address)\n end",
"def my_ip\n get(\"/tools/myip\")\n end",
"def hostip\n static_network_config[\"ipAddress\"]\n end",
"def remote_ip; end",
"def public_ip_of(server)\n server[:cloud][:public_ips].first rescue server[:ipaddress]\n end",
"def ip_address; end",
"def ip_address; end",
"def ip_address; end",
"def ip_address; end",
"def ip_address; end",
"def ip_address; end",
"def remote_ip\n get_peername[2,6].unpack('nC4')[1..4].join('.')\n end",
"def ip\n TestLab::Utility.ip(self.address)\n end",
"def clientip\n localhost ? local_ip : request.remote_ip\n end",
"def localIP\r\n @@local_ip_address\r\n end",
"def get_public_ip_address\n get_proxy.get_public_ip_address\n end",
"def ipaddr; end",
"def remote_addr; end",
"def ipaddr?; end",
"def ip\n if (ip = @host.at('tag[name=host-ip]'))\n ip.inner_text\n end\n end",
"def public_ip\n get('tools/public_ip').body['ipv4'] || get('tools/public_ip').body['ipv6']\n end",
"def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end",
"def server_host\n Socket.gethostname\n end",
"def get_ip_address\n items = `ifconfig | grep \"inet addr\"`.split\n addresses = []\n items.each do |item|\n addresses << item if item =~ /addr:/\n end\n ip = \"\"\n addresses.each do |address|\n ip = address.split(':')[1]\n if ip != '127.0.0.1'\n break\n end\n end\n ip\nend",
"def remote_ip\n if request.remote_ip == '127.0.0.1'\n # Hard coded remote address\n '18.228.1.115'\n else\n request.remote_ip\n end\n end",
"def ip; end",
"def ip; end",
"def server_get_public_ip(server_name)\n public_ip = ''\n if server_exist?(server_name)\n server = find_match(@compute.servers, server_name)\n network_name = server.addresses.keys.reduce\n server.addresses.each do |address|\n if (address.include? network_name and address.length == 2) #TODO: research why is this 'private' for a public ip?\n if address[1].length >= 2\n Puppet.debug \"found floating ip = #{address[1][1].inspect}\"\n public_ip = address[1][1].addr\n end\n end\n end\n end\n return public_ip\n end",
"def get_public_ip_address\n rpc_get_fact_direct('public_ip')\n end",
"def get_ip_address(machine)\n ip = nil\n unless @rs.ignore_private_ip\n machine.config.vm.networks.each do |network|\n key, options = network[0], network[1]\n ip = options[:ip] if key == :private_network\n next if ip\n end\n end\n\n ip || machine.ssh_info[:host]\n end",
"def ip\n ''\n end",
"def read_host_ip\n ip = read_machine_ip\n base_ip = ip.split(\".\")\n base_ip[3] = \"1\"\n base_ip.join(\".\")\n end",
"def ipaddress\n config[\"ipaddress\"]\n end",
"def public_ip\n @public_ip ||= ssh.exec!(\"curl -s ip.appspot.com\").chomp\n end",
"def getIp()\n return @ip\n\tend",
"def public_ip_address\n public_ip_addresses.first\n end",
"def ip_address(env)\n ip_address_record(env)[:address]\n end",
"def public_ip() ; info[:public_ip] ; end",
"def get_ip_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /inet addr:([\\d\\.]+)/ and $1 != '127.0.0.1')\n end\n end\n return nil\nend",
"def get_ip(node)\n provisioning.ipaddress(node)\n end",
"def local_ip\n UDPSocket.open {|s| s.connect(\"64.233.187.99\", 1); s.addr.last}\n end",
"def remote_ip\n return self[\"client-ip\"] || @forwarded_for || @peeraddr[3]\n end",
"def ip\n self.IP\n end",
"def local_ip_address\n conf['base_address'] ||\n %x{ip addr show #{conf['base_interface'] || 'br0'} | grep inet}.split(' ')[1].to_s.strip.split('/').first.to_s\nend",
"def ip\n request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip \n end",
"def address\n if !self.config\n return \"\"\n end\n\n if self.config['serverport']\n \"#{self.config['serveraddr']}:#{self.config['serverport']}\"\n else\n self.config['serveraddr']\n end\n end",
"def peer_ip(socket)\n if socket.respond_to?(:getpeername)\n # Non SSL\n sockaddr = socket.getpeername\n port, host = Socket.unpack_sockaddr_in(sockaddr)\n host\n else\n # SSL\n BasicSocket.do_not_reverse_lookup = true\n socket.peeraddr.last\n end\n end",
"def getIP(interface)\n cmd = `ip addr show #{interface}`\n ip = cmd.match(/inet ((\\d{1,3}\\.){3}\\d{1,3})\\/\\d{1,2}/).captures\n @log.debug \"IP of interface '#{interface}' is: #{ip.first}\"\n return ip.first\n end",
"def remote_address\n socket_address\n rescue Exception => e\n log_error('Could not infer remote address', e)\n nil\n end",
"def fetch_primary_ip_address\n capture(<<-GETADDR, :shell => \"bash\").chomp\n _if=\"$(netstat -nr | grep ^0\\.0\\.0\\.0 | awk '{print $8}')\";\n _ip=\"$(/sbin/ifconfig $_if | \\\n grep '^[[:space:]]*inet ' | awk '{print $2}' | \\\n awk -F':' '{print $2}')\";\n\n if [ -z \"$_ip\" -o \"$_ip\" == \"\" ] ; then\n echo \"\";\n return 10;\n else\n echo $_ip;\n fi\n GETADDR\nend",
"def ip\n # Get its IP that could have changed upon restart\n # cf https://github.com/moby/moby/issues/2801\n # Make sure we refresh its info before querying it, as we could hit a cache of a previous IP.\n _exit_status, stdout, _stderr = @cmd_runner.run_cmd \"#{podman_cmd} container inspect #{@container} | grep IPAddress\"\n stdout.strip.match(/\\d+\\.\\d+\\.\\d+\\.\\d+/)[0]\n end",
"def ip\n nil\n end",
"def ip\n @data[\"ip\"]\n end",
"def rack_client_ip\n req = request\n return nil unless req\n return req.ip if req.respond_to?(:ip)\n req.env['REMOTE_ADDR']\n end",
"def extract_ip(addrinfo)\n addrinfo[2]\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 remote_ip\n return request.env['HTTP_X_FORWARDED_FOR'] if request.env['HTTP_X_FORWARDED_FOR']\n return request.remote_ip\n end",
"def local_ip\n\nend",
"def device_ipaddress; end",
"def device_ipaddress; end",
"def ip\n render text: local_ip\n end",
"def current_ip(inter)\n net_info = `ifconfig`\n section_index = net_info.index(inter)\n line_index = net_info.index('inet', section_index)\n ip_address = net_info[line_index..-1].match(/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/)[0]\n return ip_address\nend",
"def ipaddress(node)\n @use_private_ip_for_ssh ? node['ec2']['local_ipv4'] : node['ec2']['public_ipv4']\n end",
"def ip\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n s.addr.last\n end\n ensure\n Socket.do_not_reverse_lookup = orig\n end",
"def remote_ip\n return env['HTTP_CLIENT_IP'] if env.include? 'HTTP_CLIENT_IP'\n\n if env.include? 'HTTP_X_FORWARDED_FOR' then\n remote_ips = env['HTTP_X_FORWARDED_FOR'].split(',').reject do |ip|\n ip =~ /^unknown$|^(10|172\\.16|192\\.168)\\./i\n end\n\n return remote_ips.first.strip unless remote_ips.empty?\n end\n\n return env['REMOTE_ADDR']\n end",
"def ip(args = nil)\n if args and args[:meta]\n meta = args[:meta]\n elsif httpsession = Thread.current[:hayabusa][:httpsession]\n meta = httpsession.meta\n else\n raise \"Could not figure out meta-data.\"\n end\n \n if !meta[\"HTTP_X_FORWARDED_FOR\"].to_s.strip.empty? and ips = meta[\"HTTP_X_FORWARDED_FOR\"].split(/\\s*,\\s*/)\n return ips.first.to_s.strip\n elsif ip = meta[\"REMOTE_ADDR\"].to_s.strip and !ip.empty?\n return ip\n else\n raise \"Could not figure out IP from meta-data.\"\n end\n end",
"def public_ip_address\n data[:public_ip_address]\n end",
"def client_ip\n req = request\n return nil unless req\n # Look for an external address being forwarded\n split_ips = []\n PREFFERED_IP_HEADERS.each do |header_name|\n forwarded = req.env[header_name]\n ips = split_ip_addresses(forwarded)\n lip = ips.find { |ip| (ip !~ TRUSTED_PROXIES) && valid_ip?(ip) }\n split_ips << ips unless ips.empty?\n return lip unless lip.nil?\n end\n # Else fall back to declared remote addr\n r = req.env['REMOTE_ADDR']\n # If this is localhost get the last hop before\n if r.nil? || r =~ LOCALHOST\n split_ips.each do |ips|\n lip = ips.find { |ip| (ip !~ LOCALHOST) && valid_ip?(ip) }\n return lip unless lip.nil?\n end\n end\n r\n end",
"def peer_ip; end",
"def name\n ip_address\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 obtain_ip_from_rails(env)\n env[\"action_dispatch.remote_ip\"].try(:to_s)\n end",
"def get_server_public_ip(server, cached_rules=nil)\n return nil unless server\n\n # find the public ip\n nic = get_server_default_nic(server) || {}\n if nic['type'] == 'Virtual'\n ssh_rule = get_ssh_port_forwarding_rule(server, cached_rules)\n ssh_rule ? ssh_rule['ipaddress'] : nil\n else\n nic['ipaddress']\n end\n end",
"def private_ip_of(server)\n server[:cloud][:private_ips].first rescue server[:ipaddress]\n end",
"def parse_ip\n @request[FHOST] || BLANK_STR\n end",
"def remote_host\n # NOTE: Celluloid::IO does not yet support non-blocking reverse DNS\n @socket.peeraddr(true)[2]\n end",
"def rails_client_ip\n req = request\n return unless req && req.env\n remote_ip = req.env['action_dispatch.remote_ip']\n return unless remote_ip\n # FIXME: - this exist only since Rails 3.2.1\n # http://apidock.com/rails/v3.2.1/ActionDispatch/RemoteIp/GetIp/calculate_ip\n return remote_ip.calculate_ip if remote_ip.respond_to?(:calculate_ip)\n # This might not return the same value as calculate IP\n remote_ip.to_s\n end",
"def remote_ip\n return @headers['HTTP_CLIENT_IP'] if @headers.include?('HTTP_CLIENT_IP')\n\n if @headers.include?('HTTP_X_FORWARDED_FOR') then\n remote_ips = @headers['HTTP_X_FORWARDED_FOR'].split(',').reject do |ip|\n ip =~ /^unknown$/i or local_net?(ip)\n end\n\n return remote_ips.first.strip unless remote_ips.empty?\n end\n\n return @headers['REMOTE_ADDR']\n end",
"def external_ip\n begin\n ip = OpenURI.open_uri(\"http://myip.dk\") {|f|f.read.scan(/([0-9]{1,3}\\.){3}[0-9]{1,3}/); $~.to_s}\n rescue\n ip = local_ip\n puts \"Seems like there is a problem adquiring external IP address, ...using local address: (#{ip})\"\n end\n ip\n end",
"def remote_ip\n request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip\n end",
"def host\n\t\t\t# FIXME: This is both a hack and the best way I know to do this.\n\t\t\tSocket.getaddrinfo(Socket.gethostname, 0)[0][2]\n\t\tend",
"def test_server_ip\n ip = `hostname -i`\n ip.gsub(\"\\n\", \"\")\n end",
"def ip_address\n nil\n end",
"def get_local_ip(network)\n UDPSocket.open do |sock|\n sock.connect network, 1\n sock.addr.last\n end\n end",
"def ipaddress\n @network_payload['IP']\n end",
"def private_ip_address\n private_ip_addresses.first\n end",
"def request_ip(env)\n obtain_ip_from_rails(env) || obtain_ip_from_rack(env)\n end",
"def ip\n container.json['NetworkSettings']['IPAddress'] || 'N/A'\n rescue NoMethodError\n 'N/A'\n end",
"def ip\n self['ip'] = get_public_ip || get_ip\n end",
"def ip_by_interface(int)\n ip = `ifconfig #{int} | awk '/inet addr/ {split ($2,A,\":\"); print A[2]}'`.chomp\n return ip\n end"
] | [
"0.7852457",
"0.77663803",
"0.77464926",
"0.77085835",
"0.7697207",
"0.7690139",
"0.7667996",
"0.7603963",
"0.7591252",
"0.75591755",
"0.7552053",
"0.7506804",
"0.7501567",
"0.7440655",
"0.741831",
"0.74054486",
"0.7387019",
"0.7387019",
"0.7387019",
"0.7387019",
"0.7387019",
"0.7387019",
"0.73765016",
"0.73732334",
"0.7363989",
"0.73171914",
"0.7310474",
"0.73074734",
"0.7286264",
"0.72316694",
"0.7216821",
"0.72159934",
"0.721209",
"0.7198678",
"0.71906555",
"0.7142122",
"0.7131379",
"0.7131379",
"0.71110946",
"0.7104968",
"0.7084113",
"0.7058059",
"0.7055356",
"0.7048837",
"0.7037707",
"0.70112437",
"0.7000321",
"0.6999116",
"0.69979244",
"0.6986078",
"0.697672",
"0.6972298",
"0.6962382",
"0.6958361",
"0.69426244",
"0.69335514",
"0.6928108",
"0.69173163",
"0.69135594",
"0.6875908",
"0.6872896",
"0.6850392",
"0.68481565",
"0.6844795",
"0.68357617",
"0.68303275",
"0.6802966",
"0.68001175",
"0.6795488",
"0.67950493",
"0.67950493",
"0.6792652",
"0.67918354",
"0.6788334",
"0.67860883",
"0.67828906",
"0.6773988",
"0.67738074",
"0.6768997",
"0.6766093",
"0.67593604",
"0.6749963",
"0.67400277",
"0.6735761",
"0.6733441",
"0.6710248",
"0.6706112",
"0.6701578",
"0.66964126",
"0.66925085",
"0.6685505",
"0.6681596",
"0.6672626",
"0.6671792",
"0.6660974",
"0.6656944",
"0.6643441",
"0.66424984",
"0.6638636",
"0.6636631",
"0.66363055"
] | 0.0 | -1 |
GET /solicitacao_tipos GET /solicitacao_tipos.json | def index
@solicitacao_tipos = SolicitacaoTipo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n tips = Tip.all\n json_response(tips)\n end",
"def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def show\n json_response(@tip)\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end",
"def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipp }\n end\n end",
"def index\n @tipovestuarios = Tipovestuario.all\n end",
"def index\n @tipoplatos = Tipoplato.all\n end",
"def index\n @tipos = Tipo.all\n end",
"def index\n @tipos = Tipo.all\n end",
"def tips\n\t \tbase_url = \"https://api.foursquare.com/v2/venues/#{venue_id}/tips?sort=popular&oauth_token=333XGVNQCUY0LI4GGL4B4MXWAM022G1EKD0JZWXOLKESCFK3&v=20140401\"\n\t\tresponse = HTTParty.get(base_url)\n\t\tresponse[\"response\"][\"tips\"][\"items\"].map do |item|\n\t\t\titem['text']\n\t\tend\n\tend",
"def show\n @tip = Tip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip }\n end\n end",
"def index\n @solicitacoes = Solicitacao.all\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def new\n @tip_so = TipSo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def index\n @tiposervicos = Tiposervico.all\n end",
"def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def index\n @tipocuenta = Tipocuentum.all\n end",
"def show\n @solicitante= Solicitante.find(params[:solicitante_id])\n @beneficiario= Beneficiario.find(params[:id])\n @solicitudes = Solicitud.where(solicitante_id: @solicitante.id, beneficiario_id: @beneficiario.id).all\n end",
"def index\n @tipos_contatos = TiposContato.all\n end",
"def index\n @solicitantes = Solicitante.all\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def index\n @solicitacao_pontuals = SolicitacaoPontual.all\n end",
"def index\n @response_tips = ResponseTip.all\n @tip = Tip.all\n end",
"def venue_tips(id, options = {})\n get(\"venues/#{id}/tips\", options).tips\n end",
"def index\n @tipics = Tipic.all\n end",
"def index\n @tiposveiculos = Tiposveiculo.all\n end",
"def index\n @tipotermos = Tipotermo.all\n end",
"def index\n @tipoveiculos = Tipoveiculo.all\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def create\n @tip_so = TipSo.new(params[:tip_so])\n\n respond_to do |format|\n if @tip_so.save\n format.html { redirect_to @tip_so, notice: 'Tip so was successfully created.' }\n format.json { render json: @tip_so, status: :created, location: @tip_so }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tip_so.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipospolen\n\n @info_polens = InfoPolen.collection.aggregate(\n { \"$group\" => { \"_id\" => \"$TIPOS_POLINICOS\" } },\n { \"$sort\" => {\"_id\" => 1} }\n )\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def tips\n @tips = response[\"tips\"]\n if @tips[\"groups\"]\n @tips[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::Tip.new(client, item)}\n end\n end\n @tips\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def index\n @tipomovifinanceiros = Tipomovifinanceiro.all\n end",
"def informacoes\n empregado = Empregado.find(params[:empregado_id])\n solicitacoes = Solicitacao.where(empregado_id: parametros[:empregado_id], mes_ano: parametros[:mes_ano])\n valor_ja_solicitado = solicitacoes.sum(&:valor)\n salario_disponivel = (empregado.salario || 0) - valor_ja_solicitado - solicitacoes.sum(&:taxa) # FIXME Romuloset - taxas\n\n render json: {\n valor_ja_solicitado: valor_ja_solicitado,\n salario_disponivel: salario_disponivel\n }\n end",
"def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end",
"def index\n @your_tips = YourTip.all\n end",
"def destroy\n @solicitacao_tipo.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_tipos_url }\n format.json { head :no_content }\n end\n end",
"def index\n @tipos_datos = TiposDato.all\n end",
"def new\n @tipomedalla = Tipomedalla.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def create\n @tipos_contato = TiposContato.new(tipos_contato_params)\n\n respond_to do |format|\n if @tipos_contato.save\n format.html { redirect_to @tipos_contato, notice: 'Tipos contato was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_contato }\n else\n format.html { render :new }\n format.json { render json: @tipos_contato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end",
"def set_tipos_contato\n @tipos_contato = TiposContato.find(params[:id])\n end",
"def index\n @solicituds = Solicitud.all\n end",
"def show\n @tip = Tip.find(params[:id])\n end",
"def index\n @solicituds = Solicitud.all\n end",
"def set_tipoplato\n @tipoplato = Tipoplato.find(params[:id])\n end",
"def index\n @tipus_indicadors = TipusIndicador.all\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def create\n @tipoplato = Tipoplato.new(tipoplato_params)\n\n respond_to do |format|\n if @tipoplato.save\n format.html { redirect_to @tipoplato, notice: 'Tipoplato was successfully created.' }\n format.json { render :show, status: :created, location: @tipoplato }\n else\n format.html { render :new }\n format.json { render json: @tipoplato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tipos_personas = TipoPersona.all\n end",
"def set_solicitacao_tipo\n @solicitacao_tipo = SolicitacaoTipo.find(params[:id])\n end",
"def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def select_tiporelacion\n [ \n [\"BENEFICIARIO\",\"BENEFICIARIO\"],\n [\"INTEGRANTE\",\"INTEGRANTE\"],\n [\"PROPIETARIO\",\"PROPIETARIO\"],\n [\"APODERADO\",\"APODERADO\"]\n ] \n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def index\n @tipos_pregunta = TipoPregunta.all\n end",
"def new\n @tip = Tip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip }\n end\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end",
"def tipos_contato_params\n params.require(:tipos_contato).permit(:descricao)\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end",
"def destroy\n @tip_so = TipSo.find(params[:id])\n @tip_so.destroy\n\n respond_to do |format|\n format.html { redirect_to tip_sos_url }\n format.json { head :no_content }\n end\n end",
"def index\n @trabajo = Trabajo.find(params[:trabajo_id])\n @presupuestos = @trabajo.presupuestos.order(\"aprobado DESC, rechazado ASC\")\n\n add_breadcrumb @trabajo.proposito, trabajo_path(@trabajo)\n add_breadcrumb \"Presupuestos\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @presupuestos }\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def show\n @tiposcontrato = Tiposcontrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tiposcontrato }\n end\n end",
"def index\n @tipmoneys = Tipmoney.all\n end",
"def index\n @tecidos = Tecido.all\n end",
"def index\n @tiposcontratos = Tiposcontrato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tiposcontratos }\n end\n end",
"def index\n @tips = Tip.page(params[:page]).per(5).order(created_at: :desc)\n end",
"def select_tiposdocumemto\n [\n [\"CARTAS DE PROPIETARIOS SOLICITANDO LA VIVIENDA\",\"CARTAS DE PROPIETARIOS SOLICITANDO LA VIVIENDA\"],\n [\"CARTAS PARA CAMBIO DE VIVIENDA\",\"CARTAS PARA CAMBIO DE VIVIENDA\"],\n [\"CARTAS RECIBIDAS PARA SOLICITUD DE AUMENTO DE CANON\",\"CARTAS RECIBIDAS PARA SOLICITUD DE AUMENTO DE CANON\"],\n [\"DOCUMENTACION DE TENENCIA DE VIVIENDA EVACUADA\",\"DOCUMENTACION DE TENENCIA DE VIVIENDA EVACUADA\"],\n [\"DOCUMENTACION DE VIVIENDA PARA ARRENDAR POR PRIMERA VEZ\",\"DOCUMENTACION DE VIVIENDA PARA ARRENDAR POR PRIMERA VEZ\"],\n [\"DOCUMENTACION DE VIVIENDAS DISPONIBLES\",\"DOCUMENTACION DE VIVIENDAS DISPONIBLES\"],\n [\"DOCUMENTACION PARA CAMBIO DE VIVIENDA\",\"DOCUMENTACION PARA CAMBIO DE VIVIENDA\"],\n [\"DOCUMENTOS SOPORTES DE INGRESOS FAMILIARES\",\"DOCUMENTOS SOPORTES DE INGRESOS FAMILIARES\"],\n [\"DOCUMENTOS DE IDENTIDAD DEL GRUPO FAMILIAR\",\"DOCUMENTOS DE IDENTIDAD DEL GRUPO FAMILIAR\"],\n [\"OTROS DOCUMENTOS\",\"OTROS DOCUMENTOS\"],\n [\"PAZ Y SALVOS RECIBIDOS\",\"PAZ Y SALVOS RECIBIDOS\"]\n ]\n end",
"def trips\n @trip_requests = current_user.trip_requests.trips.paginate(page:params[:page], per_page:20)\n json_response(@trip_requests)\n end",
"def create\n @tiposervico = Tiposervico.new(tiposervico_params)\n\n respond_to do |format|\n if @tiposervico.save\n format.html { redirect_to @tiposervico, notice: 'Tiposervico was successfully created.' }\n format.json { render :show, status: :created, location: @tiposervico }\n else\n format.html { render :new }\n format.json { render json: @tiposervico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tipos_de_impostos = TipoDeImposto.all\n end",
"def create\n @tipocliente = Tipocliente.new(params[:tipocliente])\n\n respond_to do |format|\n if @tipocliente.save\n format.html { redirect_to @tipocliente, :notice => 'Tipocliente was successfully created.' }\n format.json { render json: @tipocliente, status: :created }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @tipocliente.errors }\n end\n end\n end",
"def index\n @tb_solicituds = TbSolicitud.all\n end",
"def get_trip_detail(id)\n server_response = handle_timeouts do\n get \"/1/trips/#{id}.json?locale=en\"\n end\n server_response['response']\n end",
"def index\n @tipocambios = Tipocambio.all\n end",
"def index\n @solicitadors = Solicitador.all\n end",
"def create\n @tip = Tip.new(tip_params)\n respond_to do |format|\n if @tip.save\n format.html { redirect_to @tip, notice: 'Tip was successfully created.' }\n format.json { render :show, status: :created, location: @tip }\n else\n format.html { render :new }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @solicitacoes_avaliacoes_servicos = SolicitacoesAvaliacoesServico.all\n end",
"def create\n @solicitacao_tipo = SolicitacaoTipo.new(solicitacao_tipo_params)\n\n respond_to do |format|\n if @solicitacao_tipo.save\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacao_tipo }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\r\n @tipos_usuarios = TiposUsuario.all\r\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def index\n @to_dos = ToDo.all\n\n render json: @to_dos\n end",
"def tattoos\n render :nothing => true and return if params[:id].nil?\n\n @tattoo = Tattoo.find(params[:id])\n render :json => @tattoo.to_json(:include => [:artist, :assets])\n #render :json => @tattoo.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end",
"def show\n @tipp = Tipp.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipp }\n end\n end",
"def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipp }\n end\n end",
"def index\n @solicitudes = Solicitud.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitudes }\n end\n end",
"def create\n @tip = Tip.new(params[:tip])\n\n respond_to do |format|\n if @tip.save\n format.html { redirect_to @tip, notice: 'Tip was successfully created.' }\n format.json { render json: @tip, status: :created, location: @tip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tiposveiculo\n @tiposveiculo = Tiposveiculo.find(params[:id])\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def create\n @tip = Tip.new(tip_params)\n @user = current_user\n @users = User.all\n @races = Race.where(year: @year).order('race_number ASC')\n @drivers = Driver.where(year: @year).order('abbr_name ASC')\n\n respond_to do |format|\n if @tip.save\n format.html { redirect_to tips_path, notice: 'Tip was successfully created.' }\n format.json { render :show, status: :created, location: @tip }\n else\n format.html { render :new }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tiponovedads = Tiponovedad.all\n end",
"def response_tip_params\n params.require(:response_tip).permit(:tip_id, :response_for_tip, :tag_tip, :user_id)\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n @trnodo = Trnodo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trnodo }\n end\n end"
] | [
"0.65108067",
"0.64022475",
"0.61986303",
"0.61943024",
"0.61738473",
"0.60719556",
"0.60466915",
"0.6017275",
"0.5969186",
"0.5969186",
"0.5964207",
"0.59610367",
"0.59297687",
"0.59143305",
"0.591277",
"0.590865",
"0.59049314",
"0.58742553",
"0.58641595",
"0.5852805",
"0.5792326",
"0.5752998",
"0.5740865",
"0.5722674",
"0.57151985",
"0.5700381",
"0.5695156",
"0.5693295",
"0.56703144",
"0.5670011",
"0.5670011",
"0.5650762",
"0.5610691",
"0.5590182",
"0.55852664",
"0.55770355",
"0.5571863",
"0.5549924",
"0.5548298",
"0.554798",
"0.55245113",
"0.55188406",
"0.5517703",
"0.55157864",
"0.5502636",
"0.5496515",
"0.5488905",
"0.5487787",
"0.5487473",
"0.54779965",
"0.5476711",
"0.54630053",
"0.544777",
"0.54415107",
"0.54357404",
"0.54288924",
"0.54266447",
"0.54266447",
"0.5425167",
"0.541538",
"0.5399996",
"0.539987",
"0.539182",
"0.5390369",
"0.5389724",
"0.5386626",
"0.5380485",
"0.53703403",
"0.53598523",
"0.53559136",
"0.5351764",
"0.5344131",
"0.53424656",
"0.5325261",
"0.53250897",
"0.53201795",
"0.5313649",
"0.53086364",
"0.53015274",
"0.5300962",
"0.5295929",
"0.52901393",
"0.5283671",
"0.527948",
"0.52750564",
"0.5274409",
"0.5273712",
"0.52672964",
"0.52668506",
"0.52617335",
"0.5260133",
"0.525623",
"0.52561146",
"0.5252943",
"0.52519536",
"0.52508193",
"0.52500796",
"0.5243108",
"0.5241911",
"0.52406687"
] | 0.7046238 | 0 |
GET /solicitacao_tipos/1 GET /solicitacao_tipos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @solicitacao_tipos = SolicitacaoTipo.all\n end",
"def show\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end",
"def index\n tips = Tip.all\n json_response(tips)\n end",
"def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipp }\n end\n end",
"def show\n @tip = Tip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip }\n end\n end",
"def show\n json_response(@tip)\n end",
"def new\n @tip_so = TipSo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @solicitante= Solicitante.find(params[:solicitante_id])\n @beneficiario= Beneficiario.find(params[:id])\n @solicitudes = Solicitud.where(solicitante_id: @solicitante.id, beneficiario_id: @beneficiario.id).all\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end",
"def index\n @tiposervicos = Tiposervico.all\n end",
"def index\n @tipovestuarios = Tipovestuario.all\n end",
"def index\n @tipos = Tipo.all\n end",
"def index\n @tipos = Tipo.all\n end",
"def index\n @tipoplatos = Tipoplato.all\n end",
"def create\n @tip_so = TipSo.new(params[:tip_so])\n\n respond_to do |format|\n if @tip_so.save\n format.html { redirect_to @tip_so, notice: 'Tip so was successfully created.' }\n format.json { render json: @tip_so, status: :created, location: @tip_so }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tip_so.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end",
"def show\n @tip = Tip.find(params[:id])\n end",
"def index\n @solicitacoes = Solicitacao.all\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def index\n @tipocuenta = Tipocuentum.all\n end",
"def set_solicitacao_tipo\n @solicitacao_tipo = SolicitacaoTipo.find(params[:id])\n end",
"def new\n @tipomedalla = Tipomedalla.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def new\n @tip = Tip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip }\n end\n end",
"def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end",
"def index\n @tipos_contatos = TiposContato.all\n end",
"def set_tipos_contato\n @tipos_contato = TiposContato.find(params[:id])\n end",
"def index\n @solicitantes = Solicitante.all\n end",
"def get_trip_detail(id)\n server_response = handle_timeouts do\n get \"/1/trips/#{id}.json?locale=en\"\n end\n server_response['response']\n end",
"def set_tipoplato\n @tipoplato = Tipoplato.find(params[:id])\n end",
"def tipospolen\n\n @info_polens = InfoPolen.collection.aggregate(\n { \"$group\" => { \"_id\" => \"$TIPOS_POLINICOS\" } },\n { \"$sort\" => {\"_id\" => 1} }\n )\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end",
"def index\n @solicitacao_pontuals = SolicitacaoPontual.all\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def index\n @tipics = Tipic.all\n end",
"def index\n @response_tips = ResponseTip.all\n @tip = Tip.all\n end",
"def destroy\n @solicitacao_tipo.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_tipos_url }\n format.json { head :no_content }\n end\n end",
"def create\n @tipos_contato = TiposContato.new(tipos_contato_params)\n\n respond_to do |format|\n if @tipos_contato.save\n format.html { redirect_to @tipos_contato, notice: 'Tipos contato was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_contato }\n else\n format.html { render :new }\n format.json { render json: @tipos_contato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tips\n\t \tbase_url = \"https://api.foursquare.com/v2/venues/#{venue_id}/tips?sort=popular&oauth_token=333XGVNQCUY0LI4GGL4B4MXWAM022G1EKD0JZWXOLKESCFK3&v=20140401\"\n\t\tresponse = HTTParty.get(base_url)\n\t\tresponse[\"response\"][\"tips\"][\"items\"].map do |item|\n\t\t\titem['text']\n\t\tend\n\tend",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end",
"def show\n @tiposcontrato = Tiposcontrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tiposcontrato }\n end\n end",
"def show\n @trnodo = Trnodo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @tiposveiculos = Tiposveiculo.all\n end",
"def destroy\n @tip_so = TipSo.find(params[:id])\n @tip_so.destroy\n\n respond_to do |format|\n format.html { redirect_to tip_sos_url }\n format.json { head :no_content }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def index\n @tipoveiculos = Tipoveiculo.all\n end",
"def index\n @tipotermos = Tipotermo.all\n end",
"def set_tiposveiculo\n @tiposveiculo = Tiposveiculo.find(params[:id])\n end",
"def create\n @tipoplato = Tipoplato.new(tipoplato_params)\n\n respond_to do |format|\n if @tipoplato.save\n format.html { redirect_to @tipoplato, notice: 'Tipoplato was successfully created.' }\n format.json { render :show, status: :created, location: @tipoplato }\n else\n format.html { render :new }\n format.json { render json: @tipoplato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @telefononegocio = Telefononegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @telefononegocio }\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def create\n @tipocliente = Tipocliente.new(params[:tipocliente])\n\n respond_to do |format|\n if @tipocliente.save\n format.html { redirect_to @tipocliente, :notice => 'Tipocliente was successfully created.' }\n format.json { render json: @tipocliente, status: :created }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @tipocliente.errors }\n end\n end\n end",
"def informacoes\n empregado = Empregado.find(params[:empregado_id])\n solicitacoes = Solicitacao.where(empregado_id: parametros[:empregado_id], mes_ano: parametros[:mes_ano])\n valor_ja_solicitado = solicitacoes.sum(&:valor)\n salario_disponivel = (empregado.salario || 0) - valor_ja_solicitado - solicitacoes.sum(&:taxa) # FIXME Romuloset - taxas\n\n render json: {\n valor_ja_solicitado: valor_ja_solicitado,\n salario_disponivel: salario_disponivel\n }\n end",
"def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipp }\n end\n end",
"def show\n @tipp = Tipp.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipp }\n end\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def create\n @tip = Tip.new(params[:tip])\n\n respond_to do |format|\n if @tip.save\n format.html { redirect_to @tip, notice: 'Tip was successfully created.' }\n format.json { render json: @tip, status: :created, location: @tip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tip = Tip.new(tip_params)\n respond_to do |format|\n if @tip.save\n format.html { redirect_to @tip, notice: 'Tip was successfully created.' }\n format.json { render :show, status: :created, location: @tip }\n else\n format.html { render :new }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiposervico = Tiposervico.new(tiposervico_params)\n\n respond_to do |format|\n if @tiposervico.save\n format.html { redirect_to @tiposervico, notice: 'Tiposervico was successfully created.' }\n format.json { render :show, status: :created, location: @tiposervico }\n else\n format.html { render :new }\n format.json { render json: @tiposervico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tetramod }\n end\n end",
"def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end",
"def show\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @troop }\n end\n end",
"def index\n @tipomovifinanceiros = Tipomovifinanceiro.all\n end",
"def venue_tips(id, options = {})\n get(\"venues/#{id}/tips\", options).tips\n end",
"def new\n @tipp = Tipp.new(:spiel_id=>params[:spiel_id], :user_id=>params[:user_id]||current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipp }\n end\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def index\n @solicituds = Solicitud.all\n end",
"def index\n @solicituds = Solicitud.all\n end",
"def create\n @solicitacao_tipo = SolicitacaoTipo.new(solicitacao_tipo_params)\n\n respond_to do |format|\n if @solicitacao_tipo.save\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacao_tipo }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @solicitud_servicio = SolicitudServicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n @trabalho = Trabalho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trabalho }\n end\n end",
"def index\n @tipos_datos = TiposDato.all\n end",
"def show\n @tema = Tema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tema }\n end\n end",
"def show\n @to_do = ToDo.find(params[:id])\n\n render json: @to_do\n end",
"def set_tiposervico\n @tiposervico = Tiposervico.find(params[:id])\n end",
"def show\n @titulacionesdoctipo = Titulacionesdoctipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @titulacionesdoctipo }\n end\n end",
"def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def index\n @your_tips = YourTip.all\n end",
"def index\n @trabajo = Trabajo.find(params[:trabajo_id])\n @presupuestos = @trabajo.presupuestos.order(\"aprobado DESC, rechazado ASC\")\n\n add_breadcrumb @trabajo.proposito, trabajo_path(@trabajo)\n add_breadcrumb \"Presupuestos\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @presupuestos }\n end\n end",
"def show\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noto }\n end\n end",
"def create\n tip = Tip.new(tips_params)\n tip.created_by_id = @current_user.id\n \n if tip.save\n json_response(tip)\n else\n json_response({ message: tip.errors }, :unprocessable_entity)\n end\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end",
"def show\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_item }\n end\n end",
"def index\n @tacos = Taco.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render @tacos }\n end\n end",
"def index\n @tipos_pregunta = TipoPregunta.all\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def show\n @tsp = Tsp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@tsp }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tips_trick }\n end\n end",
"def index\n @tipus_indicadors = TipusIndicador.all\n end"
] | [
"0.6817256",
"0.6669637",
"0.64503783",
"0.6372201",
"0.6367699",
"0.6265731",
"0.62596667",
"0.6170344",
"0.61276793",
"0.597531",
"0.5974145",
"0.59422886",
"0.5879393",
"0.58658284",
"0.58658284",
"0.58501226",
"0.5815338",
"0.5805142",
"0.579987",
"0.57922894",
"0.57922894",
"0.5790649",
"0.5787099",
"0.57854503",
"0.5778204",
"0.57606035",
"0.5751717",
"0.5745298",
"0.5727174",
"0.5709115",
"0.5707798",
"0.5707642",
"0.57067084",
"0.56782556",
"0.56713307",
"0.5669155",
"0.56683755",
"0.56675655",
"0.5646123",
"0.5624498",
"0.56001157",
"0.55957854",
"0.55900395",
"0.55719495",
"0.5570896",
"0.5569021",
"0.5565472",
"0.5561543",
"0.5545626",
"0.55360293",
"0.5533836",
"0.5533836",
"0.55272096",
"0.55269116",
"0.55201155",
"0.55133617",
"0.54978555",
"0.549159",
"0.5485054",
"0.54814476",
"0.54800344",
"0.5469653",
"0.5466728",
"0.5464343",
"0.5454589",
"0.54479975",
"0.54328316",
"0.5425059",
"0.5420908",
"0.5418777",
"0.541466",
"0.541462",
"0.54110295",
"0.5410193",
"0.54078174",
"0.54044574",
"0.5403661",
"0.54020846",
"0.5400672",
"0.53996146",
"0.53913623",
"0.5385546",
"0.5384796",
"0.53801155",
"0.5379877",
"0.5378878",
"0.53788334",
"0.5367614",
"0.53669983",
"0.5362091",
"0.53513014",
"0.53473747",
"0.5344268",
"0.53297013",
"0.53246486",
"0.53220916",
"0.5321354",
"0.5319497",
"0.5318197",
"0.53167564",
"0.5312315"
] | 0.0 | -1 |
POST /solicitacao_tipos POST /solicitacao_tipos.json | def create
@solicitacao_tipo = SolicitacaoTipo.new(solicitacao_tipo_params)
respond_to do |format|
if @solicitacao_tipo.save
format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully created.' }
format.json { render action: 'show', status: :created, location: @solicitacao_tipo }
else
format.html { render action: 'new' }
format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @tip_so = TipSo.new(params[:tip_so])\n\n respond_to do |format|\n if @tip_so.save\n format.html { redirect_to @tip_so, notice: 'Tip so was successfully created.' }\n format.json { render json: @tip_so, status: :created, location: @tip_so }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tip_so.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipos_contato = TiposContato.new(tipos_contato_params)\n\n respond_to do |format|\n if @tipos_contato.save\n format.html { redirect_to @tipos_contato, notice: 'Tipos contato was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_contato }\n else\n format.html { render :new }\n format.json { render json: @tipos_contato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoplato = Tipoplato.new(tipoplato_params)\n\n respond_to do |format|\n if @tipoplato.save\n format.html { redirect_to @tipoplato, notice: 'Tipoplato was successfully created.' }\n format.json { render :show, status: :created, location: @tipoplato }\n else\n format.html { render :new }\n format.json { render json: @tipoplato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipovestuario = Tipovestuario.new(tipovestuario_params)\n\n respond_to do |format|\n if @tipovestuario.save\n format.html { redirect_to @tipovestuario, notice: 'Tipovestuario was successfully created.' }\n format.json { render :show, status: :created, location: @tipovestuario }\n else\n format.html { render :new }\n format.json { render json: @tipovestuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiposervico = Tiposervico.new(tiposervico_params)\n\n respond_to do |format|\n if @tiposervico.save\n format.html { redirect_to @tiposervico, notice: 'Tiposervico was successfully created.' }\n format.json { render :show, status: :created, location: @tiposervico }\n else\n format.html { render :new }\n format.json { render json: @tiposervico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n tip = Tip.new(tips_params)\n tip.created_by_id = @current_user.id\n \n if tip.save\n json_response(tip)\n else\n json_response({ message: tip.errors }, :unprocessable_entity)\n end\n end",
"def create\n @tipocliente = Tipocliente.new(params[:tipocliente])\n\n respond_to do |format|\n if @tipocliente.save\n format.html { redirect_to @tipocliente, :notice => 'Tipocliente was successfully created.' }\n format.json { render json: @tipocliente, status: :created }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @tipocliente.errors }\n end\n end\n end",
"def create\n @tip = Tip.new(tip_params)\n respond_to do |format|\n if @tip.save\n format.html { redirect_to @tip, notice: 'Tip was successfully created.' }\n format.json { render :show, status: :created, location: @tip }\n else\n format.html { render :new }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tip = Tip.new(params[:tip])\n\n respond_to do |format|\n if @tip.save\n format.html { redirect_to @tip, notice: 'Tip was successfully created.' }\n format.json { render json: @tip, status: :created, location: @tip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipos_dato = TiposDato.new(tipos_dato_params)\n\n respond_to do |format|\n if @tipos_dato.save\n format.html { redirect_to @tipos_dato, notice: 'Tipos dato was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_dato }\n else\n format.html { render :new }\n format.json { render json: @tipos_dato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiposveiculo = Tiposveiculo.new(tiposveiculo_params)\n\n respond_to do |format|\n if @tiposveiculo.save\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo criado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipocuentum = Tipocuentum.new(tipocuentum_params)\n\n respond_to do |format|\n if @tipocuentum.save\n format.html { redirect_to @tipocuentum, notice: 'Tipocuentum was successfully created.' }\n format.json { render :show, status: :created, location: @tipocuentum }\n else\n format.html { render :new }\n format.json { render json: @tipocuentum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def create\n @tipus_indicador = TipusIndicador.new(tipus_indicador_params)\n\n respond_to do |format|\n if @tipus_indicador.save\n format.html { redirect_to @tipus_indicador, notice: 'Tipus indicador was successfully created.' }\n format.json { render :show, status: :created, location: @tipus_indicador }\n else\n format.html { render :new }\n format.json { render json: @tipus_indicador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipomedalla = Tipomedalla.new(params[:tipomedalla])\n\n respond_to do |format|\n if @tipomedalla.save\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully created.' }\n format.json { render json: @tipomedalla, status: :created, location: @tipomedalla }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipomovifinanceiro = Tipomovifinanceiro.new(tipomovifinanceiro_params)\n\n respond_to do |format|\n if @tipomovifinanceiro.save\n format.html { redirect_to @tipomovifinanceiro, notice: 'Tipomovifinanceiro was successfully created.' }\n format.json { render :show, status: :created, location: @tipomovifinanceiro }\n else\n format.html { render :new }\n format.json { render json: @tipomovifinanceiro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoveiculo = Tipoveiculo.new(tipoveiculo_params)\n\n respond_to do |format|\n if @tipoveiculo.save\n format.html { redirect_to @tipoveiculo, notice: 'Tipoveiculo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoveiculo }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tip_params\n params.require(:tip).permit(:title, :body)\n end",
"def tipos_contato_params\n params.require(:tipos_contato).permit(:descricao)\n end",
"def create\n @tipos_encuestum = TiposEncuestum.new(tipos_encuestum_params)\n\n respond_to do |format|\n if @tipos_encuestum.save\n format.html { redirect_to @tipos_encuestum, notice: 'Tipos encuestum was successfully created.' }\n format.json { render :show, status: :created, location: @tipos_encuestum }\n else\n format.html { render :new }\n format.json { render json: @tipos_encuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipoplato_params\n params.require(:tipoplato).permit(:name, :description)\n end",
"def create\n @tipotermo = Tipotermo.new(tipotermo_params)\n\n respond_to do |format|\n if @tipotermo.save\n format.html { redirect_to @tipotermo, notice: 'Tipotermo was successfully created.' }\n format.json { render :show, status: :created, location: @tipotermo }\n else\n format.html { render :new }\n format.json { render json: @tipotermo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiposcontrato = Tiposcontrato.new(params[:tiposcontrato])\n\n respond_to do |format|\n if @tiposcontrato.save\n flash[:notice] = 'Tiposcontrato was successfully created.'\n format.html { redirect_to(@tiposcontrato) }\n format.xml { render :xml => @tiposcontrato, :status => :created, :location => @tiposcontrato }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tiposcontrato.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def response_tip_params\n params.require(:response_tip).permit(:tip_id, :response_for_tip, :tag_tip, :user_id)\n end",
"def create\n @everydaytip = Everydaytip.new(everydaytip_params)\n\n respond_to do |format|\n if @everydaytip.save\n format.html { redirect_to @everydaytip, notice: 'Everydaytip was successfully created.' }\n format.json { render :show, status: :created, location: @everydaytip }\n else\n format.html { render :new }\n format.json { render json: @everydaytip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def your_tip_params\n params.require(:your_tip).permit(:tip, :description)\n end",
"def create\n @tipic = Tipic.new(tipic_params)\n\n respond_to do |format|\n if @tipic.save\n format.html { redirect_to @tipic, notice: 'Tipic was successfully created.' }\n format.json { render :show, status: :created, location: @tipic }\n else\n format.html { render :new }\n format.json { render json: @tipic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @solicitacao_tipos = SolicitacaoTipo.all\n end",
"def create\n @tip = Tip.new(tip_params)\n @user = current_user\n @users = User.all\n @races = Race.where(year: @year).order('race_number ASC')\n @drivers = Driver.where(year: @year).order('abbr_name ASC')\n\n respond_to do |format|\n if @tip.save\n format.html { redirect_to tips_path, notice: 'Tip was successfully created.' }\n format.json { render :show, status: :created, location: @tip }\n else\n format.html { render :new }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiponovedad = Tiponovedad.new(tiponovedad_params)\n\n respond_to do |format|\n if @tiponovedad.save\n format.html { redirect_to @tiponovedad, notice: 'Tiponovedad was successfully created.' }\n format.json { render :show, status: :created, location: @tiponovedad }\n else\n format.html { render :new }\n format.json { render json: @tiponovedad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tiposervico_params\n params.require(:tiposervico).permit(:descricao)\n end",
"def create\n @tipocambio = Tipocambio.new(tipocambio_params)\n\n respond_to do |format|\n if @tipocambio.save\n format.html { redirect_to @tipocambio, notice: 'Tipocambio was successfully created.' }\n format.json { render :show, status: :created, location: @tipocambio }\n else\n format.html { render :new }\n format.json { render json: @tipocambio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipocambio_params\n params.require(:tipocambio).permit(:dia, :compra, :venta)\n end",
"def tipopago_params\n params.require(:tipopago).permit(:nombre, :monto)\n end",
"def tipocancer_params\n params.require(:tipocancer).permit(:descricao, :nivelgravidade)\n end",
"def tipotermo_params\n params.require(:tipotermo).permit(:nome_tipotermo, :desc_tipotermo)\n end",
"def tiposveiculo_params\n params.require(:tiposveiculo).permit(:nome)\n end",
"def tip_params\n params.require(:tip).permit(:title, :image, :content)\n end",
"def tip_params\n params.require(:tip).permit(:description, :gaming_object_id, :category)\n end",
"def solicitacao_params\n params.require(:solicitacao).permit(:status, :data, :desconto, :pagamento, :pessoa_id, :produto_solicitados_attributes => [:id, :quantidade, :_destroy, :produto_id])\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Tecnico criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tip_so = TipSo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def tipos_dato_params\n params.require(:tipos_dato).permit(:date, :time, :text)\n end",
"def create\n @tb_solicitud = TbSolicitud.new(tb_solicitud_params)\n\n respond_to do |format|\n if @tb_solicitud.save\n format.html { redirect_to @tb_solicitud, notice: 'Tb solicitud was successfully created.' }\n format.json { render :show, status: :created, location: @tb_solicitud }\n else\n format.html { render :new }\n format.json { render json: @tb_solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tip_params\n params.require(:tip).permit(:qual_first, :qual_second, :qual_third, :race_first, :race_second, :race_third, :race_tenth, :user_id, :race_id, :updated_by, :modifier_is_admin)\n end",
"def create\n @tiempo = Tiempo.new(tiempo_params)\n\n respond_to do |format|\n if @tiempo.save\n format.html { redirect_to @tiempo, notice: 'Tiempo was successfully created.' }\n format.json { render :show, status: :created, location: @tiempo }\n else\n format.html { render :new }\n format.json { render json: @tiempo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitante = Solicitante.new(solicitante_params)\n\n respond_to do |format|\n if @solicitante.save\n format.html { redirect_to @solicitante, notice: 'Solicitante was successfully created.' }\n format.json { render :show, status: :created, location: @solicitante }\n else\n format.html { render :new }\n format.json { render json: @solicitante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def nota_tecnica_params\n params.require(:nota_tecnica).permit(:data_nota, :numero_nota, :numero_processo, :status, :nome_do_analista, :area)\n end",
"def everydaytip_params\n params.require(:everydaytip).permit(:tip)\n end",
"def create\n @tipp = Tipp.new(params[:tipp])\n\n respond_to do |format|\n if @tipp.save\n format.html { redirect_to(@tipp, :notice => 'Tipp was successfully created.') }\n format.xml { render :xml => @tipp, :status => :created, :location => @tipp }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tipovestuario_params\n params.require(:tipovestuario).permit(:nombre, :descripcion)\n end",
"def create\n @tecido = Tecido.new(tecido_params)\n\n respond_to do |format|\n if @tecido.save\n format.html { redirect_to @tecido, notice: 'Tecido was successfully created.' }\n format.json { render :show, status: :created, location: @tecido }\n else\n format.html { render :new }\n format.json { render json: @tecido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tip_params\n params.require(:tip).permit(:title, :body, :topic_id, :subtopic_id, :term)\n end",
"def create\r\n #@tipos_usuario = TiposUsuario.new(tipos_usuario_params)\r\n\r\n respond_to do |format|\r\n if @tipos_usuario.save\r\n format.html { redirect_to @tipos_usuario, notice: 'Se añadió un nombre de tipo de usuario correctamente.' }\r\n format.json { render :show, status: :created, location: @tipos_usuario }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @tipos_usuario.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @your_tip = @user.your_tips.create(your_tip_params) \n redirect_to @user\n end",
"def create\n @taco = Taco.new(taco_params)\n\n respond_to do |format|\n if @taco.save\n format.html { redirect_to @taco, notice: 'Taco was successfully created.' }\n format.json { render :show, status: :created, location: @taco }\n else\n format.html { render :new }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitacao = Solicitacao.new(solicitacao_params)\n\n respond_to do |format|\n if @solicitacao.save\n format.html { redirect_to @solicitacao, notice: 'Solicitacao was successfully created.' }\n format.json { render :show, status: :created, location: @solicitacao }\n else\n format.html { render :new }\n format.json { render json: @solicitacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipocuentum_params\n params.require(:tipocuentum).permit(:nombretipocuenta, :fechaingresotipocuenta)\n end",
"def create\n @tipomaquinat = Tipomaquinat.new(tipomaquinat_params)\n #@tipomaquinat = Tipomaquinat.new\n #@tipomaquinat.id=401\n #@tipomaquinat.tipomaquina = \"KLK\" #params.require(:tipomaquinat).permit(:tipomaquina)\n #@tipomaquinat.descripcion = \"YOOOO\" #params.require(:tipomaquinat).permit(:descripcion)\n #descripcion\n\n # params.require(:tipomaquinat).permit(:tipomaquina, :descripcion,\n\n respond_to do |format|\n if @tipomaquinat.save\n format.html { redirect_to @tipomaquinat, notice: 'Tipomaquinat was successfully created.' }\n format.json { render :show, status: :created, location: @tipomaquinat }\n else\n format.html { render :new }\n format.json { render json: @tipomaquinat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def crear_tema\n f = page_of :foro\n @tema = f.children.build(:title => params[:title], :state => 'locked', :mime => 'tema')\n add_response(@tema, params[:name], params[:text])\n if @tema.save\n @nota = \"Tu tema '#{@tema.title}' aparecerá próximamente publicado en el foro.\"\n render :action => 'waiting'\n else\n @error = \"Lo siento, no se ha podido crear el tema. Vuelve a intentarlo dentro de unos minutos\"\n render :action => 'error'\n end\n end",
"def create\n @tipp = Tipp.new(params[:tipp])\n @tipp.user_id||= current_user.id\n @tipp.errors.add(:base, 'Bei einem KO Spiel kann nicht auf unentschieden getippt werden!') if @tipp.spiel.ko && @tipp.team_a_result == @tipp.team_b_result\n\n respond_to do |format|\n if ! @tipp.too_late? && @tipp.errors.empty? && @tipp.save\n format.html { redirect_to @tipp.spiel, notice: 'Tipp was successfully created.' }\n format.json { render json: @tipp, status: :created, location: @tipp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @titulacao = Titulacao.new(titulacao_params)\n\n respond_to do |format|\n if @titulacao.save\n format.html { redirect_to titulacaos_path, notice: 'Titulo criado com successo.' }\n format.json { render :index, status: :created, location: titulacaos_path }\n else\n format.html { render :new }\n format.json { render json: @titulacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tip = Tip.new(tip_params)\n if @tip.save\n redirect_to @tip\n else\n render 'new'\n end\n end",
"def solicitacao_tipo_params\n params.require(:solicitacao_tipo).permit(:tipo)\n end",
"def tarefa_params\n params.require(:tarefa).permit(:missao_id, :usuario_curso_id, :nome, :descricao)\n end",
"def create\n @topico = @modelo.topicos.new(topico_params)\n\n respond_to do |format|\n if @topico.save\n format.html { redirect_to set_path, notice: 'Tópico criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @topico }\n else\n format.html { render action: 'new' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipomensaje = Tipomensaje.new(params[:tipomensaje])\n\n respond_to do |format|\n if @tipomensaje.save\n flash[:notice] = 'Tipomensaje was successfully created.'\n format.html { redirect_to(@tipomensaje) }\n format.xml { render :xml => @tipomensaje, :status => :created, :location => @tipomensaje }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipomensaje.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tiponovedad_params\n params.require(:tiponovedad).permit(:nombre)\n end",
"def create\n @os_tarefa = OsTarefa.new(os_tarefa_params)\n\n respond_to do |format|\n if @os_tarefa.save\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi criado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi criado(a)' }\n format.json { render :show, status: :created, location: @os_tarefa }\n end\n else\n format.html { render :new }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response_tip = ResponseTip.new(response_tip_params)\n \n respond_to do |format|\n if @response_tip.save\n format.html { redirect_to my_mirror_paste_users_path, notice: 'Response tip was successfully created.' }\n format.json { render :show, status: :created, location: @response_tip }\n else\n format.html { render :new }\n format.json { render json: @response_tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipoveiculo_params\n params.require(:tipoveiculo).permit(:tvvcodigo, :tvvatualiza, :tvvativo)\n end",
"def tipus_indicador_params\n params.require(:tipus_indicador).permit(:nom_ca, :nom_es, :nom_en, :unitats, :descripcio_ca, :descripcio_es, :descripcio_en)\n end",
"def create\n @tipos_movimiento = TiposMovimiento.new(params[:tipos_movimiento])\n\n respond_to do |format|\n if @tipos_movimiento.save\n format.html { redirect_to(@tipos_movimiento, :notice => 'TiposMovimiento was successfully created.') }\n format.xml { render :xml => @tipos_movimiento, :status => :created, :location => @tipos_movimiento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipos_movimiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def solicitante_params\n params.require(:solicitante).permit(:cep, :nome, :cpf, :telefone, :email, :senha, :paypal, :descricao, :avaliacao, :autoridade)\n end",
"def create\n @titulacionesdoctipo = Titulacionesdoctipo.new(params[:titulacionesdoctipo])\n\n respond_to do |format|\n if @titulacionesdoctipo.save\n format.html { redirect_to(@titulacionesdoctipo, :notice => 'Titulacionesdoctipo was successfully created.') }\n format.xml { render :xml => @titulacionesdoctipo, :status => :created, :location => @titulacionesdoctipo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @titulacionesdoctipo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @territorio = Territorio.new(params[:territorio])\n\n respond_to do |format|\n if @territorio.save\n format.html { redirect_to @territorio, notice: 'Territorio was successfully created.' }\n format.json { render json: @territorio, status: :created, location: @territorio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @territorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipp = Tipp.new(params[:tipp])\n \[email protected] = current_user.name\n respond_to do |format|\n if @tipp.save\n format.html { redirect_to(current_user, :notice => 'Tipp was successfully created.') }\n format.xml { render :xml => @tipp, :status => :created, :location => @tipp }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create \n\t\t@tienda_cliente = @cliente.tiendas_clientes.build(tienda_cliente_params)\n\n respond_to do |format|\n if @tienda_cliente.save\n format.html { redirect_to @tienda_cliente, notice: 'La tienda se creó exitosamente.' }\n format.json { render :show, status: :created, location: @tienda_cliente }\n else\n format.html { render :new }\n format.json { render json: @tienda_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n log(\"Se ha creado la nomina #{@lt}\", 0)\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: 'La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tiempo_params\n params.require(:tiempo).permit(:SKU, :Descripción, :Tipo, :Grupo_Proyecto, :Unidades, :Costo_produccion_unitario, :Lote_Produccion, :Tiempo_Medio_Producción)\n end",
"def create\n @tipos_documento = TiposDocumento.new(tipos_documento_params)\n\n respond_to do |format|\n if @tipos_documento.save\n format.html { redirect_to @tipos_documento, notice: 'El Tipo de Documento se ha creado correctamente.' }\n format.json { render :show, status: :created, location: @tipos_documento }\n else\n format.html { render :new }\n format.json { render json: @tipos_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n @tecnico.user = current_user\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Técnico foi criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipos_pagamento = TiposPagamento.new(params[:tipos_pagamento])\n\n respond_to do |format|\n if @tipos_pagamento.save\n flash[:notice] = 'TiposPagamento was successfully created.'\n format.html { redirect_to(@tipos_pagamento) }\n format.xml { render :xml => @tipos_pagamento, :status => :created, :location => @tipos_pagamento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipos_pagamento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @intranet_financeiro_tipos_cobanca = Intranet::FinanceiroTiposCobanca.new(intranet_financeiro_tipos_cobanca_params)\n\n respond_to do |format|\n if @intranet_financeiro_tipos_cobanca.save\n format.html { redirect_to @intranet_financeiro_tipos_cobanca, notice: \"Financeiro tipos cobanca was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_financeiro_tipos_cobanca }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_financeiro_tipos_cobanca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @tips_trick.save\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully created.' }\n format.json { render json: @tips_trick, status: :created, location: @tips_trick }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipic_params\n params.require(:tipic).permit(:title, :description)\n end",
"def treinamento_ti_params\n params.require(:treinamento_ti).permit(:orgao_id, :treinamento, :empresa, :qtd_pessoa)\n end",
"def create\n @nota_tecnica = NotaTecnica.new(nota_tecnica_params)\n\n respond_to do |format|\n if @nota_tecnica.save\n format.html { redirect_to action: :index, notice: 'Nota Técnica criada com sucesso.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def set_tipos_contato\n @tipos_contato = TiposContato.find(params[:id])\n end",
"def create\n @tareas = Tarea.all\n @tareapositivas = Tarea.where(listo: true)\n @tarea = Tarea.new(tarea_params)\n\n respond_to do |format|\n if @tarea.save\n format.html { redirect_to @tarea, notice: 'Tarea was successfully created.' }\n format.json { render :show, status: :created, location: @tarea }\n else\n format.html { render :new }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @troop_detail = TroopDetail.new(troop_detail_params)\n\n respond_to do |format|\n if @troop_detail.save\n format.html { redirect_to @troop_detail, notice: 'Detalle tropa exitosamente creado.' }\n format.json { render :show, status: :created, location: @troop_detail }\n else\n format.html { render :new }\n format.json { render json: @troop_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: \"Solicitud was successfully created.\" }\n format.json { render :show, status: :created, location: @solicitud }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitud }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n tip = Tip.new(tip_params)\n tip.user_id = current_user.id\n tip.name = current_user.name\n tip.save\n \n redirect_to tips_path\n end",
"def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def solicitud_params\n params.require(:solicitud).permit(:status, :descripcion, :ayuda_id, :beneficiario_id, :solicitante_id)\n end",
"def os_tarefa_params\n params.require(:os_tarefa).permit(:os_id,:catl_id, :prod_id, :pess_abertura_tarefa_id, :pess_tarefa_atribuida_id, :entregavel_id, :id_tarefa_redmine, :ust_tarefa, :horastarefa, :situacao, :justificativa, :id_os_pagamento)\n end",
"def tecido_params\n params.require(:tecido).permit(:nome, :largura)\n end"
] | [
"0.67034465",
"0.66678816",
"0.65577585",
"0.6449446",
"0.641211",
"0.64117646",
"0.6356537",
"0.6324983",
"0.6288912",
"0.6286157",
"0.6282469",
"0.6250847",
"0.6242328",
"0.6225682",
"0.6209179",
"0.6201209",
"0.61829597",
"0.6163679",
"0.6162684",
"0.61430997",
"0.61374307",
"0.61304575",
"0.60579157",
"0.60494053",
"0.6035206",
"0.60234797",
"0.5988387",
"0.59800917",
"0.59708124",
"0.5938041",
"0.5918355",
"0.59078854",
"0.5905853",
"0.59005594",
"0.5898319",
"0.5887452",
"0.58642",
"0.5851003",
"0.5850931",
"0.58343816",
"0.5825653",
"0.5825232",
"0.58191067",
"0.5809456",
"0.5807892",
"0.5802572",
"0.580069",
"0.5788068",
"0.57769287",
"0.5776543",
"0.5772902",
"0.57680744",
"0.57657415",
"0.5764585",
"0.5762496",
"0.57582515",
"0.57459676",
"0.57394296",
"0.5738504",
"0.57296443",
"0.57186323",
"0.5714798",
"0.57118565",
"0.5694528",
"0.5693898",
"0.5688314",
"0.56757164",
"0.5673658",
"0.56518024",
"0.5642208",
"0.5638745",
"0.5625328",
"0.56125426",
"0.56055397",
"0.5599691",
"0.55949026",
"0.5591132",
"0.55861324",
"0.5585851",
"0.55808675",
"0.55770123",
"0.55736554",
"0.5563307",
"0.5558751",
"0.5557227",
"0.5555776",
"0.5550945",
"0.5546471",
"0.55369437",
"0.5535137",
"0.5535002",
"0.55331373",
"0.5529744",
"0.5528675",
"0.55188626",
"0.5518519",
"0.55143946",
"0.55095047",
"0.5502518",
"0.5498894"
] | 0.6199879 | 16 |
PATCH/PUT /solicitacao_tipos/1 PATCH/PUT /solicitacao_tipos/1.json | def update
respond_to do |format|
if @solicitacao_tipo.update(solicitacao_tipo_params)
format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n if @tip_so.update_attributes(params[:tip_so])\n format.html { redirect_to @tip_so, notice: 'Tip so was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tip_so.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipos_contato.update(tipos_contato_params)\n format.html { redirect_to @tipos_contato, notice: 'Tipos contato was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipos_contato }\n else\n format.html { render :edit }\n format.json { render json: @tipos_contato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tip.update(tips_params)\n json_response(@tip)\n end",
"def update\n respond_to do |format|\n if @tiposervico.update(tiposervico_params)\n format.html { redirect_to @tiposervico, notice: 'Tiposervico was successfully updated.' }\n format.json { render :show, status: :ok, location: @tiposervico }\n else\n format.html { render :edit }\n format.json { render json: @tiposervico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoplato.update(tipoplato_params)\n format.html { redirect_to @tipoplato, notice: 'Tipoplato was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipoplato }\n else\n format.html { render :edit }\n format.json { render json: @tipoplato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n if @tipocliente.update_attributes(params[:tipocliente])\n format.html { redirect_to @tipocliente, :notice => 'Tipocliente was successfully updated.' }\n format.json { render json: @tipocliente }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @tipocliente.errors }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tip.update!(tip_params)\n format.html { redirect_to @tip, notice: \"#{@tip.name} tip has been updated.\" }\n format.json { render :show, status: :ok, location: @tip }\n else\n format.html { render :edit }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tip.update(tip_params)\n format.html { redirect_to @tip, notice: 'Tip was successfully updated.' }\n format.json { render :show, status: :ok, location: @tip }\n else\n format.html { render :edit }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tip = Tip.find(params[:id])\n\n respond_to do |format|\n if @tip.update_attributes(params[:tip])\n format.html { redirect_to @tip, notice: 'Tip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipovestuario.update(tipovestuario_params)\n format.html { redirect_to @tipovestuario, notice: 'Tipovestuario was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipovestuario }\n else\n format.html { render :edit }\n format.json { render json: @tipovestuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoveiculo.update(tipoveiculo_params)\n format.html { redirect_to @tipoveiculo, notice: 'Tipoveiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n if @tipomedalla.update_attributes(params[:tipomedalla])\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacao.update(solicitacao_params)\n format.html { redirect_to @solicitacao, notice: 'Solicitacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipomovifinanceiro.update(tipomovifinanceiro_params)\n format.html { redirect_to @tipomovifinanceiro, notice: 'Tipomovifinanceiro was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipomovifinanceiro }\n else\n format.html { render :edit }\n format.json { render json: @tipomovifinanceiro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipos_dato.update(tipos_dato_params)\n format.html { redirect_to @tipos_dato, notice: 'Tipos dato was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipos_dato }\n else\n format.html { render :edit }\n format.json { render json: @tipos_dato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitante.update(solicitante_params)\n format.html { redirect_to @solicitante, notice: 'Solicitante was successfully updated.' }\n format.json { render :show, status: :ok, location: @solicitante }\n else\n format.html { render :edit }\n format.json { render json: @solicitante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacao.update(solicitacao_params)\n format.html { redirect_to @solicitacao, notice: 'Solicitacao was successfully updated.' }\n format.json { render :show, status: :ok, location: @solicitacao }\n else\n format.html { render :edit }\n format.json { render json: @solicitacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tb_solicitud.update(tb_solicitud_params)\n format.html { redirect_to @tb_solicitud, notice: 'Tb solicitud was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_solicitud }\n else\n format.html { render :edit }\n format.json { render json: @tb_solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tiposcontrato = Tiposcontrato.find(params[:id])\n\n respond_to do |format|\n if @tiposcontrato.update_attributes(params[:tiposcontrato])\n flash[:notice] = 'Tiposcontrato was successfully updated.'\n format.html { redirect_to(@tiposcontrato) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tiposcontrato.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipotermo.update(tipotermo_params)\n format.html { redirect_to @tipotermo, notice: 'Tipotermo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipotermo }\n else\n format.html { render :edit }\n format.json { render json: @tipotermo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipocuentum.update(tipocuentum_params)\n format.html { redirect_to @tipocuentum, notice: 'Tipocuentum was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipocuentum }\n else\n format.html { render :edit }\n format.json { render json: @tipocuentum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipomaquinat.update(tipomaquinat_params)\n format.html { redirect_to @tipomaquinat, notice: 'Tipomaquinat was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipomaquinat }\n else\n format.html { render :edit }\n format.json { render json: @tipomaquinat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipus_indicador.update(tipus_indicador_params)\n format.html { redirect_to @tipus_indicador, notice: 'Tipus indicador was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipus_indicador }\n else\n format.html { render :edit }\n format.json { render json: @tipus_indicador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tecido.update(tecido_params)\n format.html { redirect_to @tecido, notice: 'Tecido was successfully updated.' }\n format.json { render :show, status: :ok, location: @tecido }\n else\n format.html { render :edit }\n format.json { render json: @tecido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taco.update(taco_params)\n format.html { redirect_to @taco, notice: 'Taco was successfully updated.' }\n format.json { render :show, status: :ok, location: @taco }\n else\n format.html { render :edit }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipp = Tipp.find(params[:id])\n deny_access!('Zugriff verweigert! Es ist verboten die Tipps anderer Spieler zu manipulieren!') if ! current_user.id == @tipp.user_id and ! current_user.is_superuser?\n @tipp.errors.add(:base, 'Bei einem KO Spiel kann nicht auf unentschieden getippt werden!') if @tipp.spiel.ko && @tipp.team_a_result == @tipp.team_b_result\n # deny_access! unless current_user.id == @tipp.user_id and ! current_user.is_superuser?\n \n respond_to do |format|\n if ! @tipp.too_late? && @tipp.errors.empty? && @tipp.update_attributes(params[:tipp])\n format.html { redirect_to @tipp.spiel, notice: 'Tipp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tips_trick.update_attributes(params[:tips_trick])\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @everydaytip.update(everydaytip_params)\n format.html { redirect_to @everydaytip, notice: 'Everydaytip was successfully updated.' }\n format.json { render :show, status: :ok, location: @everydaytip }\n else\n format.html { render :edit }\n format.json { render json: @everydaytip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipocambio.update(tipocambio_params)\n format.html { redirect_to @tipocambio, notice: 'Tipocambio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipocambio }\n else\n format.html { render :edit }\n format.json { render json: @tipocambio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { render :show, status: :ok, location: @solicitud }\n else\n format.html { render :edit }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n tip = Tip.find(params[:id])\n tip.update(tip_params)\n \n redirect_to tips_path\n end",
"def update\n @tipomensaje = Tipomensaje.find(params[:id])\n\n respond_to do |format|\n if @tipomensaje.update_attributes(params[:tipomensaje])\n flash[:notice] = 'Tipomensaje was successfully updated.'\n format.html { redirect_to(@tipomensaje) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipomensaje.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacao_pontual.update(solicitacao_pontual_params)\n format.html { redirect_to @solicitacao_pontual, notice: 'Solicitacao pontual was successfully updated.' }\n format.json { render :show, status: :ok, location: @solicitacao_pontual }\n else\n format.html { render :edit }\n format.json { render json: @solicitacao_pontual.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipic.update(tipic_params)\n format.html { redirect_to @tipic, notice: 'Tipic was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipic }\n else\n format.html { render :edit }\n format.json { render json: @tipic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @response_tip.update(response_tip_params)\n format.html { redirect_to @response_tip, notice: 'Response tip was successfully updated.' }\n format.json { render :show, status: :ok, location: @response_tip }\n else\n format.html { render :edit }\n format.json { render json: @response_tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipos_encuestum.update(tipos_encuestum_params)\n format.html { redirect_to @tipos_encuestum, notice: 'Tipos encuestum was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipos_encuestum }\n else\n format.html { render :edit }\n format.json { render json: @tipos_encuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topico.update(topico_params)\n format.html { redirect_to set_path, notice: 'Tópico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n format.html { redirect_to tipos_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tatoo.update(tatoo_params)\n format.html { redirect_to tatoos_path, notice: 'Tatoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tatoo }\n else\n format.html { render :edit }\n format.json { render json: @tatoo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: \"Solicitud was successfully updated.\" }\n format.json { render :show, status: :ok, location: @solicitud }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tienda_cliente.update(tienda_cliente_params)\n format.html { redirect_to @tienda_cliente, notice: 'La tienda se actualizó exitosamente.' }\n format.json { render :show, status: :ok, location: @tienda_cliente }\n else\n format.html { render :edit }\n format.json { render json: @tienda_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tiempo.update(tiempo_params)\n format.html { redirect_to @tiempo, notice: 'Tiempo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tiempo }\n else\n format.html { render :edit }\n format.json { render json: @tiempo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @peticion_servicio_ti = Peticion::ServicioTi.find(params[:id])\n\n respond_to do |format|\n if @peticion_servicio_ti.update_attributes(params[:peticion_servicio_ti])\n format.html { redirect_to edit_peticion_servicio_ti_path(@peticion_servicio_ti), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peticion_servicio_ti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @titulacao.update(titulacao_params)\n format.html { redirect_to titulacaos_path, notice: 'Titulo atualizado com successo.' }\n format.json { render titulacaos_path, status: :ok, location: titulacaos_path }\n else\n format.html { render :edit }\n format.json { render json: @titulacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hack_tip.update(hack_tip_params)\n format.html { redirect_to @hack_tip, notice: 'Hack tip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hack_tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitador.update(solicitador_params)\n format.html { redirect_to @solicitador, notice: 'Solicitador was successfully updated.' }\n format.json { render :show, status: :ok, location: @solicitador }\n else\n format.html { render :edit }\n format.json { render json: @solicitador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tecnico = Tecnico.find(params[:id])\n @tecnico.user = current_user\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Técnico foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipp = Tipp.find(params[:id])\n\[email protected] = current_user.name\n respond_to do |format|\n if @tipp.update_attributes(params[:tipp])\n #format.html { redirect_to(@tipp, :notice => 'Tipp was successfully updated.') }\n format.html { redirect_to(tipps_url)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if @os_tarefa.update(os_tarefa_params)\n #se as situacao da tarefa nao for aceita, altera a ordem_servico_pagamento para null\n if(@os_tarefa.situacao!=OsTarefa.situacoes[0] && @os_tarefa.situacao!=OsTarefa.situacoes[1])\n\n @os_tarefa.ordem_servico_pagamento=nil\n @os_tarefa.save\n end\n\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_tarefa }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip_todo.update(trip_todo_params)\n format.html { redirect_to @trip_todo, notice: 'Trip todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_todo }\n else\n format.html { render :edit }\n format.json { render json: @trip_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n if @tipo_nota.update_attributes(params[:tipo_nota])\n format.html { redirect_to(@tipo_nota, :notice => 'TipoNota was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_nota.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipos = Tipo.all\n if @ingrediente.update(ingrediente_params)\n flash[:success] = \"Ingrediente editado exitosamente\"\n redirect_to ingrediente_path(@ingrediente)\n else\n render 'ingredientes/edit'\n end\n end",
"def update\n @telefononegocio = Telefononegocio.find(params[:id])\n\n respond_to do |format|\n if @telefononegocio.update_attributes(params[:telefononegocio])\n format.html { redirect_to @telefononegocio, notice: 'Telefononegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @telefononegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n if @tipo_contrato.update_attributes(params[:tipo_contrato])\n format.html { redirect_to tipo_contratos_path, notice: 'Tipo de contrato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_contrato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @treinamento_ti.update(treinamento_ti_params)\n format.html { redirect_to @treinamento_ti, notice: 'Treinamento de TI atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @treinamento_ti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tb_servicio.update(tb_servicio_params)\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tb_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nota_tecnica.update(nota_tecnica_params)\n format.html { redirect_to @nota_tecnica, notice: 'Nota tecnica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nota_tecnica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @tipos_usuario.update(tipos_usuario_params)\r\n format.html { redirect_to @tipos_usuario, notice: 'La actualización del nombre del tipo de usuario se realizó correctamente.' }\r\n format.json { render :show, status: :ok, location: @tipos_usuario }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @tipos_usuario.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n if @territorio.update_attributes(params[:territorio])\n format.html { redirect_to @territorio, notice: 'Territorio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @territorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jobtip.update(jobtip_params)\n format.html { redirect_to @jobtip, notice: 'Jobtip was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobtip }\n else\n format.html { render :edit }\n format.json { render json: @jobtip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipos_movimiento = TiposMovimiento.find(params[:id])\n\n respond_to do |format|\n if @tipos_movimiento.update_attributes(params[:tipos_movimiento])\n format.html { redirect_to(@tipos_movimiento, :notice => 'TiposMovimiento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipos_movimiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitudinforme.update(solicitudinforme_params)\n format.html { redirect_to @solicitudinforme, notice: 'Solicitudinforme was successfully updated.' }\n format.json { render :show, status: :ok, location: @solicitudinforme }\n else\n format.html { render :edit }\n format.json { render json: @solicitudinforme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n if @tipp.update_attributes(params[:tipp])\n format.html { redirect_to(@tipp, :notice => 'Tipp was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @titulacionesdoctipo = Titulacionesdoctipo.find(params[:id])\n\n respond_to do |format|\n if @titulacionesdoctipo.update_attributes(params[:titulacionesdoctipo])\n format.html { redirect_to(@titulacionesdoctipo, :notice => 'Titulacionesdoctipo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @titulacionesdoctipo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n if @tservicio.update_attributes(params[:tservicio])\n format.html { redirect_to(@tservicio, :notice => 'Tservicio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tservicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trnodo = Trnodo.find(params[:id])\n\n respond_to do |format|\n if @trnodo.update_attributes(params[:trnodo])\n format.html { redirect_to @trnodo, notice: 'Trnodo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trnodo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_contrato = TipoContrato.find(params[:id])\n respond_to do |format|\n if @tipo_contrato.update_attributes(params[:tipo_contrato])\n flash[:notice] = 'TiposContratos actualizado correctamente.'\n format.html { redirect_to(@tipo_contrato) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_contrato.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_tipos_contato\n @tipos_contato = TiposContato.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @tiponovedad.update(tiponovedad_params)\n format.html { redirect_to @tiponovedad, notice: 'Tiponovedad was successfully updated.' }\n format.json { render :show, status: :ok, location: @tiponovedad }\n else\n format.html { render :edit }\n format.json { render json: @tiponovedad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n if @torso.update_attributes(params[:torso])\n format.html { redirect_to @torso, notice: 'Torso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trabajo.update(trabajo_params)\n format.html { redirect_to cliente_path(@cliente), notice: 'Trabajo was successfully updated.' }\n format.json { render :show, status: :ok, location: cliente_trabajo_path(@cliente, @trabajo) }\n else\n format.html { render :edit }\n format.json { render json: @trabajo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tip = Tip.find(params[:id])\n if @tip.update(tip_params)\n redirect_to @tip\n else\n render 'edit'\n end\n end",
"def set_solicitacao_tipo\n @solicitacao_tipo = SolicitacaoTipo.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @tema_curso.update(tema_curso_params)\n format.html { redirect_to @tema_curso, notice: 'Tema do curso atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @tema_curso }\n else\n format.html { render :edit }\n format.json { render json: @tema_curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_aposta.update(tipo_aposta_params)\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_aposta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:persona_id])\n respond_to do |format|\n if @persona.info_extra_pacientes.update(info_extra_paciente_params)\n format.html { redirect_to @info_extra_paciente, notice: 'Info extra actualizada.' }\n format.json { render :show, status: :ok, location: @info_extra_paciente }\n else\n format.html { render :edit }\n format.json { render json: @info_extra_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_telefone = TipoTelefone.find(params[:id])\n\n respond_to do |format|\n if @tipo_telefone.update_attributes(params[:tipo_telefone])\n flash[:notice] = 'TipoTelefone was successfully updated.'\n format.html { redirect_to(@tipo_telefone) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_telefone.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n if @tipo_atendimento.update_attributes(params[:tipo_atendimento])\n format.html { redirect_to @tipo_atendimento, notice: \"Tipo de atendimento: #{@tipo_atendimento.descricao}, foi atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_atendimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todoa.update(todoa_params)\n format.html { redirect_to todoas_url }\n format.json { render :show, status: :ok, location: @todoa }\n else\n format.html { render :edit }\n format.json { render json: @todoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_imposto.update(tipo_de_imposto_params)\n format.html { redirect_to @empresa, notice: 'Tipo de imposto actualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @tipo_de_imposto }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_imposto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @m_tip = MTip.find(params[:id])\n\n respond_to do |format|\n if @m_tip.update_attributes(params[:m_tip])\n format.html { redirect_to(@m_tip, :notice => 'M tip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @m_tip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def set_solicitacao\n @solicitacao = Solicitacao.find(params[:id])\n end",
"def set_solicitacao\n @solicitacao = Solicitacao.find(params[:id])\n end",
"def solicitacao_params\n params.require(:solicitacao).permit(:status, :data, :desconto, :pagamento, :pessoa_id, :produto_solicitados_attributes => [:id, :quantidade, :_destroy, :produto_id])\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @troop.update(troop_params)\n format.html { redirect_to @troop, notice: 'Tropa exitosamente actualizada.' }\n format.json { render :show, status: :ok, location: @troop }\n else\n format.html { render :edit }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68049604",
"0.66864556",
"0.66023237",
"0.6564181",
"0.655705",
"0.65283144",
"0.6523591",
"0.6453579",
"0.6410637",
"0.64080346",
"0.63508874",
"0.6267339",
"0.6209148",
"0.6205629",
"0.62011945",
"0.6186779",
"0.61786264",
"0.6166486",
"0.61635375",
"0.6155421",
"0.615132",
"0.61306924",
"0.6125394",
"0.61030215",
"0.60593426",
"0.60377514",
"0.6029771",
"0.6029369",
"0.60203964",
"0.6019158",
"0.60117686",
"0.60091823",
"0.6003935",
"0.5999514",
"0.59991753",
"0.5989547",
"0.59860456",
"0.5974033",
"0.59706515",
"0.59688497",
"0.5962793",
"0.59532666",
"0.5936551",
"0.5932652",
"0.5930277",
"0.5927348",
"0.5921922",
"0.5903982",
"0.5891036",
"0.5884056",
"0.58716327",
"0.5870707",
"0.58634466",
"0.58574647",
"0.58547175",
"0.58478737",
"0.5842917",
"0.5838729",
"0.58357304",
"0.58270526",
"0.5826076",
"0.58129066",
"0.5805423",
"0.5803139",
"0.57948476",
"0.57948035",
"0.5791826",
"0.5779218",
"0.5777536",
"0.57601434",
"0.57436115",
"0.57412803",
"0.5741042",
"0.57367027",
"0.5734766",
"0.57346016",
"0.57328933",
"0.5726751",
"0.571682",
"0.57118285",
"0.5707139",
"0.5695431",
"0.56905955",
"0.5683222",
"0.5664676",
"0.5663824",
"0.5658145",
"0.5657619",
"0.56528527",
"0.56494784",
"0.564538",
"0.5639446",
"0.5634831",
"0.5632658",
"0.5628461",
"0.56206304",
"0.56206304",
"0.56193286",
"0.56161183",
"0.56125164"
] | 0.6580395 | 3 |
DELETE /solicitacao_tipos/1 DELETE /solicitacao_tipos/1.json | def destroy
@solicitacao_tipo.destroy
respond_to do |format|
format.html { redirect_to solicitacao_tipos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tip_so = TipSo.find(params[:id])\n @tip_so.destroy\n\n respond_to do |format|\n format.html { redirect_to tip_sos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipocliente = Tipocliente.find(params[:id])\n @tipocliente.destroy\n\n respond_to do |format|\n format.html { redirect_to tipoclientes_url }\n #format.json { head :ok }\n end\n end",
"def destroy\n @tb_solicitud.destroy\n respond_to do |format|\n format.html { redirect_to tb_solicituds_url, notice: 'Tb solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipovestuario.destroy\n respond_to do |format|\n format.html { redirect_to tipovestuarios_url, notice: 'Tipovestuario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiposveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitante.destroy\n respond_to do |format|\n format.html { redirect_to solicitantes_url, notice: 'Solicitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: \"Solicitud was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipos_contato.destroy\n respond_to do |format|\n format.html { redirect_to tipos_contatos_url, notice: 'Tipos contato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipomedalla = Tipomedalla.find(params[:id])\n @tipomedalla.destroy\n\n respond_to do |format|\n format.html { redirect_to tipomedallas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao.destroy\n respond_to do |format|\n format.html { redirect_to solicitacoes_url, notice: 'Solicitacao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao_pontual.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_pontuals_url, notice: 'Solicitacao pontual was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipocuentum.destroy\n respond_to do |format|\n format.html { redirect_to tipocuenta_url, notice: 'Tipocuentum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiposervico.destroy\n respond_to do |format|\n format.html { redirect_to tiposervicos_url, notice: 'Tiposervico was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipus_indicador.destroy\n respond_to do |format|\n format.html { redirect_to tipus_indicadors_url, notice: 'Tipus indicador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoplato.destroy\n respond_to do |format|\n format.html { redirect_to tipoplatos_url, notice: 'Tipoplato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipos_encuestum.destroy\n respond_to do |format|\n format.html { redirect_to tipos_encuesta_url, notice: 'Tipos encuestum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tip = Tip.find(params[:id])\n @tip.destroy\n\n respond_to do |format|\n format.html { redirect_to tips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_distribucion.destroy\n respond_to do |format|\n format.html { redirect_to tipos_distribuciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipomovifinanceiro.destroy\n respond_to do |format|\n format.html { redirect_to tipomovifinanceiros_url, notice: 'Tipomovifinanceiro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipos_dato.destroy\n respond_to do |format|\n format.html { redirect_to tipos_datos_url, notice: 'Tipos dato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiposcontrato = Tiposcontrato.find(params[:id])\n @tiposcontrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(tiposcontratos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_alerta = TipoAlerta.find(params[:id])\n @tipo_alerta.destroy\n\n respond_to do |format|\n format.html { redirect_to tipos_alertas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitador.destroy\n respond_to do |format|\n format.html { redirect_to solicitadors_url, notice: 'Solicitador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitudinforme.destroy\n respond_to do |format|\n format.html { redirect_to solicitudinformes_url, notice: 'Solicitudinforme was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tip.destroy\n respond_to do |format|\n format.html { redirect_to tip_url, notice: 'Tip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipomaquinat.destroy\n respond_to do |format|\n format.html { redirect_to tipomaquinats_url, notice: 'Tipomaquinat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao_repass.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_repasses_url, notice: \"Solicitacao repasse was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_negocio = TipoNegocio.find(params[:id])\n @tipo_negocio.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_negocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tip.destroy\n respond_to do |format|\n format.html { redirect_to tips_url, notice: 'Tip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tip.destroy\n respond_to do |format|\n format.html { redirect_to tips_url, notice: 'Tip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud_horario.destroy\n respond_to do |format|\n format.html { redirect_to solicitud_horarios_url, notice: 'Solicitud horario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipocambio.destroy\n respond_to do |format|\n format.html { redirect_to tipocambios_url, notice: 'Tipocambio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intranet_financeiro_tipos_cobanca.destroy\n respond_to do |format|\n format.html { redirect_to intranet_financeiro_tipos_cobancas_url, notice: \"Financeiro tipos cobanca was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecido.destroy\n respond_to do |format|\n format.html { redirect_to tecidos_url, notice: 'Tecido was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipotermo.destroy\n respond_to do |format|\n format.html { redirect_to tipotermos_url, notice: 'Tipotermo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n @denuncia_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to denuncia_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tipo_de_servicios_url, notice: 'Tipo de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evolucao_tipo.destroy\n respond_to do |format|\n format.html { redirect_to evolucao_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trnodo = Trnodo.find(params[:id])\n @trnodo.destroy\n\n respond_to do |format|\n format.html { redirect_to trnodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, Solicitud\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tattoo = Tattoo.find(params[:id])\n @tattoo.destroy\n\n respond_to do |format|\n format.html { redirect_to tattoos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taco.destroy\n respond_to do |format|\n format.html { redirect_to tacos_url, notice: 'Taco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_imposto.destroy\n respond_to do |format|\n format.html { redirect_to @empresa, notice: 'Tipo de imposto removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trabajo.destroy\n respond_to do |format|\n format.html { redirect_to cliente_url(@cliente), notice: 'Trabajo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_aposta.destroy\n respond_to do |format|\n format.html { redirect_to tipo_apostas_url, notice: 'Tipo aposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipocosto.destroy\n respond_to do |format|\n format.html { redirect_to tipocostos_url, notice: 'Tipocosto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @tipos_usuario.destroy\r\n respond_to do |format|\r\n format.html { redirect_to tipos_usuarios_url, notice: 'El nombre del tipo de usuario se eliminó corrctamente.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao_bloq.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_bloqs_url, notice: 'Solicitacao bloq was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tb_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tb_servicios_url, notice: 'Tb servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipomensaje = Tipomensaje.find(params[:id])\n @tipomensaje.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipomensajes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_agressor.destroy\n respond_to do |format|\n format.html { redirect_to tipo_agressores_url, notice: @@msgs }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao_enviada.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_enviadas_url, notice: 'Solicitacao enviada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @treinamento_ti.destroy\n respond_to do |format|\n format.html { redirect_to treinamentos_ti_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipp = Tipp.find(params[:id])\n @tipp.destroy\n\n respond_to do |format|\n format.html { redirect_to tipps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona_tipo = PersonaTipo.find(params[:id])\n @persona_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to persona_tipos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @titulacionesdoctipo = Titulacionesdoctipo.find(params[:id])\n @titulacionesdoctipo.destroy\n\n respond_to do |format|\n format.html { redirect_to(titulacionesdoctipos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_ventum.destroy\n respond_to do |format|\n format.html { redirect_to tipo_venta_url, notice: 'Tipo ventum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etnia = Etnia.find(params[:id])\n @etnia.destroy\n\n respond_to do |format|\n format.html { redirect_to etnias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @titulacao.destroy\n respond_to do |format|\n format.html { redirect_to titulacaos_path, notice: 'Titulo excluído com successo.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tangazo.destroy\n respond_to do |format|\n format.html { redirect_to tangazos_url, notice: 'Tangazo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @substancia.destroy\n respond_to do |format|\n format.html { redirect_to substancias_url, notice: 'Substancia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_contratos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_veiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipo_veiculos_url, notice: 'Tipo veiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anteproyecto_observacion.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_observaciones_url, notice: 'Anteproyecto observacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_persona.destroy\n respond_to do |format|\n format.html { redirect_to tipos_personas_url, notice: 'Tipo persona was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todoroute.destroy\n respond_to do |format|\n format.html { redirect_to todoroutes_url, notice: 'Todoroute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tattoo.destroy\n respond_to do |format|\n format.html { redirect_to tattoos_url, notice: 'Tattoo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipic.destroy\n respond_to do |format|\n format.html { redirect_to tipics_url, notice: 'Tipic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiempo.destroy\n respond_to do |format|\n format.html { redirect_to tiempos_url, notice: 'Tiempo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @troop_detail.destroy\n respond_to do |format|\n format.html { redirect_to troop_details_url, notice: 'Detalle tropa exitosamente borrado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tarifas_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Fue destruido con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n @core_tipo_unidade.destroy\n\n respond_to do |format|\n format.html { redirect_to core_tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_despesa.destroy\n respond_to do |format|\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n @tramos=Peticion.where(\"solicitudrecurso_id = ?\",@solicitudrecurso.id).to_a # busco todos los tramos que tenian el id\n @tramos.each {|tramo| tramo.destroy} # los elimino en cascada\n @solicitudrecurso.destroy\n \n respond_to do |format|\n format.html { redirect_to(solicitudrecursos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sitio_entrega = SitioEntrega.find(params[:id])\n @sitio_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to sitio_entregas_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n\n \n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @everydaytip.destroy\n respond_to do |format|\n format.html { redirect_to everydaytips_url, notice: 'Everydaytip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip_todo.destroy\n respond_to do |format|\n format.html { redirect_to trip_todos_url, notice: 'Trip todo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipos_movimiento = TiposMovimiento.find(params[:id])\n @tipos_movimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipos_movimientos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n @solicitudrecurso.destroy\n @tramos=Peticion.find_all_by_solicitudrecurso_id(@solicitudrecurso.id) # busco todos los tramos que tenian el id\n @tramos.each {|tramo| tramo.destroy} # los elimino en cascada\n\n respond_to do |format|\n format.html { redirect_to(solicitudrecursos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @telefononegocio = Telefononegocio.find(params[:id])\n @telefononegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to telefononegocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tatoo.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend"
] | [
"0.7579861",
"0.7466454",
"0.74196404",
"0.7383597",
"0.7359379",
"0.7359123",
"0.73443264",
"0.73396087",
"0.73336804",
"0.73320884",
"0.7324677",
"0.7316358",
"0.73079914",
"0.7290945",
"0.72845405",
"0.71892256",
"0.7168368",
"0.71579796",
"0.7135689",
"0.7111101",
"0.7103224",
"0.70938843",
"0.708521",
"0.7072122",
"0.7057565",
"0.7042497",
"0.7042392",
"0.7042116",
"0.702896",
"0.702896",
"0.702896",
"0.7019406",
"0.7019251",
"0.701735",
"0.701687",
"0.7011781",
"0.7001299",
"0.6995719",
"0.6995719",
"0.6992839",
"0.6989112",
"0.6983867",
"0.69809914",
"0.69734144",
"0.6970334",
"0.69643974",
"0.69640785",
"0.6959656",
"0.6946077",
"0.693926",
"0.693647",
"0.6932594",
"0.6915984",
"0.6910004",
"0.6901132",
"0.6900986",
"0.6896949",
"0.68967056",
"0.6892963",
"0.6888644",
"0.68824357",
"0.6881974",
"0.68719155",
"0.68662274",
"0.68654054",
"0.68644136",
"0.6863781",
"0.6862294",
"0.68621385",
"0.6855434",
"0.68528616",
"0.68499523",
"0.68495786",
"0.68489194",
"0.6842378",
"0.68418556",
"0.68400615",
"0.6839496",
"0.68334985",
"0.6830195",
"0.6828614",
"0.68264264",
"0.68256617",
"0.6823741",
"0.6822698",
"0.6819903",
"0.6818894",
"0.6815806",
"0.6814341",
"0.681372",
"0.6813368",
"0.6813132",
"0.68121845",
"0.68114257",
"0.6805931",
"0.6804856",
"0.68038094",
"0.6803079",
"0.6801633",
"0.679669"
] | 0.784042 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_solicitacao_tipo
@solicitacao_tipo = SolicitacaoTipo.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 solicitacao_tipo_params
params.require(:solicitacao_tipo).permit(:tipo)
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 valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\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 origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.62905645",
"0.6289235",
"0.6283876",
"0.62425834",
"0.62410337",
"0.6218672",
"0.62151134",
"0.62096137",
"0.6192354",
"0.6178057",
"0.6177618",
"0.61727077",
"0.6162073",
"0.6152049",
"0.61515594",
"0.61458135",
"0.6122875",
"0.61165285",
"0.6107696",
"0.6104097",
"0.6091097",
"0.6080201",
"0.60699946",
"0.6063739",
"0.60206395",
"0.60169303",
"0.60134894",
"0.601003",
"0.6007347",
"0.6007347",
"0.6001054",
"0.59997267",
"0.5997844",
"0.5991826",
"0.5991213",
"0.59911627",
"0.5980111",
"0.5967009",
"0.59597385",
"0.5958542",
"0.595787",
"0.5957425",
"0.59522784",
"0.5951228",
"0.59423685",
"0.5939385",
"0.5939122",
"0.5939122",
"0.59325653",
"0.5930178",
"0.59248054",
"0.59243476",
"0.59164625",
"0.59106",
"0.59101933",
"0.59084356",
"0.5905666",
"0.58975077",
"0.58974737",
"0.5895128",
"0.58946574",
"0.589308",
"0.58916",
"0.5885987",
"0.58838505",
"0.58792",
"0.58723736",
"0.58684355",
"0.58677715",
"0.5865701",
"0.5865538",
"0.5865288",
"0.586385",
"0.5862139",
"0.58614355",
"0.58593005",
"0.5857459",
"0.58541363",
"0.58536613",
"0.58520085",
"0.585011"
] | 0.0 | -1 |
GET /u_sers/1 GET /u_sers/1.json | def show
@u_ser = USer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @u_ser }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @u_sers = USer.all\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end",
"def index\n @uzsers = Uzser.all\n end",
"def set_u_ser\n @u_ser = USer.find(params[:id])\n end",
"def new\n @u_ser = USer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u_ser }\n end\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"def index\n @ussers = Usser.all\n end",
"def get_handle\n logger.debug \"Hoo ha!\"\n s = Swimmer.find(:all, :conditions => \"last = '#{params[:last]} and first like '#{params[:first]}'\").map {er|x| x.id }\n respond_to do |format|\n json { render s.to_json }\n end\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show_my_disposisi\n\t\t@user = UserDisposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend",
"def load_tailors\n\t\t@shop_name=params[:shop_name]\n\t\t@title=params[:title]\n\t\tuser = User.where(:user_type => \"tailor\", :shop_name => @shop_name, :title => @title).select(\"id\",\"username\",\"email\")\n\t\tif user.nil?\n\t\t\trender json: {message: \"No any tailor in this group\"}\n\t\telse\t\t\t\n\t\t \tdetails = []\n\t\t\tuser.each do |chat|\n\t\t\t\tdetails << { :id => chat.id, :type => chat.username, :email => chat.email}\n\t\t\tend\n\t\t\trender :json => details.to_json\t\n\t\tend\n\tend",
"def show_disposisi_user\n\t\t@user = Disposisi.where(user_id: params[:user_id]).order(id: :desc).limit(20)\n\t\trender json: @user\t\n\tend",
"def userReponses\n user=User.find(params[:userId])\n render :json=> user.response\n end",
"def users\n\t\t@recipes = Recipe.where('published = ?',1).find_by_user_id(params[:id])\n\t\trespond_with @recipes\t\n\tend",
"def show\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uset }\n end\n end",
"def index\n json_response(User.all) \n end",
"def index\n # 1 is for UserType : 'Professeur'\n @users = User.find_all_by_class_room_id_and_user_type_id(current_user.class_room, 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end",
"def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end",
"def search\n render json: User.first(10)\n end",
"def show\n @sluzby = Sluzby.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sluzby }\n end\n end",
"def get_users\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n response = RestClient.get \"#{@api_endpoint}/users?writerId=#{@writer_id}\", headers\n\n return response\n\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n @user = User.find(params[:id])\n @readings = @user.readings\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def index\n @creations = Creation.where(user_id: params[:user_id])\n\n render json: @creations\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n puts render json: @user.students, each_serializer: UserSerializer\n end",
"def show\n @user_sc = UserSc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_sc }\n end\n end",
"def select_user\n # @users = ['ichthala', 'wescarr17', 'seraphicmanta', 'tcclevela', 'antonwheel', 'horse_ebooks', 'catlandbooks']\n # @users.each_with_index do |user, index|\n # @users[index] = Twitter.user(user)\n # end\n\n @users = []\n\n while @users.count < 9\n offset = rand(Twitteruser.count)\n rand_sn = Twitteruser.first(:offset => offset).screen_name\n unless @users.find_index(rand_sn)\n @users << rand_sn\n end\n end\n\n @users << 'horse_ebooks'\n\n @users.each_with_index do |user, index|\n @users[index] = Twitter.user(user)\n end\n\n respond_to do |format|\n format.html\n format.json {render json: @users}\n end\n\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def index\n @uuids = Uuid.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: {payload: @uuids} }\n end\n end",
"def byUid\n @user = User.find(:all, :conditions => [ \"uid = ?\" , params[:id]])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def user\n render :json=> User.find(params[:id])\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end",
"def index\n @susu_memberships = SusuMembership.page(params[:page]).per(params[:per])\n\n render json: @susu_memberships\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end",
"def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def show\n @title = \"\"\n\n puts '====================== show'\n\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :user=>@user.as_json(:only => [:id, :name, :invitation_token, :notify, :buddy, :gender, :displayname], :methods => [:photo_url],\n :include => { \n :rounds => { }\n }\n ) \n } }\n end\n end",
"def show\n @userr = Userr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @userr }\n end\n end",
"def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"def getMerchants\n\tbegin\n\t\tresponse = RestClient.get('http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40')\n\trescue\n\t\tputs \"error retrieving response...\"\n\tend\n\n\tmerchants = JSON.parse(response)\n\treturn merchants\nend",
"def show\n @former_user = FormerUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @former_user }\n end\n end",
"def list_users\n self.class.get('/users')\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n @cadavre = Cadavre.find(params[:id])\n @users = @cadavre.sentences.map{|s| s.user}.uniq \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cadavre }\n end\n end",
"def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end",
"def show\n @roster = Roster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @roster }\n end\n end",
"def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end",
"def volunter_by_me\n @requests = @current_user.volunters.map(&:request)\n json_response(@requests)\n end",
"def show\n @rooster = Rooster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rooster }\n end\n end",
"def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end",
"def show\n #@service_request = ServiceRequest.find(params[:id])\n @the_creator = User.find_by_id(@service_request.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_request }\n end\n end",
"def show\r\n @usertable = Usertable.find(params[:id])\r\n # @user = User.find(session[:user_id])\r\n \r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @usertable }\r\n end\r\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def show\n @renter = Renter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @renter }\n end\n end",
"def find(username)\n response = client.get \"/users/#{username}\"\n response.code == 200 ? build(JSON.parse(response.body)) : nil\n end",
"def index\n @users = User.order(:idnum)\n respond_to do |format|\n format.html { render json: {:message => \"Here are the details of all #{@users.size} users.\", :users => @users }}\n end\n end",
"def index\n \n @users = User.page(params[:page]).per_page(14)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n \n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def users\n\t\trespond_with User.all\n\tend",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def byuser\n @evclient = Evclient.find(:first, :conditions => [ \"userid = ?\", params[:userid]])\n #@evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @evclient }\n end\n end",
"def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end",
"def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end",
"def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end",
"def users\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def users\n get('get_users')\n end",
"def index\n temp = current_user.id\n # Auf Methode warten, nur noch offene, in der Zukunft liegende Requests \n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def by_user\r\n user = params[:user] || nil\r\n streams = Stream.where(user_id: user)\r\n render json: streams\r\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def index\n @usrs = Usr.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @usrs }\n end\n end",
"def show\n @users = User.find(params[:id])\n @users = parsearUsuario(@users)\n end",
"def show\n rsa = Rsa.find_by id: params[:id];\n respond_to do |format|\n format.json {render json: {'n' => rsa.n , 'e' => rsa.e, 'd' => rsa.d}}\n end\n end",
"def students\n student_size = User.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n if current_offset + direction < student_size && current_offset + direction >= 0\n offset = current_offset + direction\n @students = User.all.offset(offset).take(10) \n render :json => @students\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\tend",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def list\n render json: User.all\n end",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def show\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slitter }\n end\n end",
"def index\n users = @fun.get_reposts.limit(5).reposters\n users.map! do |user|\n user = user.info_to_json\n user[:user_path] = user_path user[:login]\n user\n end\n render json: users\n end",
"def index\n users = User.all\n render json: users \n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def show\n @id = @my_team.team_id\n @team_name = Teams.find(@id)\n roster = RestClient.get(\"https://statsapi.web.nhl.com/api/v1/teams/#{@id}/roster\")\n @roster = JSON.parse(roster)[\"roster\"]\n end",
"def index\n users = User.all \n render json: users \n end",
"def all_users\n every_user =\n $all_posts.group_by { |row| row.name}\n .map { |row| row.first }\n render json: every_user\n end",
"def search\n users = Api.users.find(params)\n\n select2_format=(params[:f]=='s2')\n if select2_format\n hash = {\n :more => false,\n :results => users.map { |user| {:id => user.login, :text => \"#{user.name} (#{user.login})\"} }\n }\n else\n hash = {:users => users.map { |user| User.to_hash(user) }}\n end\n\n respond_to do |format|\n format.json { render :json => jsonp(hash) }\n format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'users') }\n end\n end",
"def showName\n render json: User.findByName(params[\"name\"])\n end",
"def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end",
"def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def get_users(request); end",
"def show\n @usersevent = Usersevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @usersevent }\n end\n end"
] | [
"0.72598606",
"0.64190686",
"0.61925536",
"0.6137131",
"0.6118909",
"0.58885694",
"0.58674437",
"0.584617",
"0.57275486",
"0.57150984",
"0.5712456",
"0.57095677",
"0.57087487",
"0.56723416",
"0.56693363",
"0.5663225",
"0.5655754",
"0.5607923",
"0.5603253",
"0.55927724",
"0.5592211",
"0.55823034",
"0.558114",
"0.5575995",
"0.5569424",
"0.5565434",
"0.55548966",
"0.5553174",
"0.5546716",
"0.5544432",
"0.55345875",
"0.55215746",
"0.5514871",
"0.5477587",
"0.5468556",
"0.5465716",
"0.5464541",
"0.54612017",
"0.5455981",
"0.54495114",
"0.5448347",
"0.544423",
"0.54290426",
"0.5418323",
"0.5417667",
"0.5417614",
"0.540723",
"0.5399594",
"0.53992647",
"0.5395561",
"0.53937864",
"0.53922147",
"0.53866607",
"0.5381823",
"0.5380576",
"0.53788304",
"0.5376505",
"0.53751296",
"0.53678393",
"0.5364101",
"0.53595763",
"0.53555053",
"0.535183",
"0.5348717",
"0.5346407",
"0.53460896",
"0.53451246",
"0.53376955",
"0.53352445",
"0.53350484",
"0.533098",
"0.5327401",
"0.53258824",
"0.5323538",
"0.5323524",
"0.5321769",
"0.53207016",
"0.53145695",
"0.5312111",
"0.53079367",
"0.5307763",
"0.5307242",
"0.53064924",
"0.5306322",
"0.53054637",
"0.5305159",
"0.53026724",
"0.53022414",
"0.5302038",
"0.52967536",
"0.52944505",
"0.5293975",
"0.5292527",
"0.52900213",
"0.5287628",
"0.52870744",
"0.52870345",
"0.52868354",
"0.5286709",
"0.5284291"
] | 0.669042 | 1 |
GET /u_sers/new GET /u_sers/new.json | def new
@u_ser = USer.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @u_ser }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end",
"def new\n @usr = Usr.new\n \n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @usr }\n format.json { render :json => @usr }\n end\n end",
"def new\n @uset = Uset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uset }\n end\n end",
"def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end",
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end",
"def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def newent\n @user = User.new\n respond_to do |format|\n format.html # newent.html.erb\n format.json { render :json => @user }\n end\n end",
"def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n #@user = User.new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\r\n @usertable = Usertable.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @usertable }\r\n end\r\n end",
"def new\n @spieler = Spieler.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spieler }\n end\n end",
"def new\n p 'new called'\n @user = User.new\n\n p \"#{@user}\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end",
"def new\n @srsa = Srsa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @srsa }\n end\n end",
"def new\n @ministerio = Ministerio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ministerio }\n end\n end",
"def new\n @user = User.new\n render :json => @user\n end",
"def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end",
"def new\n @suplente = Suplente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suplente }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @sluzby = Sluzby.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sluzby }\n end\n end",
"def new\n @user = User.new\n\n render json: @user\n end",
"def new\n @spdatum = Spdatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spdatum }\n end\n end",
"def new\n @recinto = Recinto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recinto }\n end\n end",
"def new\n @seguro = Seguro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguro }\n end\n end",
"def new\r\n @salle = Salle.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end",
"def new\n @users = User.all\n render json: @users\n end",
"def new\n @sotrudniki = Sotrudniki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sotrudniki }\n end\n end",
"def new\n @sala = Sala.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sala }\n end\n end",
"def new\n @seguidore = Seguidore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def new\n @pessoa_receber = PessoaReceber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def new\n @surname = Surname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @surname }\n end\n end",
"def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sm }\n end\n end",
"def new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @human = Human.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end",
"def new\n @lector = Lector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lector }\n end\n end",
"def new\n @sezione = Sezione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sezione }\n end\n end",
"def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end",
"def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end",
"def new\n @usr = Usr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usr }\n end\n end",
"def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end",
"def new\n @human = Human.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end",
"def new\n @utente = Utente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @utente }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def create\n @u_ser = USer.new(params[:u_ser])\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render json: @u_ser, status: :created, location: @u_ser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n get_list\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @user }\n end\n end",
"def new\n # @updaterete = Updaterete.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @updaterete }\n end\n end",
"def new\n @user = ::User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.json { render json: @user }\n format.html # new.html.erb\n end\n end",
"def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spiel }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end"
] | [
"0.7417012",
"0.71170324",
"0.7092639",
"0.70402247",
"0.7038747",
"0.69986254",
"0.6989611",
"0.6915032",
"0.69037205",
"0.68724126",
"0.68586445",
"0.685825",
"0.68405515",
"0.68140286",
"0.680881",
"0.6794129",
"0.67895055",
"0.67843366",
"0.67783564",
"0.67762804",
"0.67507356",
"0.674956",
"0.67310715",
"0.6721438",
"0.6717827",
"0.67165464",
"0.6707969",
"0.6704191",
"0.67033833",
"0.6701698",
"0.67006636",
"0.6698987",
"0.66973525",
"0.6694397",
"0.66910076",
"0.6688399",
"0.66883075",
"0.66813534",
"0.66782206",
"0.66782206",
"0.66782147",
"0.66755146",
"0.667127",
"0.6663278",
"0.666248",
"0.6652964",
"0.6650354",
"0.6650354",
"0.66427594",
"0.66383415",
"0.66383415",
"0.66383415",
"0.6638092",
"0.66369843",
"0.6633131",
"0.6632141",
"0.66297626",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461",
"0.6629461"
] | 0.7504908 | 0 |
POST /u_sers POST /u_sers.json | def create
@u_ser = USer.new(params[:u_ser])
respond_to do |format|
if @u_ser.save
format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }
format.json { render json: @u_ser, status: :created, location: @u_ser }
else
format.html { render action: "new" }
format.json { render json: @u_ser.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @u_ser = USer.new(u_ser_params)\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render :show, status: :created, location: @u_ser }\n else\n format.html { render :new }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @u_sers = USer.all\n end",
"def create\n @uzser = Uzser.new(uzser_params)\n\n respond_to do |format|\n if @uzser.save\n format.html { redirect_to @uzser, notice: 'Uzser was successfully created.' }\n format.json { render :show, status: :created, location: @uzser }\n else\n format.html { render :new }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @renter = Renter.new(params[:renter])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @renter.save\n @users.each do |user|\n RenterMailer.registration_welcome(@renter, user).deliver\n Renter.increment_counter(\"times_forwarded\", @renter.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @renter, :status => :created, :location => @renter }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def create\n @sesiune = Sesiune.new(sesiune_params)\n\n respond_to do |format|\n if @sesiune.save\n\n # duplic temele si domeniile din ultima sesiune si le adaug in baza de date cu sesiune_id asta pe care tocmai am creat-o\n @ultima_sesiune = Sesiune.where(este_deschisa: false).last\n Domeniu.where(sesiune_id: @ultima_sesiune.id).each do |dom|\n nou_dom = Domeniu.create(nume: dom.nume, descriere: dom.descriere, user_id: dom.user_id, sesiune_id: @sesiune.id)\n Tema.where(sesiune_id: @ultima_sesiune.id).where(domeniu_id: dom.id).each do |tema|\n Tema.create(nume: tema.nume, descriere: tema.descriere, domeniu_id: nou_dom.id, este_libera: true, user_id: tema.user_id, sesiune_id: @sesiune.id)\n # ce faci dc user_id-ul temei este un student care a terminat? si th i se desfiinteaza contul?\n end\n end\n\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sesiune }\n else\n format.html { render action: 'new' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usser = Usser.new(usser_params)\n\n respond_to do |format|\n if @usser.save\n format.html { redirect_to @usser, notice: 'Usser was successfully created.' }\n format.json { render :show, status: :created, location: @usser }\n else\n format.html { render :new }\n format.json { render json: @usser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @u_ser = USer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u_ser }\n end\n end",
"def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end",
"def users(name, args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&name#{name}\"\n path = __method__.to_s\n http_post(path, query)\n end",
"def set_u_ser\n @u_ser = USer.find(params[:id])\n end",
"def create\n @serie = Serie.new(serie_params)\n\n unless a = Author.find_by_id(params[:author_id]) || Author.find_by_name(params[:author_name].strip)\n a = Author.new\n a.name = params[:author_name].strip\n a.save!\n end\n @serie.authors << a\n\n unless m = Magazine.find_by_id(params[:magazine_id]) || Magazine.find_by_name(params[:magazine_name].strip)\n m = Magazine.new\n m.name = params[:magazine_name].strip\n m.publisher = params[:magazine_publisher].strip\n m.save!\n end\n @serie.magazines << m if m\n\n if params[:book_ids]\n params[:book_ids].each do |bid|\n @serie.books << Book.find(bid)\n end\n end\n\n respond_to do |format|\n if @serie.save\n format.html { redirect_to(root_path, :notice => 'Serie was successfully created.') }\n format.xml { render :xml => @serie, :status => :created, :location => @serie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def u_ser_params\n params.require(:u_ser).permit(:name, :email)\n end",
"def create\n\n @semestre = current_user.semestres.new(semestre_params)\n\n respond_to do |format|\n if @semestre.save\n format.html { redirect_to semestres_url, notice: 'Semestre was successfully created.' }\n format.json { render :show, status: :created, location: @semestre }\n else\n format.html { render :new }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @uzsers = Uzser.all\n end",
"def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end",
"def new\n @serie = current_user.series.build\n @serie.genres.build\n @serie.countries.build\n @serie.languages.build\n @serie.subtitles.build\n @serie.actors.build\n @serie.directors.build\n end",
"def suscriber_wm\n\t\turi = URI(\"http://staging.benchprep.com/api/v1/test/fixtures.json\")\t\n\n\t\tres = Net::HTTP.post_form(uri, 'email' => '[email protected]&enrollments_persona=subscriber&devices_persona=web_and_mobile')\n\t\t# write this output to a file\n\t\toutput = File.open( \"spec/fixtures/sp_wm_persona.json\",'w' ){|f| \n\t\t\tf.flock(File::LOCK_EX)\n\t\t\tf.write(res.body)\n\t\t}\n\n\t\t# Now parse this string as json\n\t\tjson = File.read('spec/fixtures/sp_wm_persona.json')\n\t\templs = JSON.parse(json)\n\n\t\treturn empls #pretty printed output\n\tend",
"def create\n @user = User.new(params[:user])\n\n # RestClient.post(\"http://sms.ru/sms/send\", :api_id => \"9d3359eb-9224-2384-5d06-1118975a2cd2\", :to => \"79051916188\", :text => \"Ваш ID на велопробег #{@user.id}\")\n\n respond_to do |format|\n if @user.save\n\n \n\n format.html { redirect_to edit_user_path(@user), notice: 'Участник успешно создан!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { redirect_to root_path,\n notice: 'Поздравляем! Вы подали заявку на регистрацию. Для подтверждения регистрации \n необходимо внести взнос.' }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def new\n @user = User.new\n sem = Seminar.all\n @seminars = Hash.new\n @topics = Hash.new\n sem.each do |t|\n @seminars[t.id] = t;\n @topics[t.id] = Hash.new\n t.topics.each do |u|\n @topics[t.id][u.id] = u;\n @user.selections.build(:seminar_id=>t.id, :topic_id=>u.id)\n end\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def create\n @uder = Uder.new(uder_params)\n\n respond_to do |format|\n if @uder.save\n format.html { redirect_to @uder, notice: 'Uder was successfully created.' }\n format.json { render action: 'show', status: :created, location: @uder }\n else\n format.html { render action: 'new' }\n format.json { render json: @uder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sejour = current_user.sejours.build(sejour_params)\n\n respond_to do |format|\n if @sejour.save\n format.html { redirect_to @sejour, notice: 'Le sejour a bien ete cree.' }\n format.json { render :show, status: :created, location: @sejour }\n else\n format.html { render :new }\n format.json { render json: @sejour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sensor_list\n #this is making a post request by intializing the restclient gem with RestClient::Request.new to get sensors list\n #if the call is successful it provide the response.body\n #if fails and returns a 400 with the error.\n response = RestClient::Request.new({\n method: :post,\n url:\"https://api.samsara.com/v1/sensors/list?access_token=#{Rails.application.credentials.secret_key}\",\n payload:{ \"groupId\": 32780 }.to_json,\n headers: { :accept => :json, content_type: :json }\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, (response.to_json) ]\n when 200\n [ :success, (response.to_json) ]\n else\n fail \"Invalid response #{response} received.\"\n end\n # here I setting the body to an elemnet that will be availble in the views.\n @sensor_list = response.body\n end\n end",
"def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend",
"def create\n @souvenir = Souvenir.new(souvenir_params)\n\n respond_to do |format|\n if @souvenir.save\n format.html { redirect_to @souvenir, notice: 'Souvenir was successfully created.' }\n format.json { render json: { user: @souvenir, status: 200, description: 'Souvenir was successfully created.' }, status: :ok }\n else\n format.html { render :new }\n format.json { render json: { user: @souvenir, status: 500, description: 'Internal server error : faliled to save' }, status: :internal_server_error }\n end\n end\n end",
"def create\n @pessoa_receber = PessoaReceber.new(params[:pessoa_receber])\n @pessoa_receber.user_id = current_user.id\n respond_to do |format|\n if @pessoa_receber.save\n format.html { redirect_to @pessoa_receber, :notice => 'Pessoa receber was successfully created.' }\n format.json { render :json => @pessoa_receber, :status => :created, :location => @pessoa_receber }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pessoa_receber.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n\t @recipient_array = User.all.map &:nick\n @postum = Postum.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @postum }\n end\n end",
"def create\n @siritori = Siritori.new(siritori_params)\n\n respond_to do |format|\n if @siritori.save\n format.html { redirect_to @siritori, notice: 'Siritori was successfully created.' }\n format.json { render :show, status: :created, location: @siritori }\n else\n format.html { render :new }\n format.json { render json: @siritori.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(user,pass,firstname,lastname,sso_provider)\n\n # test_user = '[email protected]'\n # pass = 'akbvgdrz77'\n # firstname = 'J'\n # lastname = 'T'\n\n values = \"{\\\"writerId\\\": \\\"#{@writer_id}\\\", \\\"email\\\": \\\"#{user}\\\", \\\"password\\\": \\\"#{pass}\\\", \\\"firstName\\\": \\\"#{firstname}\\\", \\\"lastName\\\": \\\"#{lastname}\\\", \\\"ssoProvider\\\": \\\"#{sso_provider}\\\"}\"\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n begin\n response = RestClient.post \"#{@api_endpoint}/users\", values, headers\n\n rescue Exception => msg\n\n puts msg\n #manager.clean_csv(variable_file,message)\n #manager.set_existing_variable_bulk(variable_file,$gd_pid)\n #puts message\n end\n\n return response\n\n end",
"def create\n @user = User.new(user_params)\n #require 'json'\n respond_to do |format|\n if @user.save\n if @user.role == \"docteur\"\n @doc = Doctor.new\n @doc.user_id = @user.id\n @doc.name = @user.name\n @doc.city = @user.cite\n @doc.date_of_birth = @user.date_of_birth\n @doc.address = @user.adress\n @doc.country = @user.country\n if @doc.save!\n flash[:notice] = 'Médecin enregistré avec succes.'\n else\n flash[:error] = \"Une erreur s'est produite.\"\n end\n\n \n\n # @all = Doctor.all\n # File.open(\"public/test.json\",\"w\") do |f|\n # f.write(@all.to_json)\n #end\n\n end\n\n UserMailer.welcome_email(@user).deliver_now\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n \n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suscriber = Suscriber.new(suscriber_params)\n\n respond_to do |format|\n if @suscriber.save\n format.html { redirect_to suscribe_path, notice: t(:suscribed) }\n format.json { render :show, status: :created, location: suscribe_path }\n else\n format.html { redirect_to suscribe_path, alert: t(:suscriber_exist)}\n format.json { render json: @suscriber.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @singer = Singer.new(singer_params)\n\n respond_to do |format|\n if @singer.save\n format.html { redirect_to @singer, notice: \"Singer was successfully created.\" }\n format.json { render :show, status: :created, location: @singer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @singer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end",
"def create\n @semestre = Semestre.new(semestre_params)\n\n respond_to do |format|\n if @semestre.save\n format.html { redirect_to @semestre, notice: 'Semestre was successfully created.' }\n format.json { render :show, status: :created, location: @semestre }\n else\n format.html { render :new }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def grabar_ensambladora\n # puts 'AQUI'\n @ensambladora = Ensambladora_vehiculos.new\n @usuario = Usuario.new\n @rif=params[:rif]\n @nombre=params[:nombre]\n @correo=params[:correo]\n @telefono=params[:telefono]\n @ciudad=params[:ciudad]\n @direccion=params[:direccion]\n @marca=params[:marca]\n #------\n @nombre_usuario=params[:nombre_usuario]\n @contrasena=params[:contrasena]\n # puts ''+@nombre_usuario+''\n @usuario.grabar_usuario_ensambladora(@nombre_usuario, @contrasena);\n # puts '+++++++++++++++++++++++++++++++++++++++++++++++++++++++metio usuario'\n @ensambladora.grabar_ensambladora(@rif,@nombre,@correo,@telefono,@ciudad,@direccion,@marca,@nombre_usuario)\n render :text => $tirajson\n end",
"def create\n @sluzby = Sluzby.new(params[:sluzby])\n\n respond_to do |format|\n if @sluzby.save\n format.html { redirect_to @sluzby, notice: 'Sluzby was successfully created.' }\n format.json { render json: @sluzby, status: :created, location: @sluzby }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sluzby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @souvenior = Souvenior.new(souvenior_params)\n\n respond_to do |format|\n if @souvenior.save\n format.html { redirect_to root_path, notice: 'Souvenior was successfully created.' }\n format.json { render :show, status: :created, location: @souvenior }\n else\n format.html { render :new }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def new\r\n @usertable = Usertable.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @usertable }\r\n end\r\n end",
"def create\n @buyer = Buyer.new(params[:buyer])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @buyer.save\n @users.each do |user|\n BuyerMailer.registration_welcome(@buyer, user).deliver\n Buyer.increment_counter(\"times_forwarded\", @buyer.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @buyer, :status => :created, :location => @buyer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @buyer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @duer = Duer.new(duer_params)\n\n respond_to do |format|\n if @duer.save\n format.html { redirect_to @duer, notice: 'Duer was successfully created.' }\n format.json { render :show, status: :created, location: @duer }\n else\n format.html { render :new }\n format.json { render json: @duer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def uf\n api_url = \"https://mindicador.cl/api/uf/#{(params[:date])}\"\n response = HTTParty.get(api_url)\n responsetohash = JSON.parse(response.read_body)\n if responsetohash['serie'][0].nil?\n return render json: {mensaje:\"Valor no existe en esa fecha\"}\n else \n if request.headers['X-CLIENT'].present?\n Client.create(name: request.headers['X-CLIENT'], request_date: \"#{params[:date]}\", ufvalue: responsetohash['serie'][0]['valor'] )\n render json: responsetohash['serie'][0]['valor']\n else\n return render json: {mensaje:\"falta colocar key = X-CLIENT y en Header su nombre de cliente\"}\n end\n end\n end",
"def create\n @serie_detalle = SerieDetalle.new(serie_detalle_params)\n\n respond_to do |format|\n if @serie_detalle.save\n format.html { redirect_to @serie_detalle, notice: 'Serie detalle was successfully created.' }\n format.json { render :show, status: :created, location: @serie_detalle }\n else\n format.html { render :new }\n format.json { render json: @serie_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @snail = Snail.new(name: params[:snail][:name], owner: params[:snail][:owner], description: params[:snail][:description], speed: Random.new.rand(1..10), endurance: Random.new.rand(1..10), motivation: Random.new.rand(1..10), win: 0, lose: 0)\n\n respond_to do |format|\n if @snail.save\n format.html { redirect_to @snail, notice: 'Snail was successfully created.' }\n format.json { render :show, status: :created, location: @snail }\n else\n format.html { render :new }\n format.json { render json: @snail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serie = Serie.new(params[:serie])\n\n respond_to do |format|\n if @serie.save\n format.html { redirect_to(niveis_ensino_serie_url(@nivel,@serie) , :notice => 'Serie cadastrado com sucesso.') }\n format.xml { render :xml => @serie, :status => :created, :location => @serie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_snack\n response = RestClient.post SNACKS_URL, {name: @suggestion.name, location: @suggestion.location}.to_json, content_type: :json\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end",
"def create\n @user = User.new(thriver_params)\n base = 'Failed to save the Thriver. '\n respond_to do |format|\n if @user.save\n flash[:success] = 'The Thriver was successfully created.'\n format.html { redirect_to admins_thriver_url(@user) }\n format.json { render json: { rows: [@user.marshall], status: 200, total: 1 } }\n else\n flash[:error] = 'An error occured while creating the Thriver.'\n format.html { render action: \"new\", alert: base + @user.errors.full_messages.to_sentence + \".\" }\n format.json { render json: { errors: @user.errors, status: :unprocessable_entity } }\n end\n end\n end",
"def create\n @u = U.new(params[:u])\n\n respond_to do |format|\n if @u.save\n format.html { redirect_to edit_u_path @u, notice: 'U was successfully created.' }\n # format.json { render json: @u, status: :created, location: @u }\n else\n format.html { render action: \"new\" }\n format.json { render json: @u.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n\t\n respond_to do |format|\n if @user.save\n\t url = \"http://tagnart.com/rdc/\"+params[:url]\n\t @tag = @user.tags.new(:url => url, :data => params[:data])\n\t\tif @tag.save \n\t\t\tflash[:notice] = \"User #{@user.email} was successfully created.\"\n\t\t\tformat.html { redirect_to :action=>'index' }\n\t\t\tformat.json { render json: @user, status: :created, location: @user } \n\t\telse\n\t\t\tputs \"User #{@user.email} was not successfully created.\"\n\t\tend\n\t else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @reunion = Reunion.new(params[:reunion])\n asistente_ids = params[:asistente_ids]\n respond_to do |format|\n unless asistente_ids.nil? or asistente_ids.size < 2 then\n if @reunion.save\n\n asistente_ids.each do |asistente|\n @Asistente = ReunionsEstudiantes.new(:reunion_id => @reunion.id, :estudiante_id => asistente, :finalizado => false)\n @Asistente.save\n\n estudiante = Estudiante.find(:all, :conditions => [ \"id = ?\", asistente ])\n\n if asistente.to_f < 100 then\n datosAsist = {:nombre => estudiante[0].nombreEstudiante,\n :correo => estudiante[0].correoElectronico + \"@uniandes.edu.co\"}\n else\n profesor = Profesor.find(asistente)\n correo = \"[email protected]\"\n datosAsist = {:nombre => profesor.nombre, :correo => correo}\n end\n\n UserMailer.notificar_reunion(datosAsist, @reunion).deliver\n end\n\n format.html { redirect_to @reunion, notice: 'Reunion creada exitosamente.' }\n format.json { render json: @reunion, status: :created, location: @reunion }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @reunion.errors, status: :unprocessable_entity }\n end\n else\n @reunion.errors[:estudiante_ids] = \"Seleccione al menos dos asistentes a la reunión\"\n format.html { render action: \"new\" }\n format.json { render json: @reunion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitacao_repass = SolicitacaoRepasse.new(solicitacao_repasse_params)\n @entregas_externas = EntregaExterna.all\n @entregas_externas_usuario = []\n @entregas_externas.each { |entrega|\n if !@current_user.isMorador || entrega.encomenda.usuario.id == @current_user.id\n @entregas_externas_usuario.push(entrega)\n end\n }\n\n respond_to do |format|\n if @solicitacao_repass.save\n format.html { redirect_to @solicitacao_repass, notice: \"Solicitacao repasse was successfully created.\" }\n format.json { render :show, status: :created, location: @solicitacao_repass }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @solicitacao_repass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blocker = user.blocker.new(blocker_params)\n @team = Team.find(session[:team_id])\n @users = Session.get_users(params[:user_ids].map{|i| i.to_i})\n @session.tag_list = get_user_first_names(@users)\n respond_to do |format|\n if @blocker.save\n format.html { redirect_to @blocker, notice: 'Blocker was successfully created.' }\n format.json { render :show, status: :created, location: @blocker }\n else\n format.html { render :new }\n format.json { render json: @blocker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n client= Client.new\n client.cedula= params[:cedula]\n client.sector= params[:sector]\n client.nombre= params[:nombre]\n client.telefono= params[:telefono]\n client.pagina= params[:pagina]\n client.direccion= params[:direccion]\n if client.save\n render(json: client, status: 201 , location: client)\n else \n render(json: client.errors, status: 422)\n end\n end",
"def create\n @sanchaypatra = current_user.sanchaypatras.new(sanchaypatra_params)\n @sanchaypatra.generate_tokens\n\n respond_to do |format|\n if @sanchaypatra.save\n format.html { redirect_to sanchaypatras_url, notice: 'Sanchaypatra was successfully created.' }\n format.json { render :show, status: :created, location: @sanchaypatra }\n else\n format.html { render :new }\n format.json { render json: @sanchaypatra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postUser( email, user_id, first_name, last_name, active, trust, creation_date, user_type, social_network, social_network_id, reseller_admin_masheryid, group_id, admin_upgrader)\n params = Hash.new\n params['email'] = email\n params['user_id'] = user_id\n params['first_name'] = first_name\n params['last_name'] = last_name\n params['active'] = active\n params['trust'] = trust\n params['creation_date'] = creation_date\n params['user_type'] = user_type\n params['social_network'] = social_network\n params['social_network_id'] = social_network_id\n params['reseller_admin_masheryid'] = reseller_admin_masheryid\n params['group_id'] = group_id\n params['admin_upgrader'] = admin_upgrader\n return doCurl(\"post\",\"/user\",params)\n end",
"def create\n\n @salle = current_user.salles.new(salle_params)\n\n respond_to do |format|\n if @salle.save\n format.html { redirect_to salles_url, notice: 'Salle was successfully created.' }\n format.json { render :show, status: :created, location: @salle }\n else\n format.html { render :new }\n format.json { render json: @salle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @salle = Salle.new(params[:salle])\r\n\r\n respond_to do |format|\r\n if @salle.save\r\n format.html { redirect_to @salle, notice: 'Salle was successfully created.' }\r\n format.json { render json: @salle, status: :created, location: @salle }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @salle.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end",
"def create\n @sinistro = Sinistro.new(sinistro_params)\n\n respond_to do |format|\n if @sinistro.save\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully created.' }\n format.json { render :show, status: :created, location: @sinistro }\n else\n format.html { render :new }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def volunter_by_me\n @requests = @current_user.volunters.map(&:request)\n json_response(@requests)\n end",
"def create\n @saler = Saler.new(saler_params)\n\n respond_to do |format|\n if @saler.save\n format.html { redirect_to @saler, notice: 'Saler was successfully created.' }\n format.json { render :show, status: :created, location: @saler }\n else\n format.html { render :new }\n format.json { render json: @saler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uset = Uset.new(params[:uset])\n\n respond_to do |format|\n if @uset.save\n format.html { redirect_to @uset, notice: 'Uset was successfully created.' }\n format.json { render json: @uset, status: :created, location: @uset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # byebug\n @survey_creator = SurveyCreator.create(survey_creator_params)\n if @survey_creator.valid?\n wristband = encode_token({ survey_creator_id: @survey_creator.id })\n render json: { survey_creator: SurveyCreatorSerializer.new(@survey_creator), token: wristband }\n else\n render json: { error: 'Invalid username or password' }\n end\n end",
"def create\n @spieler = Spieler.new(params[:spieler])\n\n respond_to do |format|\n if @spieler.save\n format.html { redirect_to @spieler, notice: 'Spieler was successfully created.' }\n format.json { render json: @spieler, status: :created, location: @spieler }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spieler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n if params[\"allergens\"] != nil\n params[\"allergens\"].each do |a|\n if Ingredient.find_by_name(a) == nil\n @ingredient = Ingredient.create({:name => a})\n Useringredient.create({:user_id => @user.id, :allergen_id => @ingredient.id})\n else\n @ingredient = Ingredient.find_by_name(a)\n Useringredient.create({:user_id => @user.id, :allergen_id => @ingredient.id})\n end\n end\n end\n session[\"user_id\"] = @user.id\n format.html { redirect_to '/', notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n puts request.body.string\n\n if request.body.string.include? %q[\"id\"]\n render json: %q[{\"error\": \"No se puede crear usuario con id\"}], status: 400\n else\n @usuario = Usuario.new(usuario_params)\n #Tuve que hacerlo asi, pq por alguna razon no me dejaba de la forma tradicional!\n #@usuario = Usuario.new\n #@usuario.usuario = params[:usuario]\n #@usuario.nombre = params[:nombre]\n #@usuario.apellido = params[:apellido]\n #@usuario.twitter = params[:twitter]\n\n\n respond_to do |format|\n if @usuario.save\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n #format.html { render :new }\n format.json { render json: @usuario.errors, status: 404}# status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @seihinn = Seihinn.new(seihinn_params)\n\n respond_to do |format|\n if @seihinn.save\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully created.\" }\n format.json { render :show, status: :created, location: @seihinn }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @short_message = ShortMessage.new(short_message_params)\n\n client = GlobeLabs.new\n target = @short_message.target\n if target.present?\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n\n recepients = params[:recepients]\n Rails.logger.info(\"==== params:#{params.inspect}\")\n if recepients.present?\n Rails.logger.info(\"==== params:#{params[:recepients].inspect}\")\n recepients.each do |cell_no|\n @short_message = ShortMessage.new(short_message_params)\n @short_message.target = cell_no\n if @short_message.save\n resp = client.send_sms(@short_message)\n Rails.logger.info(\"=== savon client resp: #{resp.inspect}\")\n end\n end\n end\n\n respond_to do |format|\n if @short_message.save\n format.html { redirect_to short_messages_path, notice: 'Short message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @short_message }\n else\n format.html { render action: 'new' }\n format.json { render json: @short_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usuario_seguidor = UsuarioSeguidor.new(usuario_seguidor_params)\n\n respond_to do |format|\n if @usuario_seguidor.save\n format.html { redirect_to @usuario_seguidor, notice: 'Usuario seguidor was successfully created.' }\n format.json { render :show, status: :created, location: @usuario_seguidor }\n else\n format.html { render :new }\n format.json { render json: @usuario_seguidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usesr = Usesr.new(usesr_params)\n\n respond_to do |format|\n if @usesr.save\n format.html { redirect_to @usesr, notice: 'Usesr was successfully created.' }\n format.json { render action: 'show', status: :created, location: @usesr }\n else\n format.html { render action: 'new' }\n format.json { render json: @usesr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @socio_serasa = SocioSerasa.new(socio_serasa_params)\n\n respond_to do |format|\n if @socio_serasa.save\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_serasa }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sluzby = Sluzby.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sluzby }\n end\n end",
"def create\n @store = Store.new(store_params)\n @store.commerce = @commerce\n @seller = Seller.new\n respond_to do |format|\n if @store.save\n @seller.store=@store\n @seller.commerce = @commerce\n @seller.user_id=current_user.id\n @seller.slug=current_user.cedula\n puts \"DATOS DE VENDEDOR *******\"\n puts @seller.to_json\n @seller.save\n format.html { redirect_to owner_commerce_stores_path(@store.commerce.slug), notice: 'Tienda creada exitosamente.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gradework = Gradework.new(gradework_params)\n\n if params.has_key?(:students) and params[:students] != [\"\"]\n students = params[:students]\n @gradework.users << User.find(students)\n end\n\n if params.has_key?(:juries) and params[:juries] != [\"\"]\n juries = params[:juries]\n @gradework.users << User.find(juries)\n end\n\n if params.has_key?(:directors) and params[:directors] =! \"\"\n directors = params[:directors]\n @gradework.users << User.find(directors)\n end\n\n respond_to do |format|\n if @gradework.save!\n format.html { redirect_to @gradework, notice: 'La tesis se creó correctamente' }\n format.json { render :show, status: :created, location: @gradework }\n else\n format.html { redirect_to @gradework, notice: 'La tesis no se pudo crear correctamente' }\n format.json { render json: @gradework.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eou = Eou.new(params[:eou])\n\n respond_to do |format|\n if @eou.save\n format.html { redirect_to @eou, :notice => 'Eou was successfully created.' }\n format.json { render :json => @eou, :status => :created, :location => @eou }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @asesor = Asesor.new(params[:asesor])\n\n respond_to do |format|\n if @asesor.save\n format.html { redirect_to @asesor, notice: 'Asesor was successfully created.' }\n format.json { render json: @asesor, status: :created, location: @asesor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asesor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scn_users\n\t\tusers = User.all\n\t\t#checking users is present or not.\n\t if users.present?\n\t \trender :json=> {success: true, \"users\" => users.as_json('question_data') }\n\t # render json: { success: true, response: @questions.map{ |f| QuestionSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Users are not present\" },:status=> 203\n\t end\n\tend",
"def new\n @safra = Safra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra }\n end\n end",
"def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugerencia = Sugerencia.new(params[:sugerencia])\n\n respond_to do |format|\n if @sugerencia.save\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' }\n format.json { render :json => @sugerencia, :status => :created, :location => @sugerencia }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n param_tags = params[:episode][:tags_list]\n params[:episode].delete(:tags_list)\n @episode = Episode.new(episode_params)\n @episode.season_id = @season.id\n @episode.update_tags(param_tags, @episode)\n\n\n\n respond_to do |format|\n if @episode.save\n series = Serial.find_by_id(@season.serial_id)\n User.all.each do |u|\n if u.serials.include?(series)\n #UserMailer.new_episode(u).deliver\n end\n end\n format.html { redirect_to [@serial,@season,@episode], notice: 'Episode was successfully created.' }\n format.json { render action: 'show', status: :created, location: @episode }\n else\n format.html { render action: 'new' }\n format.json { render json: @episode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n if params[:user][:app] == \"instainvoice\"\n options = {:body => {:user => {\n :email => params[:user][:email], :password => params[:user][:password], \n :referrer => params[:user][:referrer], :source => \"InstaInvoice\"}\n }\n \n }\n resp = HTTParty.post(\"http://billing.breeasy.com/api/v1/users.json\", options)\n #raise resp.body.inspect\n retval = JSON.parse(resp.body)\n elsif params[:user][:app] == \"bfsb\"\n \n options = {:body => {:user => {:email => params[:user][:email], :password => params[:user][:password],\n :first_name => params[:user][:first_name], :last_name => params[:user][:last_name],\n :title => params[:user][:title],\n :username => params[:user][:username],:refferal_code => params[:user][:referral_code]}\n },\n :query => {:plan_id => params[:plan_id]}\n }\n resp = HTTParty.post(\"http://app.breeasy.com/api/v1/users.json\", options)\n retval = JSON.parse(resp.body)\n \n end\n # user = User.find 35\n \n respond_to do |format|\n format.json { render :json => retval } # note, no :location or :status options\n end\n end",
"def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"def new\n @uset = Uset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uset }\n end\n end",
"def create\n\n client = Cliente.new\n\n client.nombre = params[:nombre]\n client.cedula = params[:cedula]\n client.pagina = params[:pagina]\n\n client.dirrecion = params[:dirrecion]\n client.telefono = params[:telefono]\n \n client.sector = params[:sector]\n \n\n if client.save\n \n\n render(json: client,status: 201 ,location: client)\n else\n\n render(json: client.errors,status: 422 )\n\n end\n end",
"def create\n @serf = Serve.new(serf_params)\n\n respond_to do |format|\n if @serf.save\n format.html { redirect_to @serf, notice: 'Serve was successfully created.' }\n format.json { render :show, status: :created, location: @serf }\n else\n format.html { render :new }\n format.json { render json: @serf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assigning_tutor\n unless params[:student_ids].empty?\n @students = Student.where(id: params[:student_ids])\n tutor = User.find(params[:user_id])\n\n @students.each do |s|\n s.assign_tutor(tutor)\n end\n message = {message: @students.size.to_s + ' students have been assigned a new tutor.'}\n else\n message = {message: 'No student ids were received.'}\n end\n render json: message\n end",
"def create\n @study = Study.new\n @user = User.find_by_id(params[:user])\n @study.user = @user\n @sec = Sec.find_by_id(params[:sec])\n @study.sec = @sec\n respond_to do |format|\n if @study.save\n format.html { redirect_to @study, notice: 'Study was successfully created.' }\n format.json { render :show, status: :created, location: @study }\n else\n format.html { render :new }\n format.json { render json: @study.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end",
"def create\n @silla = Silla.new(silla_params)\n\n respond_to do |format|\n if @silla.save\n format.html { redirect_to @silla, notice: 'Silla was successfully created.' }\n format.json { render :show, status: :created, location: @silla }\n else\n format.html { render :new }\n format.json { render json: @silla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ami = Ami.new\n @users = User.order(\"nom ASC\").all\n @sports = Sport.order(\"sport ASC\").all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ami }\n end\n end",
"def create\n\n @seminar = Seminar.find(params[:seminar_id])\n\n @signup = Signup.new(signup_params)\n\n respond_to do |format|\n if @signup.save\n format.html { redirect_to @seminar, notice: \"Signup was successfully created.\" }\n format.json { render :show, status: :created, location: @seminar }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @signup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @safra = Safra.new(params[:safra])\n\n respond_to do |format|\n if @safra.save\n format.html { redirect_to @safra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.634905",
"0.6186928",
"0.57403594",
"0.5651373",
"0.56368405",
"0.5628509",
"0.55825585",
"0.5521971",
"0.5495161",
"0.5338382",
"0.5268426",
"0.5267577",
"0.5261323",
"0.52466214",
"0.52267075",
"0.520776",
"0.5193178",
"0.5183848",
"0.51413196",
"0.51302457",
"0.51100314",
"0.51065767",
"0.509599",
"0.5095353",
"0.50860184",
"0.5071925",
"0.50688225",
"0.50457317",
"0.5041106",
"0.5038812",
"0.5035701",
"0.50346774",
"0.5026137",
"0.5021881",
"0.50206107",
"0.50117904",
"0.49968722",
"0.49942824",
"0.4988609",
"0.49880093",
"0.4978546",
"0.49670607",
"0.49645185",
"0.495231",
"0.4946531",
"0.49339995",
"0.49311385",
"0.49259305",
"0.49108833",
"0.48988995",
"0.4882891",
"0.4880288",
"0.48788667",
"0.48784587",
"0.48661193",
"0.48656002",
"0.48608315",
"0.48600972",
"0.4858124",
"0.4853321",
"0.4851723",
"0.4850612",
"0.48505217",
"0.483258",
"0.4831508",
"0.48252535",
"0.4822985",
"0.4821742",
"0.4820708",
"0.4820638",
"0.4819327",
"0.48188204",
"0.48044384",
"0.48004234",
"0.47995374",
"0.47950023",
"0.4794611",
"0.47943956",
"0.47911665",
"0.47892085",
"0.47861108",
"0.47821346",
"0.4782069",
"0.47818556",
"0.4780947",
"0.4777433",
"0.47750902",
"0.47689062",
"0.47675344",
"0.47654656",
"0.47607544",
"0.47562608",
"0.47557512",
"0.47554278",
"0.47543544",
"0.47481644",
"0.47475657",
"0.4746877",
"0.47457114",
"0.4744299"
] | 0.6416255 | 0 |
PUT /u_sers/1 PUT /u_sers/1.json | def update
@u_ser = USer.find(params[:id])
respond_to do |format|
if @u_ser.update_attributes(params[:u_ser])
format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @u_ser.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @u_ser.update(u_ser_params)\n format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }\n format.json { render :show, status: :ok, location: @u_ser }\n else\n format.html { render :edit }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_u_ser\n @u_ser = USer.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @usser.update(usser_params)\n format.html { redirect_to @usser, notice: 'Usser was successfully updated.' }\n format.json { render :show, status: :ok, location: @usser }\n else\n format.html { render :edit }\n format.json { render json: @usser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update\n load_user\n build_user\n respond_to do |format|\n if user.save\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @ser }\n else\n format.html { render :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n @u = U.find(params[:id])\n\n respond_to do |format|\n if @u.update_attributes(params[:u])\n format.html { render action: \"edit\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @u.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def set_usser\n @usser = Usser.find(params[:id])\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def set_suscriber\n @suscriber = Suscriber.find(params[:id])\n end",
"def set_souvenior\n @souvenior = Souvenior.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @uzser.update(uzser_params)\n format.html { redirect_to @uzser, notice: 'Uzser was successfully updated.' }\n format.json { render :show, status: :ok, location: @uzser }\n else\n format.html { render :edit }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @u_ser = USer.new(params[:u_ser])\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render json: @u_ser, status: :created, location: @u_ser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @souvenir.update(souvenir_params)\n format.html { redirect_to @souvenir, notice: 'Souvenir was successfully updated.' }\n format.json { render json: { user: @souvenir, status: 200, description: 'Souvenir was successfully updated.' }, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: { user: @souvenir, status: 500, description: 'Internal server error : faliled to save' }, status: :internal_server_error }\n end\n end\n end",
"def update\n @routine = Routine.find(params[:id])\n # @routine.user_id = @user.id\n @users = User.all if @user.admin?\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update_cheer_up\n user = User.find(params[:id])\n updating_cheer_up = CheerUp.find(params[:cheer_up_id])\n updating_cheer_up.update(cheer_up_params)\n render json:\n {\n status: 200,\n user: user,\n cheer_ups: user.cheer_ups,\n updated_cheer_up: updating_cheer_up\n } # end render json\n end",
"def update\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n if @uset.update_attributes(params[:uset])\n format.html { redirect_to @uset, notice: 'Uset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @souvenior.update(souvenior_params)\n format.html { redirect_to @souvenior, notice: 'Souvenior was successfully updated.' }\n format.json { render :show, status: :ok, location: @souvenior }\n else\n format.html { render :edit }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suscriber.update(suscriber_params)\n format.html { redirect_to @suscriber, notice: 'Suscriber was successfully updated.' }\n format.json { render :show, status: :ok, location: @suscriber }\n else\n format.html { render :edit }\n format.json { render json: @suscriber.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_serasa.update(socio_serasa_params)\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find_by_id(params[:user])\n @study.user = @user\n @sec = Sec.find_by_id(params[:sec])\n @study.sec = @sec\n respond_to do |format|\n if @study.update(study_params)\n format.html { redirect_to @study, notice: 'Study was successfully updated.' }\n format.json { render :show, status: :ok, location: @study }\n else\n format.html { render :edit }\n format.json { render json: @study.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @u_ser = USer.new(u_ser_params)\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render :show, status: :created, location: @u_ser }\n else\n format.html { render :new }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @u_ser = USer.find(params[:id])\n @u_ser.destroy\n\n respond_to do |format|\n format.html { redirect_to u_sers_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @sneaker.update(sneaker_params)\n Sneaker.reindex\n format.html { redirect_to @sneaker, notice: 'Sneaker was successfully updated.' }\n format.json { render :show, status: :ok, location: @sneaker }\n else\n format.html { render :edit }\n format.json { render json: @sneaker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def set_singer\n @singer = Singer.find(params[:id])\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end",
"def update\n #@user = User.find(params[:id])\n \n if @trainer.update(trainer_params)\n render json: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\nend",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n #head :no_content\n render json: @user, status: :accepted, location: @user #sera? status accepted? \n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @serf.update(serf_params)\n format.html { redirect_to @serf, notice: 'Serve was successfully updated.' }\n format.json { render :show, status: :ok, location: @serf }\n else\n format.html { render :edit }\n format.json { render json: @serf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mf_api_user_update_tags\n\n # Get User From DB with client_id\n user = User.where(clientid: params[:client_id]).first\n\n # If user not found, return error response\n if user.empty?\n response = {\n success: false,\n message: 'User with ClientID not found'\n }\n\n render json: response\n end\n\n # Get the Infusionsoft contact info\n contact = Infusionsoft.data_load('Contact', user.clientid, [:Groups])\n\n # Update User Tags\n user.put('', {\n :client_tags => contact['Groups']\n })\n\n\n response = {\n success: true,\n message: 'User Tags Updated'\n }\n\n render json: response\n\n end",
"def update\n @sluzby = Sluzby.find(params[:id])\n\n respond_to do |format|\n if @sluzby.update_attributes(params[:sluzby])\n format.html { redirect_to @sluzby, notice: 'Sluzby was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sluzby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def put!\n request! :put\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update \n retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?)\n retorno = {erro: \"000\", body: {evento_id: @usuario.id, usuario_nome: @usuario.nome}}\n end\n render json: retorno.to_json\n end",
"def update\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n if @serie.update_attributes(params[:serie])\n format.html { redirect_to(niveis_ensino_serie_url(@nivel,@serie), :notice => 'Serie atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @roster_id = args[:roster_id] if args.key?(:roster_id)\n @user_id = args[:user_id] if args.key?(:user_id)\n end",
"def update\n respond_to do |format|\n if @<%= singular_table_name %>.update(<%= singular_table_name %>_params)\n format.html { redirect_to @<%= singular_table_name %>, notice: \"#{t('activerecord.models.<%= singular_table_name %>.one')} atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @usesr.update(usesr_params)\n format.html { redirect_to @usesr, notice: 'Usesr was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @usesr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @u_sers = USer.all\n end",
"def update\n respond_to do |format|\n if @singer.update(singer_params)\n format.html { redirect_to @singer, notice: \"Singer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @singer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @singer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def set_tsunami\n @tsunami = Tsunami.find(params[:id])\n end",
"def change_owner\n @seminar = Seminar.find(params[:id])\n @teacher = Teacher.find(params[:new_owner])\n \n @seminar.update(:owner => @teacher)\n SeminarTeacher.find_or_create_by(:user => @teacher, :seminar => @seminar).update(:can_edit => true)\n \n flash[:success] = \"Class Owner Updated\"\n redirect_to @seminar\n end",
"def update\n # @user_trick = UserTrick.find(params[:id])\n @user_trick.update(user_trick_params)\n render json: UserTrickSerializer.new(@user_trick).serialized_json\n end",
"def update\n respond_to do |format|\n if @semestre.update(semestre_params)\n format.html { redirect_to @semestre, notice: 'Semestre was successfully updated.' }\n format.json { render :show, status: :ok, location: @semestre }\n else\n format.html { render :edit }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agent = Agent.find(params[:id])\n params.delete :username\n params.delete :name\n params.delete :password\n\n respond_to do |format|\n if @agent.update_attributes(params[:agent])\n Rosteruser.update_all({:nick => @agent.name}, {:jid => \"#{@agent.username}@agent.monit.cn\"})\n flash[:notice] = \"#{@agent.name}更新成功\"\n format.html { redirect_to(@agent) }\n format.xml { head :ok }\n else\n dictionary\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @agent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"[email protected]\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n # set_user\n # set_routine\n if @routine.update(routine_params)\n @user.routines << @routine\n redirect_to user_routines_path(@user, @routine), notice: 'Exercise was successfully updated.' \n else\n format.html { render :edit }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n \n end",
"def update\n respond_to do |format|\n if @ss.update(ss_params)\n format.html { redirect_to @ss, notice: 'Sse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ss.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sesiune\n @sesiune = Sesiune.find(params[:id])\n end",
"def update\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n if @serie.update_attributes(serie_params)\n format.html { redirect_to(@serie, :notice => 'Serie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @safra = Safra.find(params[:id])\n\n respond_to do |format|\n if @safra.update_attributes(params[:safra])\n format.html { redirect_to @safra}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @semestre.update(semestre_params)\n format.html { redirect_to semestres_url, notice: 'Semestre was successfully updated.' }\n format.json { render :show, status: :ok, location: @semestre }\n else\n format.html { render :edit }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n if @slitter.update_attributes(params[:slitter])\n format.html { redirect_to @slitter, notice: 'Slitter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slitter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #if @visto.users.include?(current_user)\n # @visto.users.push(current_user)\n #else\n # @visto.users.delete(current_user)\n #end\n #if @visto.update({users:@visto.users})\n # redirect_to serial_chapter_path(@serial,@chapter)\n #else\n # render 'edit'\n #end\n end",
"def update\n @user # @trade = Trade.where(user_id: params[:id])\n @user.update(user_params)\n\n #im going to set one to two from here\n # respond_to do |format|\n # if @user.update(user_params)\n # format.html { redirect_to :action => \"show\", :controller => \"trades\"}\n # format.json { render :show, status: :ok, location: @user }\n # else\n # format.html { render :edit }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @scouter = Scouter.find(params[:id])\n\n respond_to do |format|\n if @scouter.update_attributes(params[:scouter])\n format.html { redirect_to(@scouter, :notice => 'Scouter was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scouter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sensor.update(sensor_params) && @sensor.user_id==current_user.id\n format.html { redirect_to @sensor, notice: 'Sensore aggiornato correttamente' }\n format.json { render :show, status: :ok, location: @sensor }\n else\n format.html {\n flash[:notice] = 'Non puoi modificare un sensore non tuo!'\n render :edit }\n format.json { render json: @sensor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @rooster = Rooster.find(params[:id])\n\n respond_to do |format|\n if @rooster.update_attributes(params[:rooster])\n format.html { redirect_to @rooster, notice: 'Rooster was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rooster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @name = Name.find(params[:id])\n\n\t\tif params[:index]\n\t\t\tn = @name.sei.length\n\t\t\ti = params[:index].to_i\n\t\t\tif i < n\n\t\t\t\tparams[:name][:mei] = params[:name][:sei][i .. n]\n\t\t\t\tparams[:name][:sei] = params[:name][:sei][0 .. i-1]\n\t\t\tend\n\t\tend\n\n respond_to do |format|\n if @name.update_attributes(params[:name])\n format.html { redirect_to @name, notice: 'Name was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @name.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @usersevent = Usersevent.find(params[:id])\n\n respond_to do |format|\n if @usersevent.update_attributes(params[:usersevent])\n format.html { redirect_to @usersevent, :notice => 'Usersevent was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @usersevent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_sivic_ministerio\r\n @sivic_ministerio = SivicMinisterio.find(params[:id])\r\n end",
"def update\n respond_to do |format|\n if @siritori.update(siritori_params)\n format.html { redirect_to @siritori, notice: 'Siritori was successfully updated.' }\n format.json { render :show, status: :ok, location: @siritori }\n else\n format.html { render :edit }\n format.json { render json: @siritori.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sire.update(sire_params)\n format.html { redirect_to @sire, notice: 'Sire was successfully updated.' }\n format.json { render :show, status: :ok, location: @sire }\n else\n format.html { render :edit }\n format.json { render json: @sire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @singer.update_attributes(params[:singer])\n flash[:notice] = 'Singer was successfully updated.'\n format.html { redirect_to(@singer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @singer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_suggetion\n @suggetion = Suggetion.find(params[:id])\n end",
"def update\n @scripture = Scripture.find(params[:id])\n if @scripture[:user_id].nil?\n @scripture[:user_id] = current_user.id\n end\n respond_to do |format|\n if @scripture.update_attributes(params[:scripture])\n flash[:notice] = 'Scripture was successfully updated.'\n format.html { redirect_to(@scripture) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scripture.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end",
"def update\n @asesor = Asesor.find(params[:id])\n\n respond_to do |format|\n if @asesor.update_attributes(params[:asesor])\n format.html { redirect_to @asesor, notice: 'Asesor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asesor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n@users = User.all.order(nombre1: :asc)\n if params[:research][:user_ids]\n params[:research][:user_ids] = params[:research][:user_ids].map{|k, v| k}\n else\n params[:research][:user_ids] = []\n end\n \n respond_to do |format|\n if @research.update(research_params)\n format.html { redirect_to @research, notice: 'La actividad se actualizo con exito.' }\n format.json { render :show, status: :ok, location: @research }\n else\n format.html { render :edit }\n format.json { render json: @research.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @sekilas_info.update(sekilas_info_params)\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n respond_to do |format|\n if @minister.update(minister_params)\n format.html { redirect_to @minister, notice: 'Minister was successfully updated.' }\n format.json { render :show, status: :ok, location: @minister }\n else\n format.html { render :edit }\n format.json { render json: @minister.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_updated_at_and_by\n #logger.info { \"FILTTERISSÄ: #{response.headers[\"Status\"]}\" }\n if response.headers[\"Status\"] =~ /^20/\n @collection.set_update_info(DateTime.now, (@user ? @user.guid : @client.id))\n # @collection.updated_at = DateTime.now\n # @collection.updated_by = @user ? @user.guid : @client.id\n # @collection.save\n\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end",
"def update\n respond_to do |format|\n @levels = levels\n @ra = Reserva.where(user_id: params[:id], status: 1)\n @r = Reserva.where(entidade_id: @user.entidade_id, status: 1)\n\n if @user.update(user_params)\n format.html { redirect_to users_url, notice: 'Atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: '{\"msg\":\"Este já tem cadastro!\"}', status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @roster = args[:roster] if args.key?(:roster)\n @user = args[:user] if args.key?(:user)\n end",
"def set_siritori\n @siritori = Siritori.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @nitrou.update(nitrou_params)\n format.html { redirect_to @nitrou, notice: 'Nitrou was successfully updated.' }\n format.json { render :show, status: :ok, location: @nitrou }\n else\n format.html { render :edit }\n format.json { render json: @nitrou.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head 404\n # @api_v1_follower = Api::V1::Follower.find(params[:id])\n\n # if @api_v1_follower.update(api_v1_follower_params)\n # head :no_content\n # else\n # render json: @api_v1_follower.errors, status: :unprocessable_entity\n # end\n end",
"def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end",
"def update\r\n @salle = Salle.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @salle.update_attributes(params[:salle])\r\n format.html { redirect_to @salle, notice: 'Salle was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @salle.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end"
] | [
"0.63182807",
"0.6270266",
"0.598554",
"0.58476627",
"0.5657172",
"0.5600045",
"0.55445385",
"0.5544309",
"0.55440676",
"0.5539058",
"0.5495385",
"0.5483849",
"0.54661477",
"0.54532695",
"0.54205054",
"0.5383168",
"0.5339815",
"0.5328165",
"0.532579",
"0.53112024",
"0.5309192",
"0.5307221",
"0.5304799",
"0.53005177",
"0.5263429",
"0.5246781",
"0.5245408",
"0.5235085",
"0.52333903",
"0.5224097",
"0.5218328",
"0.521098",
"0.5203165",
"0.5196123",
"0.5190912",
"0.5190382",
"0.5187568",
"0.5179179",
"0.51778007",
"0.5177624",
"0.51709855",
"0.5148727",
"0.51445353",
"0.5140686",
"0.51330864",
"0.5128975",
"0.5117983",
"0.511783",
"0.51078916",
"0.5097917",
"0.5097865",
"0.5094168",
"0.50936735",
"0.509094",
"0.50905305",
"0.5083335",
"0.50777733",
"0.5076937",
"0.5076466",
"0.5076072",
"0.50706387",
"0.5066478",
"0.50650805",
"0.5061832",
"0.50605434",
"0.50601685",
"0.50573343",
"0.5052295",
"0.5050661",
"0.50500464",
"0.50485",
"0.50464547",
"0.50452435",
"0.5042572",
"0.50424194",
"0.5037527",
"0.50315785",
"0.50291973",
"0.50283706",
"0.5027779",
"0.5026714",
"0.50264555",
"0.5024712",
"0.50239646",
"0.5021764",
"0.5014574",
"0.5008428",
"0.50001025",
"0.5000043",
"0.49976173",
"0.49972972",
"0.49956644",
"0.49943206",
"0.49936685",
"0.49934098",
"0.4993211",
"0.4992773",
"0.49925518",
"0.4991166",
"0.49841014"
] | 0.65416086 | 0 |
DELETE /u_sers/1 DELETE /u_sers/1.json | def destroy
@u_ser = USer.find(params[:id])
@u_ser.destroy
respond_to do |format|
format.html { redirect_to u_sers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @u_ser.destroy\n respond_to do |format|\n format.html { redirect_to u_sers_url, notice: 'U ser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uder.destroy\n respond_to do |format|\n format.html { redirect_to uders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @u = U.find_by_name(params[:id])\n @u.destroy\n\n respond_to do |format|\n format.html { redirect_to us_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n user = User.find(params[:id])\n senator = Senator.find(params[:senator_id])\n user.senators.delete(senator)\n render json: user.senators\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @uzser.destroy\n respond_to do |format|\n format.html { redirect_to uzsers_url, notice: 'Uzser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sluzby = Sluzby.find(params[:id])\n @sluzby.destroy\n\n respond_to do |format|\n format.html { redirect_to sluzbies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @usser.destroy\n respond_to do |format|\n format.html { redirect_to ussers_url, notice: 'Usser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronists_url }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @surah.destroy\n respond_to do |format|\n format.html { redirect_to surahs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @strosek.destroy\n respond_to do |format|\n format.html { redirect_to stroseks_url }\n format.json { head :no_content }\n end\n end",
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @ss.destroy\n respond_to do |format|\n format.html { redirect_to sses_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete\n api_client.delete(url)\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @sejour.destroy\n respond_to do |format|\n format.html { redirect_to sejours_url, notice: 'Sejour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @souvenir.destroy\n respond_to do |format|\n format.html { redirect_to souvenirs_url, notice: 'Souvenir was successfully deleted.' }\n format.json { render json: { user: @souvenir, status: 200, description: 'Souvenir was successfully deleted.' }, status: :ok }\n end\n end",
"def destroy\n @suscriber.destroy\n respond_to do |format|\n format.html { redirect_to suscribers_url, notice: 'Suscriber was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unique.destroy\n respond_to do |format|\n format.html { redirect_to uniques_url, notice: 'Unique was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suplente = Suplente.find(params[:id])\n @suplente.destroy\n\n respond_to do |format|\n format.html { redirect_to suplentes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_relatorioscelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_relatorioscelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @client.delete( name )\n end",
"def delete_data(path, &block)\n url = \"#{host}/api/v#{version}/#{path}\"\n params = Jbuilder.encode(&block) if block_given?\n params ||= {}\n resource = RestClient::Resource.new(\n url, \n headers: {\n \"uid\" => @uid,\n \"client\" => @client,\n \"access-token\" => @access_token\n }\n )\n resource.delete(params) do |response, request, result, &blk|\n case response.code\n when 200\n if response.blank?\n true\n else\n auth_data = {\n uid: response.headers[:uid],\n client: response.headers[:client],\n access_token: response.headers[:access_token]\n }\n JSON.parse(response).merge(auth_data)\n end\n when 404\n nil\n else\n JSON.parse(response)\n end\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soiree = Soiree.find(params[:id])\n @soiree.destroy\n\n respond_to do |format|\n format.html { redirect_to soirees_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @user_sc = UserSc.find(params[:id])\n @user_sc.destroy\n\n respond_to do |format|\n format.html { redirect_to user_scs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ujumbe.destroy\n respond_to do |format|\n format.html { redirect_to ujumbes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @sivic_rede.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_redes_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @sin = Sin.find(params[:id])\n @sin.destroy\n\n respond_to do |format|\n format.html { redirect_to sins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete(@name)\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n @sire.destroy\n respond_to do |format|\n format.html { redirect_to sires_url, notice: 'Sire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sekilas_info.destroy\n respond_to do |format|\n format.html { redirect_to sekilas_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rum = Rum.find(params[:id])\n @rum.destroy\n\n respond_to do |format|\n format.html { redirect_to rums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @stilage.destroy\n respond_to do |format|\n format.html { redirect_to stilages_url, notice: 'Stilage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = UtilisateurService.instance.supprimerUtilisateur(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eou = Eou.find(params[:id])\n @eou.destroy\n\n respond_to do |format|\n format.html { redirect_to eous_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitemenu.destroy\n respond_to do |format|\n format.html { redirect_to sitemenus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @duer = Duer.find(params[:id])\n @duer.destroy\n respond_to do |format|\n format.html { redirect_to duers_url, notice: 'Duer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @osusume.destroy\n respond_to do |format|\n format.html { redirect_to osusumes_url, notice: 'Osusume was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client a été supprimer.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @safra = Safra.find(params[:id])\n @safra.destroy\n\n respond_to do |format|\n format.html { redirect_to safras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datum = Datum.find(params[:id])\n verify_user(@datum.user.id)\n @datum.destroy\n\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sa_request.destroy\n respond_to do |format|\n format.html { redirect_to sa_requests_url, notice: 'Sa request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @usuario_seguidor.destroy\n respond_to do |format|\n format.html { redirect_to usuario_seguidores_url, notice: 'Usuario seguidor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @usertable = Usertable.find(params[:id])\r\n @usertable.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to usertables_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @sugerencia = Sugerencia.find(params[:id])\n @sugerencia.destroy\n\n respond_to do |format|\n format.html { redirect_to sugerencias_url }\n format.json { head :ok }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @userr = Userr.find(params[:id])\n @userr.destroy\n\n respond_to do |format|\n format.html { redirect_to userrs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:user_uuid])\n @user.destroy\n head :ok\n end",
"def destroy\n @uen.destroy\n respond_to do |format|\n format.html { redirect_to uens_url, notice: 'Uen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.6946302",
"0.69276553",
"0.667342",
"0.6612868",
"0.65867144",
"0.6580875",
"0.6554371",
"0.65526795",
"0.6550917",
"0.6549767",
"0.654431",
"0.65373445",
"0.6532813",
"0.6529876",
"0.65264964",
"0.65020865",
"0.6501794",
"0.64871585",
"0.64734113",
"0.64729655",
"0.64545804",
"0.644622",
"0.64199376",
"0.64147925",
"0.64128417",
"0.6412245",
"0.6400706",
"0.63956034",
"0.63932794",
"0.6389923",
"0.63850045",
"0.63803613",
"0.6379994",
"0.637889",
"0.63779235",
"0.6372289",
"0.63683176",
"0.63636583",
"0.6358543",
"0.6355982",
"0.6347247",
"0.6342874",
"0.634241",
"0.63383186",
"0.6338228",
"0.6336792",
"0.6335213",
"0.6325912",
"0.63247263",
"0.6324688",
"0.6319481",
"0.63156307",
"0.6313163",
"0.6313163",
"0.6313163",
"0.6313163",
"0.6307525",
"0.63038373",
"0.6301298",
"0.6301298",
"0.62958604",
"0.6294861",
"0.6294264",
"0.6294264",
"0.6293333",
"0.62910193",
"0.6290423",
"0.6289177",
"0.6287977",
"0.6286219",
"0.62811494",
"0.6278413",
"0.6276194",
"0.62760735",
"0.6271748",
"0.62668043",
"0.62667555",
"0.62656873",
"0.62650836",
"0.62604624",
"0.62537855",
"0.62506396",
"0.6248809",
"0.624225",
"0.6241736",
"0.6236199",
"0.62346524",
"0.6234198",
"0.62337935",
"0.6233341",
"0.62332326",
"0.6230581",
"0.6230173",
"0.62301254",
"0.622809",
"0.62272114",
"0.62258786",
"0.6225658",
"0.6220143",
"0.62174433"
] | 0.7272203 | 0 |
devise check to ensure only logged in users can access GET /posts GET /posts.json | def index
@posts = Post.all
# authorize @posts
puts "current project is: #{@current_project.name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_post_owner\n json_response({ error: 'Not authorized' }, :unauthorized) unless @post.user_id == current_user.id\n end",
"def show\n if user_signed_in?\n\n @post = current_user.posts.find(params[:id])\n \n if @post.user_id == current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n else\n redirect_to action: 'index'\n end\n else\n redirect_to action: 'index'\n end \n end",
"def user_check\n if user_signed_in?\n render status: :ok, json: current_user\n else\n render status: :forbidden, nothing: true\n end\n end",
"def authorize\n if !current_user\n flash[:alert] = \"Sign in to access that feature.\"\n redirect_to '/posts'\n end\n end",
"def restrict_access\n head :unauthorized and return false unless current_user\n end",
"def show\n @post = Post.find(params[:id])\n\n if !authenticated? && [email protected]\n redirect_to posts_path\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end\n end",
"def check_post_user\n # Fetch post by id\n @post = Post.find(params[:id])\n\n # Redirect to home page if wrong user or not admin\n unless @post.blog.user == logged_in_user || logged_in_user.admin?\n redirect_to root_url\n end\n end",
"def check_user\n if current_user.nil?\n render status: :forbidden, json: false\n return\n end\n end",
"def is_login?\n @post = Post.where(:id => params[:id]).first\n unless current_user.present?\n respond_to do |format|\n format.js { \n @comments = @post.comments.created_at_order\n flash[:error] = \"You need to sign in or sign up before continuing.\" \n render action: :create and return true \n }\n end\n end\n end",
"def verify_logged_in\n if not current_user\n render json: '[]', status: :unauthorized\n end\n end",
"def require_logged_in_user\n if !current_user\n head 403\n end\n end",
"def authorized_user\n @user = Post.find(params[:id]).user\n redirect_to(root_url) unless logged_in? && (current_user?(@user) || current_user.admin?)\n end",
"def require_auth\n head :unauthorized unless current_user\n end",
"def only_current_user_posts\n\t\t\t@user = User.find( params[:user_id] )\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend",
"def ensure_authenticated_user\r\n head :unauthorized unless current_user\r\n end",
"def require_auth\n if session[:user_id]\n return true \n else\n render json: {message: \"not authenticated\"}, status: :forbidden\n return false\n end\n end",
"def is_authenticated\n render json:{}, status:204\n end",
"def access?\n unless current_user? @user\n respond_to do |format|\n format.html { redirect_to login_path, notice: 'Unauthorized access!',\n status: 401 }\n format.json { render json: @user.errors, status: 401 }\n end\n end\n end",
"def show\n if (!@isLogin || !@isValidUser)\n return\n end\n @posts = @user.posts\n end",
"def user_post\n @posts = Post.where(user_id: current_user.id)\n\n if @posts.nil?\n render :json => {message: \"Cannot find post\" }\n end\n\n render :index\n end",
"def api_authentication_required\n unauthorized unless current_user?\n end",
"def allow_access\n !@current_user.nil?\n end",
"def check_login\n head :forbidden unless self.current_user\n end",
"def verify_post_access(cat)\n post_id = params[:id]\n\n if article_for_member_only?(cat)\n\n return user_signed_in?\n else\n # the article is not for member only, so let them see it\n return true\n end\n end",
"def ensure_logged_in\n if not user_signed_in?\n render :json => {response:'auth token not accepted'}, :status => :bad_request\n return false\n end\n\n return true\n end",
"def can_manage_post\n raise ActionController::RoutingError 'Forbidden' if current_user.nil? || cannot?(:manage, @post)\n true\n end",
"def require_login\n return head(:forbidden) unless current_user\n end",
"def require_login\n return head(:forbidden) unless current_user\n end",
"def logged_in?\n redirect_to(root_path, notice: 'Unauthorized access!') unless current_user\n end",
"def ensure_authenticated_user\n render json: {message: 'Unauthorized'}, status: 401 unless current_user\n # head :unauthorized unless current_user\n end",
"def restrict_access\n\t authenticate_or_request_with_http_token do |token, options|\n\t User.exists?(api_key: token)\n\t end\n\tend",
"def require_logged_in!\n unless signed_in?\n render json: [\"You must be signed in to perform that action!\"], status: :unauthorized\n end\n end",
"def index\n # Once someone signs in, hand things over to the angular page\n if current_user && user_signed_in?\n #@post = Post.all\n respond_to do |format|\n format.json { render json: Post.all }\n format.html\n end\n\n else\n redirect_to new_user_session_path\n end\n end",
"def check_is_login_required\n authorized_denied unless logged_in?\n end",
"def check_session\n unless current_user\n render :json => { :status => \"unauthroized\" }, :status => :unauthorized\n end\n end",
"def check_if_admin\n unless current_user.is_admin?\n render json: {\"errors\" => [\"Inaccessible Resource\"]},\n status: :unauthorized\n return\n end\n end",
"def restrict_access\n user = User.find_by_authentication_token(params[:access_token])\n head :unauthorized unless user\n end",
"def index\n if !( user_signed_in? && current_user.admin? )\n redirect_to root_path\n flash[:notice] = 'insufficient privilege' \n return \n end\n @posts = Post.all\n end",
"def logged_in_user\n unless logged_in?\n render json: { error: 'Log in to access this page'}, status: :unauthorized\n end\n end",
"def is_signed_in\n if user_signed_in?\n render json: \"\", status: 200\n else\n render json: \"\", status: 401\n end\n end",
"def check_current_user_owns\n head :not_found unless @user == current_user\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n User.find_by_api_key(token).present?\n end\n end",
"def is_post_exist?\n @post = current_user.posts.where(:id => params[:id]).first\n unless @post.present?\n redirect_to user_posts_path, notice: 'You dont have access to requested post'\n end\n end",
"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 permission_required \n render_403 unless admin? || @user == current_user\n end",
"def before_filter\n if current_user\n true\n end\n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end",
"def can_create\n raise ActionController::RoutingError 'Forbidden' if current_user.nil? || cannot?(:write, :posts)\n true\n end",
"def show\n authorize @user\n render json: @user\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_logged_in\n (render json: [\"You need to be logged in for this.\"], status: 401) unless logged_in?\n end",
"def is_authenticated?\n end",
"def index\n if params[:user_id]\n @posts = Post.where(user_id: params[:user_id])\n else\n @posts = current_user.posts\n end\n end",
"def show\n \tif(logged_in)\n \t\t@posts = User.find(@user.id).posts\n \telse\n \t\treturn\n \tend\n end",
"def require_auth(user)\n return head(:forbidden) unless current_user == user.account\n end",
"def authenticate\n# byebug\n return true if public_action?\n if request.format.json?\n authenticate_token || render_json_unauthorized\n else\n authenticate_user!\n end\n end",
"def show\n @user = User.find(params[:id])\n @post_count = Post.where(:user_id => @user.id).count\n @vote_count = Vote.where(:user_id => @user.id).count\n @vote_for_your_posts_count = Post.where(:user_id => @user.id).joins(:votes).count\n\n if !is_admin?\n if !(@user == @current_user)\n redirect_to @current_user\n return\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def authorized\n render json: { message: 'Please log in' }, status: :unauthorized unless logged_in?\n end",
"def authorized?\n logged_in?\n end",
"def authorized?\n logged_in?\n end",
"def authorize_user\n post = Post.find(params[:id])\n\n unless current_user == post.user || current_user.admin?\n flash[:alert] = \"You must be an admin to do that.\"\n redirect_to [post.topic, post]\n end\n end",
"def check_access\n if not user_signed_in?\n redirect_to('/users/sign_in')\n end\n end",
"def require_sign_in\n render status: 403\n end",
"def load_and_authorize_resource\n user = current_user\n user ||= User.new # guest user (not logged in)\n \n post = Post.find(params[:id])\n \n # If the post will be destroyed in the next cron job, tell the user\n # it is already gone.\n if not post.burn_after_date.nil? and post.burn_after_date < Time.now\n obscure_existence\n return\n end\n \n if post.user == current_user\n @post = post\n return\n end\n \n if post.public and post.random_token == params[:random_token]\n @post = post\n return\n # has access\n end\n \n obscure_existence\n \n end",
"def authorized\n render json: { message: 'Please log in' }, status: :unauthorized unless logged_in?\n end",
"def authorized\n render json: {message: 'Please log in'}, status: :unauthorized unless logged_in?\n end",
"def authenticate\n return true if public_action?\n if request.format.json?\n render_json_unauthorized unless authenticate_token\n else\n authenticate_user!\n end\n end",
"def authorized\n render json: { message: 'Please log in'}, status: :unauthorized unless logged_in?\n end",
"def restrict_access\n render :\"/home/http_404\" unless @pet && @pet.user == current_user\n end",
"def protected\n auth = request.headers['HTTP_AUTHORIZATION']\n\n if auth =~ /sekret/\n render json: {success: \"You're in!\"}\n else\n render json: {error: 'Unauthorized'}, status: 401\n end\n end",
"def authorized?\n true\n end",
"def needs_authorization?\n true\n end",
"def authorized?\n # TODO(samstern): Check for expired token.\n !(session[:user_id].nil?)\n end",
"def verify_on_current_user\n render_401 unless params[:id].to_i == current_user.id\n end",
"def show\n # Making sure only signed in users can access\n # if user_signed_in?\n topic = Topic.find(params[:id])\n render json: topic\n # else\n # render status: 403, plain: 'Please Sign In to Access'\n # end\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n if User.exists?(token: token)\n @currentUser = User.find_by_token(token)\n end\n end\n end",
"def validate_access\n if @user_logged_in != @answer.user\n render status: :forbidden\n end\n end",
"def require_authorization!\n unless current_user == @event.user\n render json: {}, status: :forbidden\n end\n end",
"def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end",
"def authorization_check\n # if there isn't a current session, redirect to login\n if session[:current_user] == nil\n redirect \"/login\"\n else\n return true\n end\n end",
"def private_filter\n post = Post.find(params[:id])\n if post.nil?\n flash[:error] = \"Post not found\"\n redirect_to home_url\n end\n\n if !post.has_access(current_user)\n flash[:error] = \"Post is private\"\n redirect_to home_url\n end\n end",
"def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def authorized?\n logged_in?\n end",
"def user_signed_in?\n api_current_user.present?\n end",
"def authorize_user!\n if !current_user.present?\n render json: {error: 'No user error'}\n end\n end",
"def authorize_user\n render json: {message: \"Unauthorized\"}, status: 401 unless get_current_user.id == params[:user_id].to_i\n end",
"def authenticate_current_user\n render json: {}, status: :unauthorized if get_current_user.nil?\n end",
"def authorization_check\n # if there isn't a current session, redirect to login\n if session[:current_user] == nil\n redirect \"users/login\"\n else\n return true\n end\n end",
"def require_permission\n post = Post.find_by_slug(params[:id])\n if current_user.id != post.user_id\n redirect_to user_post_path(post.user, post), notice: \"Why are you trying to edit something that isn't yours? ಠ_ಠ\"\n end\n end",
"def authorized\n render json: { message: 'Please log in' }, status: :unauthorized unless logged_in?\n end",
"def login_required\n authorized? || access_denied\n end",
"def login_required\n authorized? || access_denied\n end",
"def login_required\n authorized? || access_denied\n end",
"def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end",
"def authorized?\n current_user.logged_in?\n end",
"def logged_in?\n authorized?\n end",
"def authorization_check\n if session[:current_user] == nil\n redirect '/not_authorized'\n else\n return true\n end\nend",
"def show\n authorize @user\n end",
"def show\n authorize @user\n end"
] | [
"0.75213313",
"0.7219987",
"0.7109975",
"0.707588",
"0.7053311",
"0.69760376",
"0.69620776",
"0.6915803",
"0.6891779",
"0.68828577",
"0.6861492",
"0.68146676",
"0.6785645",
"0.6763384",
"0.67630196",
"0.6755915",
"0.6710937",
"0.67034155",
"0.66480917",
"0.66394776",
"0.6624662",
"0.661472",
"0.6613616",
"0.6573183",
"0.6569664",
"0.65532887",
"0.654626",
"0.65424037",
"0.6533793",
"0.6531125",
"0.65301424",
"0.65268373",
"0.6519291",
"0.65175635",
"0.65122837",
"0.65072274",
"0.64772767",
"0.6475812",
"0.64696664",
"0.64624643",
"0.6460262",
"0.6440026",
"0.64339656",
"0.6408527",
"0.6408249",
"0.64078337",
"0.63846856",
"0.6380021",
"0.6380021",
"0.6378059",
"0.6373145",
"0.6365219",
"0.63644695",
"0.63576263",
"0.6349776",
"0.6342707",
"0.63394064",
"0.6324762",
"0.6323687",
"0.6320291",
"0.6316673",
"0.6316673",
"0.6311218",
"0.6307721",
"0.6305745",
"0.63046104",
"0.63001764",
"0.6298372",
"0.6293232",
"0.6292846",
"0.62906337",
"0.6289012",
"0.6286911",
"0.62798715",
"0.6279548",
"0.6275422",
"0.6275078",
"0.6274614",
"0.62678146",
"0.6267126",
"0.6263907",
"0.62591594",
"0.6255668",
"0.6255136",
"0.62533045",
"0.6251461",
"0.6251098",
"0.6247818",
"0.62473387",
"0.6242092",
"0.62399244",
"0.62385106",
"0.6234532",
"0.6234532",
"0.6234532",
"0.6233426",
"0.62308156",
"0.6229054",
"0.6228839",
"0.6228467",
"0.6228467"
] | 0.0 | -1 |
GET /posts/1 GET /posts/1.json | def show
if request.path != project_post_path(@current_project, @post)
return redirect_to project_post_path(@current_project, @post), :status => :moved_permanently
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"def show\n \trender json: Post.find(params[:id])\n end",
"def show\n post = Post.find(params[:id])\n render json: post\n end",
"def show\n\t \trender json: Post.find(params[:id])\n\t end",
"def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n # when you go to http://localhost:3000/posts/1, rails interprets this\n # as a call to the show action for the resource and passes 1 to the \n # :id paramater. Using this blog app you can do that by clicking the \n # show link for a post on the index page.\n\n @post = Post.find(params[:id])\n # The show action uses Post.find to search for a single record \n # in the database by its id value. After finding the record, Rails \n # displays it by using app/views/posts/show.html.erb\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"def index\n render json: Post.all\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def show\n render json: @post\n end",
"def show\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v2_post }\n end\n end",
"def show\n render json: @post\n end",
"def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def show\n render :json => @post\n end",
"def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"def index\n @api_v1_posts = Api::V1::Post.all\n end",
"def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def show\n @post = PostsService.getPostById(params[:id])\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end",
"def index\n\t\tgon.posts = Post.all.as_json\n\tend",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end",
"def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def index\n @posts = Post.find(:all)\n end",
"def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n render json: { posts: current_user.posts.all.map(&:to_h) }\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def index\n\t@posts = list_posts\n end",
"def show\n #GET a single post by ID\n @post = Post.find(params[:id])\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def show\n @post = Post.find(params[:id])\n @title = @post.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n # TODO: implement listing all posts\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def show\n @blogpost = Blogpost.published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end",
"def post(postid)\n request(:id => postid).posts.first\n end",
"def show\n Rails.logger.debug(\"Inside show \")\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @posto = Posto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posto }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def display_post\n begin\n # asks the user for the post id\n print \"Enter the post ID: \"\n id = STDIN.gets.chomp\n response = RestClient.get \"#{@@DOMAIN}/api/posts/#{id}.json\", authorization_hash\n\n js = JSON response.body\n js.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = PostService.getAllPosts\n end",
"def show\n render json: {\n data: @post\n }\n end",
"def show\n @post = Post.find(params[:id])\n @videos = Video.get_for @post #where([\"post_id = ?\", params[:id]]).all\n @background = get_background_for @post #Background::DEFAULT #Background.where([\"post_id = ?\", params[:id]])\n @nav = get_navigation :for => 'post', :current => @post\n @menu = get_menu :for => 'post'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"def show\n if !params[:id]\n @post = Post.find_by_title('Welcome')\n elsif params[:id] =~ /^[a-zA-Z ]+$/\n @post = Post.find_by_title(params[:id])\n else\n @post = Post.find(params[:id].to_i)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @blogpost = Blogpost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogpost }\n end\n end",
"def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blog_post }\n end\n end",
"def index\n @post = Post.find_by_id(params[:post_id])\n if @post.nil?\n return render json: { error: \"Post not found\" }, status: :not_found\n end\n render json: @post.comments,status: 200\n end",
"def show\n @post2 = Post2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post2 }\n end\n end"
] | [
"0.77110183",
"0.73537844",
"0.73433185",
"0.73379177",
"0.73228735",
"0.7293139",
"0.7275997",
"0.7256934",
"0.7161576",
"0.7158913",
"0.71552676",
"0.71552676",
"0.7119547",
"0.7094749",
"0.7094749",
"0.7094749",
"0.70943594",
"0.7071599",
"0.70607626",
"0.70452625",
"0.7032558",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.7020259",
"0.69897074",
"0.6955722",
"0.6955722",
"0.6954564",
"0.6937062",
"0.6936725",
"0.69257236",
"0.6917876",
"0.69010335",
"0.69005007",
"0.6894985",
"0.6893989",
"0.68756175",
"0.6860515",
"0.6853294",
"0.6853291",
"0.6847577",
"0.68364173",
"0.68232405",
"0.68093437",
"0.6804144",
"0.67621773",
"0.6743674",
"0.67226875",
"0.6720067",
"0.67147297",
"0.6713107",
"0.6699554",
"0.6693189",
"0.6679935",
"0.6655543",
"0.6644503",
"0.6641595",
"0.66299",
"0.6619761",
"0.66178924",
"0.66124725",
"0.6608166",
"0.66017526",
"0.6597235",
"0.65952027",
"0.65909946",
"0.65858185",
"0.6582703",
"0.658145",
"0.65768254",
"0.65733755",
"0.6568626",
"0.65668",
"0.655592",
"0.65385455",
"0.6525845",
"0.65144473",
"0.6513119",
"0.6497587",
"0.6497312",
"0.6493223",
"0.6491053",
"0.64720887",
"0.6471776",
"0.64655757",
"0.6455566",
"0.64530945",
"0.6448596",
"0.64456475",
"0.64289075"
] | 0.0 | -1 |
POST /posts POST /posts.json | def create
@post = Post.new(post_params)
# authorize @post
respond_to do |format|
if @post.save
format.html { redirect_to project_posts_path, notice: 'Post was successfully created.' }
format.json { render :show, status: :created, location: @post }
else
format.html { render :new }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def create\n @post = Post.new(post_params)\n @post.user = current_user\n\n if @post.save\n render json: @post, status: :created, location: api_v1_post_path(@post), serializer: Api::V1::PostSerializer\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def create\n post = @current_user.posts.create(post_params)\n\n if post.save\n render json: post\n else\n render json: { errors: post.errors.full_messages }, status: :forbidden\n end\n end",
"def create\n title = params[:title]\n body = params[:body]\n\n @post = current_user.posts.create(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def create\n @post = Post.new({ :title => params[:post][:title] })\n \n respond_to do |format|\n if @post.save\n format.json { render :json => { :post => @post.as_json}, :status => :created, :location => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n\n if @post.save\n render json: @post, status: :created, location: [@user, @post]\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render json: {\n message: 'Post was successfully created.'\n }, status: :created\n else\n render json: {\n errors: @post.errors,\n message: 'Post could not be created.'\n }, status: :unprocessable_entity\n end\n end",
"def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end",
"def create\n\n\n @post = current_user.posts.build(post_params)\n\n if @post.save\n\n render json: \"Posted successfully\", status: 201\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tpost = @current_user.posts.create(post_params) \n\t\tif post.save\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id}\n\t else\n\t render json: {success: false, errors: post.errors.full_messages, message: \"Validation failed\"}, status: 422\n\t\tend \n\tend",
"def create\n @post = Post.new(params[:post])\n respond_to do |format|\n if @post.save\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.create(params[:post])\n end",
"def create_posts\n end",
"def create_posts\n end",
"def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render :show, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n respond_with Post.create(post_params)\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post(*args)\n request :post, *args\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_post = current_user.posts.new(api_post_params)\n if @api_post.save\n render :show\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n authenticated\n\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new post_params\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render :show, status: :created, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts \"create post: #{post_params.inspect}\"\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @title = \"Create New Post\"\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n post_service = PostService.new(current_user, params)\n post_service.create_post\n #post_service.create\n respond_to do |format|\n if post_service.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to new_post_url, alert: post_service.errors }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :created, location: @post }\n format.xml { render xml: @post, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posts = Post.page(params[:page]).order('created_at desc')\n @post = Post.new(post_params)\n @user = User.where('account_id == ?', current_account.id)[0]\n respond_to do |format|\n if @post.save\n format.html { redirect_to '/posts' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :index }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\t\t\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_post_param\n respond_to do |format|\n if @post.save\n format.html do\n redirect_to @post, notice:\n \"Post was successfully created.\"\n end\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json do\n render json: @post.errors, status:\n :unprocessable_entity\n end\n end\n end\n end",
"def create\n @api_v1_post = Api::V1::Post.new(api_v1_post_params)\n\n respond_to do |format|\n if @api_v1_post.save\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_post }\n else\n format.html { render :new }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(params[:post])\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path, flash: { error: @post.errors.full_messages } }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def create\n @user = current_user\n @post = @user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n post = Post.new\n render json: post\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @post = Post.new(params[:post])\r\n\r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render json: @post, status: :created, location: @post }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @post = Post.create(post_params)\n set_posts\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, :notice => \"slam\" }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { redirect_to posts_path }\n flash[:alert] = \"shit.\"\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n post\n end",
"def create\n @post = Post.new(content: params[:post][:content], user_id: @user.id)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @user }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { redirect_to @user }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @post = Post.new(post_params)\n @post.user_id = params[:user_id]\n if @post.save\n render json: @post, meta: { status: :created }, meta_key: 'result', status: :created\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = current_user.posts.new(post_params.merge(writter: current_user.name))\n\n if @post.save\n render json: {status: 1, id: @post.id.to_s, notice: \"新增成功,标题是:#{@post.title.capitalize}\", number: @post.number, errors: []}\n else\n render json: {status: -1, notice: \"新增失败,请先登录\", errors: @post.errors.full_messages}\n end\n end",
"def create\n puts \"Trying to Create New Post\"\n # Creates new post with given content tied to given userid\n @post = Post.new(post_params) \n if @post.save\n puts \"Post successfully created\"\n response.status=(201)\n render json: {status: \"Success\", message: [\"Post created!\"]}\n else\n # Error handling\n puts \"Something went wrong while creating new Post\"\n puts(@Post.errors.full_messages)\n response.status=(422)\n render json: { status: \"Error\", message: [@post.errors.full_messages]}\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to list_of_posts_post_path(@post.user), notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(*args)\n execute(:post, *args)\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n coerce_date(params[:post], 'published_at')\n @post = Mist::Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to new_post_successful_posts_path, notice: 'Anúncio criado com sucesso.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user = User.find_by_auth_token!(cookies[:auth_token])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n redirect_to login_path unless session[:user_id]\n message = 'Post was successfully created.'\n @post = Post.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: message }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.74453115",
"0.73224664",
"0.73065",
"0.7123661",
"0.7014955",
"0.7012768",
"0.69840264",
"0.6938563",
"0.69309723",
"0.6905106",
"0.68197066",
"0.68119097",
"0.67928475",
"0.6792773",
"0.67785394",
"0.67785394",
"0.6762736",
"0.6759516",
"0.67510056",
"0.67350024",
"0.66986823",
"0.6694242",
"0.6679357",
"0.66507727",
"0.661762",
"0.6607913",
"0.6576586",
"0.6566928",
"0.6534542",
"0.65245205",
"0.6516953",
"0.65119916",
"0.65119916",
"0.6498843",
"0.648704",
"0.648219",
"0.647903",
"0.6478571",
"0.64756644",
"0.64756644",
"0.64756644",
"0.64756644",
"0.64756644",
"0.64756644",
"0.64756644",
"0.6451724",
"0.6443117",
"0.6440887",
"0.6438761",
"0.64304584",
"0.6413615",
"0.6401683",
"0.6401094",
"0.63966864",
"0.63951707",
"0.6387734",
"0.6387734",
"0.63795847",
"0.6375628",
"0.6373732",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6370935",
"0.6369107",
"0.63611555",
"0.6351466",
"0.6348891",
"0.6344897",
"0.6312749",
"0.6307845",
"0.63030463",
"0.6300117",
"0.6297244",
"0.62969273",
"0.6294826",
"0.6294681",
"0.6294436",
"0.6288339",
"0.6287679",
"0.62829244",
"0.62818336",
"0.626294"
] | 0.0 | -1 |
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json | def update
respond_to do |format|
if @post.update(post_params)
format.html { redirect_to project_posts_path, notice: 'Post was successfully updated.' }
format.json { render :show, status: :ok, location: @post }
else
format.html { render :edit }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n respond_with Post.update(params[:id],post_params)\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update({\n title: post_params[:title],\n content: post_params[:content],\n })\n render json: Post.all.as_json\n else\n render json: {errors: @post.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render json: @post }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @api_post = Api::Post.find(params[:id])\n\n if @api_post.update(api_post_params)\n head :no_content\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @post.update(post_params)\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n if @api_v2_post.update_attributes(params[:api_v2_post])\n format.html { redirect_to @api_v2_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v2_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @post\n\n if @post.save\n render json: @post\n else\n render json: @post.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@post = post.find(params[:id])\n\t\[email protected]_attributes(post_params)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to post_path(@post)}\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.json { render :show, status: :ok, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tif @post.update(post_params)\n\t\t\trender json: @post, status: :success\n\t\telse\n\t\t\trender json: @post.errors, status: :unprocessable_entity #422\n\t\tend\n\tend",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'slam updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: '' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to @post, notice: 'Post 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: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @user = current_user\n @post = @user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if (@post.update(params.permit(:title, :content)))\n render json: @post, status: :ok\n else\n render json: @post.errors, status: 422\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n #disable edit for now\n redirect_to posts_path\n return\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render action: \"show.json.jbuilder\"\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\t\n\t\tpost = @current_user.role == \"admin\" ? Post.find_by(id: params[:id]) : @current_user.posts.find_by(id: params[:id]) \n\t\tif post && post.update_attributes(post_params)\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id, post_desc: post.description}\n\t else\n\t render json: {success: false, message: \"not found or validation failed\"}, status: 422\n\t\tend \n\tend",
"def update\n post = Post.find_by(id: params[:id])\n # byebug\n\n post.assign_attributes(update_params)\n if post.valid?\n post.save\n render json: post, status: :created\n else\n render json: {errors: post.errors.full_messages}, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find_by_slug(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # if @post.update_attributes(params[:post])\n # format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n # format.json { head :no_content }\n #else\n # format.html { render action: \"edit\" }\n # format.json { render json: @post.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n #this works largely the same, \n @post = Post.find(params[:id])\n @post.created_at = params[:created_at] if !!params[:created_at]\n if @post.update_attributes(params[:post])\n render \"show\", handlers: [:rabl]\n else\n render :json => @post.errors.full_messages, status: 422\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to \"/#{session[:username]}\", notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update?(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n delete_caches\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n update_resource_response(@post, blog_post_params)\n end",
"def update\n \n @previous_content = @post[:content]\n respond_to do |format|\n if @post.update_attributes(params[:post])\n \t\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n verify_owner_or_admin(@post)\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: \"Post was successfully updated.\" }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @update = Update.find(params[:id])\n @post = @update.post\n\n respond_to do |format|\n if @update.update_attributes(params[:update])\n format.html { redirect_to @post, notice: 'Update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render json: {status: 1, id: @post.id.to_s, notice: \"修改成功,标题是:#{@post.title.capitalize}\", errors: []}\n else\n render json: {status: -1, notice: \"修改失败\", errors: @post.errors.fall_message}\n end\n end",
"def update\n params[:post][:tag_ids] ||= []\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to [@post.user, @post], notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @post = Post.find(params[:id])\r\n @root_post = root_post_of(@post)\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n @root_post.touch(:updated_at)\r\n update_child_posts(@post)\r\n\r\n format.html { redirect_to @post, notice: 'Post 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: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @post.short_body = post_params[:body].split('</p>')[0] + '</p>'\n @post.tags.delete_all\n set_tags\n\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render_forbidden and return unless can_edit?\n @post = Post.friendly.find(params[:id])\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n redirect_to root_path\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.71867543",
"0.7042899",
"0.6774105",
"0.67672604",
"0.6669961",
"0.6649129",
"0.657972",
"0.6556958",
"0.6551495",
"0.6549005",
"0.6535034",
"0.6531995",
"0.6497553",
"0.64958835",
"0.6468818",
"0.64319825",
"0.6428907",
"0.64275557",
"0.64273673",
"0.64193714",
"0.64193666",
"0.6413534",
"0.6401499",
"0.6401499",
"0.63909745",
"0.63825583",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.63711846",
"0.6371097",
"0.63611764",
"0.6360867",
"0.63598454",
"0.63573265",
"0.63573265",
"0.63573265",
"0.63573265",
"0.6348769",
"0.6339638",
"0.63390875",
"0.633172",
"0.63293755",
"0.63204026",
"0.63095254",
"0.62960684",
"0.6289831",
"0.62780434",
"0.6271677",
"0.62716043",
"0.6271454",
"0.6261652",
"0.62530375",
"0.62426263",
"0.6228117",
"0.621697",
"0.6215017",
"0.6206318",
"0.6204175",
"0.6204175",
"0.6204175",
"0.6204175",
"0.6204175",
"0.6204175",
"0.6204175",
"0.6204175",
"0.6204175",
"0.6204175",
"0.62031627",
"0.61977786",
"0.61819714",
"0.61774534",
"0.61740726",
"0.6168681",
"0.6159861",
"0.61563087",
"0.61456937",
"0.61456937",
"0.614226",
"0.6122881",
"0.6116053",
"0.61133987",
"0.6110099",
"0.6107206",
"0.6105214",
"0.60997695",
"0.60986936",
"0.6094729",
"0.60945"
] | 0.0 | -1 |
DELETE /posts/1 DELETE /posts/1.json | def destroy
@post.destroy
respond_to do |format|
format.html { redirect_to project_posts_url, notice: 'Post was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: params[:id]}}, status: :ok\n end\n end",
"def destroy\n @post.destroy\n render json: {}, status: :ok\n end",
"def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end",
"def destroy\n @api_v2_post = Post.find(params[:id])\n @api_v2_post.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v2_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_post.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authenticated\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n\n json_response(@post)\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n render json: {\n data: {\n post: { key: @post.id },\n status: @post.status,\n }\n }\n end",
"def destroy\n\t\tpost = Post.find(params[:id])\n\t\t# byebug\n \tpost.destroy\n\t posts = Post.all\n \trender json: posts\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to posts_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path, notice: \"Post removed.\" }\n format.json { render 'destroy' }\n end\n end",
"def delete\n @post = Post.find(params[:id])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to root_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n render json: Post.all.as_json\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n @title = \"Kill Post\"\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to all_user_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html {redirect_to posts_url, notice: 'Post was successfully destroyed.'}\n format.json {head 200}\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path, notice: 'Post was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with post.destroy(params[:id])\n end",
"def destroy\n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to post_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end",
"def destroy\n # @post = Post.find(params[:id])\n #@post.destroy\n\n #respond_to do |format|\n # format.html { redirect_to posts_url }\n #format.json { head :no_content }\n #end\n end",
"def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to news_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find_by_slug(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Anúncio removido com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Postitus edukalt kustutatud!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluída com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mural_post.destroy\n respond_to do |format|\n format.html { redirect_to mural_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @posto = Posto.find(params[:id])\n @posto.destroy\n\n respond_to do |format|\n format.html { redirect_to postos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n end"
] | [
"0.8046884",
"0.76902676",
"0.7583626",
"0.75803024",
"0.7568048",
"0.75047046",
"0.75031126",
"0.74750155",
"0.74671036",
"0.74650854",
"0.746482",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74589694",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.74579465",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7428427",
"0.7423174",
"0.74059606",
"0.73990285",
"0.73928183",
"0.7389498",
"0.7371715",
"0.7371117",
"0.7349121",
"0.7344524",
"0.7342226",
"0.7338908",
"0.7313371",
"0.73123556",
"0.731156",
"0.73095584",
"0.7299751",
"0.7298017",
"0.7298017",
"0.7282874",
"0.7277125",
"0.7266815",
"0.7260945",
"0.72549784",
"0.7254856",
"0.7239102",
"0.7238946",
"0.7229726",
"0.7227931",
"0.7221013",
"0.721375",
"0.7211237",
"0.72097856",
"0.7190222",
"0.71850675",
"0.7171746",
"0.71533066",
"0.71457464",
"0.71434635",
"0.7142048",
"0.7139985",
"0.7137574"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_post
@post = Post.friendly.find(params[:id])
# authorize @post
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 post_params
params.require(:post).permit(:name, :description, :project_id)
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 valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\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 origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.62905645",
"0.6289235",
"0.6283876",
"0.62425834",
"0.62410337",
"0.6218672",
"0.62151134",
"0.62096137",
"0.6192354",
"0.6178057",
"0.6177618",
"0.61727077",
"0.6162073",
"0.6152049",
"0.61515594",
"0.61458135",
"0.6122875",
"0.61165285",
"0.6107696",
"0.6104097",
"0.6091097",
"0.6080201",
"0.60699946",
"0.6063739",
"0.60206395",
"0.60169303",
"0.60134894",
"0.601003",
"0.6007347",
"0.6007347",
"0.6001054",
"0.59997267",
"0.5997844",
"0.5991826",
"0.5991213",
"0.59911627",
"0.5980111",
"0.5967009",
"0.59597385",
"0.5958542",
"0.595787",
"0.5957425",
"0.59522784",
"0.5951228",
"0.59423685",
"0.5939385",
"0.5939122",
"0.5939122",
"0.59325653",
"0.5930178",
"0.59248054",
"0.59243476",
"0.59164625",
"0.59106",
"0.59101933",
"0.59084356",
"0.5905666",
"0.58975077",
"0.58974737",
"0.5895128",
"0.58946574",
"0.589308",
"0.58916",
"0.5885987",
"0.58838505",
"0.58792",
"0.58723736",
"0.58684355",
"0.58677715",
"0.5865701",
"0.5865538",
"0.5865288",
"0.586385",
"0.5862139",
"0.58614355",
"0.58593005",
"0.5857459",
"0.58541363",
"0.58536613",
"0.58520085",
"0.585011"
] | 0.0 | -1 |
, 64 Dado un arreglo no vacio, duplique los items | def maps(x)
duplicados = x.map { |n| n * 2}
print duplicados
puts
return duplicados
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duplicate_items_from(items)\n transaction do\n items.each do |item|\n transfer_items << item.dup\n end\n end\n end",
"def items; @items.clone end",
"def resize\n old_items = @items\n @items = Array.new(@items.size*2)\n old_items.each do |i|\n if i != nil\n puts i\n @items[index(i.key,@items.length)] = HashItem.new(i.key, i.value)\n end\n end\n end",
"def dup #$\n a = pop\n push a\n push a\n end",
"def add_dimension_to_items\n new_items = Array.new\n items.each do |i|\n Rails.logger.debug(\"i[:product_id] is #{i[:product_id]}\")\n p = CachedProduct.find_by_product_id(i[:product_id])\n i = i.merge({:height=>p.height, :width=>p.width, :length =>p.length})\n new_items << i\n end\n new_items\n end",
"def push_dup; end",
"def merge_drops_items(items)\n drop_items = []\n for item in items\n if item != nil\n \n victory_item = nil\n drop_items.each() { |vi| victory_item = vi if vi.item.id == item.id }\n \n if victory_item.nil?\n drop_items.push(VictoryItem.new(item, 1))\n else\n victory_item.quantity += 1\n end\n end\n end\n return drop_items\n end",
"def incluir(item, quantidade=1, data=Time.now.strftime('%d/%m/%y %I:%M%p'))\n indice = self.items.index { |x| x.produto == item }\n indice.nil? ? items << Item.new(item, quantidade, data) : self.items[indice].quantidade += quantidade\n end",
"def resize\n doubled = Array.new(size*2)\n @items.each do |item|\n if item\n doubled[index(item.key, doubled.length)] = item\n #puts \"item: #{item.key} \\n#{doubled}\"\n end\n end\n @items = doubled\n end",
"def dup\n\n # duplicate self\n rta = super\n\n # iterate through array and dup each hash\n rta.each_with_index do |w_hash, index|\n\n # dup the hash at this index\n rta[index] = w_hash.dup\n\n # to be complete, also dup the key/values in the hash, in case another hash/array is nested\n w_hash.each_pair do |k, v|\n rta[index][k] = v.dup if v.is_a? Hash\n end\n end\n\n # now everything should have new object_id's\n rta\n end",
"def consolidate_cart(cart)\nindex = 0\nnew_cart = []\n\nwhile index < cart.length do\n item = find_item_by_name_in_collection(cart[index][:item],new_cart)\n if item\n new_cart_index = 0\n while new_cart_index < new_cart.length do\n if new_cart[new_cart_index][:item]===item[:item]\n new_cart[new_cart_index][:count]+=1\n end\n new_cart_index+=1\n end\n else \n cart[index][:count] = 1\n new_cart << cart[index]\n end\n index+=1\nend\nnew_cart\nend",
"def pack(item, index); end",
"def dup(n=1)\n n.times{dps.concat(dps)}\n self\nend",
"def dup_and_save\n new_q = self.amoeba_dup\n new_q.sort_order = self.sort_order.to_i + 1\n new_q.save\n new_q\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n\t item.cart_id = nil\n \t line_items << item\n end\n end",
"def inserir_item(item)\n # Insere um item no inicio do buffer\n BUFFER.unshift item\n end",
"def item_list_adder(list, items, quantity)\n list[items] = quantity\n list\nend",
"def items_to_obj\n item_basket = []\n @items.each do |id, nbr|\n nbr.times do |i|\n item_basket << $data_items[id]\n end\n end\n item_basket\n end",
"def dupitems(arr)\n puts arr.reject { |e| arr.rindex(e) == arr.index(e) }.uniq\nend",
"def destutter2(seq)\n result = [] #result will be a new array\n last = nil #keep track of last thing\n\n seq.each do |item|\n if item != last\n result.push(item)\n #result << item\n end\n last = item\n end\n result\nend",
"def duplicate\n dup = Order.new\n dup.parent = self\n self.children << dup\n\n [:email,\n :ship_address,\n :bill_address,\n :shipping_method,\n :special_instructions,\n :split_shipment_type,\n :dc_code,\n :order_type].each do |attr|\n value = self.send(attr)\n dup.send(\"#{attr.to_s}=\", value)\n end\n\n # assign line_items\n self.line_items.each { |li| dup.add_variant li.variant, li.quantity }\n\n # set name\n dup.order_name = \"Duplicate of #{self.number}: #{self.order_name}\"\n dup.save!\n dup\n end",
"def consolidate_cart(cart)\n new_cart = []\n count = 0\n while count < cart.length\n new_cart_item = find_item_by_name_in_collection(cart[count][:item], new_cart)\n if new_cart_item != nil\n new_cart_item[:count] += 1\n else\n new_cart_item = {\n :item => cart[count][:item], \n :price => cart[count][:price],\n :clearance => cart[count][:clearance],\n :count => 1\n }\n new_cart << new_cart_item\n end\n count += 1\n end\n new_cart\nend",
"def line_items\n @line_items.dup.freeze\n end",
"def dup \n Daru::Vector.new @data.dup, name: @name, index: @index.dup\n end",
"def add_line_items_from(cart)\n\t\tcart.line_items.each do |item| \n\t\t\titem.cart_id = nil \n\t\t\tline_items << item \n\t\tend\n\tend",
"def uniq!\n im = Rubinius::IdentityMap.from self\n return if im.size == size\n\n Rubinius.check_frozen\n\n array = im.to_array\n @tuple = array.tuple\n @start = array.start\n @total = array.total\n\n self\n end",
"def make_quantity_list(item_list)\n index = 0\n while index < item_list.length\n item_list[index] = 1\n index = index+1\n end\n return item_list\nend",
"def resize\n temp_array = Array.new(@items)\n @items = Array.new(temp_array.length*2)\n\n # Iterates over every item in the original array, makes a new hash key, and puts it into new @items.\n for item in temp_array do\n if item != nil\n new_hash_key = self.index(item.key,self.size)\n @items[new_hash_key] = item\n end\n end\n end",
"def dup\n copy = super\n copy.clear_puzzle\n @puzzle.each_with_index do |entry, index|\n copy[index] = entry\n end\n copy\n end",
"def add_s(arry)\n arry.map! do |item|\n item = item + \"s\"\n# arry[1] >> arry[1].slice(0..-2)\n\n end\n arry[1]=arry[1].slice(0..-2)\n arry\nend",
"def copy_list \n\n\tend",
"def get_board_copy(board)\n dupe_board = []\n for i in board\n dupe_board.push(i)\n end \n return dupe_board\nend",
"def copied(src_item, item)\n end",
"def dupd\n\t\t\tpush [:dup]\n\t\t\tdip\n\t\tend",
"def build_duplicate(attrs)\n # Note that the duplication is *ONLY* the cart items and no attributes from\n # the originating cart are retained\n cloned = Cart.new(attrs)\n\n # Nor are the cart items fully cloned. Only the fabric variant is\n # retained (and associated denormalized columns)\n cart_items.each do |ci|\n cloned.cart_items.build({\n fabric_variant_id: ci.fabric_variant_id,\n mill_id: ci.mill_id,\n fabrium_id: ci.fabrium_id\n })\n end\n\n # overrides\n cloned.duplicating!\n cloned\n end",
"def dupli(list)\n list.map { |i| [i, i] }.flatten\nend",
"def consolidate_cart(cart)\n \n #declare new array\n new_cart = []\n \n #start with a counter so it begins at the first item\n counter = 0 \n \n #then create while loop\n while counter < cart.length \n \n #take each item in the cart and see if it is already in the new cart\n #calling the find_item_by_name_in_collection to check if item is in the new cart. Second argument is the collection we want to search want to see if the item is in our new cart.\n #So this will return either the item found or if not found it will return nil\n \n new_cart_item = find_item_by_name_in_collection(cart[counter][:item], new_cart)\n #if item is already in cart, we just want to increase the count\n if new_cart_item != nil \n \n #if new_cart_item does not equal nil then we want to access new_cart_item and inside we want to access the count and increase by 1\n new_cart_item[:count] += 1\n \n #otherwise, item is nil. We would need to create our item. Inside the hash we need to construct the new item in the new cart\n else\n new_cart_item = {\n :item => cart[counter][:item], \n :price => cart[counter][:price],\n :clearance => cart[counter][:clearance],\n #this is the first time count is being used, the old item did not have count\n :count => 1\n }\n #after the new_cart is built, we are going to shovel new_cart_item variable\n new_cart << new_cart_item\n end\n #to ensure there is not an infinite loop \n counter += 1\n end\n new_cart\nend",
"def add_item(olist, item, quant=1)\n new_list = {item => quant}\n olist.merge(new_list)\nend",
"def assure_unique_ingredients\n self.ingredients.uniq!\n end",
"def duplicate(array)\n array.uniq!\nend",
"def add_item(d_item, i, j)\n result = @tiles[j][i].add_item(d_item)\n #3 cases:\n #If an item is already in dest box:\n # 1) if they merge completely, change that item (dispose this one)\n # 2) if they do not fully merge, bounce this item back to original i,j\n #If no item already present:\n # 3) move this item to box\n case result\n when 1\n d_item.dispose\n when 2\n #i and j stay the same, restore items\n when 3\n rec = @grid_viewport.rect\n vp = Viewport.new(rec.x, rec.y, rec.width, rec.height)\n vp.z = d_item.z\n d_item.change_viewport(vp)\n #@items[d_item.j*@gw+d_item.i] = d_item.item.to_array\n end\n return result\n end",
"def fix_items\n valid_items = EquipmentModel.where(id: items.keys).collect(&:id)\n self.items = items.select { |em, _count| valid_items.include? em }\n end",
"def consolidate_cart(cart)\n# [{:item => \"AVOCADO\", :price => 3.00, :clearance => true },\n# {:item => \"AVOCADO\", :price => 3.00, :clearance => true },\n# {:item => \"KALE\", :price => 3.00, :clearance => false}]\n new_cart = []\n i = 0\n while i < cart.length do\n new_cart_item = find_item_by_name_in_collection(cart[i][:item], new_cart)\nif new_cart_item != nil\n new_cart_item[:count] += 1\nelse\n new_cart_item = {\n :item=> cart[i][:item],\n :price => cart[i][:price],\n :clearance => cart[i][:clearance],\n :count => 1\n }\n new_cart << new_cart_item\nend\n i+=1\n end\n new_cart\nend",
"def pack_consecutive_duplicates\n self.inject([[]]) do |array, current|\n if array[-1][-1] == current or array[-1][-1].nil?\n array[-1] << current\n else\n array << [current]\n end\n array\n end\n \n end",
"def reorganizeCart\n\t\t@new_cart = {}\n\t\[email protected] do |itemhash|\n\t\t\titemhash.each do |item, details|\n\t\t\t\t@new_cart[item] = details\n\t\t\t\t# adds :count key value to the hash\n\t\t\t\tif @new_cart[item][:count].nil? \n\t\t\t\t\t@new_cart[item][:count] = 1\n\t\t\t\telse\n\t\t\t\t\t@new_cart[item][:count] += 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#gets rid of duplicate entries\n\t\trepeat = []\n\t\t@new_cart.each do |item, hash|\n\t\t\tif repeat.include?(item) \n\t\t\t\tdelete(item)\n\t\t \telse\n\t\t \t\trepeat << item\n\t\t \tend\n\t\tend\n\t\t@new_cart\n\tend",
"def duplicate!\n ff = amoeba_dup\n ff.save\n ff\n end",
"def items\n instance_item_display = []\n @instance_items.each do |entry|\n quantity = entry[2]\n item = entry[0]\n quantity.times{instance_item_display << item} \n end \n instance_item_display\nend",
"def dup_pixi tmpFlg, repost=false\r\n ListingDataProcessor.new(self).dup_pixi tmpFlg, repost\r\n end",
"def dup\n copy = Queue.new\n copy.size = @size\n copy.elements = @elements\n copy\n end",
"def deep_dup; end",
"def consolidate_cart(cart)\n \n new_cart = []\n index = 0\n\n while index < cart.count do\n new_cart_item = find_item_by_name_in_collection(cart[index][:item], new_cart)\n if new_cart_item\n new_cart_item[:count] += 1\n else\n new_cart_item = {\n :item => cart[index][:item],\n :price => cart[index][:price],\n :clearance => cart[index][:clearance],\n :count => 1\n }\n new_cart << new_cart_item\n end\n\n index += 1\n end\n \n return new_cart\nend",
"def remove_duplicates(cart:[])\n cart.uniq\nend",
"def update(items)\n # clear!\n self.items.each do |i|\n number = items[i.id].blank? ? 1 : items[i.id].to_i <= 0 ? 1 : items[i.id]\n number.to_i < 99 ? i.quantity = number.to_i : i.quantity=99\n end\n # items.each { |id, quantity| add_items(id, quantity) }\n end",
"def add_item(glist, item, count=1)\n\tglist[item] = 1\n\treturn glist\nend",
"def duplin(list, n)\n list.map { |i| [i] * n }.flatten\nend",
"def duplicate(from)\n @bits.each_index {|i| @bits[i] = from.getWord(i)}\n end",
"def resize\n old_array = @items\n @items = Array.new(old_array.length * 2)\n old_array.each do |h_item|\n if h_item != nil\n @items[index(h_item.key, size)] = HashItem.new(h_item.key, h_item.value)\n end\n end\n end",
"def consolidate_cart(cart)\n new_cart = []\ncart.each do |grocery_item|\n current_item = find_item_by_name_in_collection(grocery_item[:item],new_cart)\n if current_item\n new_cart.each do |new_cart_item|\n if new_cart_item[:item] == current_item[:item]\n new_cart_item[:count]+=1 \n end\n end\n else\n grocery_item[:count] = 1 \n new_cart << grocery_item\nend\nend\nnew_cart\nend",
"def add_item(list, item, quantity)\n #list = item.push\n list[item] = quantity.to_i\n list\nend",
"def duplicate(i)\n\t\tself.push @storage[i].resource.clone\n\tend",
"def separate_books_repeateds\n repeated_books_array = Array.new\n\n #dup faz uma copia\n books_temp = @books.dup\n\n @books.each do |book|\n #puts \"book: #{book.name}\"\n #puts \"---------\"\n repeated_count = 0\n books_temp.size\n\n books_temp.each do |book_temp|\n #puts \"book_temp: #{book_temp.name}\"\n if book == book_temp\n repeated_count += 1\n end\n end\n\n #puts \"repeated_count: #{repeated_count}\"\n\n # > 1 porque sempre vai ter ele mesmo\n if repeated_count > 1\n repeated_books_hash = Hash.new\n\n repeated_books_hash[:book] = book\n repeated_books_hash[:quantity] = repeated_count\n repeated_books_array << repeated_books_hash\n #Remove todos os books que eh igaul ao atual da lista :books_temp\n books_temp.delete book\n #puts books_temp.size\n #puts @books.size\n end\n end\n\n return repeated_books_array\n end",
"def dup_copy\n @num_copies += 1\n @num_in += 1\n\n puts \"Great now we have #{@num_copies}!\"\n end",
"def consolidate_cart(cart)\n consol_cart = []\n i = 0\n while i < cart.length\n new_item = find_item_by_name_in_collection(cart[i][:item], consol_cart)\n if new_item\n new_item[:count] += 1\n else\n new_item = {\n :item => cart[i][:item],\n :price => cart[i][:price],\n :clearance => cart[i][:clearance],\n :count => 1\n }\n consol_cart << new_item\n end\n i += 1\n end\n consol_cart\nend",
"def expand_repeats(hash)\n\t\t\t\thash.each do |key,val|\n\t\t\t\t\tif val.kind_of? Array\n\t\t\t\t\t\tval.each_with_index{|v, i| hash[\"#{key}(#{i+1})\"] = v}\n\t\t\t\t\t\thash.delete(key)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\thash\n\t\t\tend",
"def pack(a)\n\treps = Hash.new(1)\n prev = nil\n \n # filter out repeats\n a.select! {|v| prev == v ? (reps[v] += 1; false) : prev = v}\n \n # replace with nested arrays\n reps.each {|k, v| a[a.index k] = Array.new(v, k)}\n \n a\nend",
"def test_build_line_items_from_hash\n # Create a new order and put just one line item.\n setup_new_order()\n @o.order_line_items << @li\n \n # Now try to feed it with others.\n @o.line_items = {\n items(:red_lightsaber).id => {'quantity' => 2},\n items(:towel).id => {'quantity' => 1},\n items(:blue_lightsaber).id => {'quantity' => \"\"}\n }\n \n assert_equal @o.items.size, 2\n end",
"def ordenar_for\n\t @lista = self.map{ |a| a }\n\t \tfor i in ([email protected])\n\t\t\tfor j in ([email protected])\n\t\t\t\tif j+1 != @lista.count\n if @lista[j+1] < @lista[j]\n\t\t\t\t\t\t@lista[j],@lista[j+1] = @lista[j+1],@lista[j]\n \t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@lista\n end",
"def dedup(match_section: true)\n unique = Items.new\n each do |item|\n unique.push(item) unless unique.include?(item, match_section: match_section)\n end\n\n unique\n end",
"def add_redundancy(pw_data)\n entries = 8000 + SecureRandom.random_number(4000)\n position = SecureRandom.random_number(entries)\n \n ret = entries.times.map{ # or whatever... just create noise ;)\n { SecureRandom.uuid.chars.to_a.shuffle.join => SecureRandom.uuid.chars.to_a.shuffle.join }\n }\n ret[position] = pw_data\n ret << position\n \n ret\n end",
"def repeat(item, times)\n\tarr = []; arr += [item] * times; return arr\nend",
"def consolidate_cart(cart)\n \n nhash ={}\n new_array = []\n row_index =0\n \n while row_index < cart.length\n item_mutch = find_item_by_name_in_collection(cart[row_index][:item],nhash)\n \n if !item_mutch\n \n nhash[row_index] = {}\n nhash[row_index][:item] = cart[row_index][:item]\n nhash[row_index][:count] = 1\n nhash[row_index][:clearance] = false\n nhash[row_index][:price] = cart[row_index][:price]\n new_array << nhash[row_index]\n# binding.pry\nelse\n item_mutch[:count] += 1\n item_mutch[:clearance] =true\n # nhash[:price] += cart[row_index][:price]\nend\n\n\n row_index += 1\n # Consult README for inputs and outputs\n #\n # REMEMBER: This returns a new Array that represents the cart. Don't merely\n # change `cart` (i.e. mutate) it. It's easier to return a new thing.\n\nend\nreturn new_array\n end",
"def refill(items = {})\n validate_refill(items)\n items.each do |key, value|\n return unless value.to_f && @inventory[key.to_s]\n\n new_value = @inventory[key.to_s] + value.to_f\n @inventory[key.to_s] += value.to_f\n end\n end",
"def consolidate_cart(cart)\n index = 0\n new_cart = []\n \n cart.each do |grocery_item|\n current_item = find_item_by_name_in_collection(grocery_item[:item], new_cart)\n if current_item\n new_cart_index = 0\n new_cart.each do |new_cart_item|\n if new_cart_item[:item] === current_item[:item]\n new_cart_item[:count] += 1\n end\n new_cart_index += 1\n end\n else\n grocery_item[:count] = 1\n new_cart << grocery_item\n end\n index += 1\n end\n new_cart\nend",
"def dup\n self.class.new(\n items.dup,\n first: first,\n after: after,\n max_page_size: max_page_size,\n last: last,\n before: before\n )\n end",
"def duplicate\n dup.tap do |c|\n c.page = nil\n columns.each do |column|\n c.columns << column.duplicate\n end\n pictures.each do |picture|\n c.pictures << picture.duplicate\n end\n end\n end",
"def create_copy(arr)\n copy = []\n arr.each { |e| copy.unshift(e) }\n copy\nend",
"def cascade_packed_items_location\n box_items.each(&:save!)\n end",
"def add_items(items)\n add_items!(unknown_items(items))\n end",
"def push_dup\n push(@store.last) if size > 0\n end",
"def consolidate_cart(cart)\n cons_cart = []\n item_index = 0 \n while item_index < cart.length do \n item = cart[item_index][:item]\n price = cart[item_index][:price]\n clearance = cart[item_index][:clearance]\n current_item = find_item_by_name_in_collection(item, cons_cart)\n if !current_item\n cons_cart << {:item => item, :price => price, :clearance => clearance, :count => 1}\n else\n current_item[:count] += 1\n end\n item_index += 1\n end\n cons_cart\nend",
"def resize\n # TODO\n # if aray is 75% full, double the array and copy all items over\n end",
"def dup \n Daru::Vector.new @vector.dup, name: @name, index: @index.dup\n end",
"def add_discretionary_items\n while (item = next_discretionary_item) && [email protected]?\n add_item_to_card(item)\n end\n end",
"def dup\n empty_board = Board.new(false)\n pieces.each do |piece|\n temp_color = (piece.color == :red) ? :red : :white\n temp_pos = [piece.pos[0], piece.pos[1]]\n temp_kinged = piece.kinged\n temp_piece = Piece.new(empty_board, temp_color, temp_pos, temp_kinged)\n\n # empty_board.add_piece(Piece.new(empty_board, temp_color, temp_pos, temp_kinged), temp_pos)\n end\n\n empty_board\n # duped_rows = rows.map(&:dup)\n #\n # duped_rows.each_with_index do |row, row_idx|\n # row.each_index do |col_idx|\n # next if duped_rows[row_idx].nil?\n # current_cell = duped_rows[row_idx][col_idx]\n #\n # next if current_cell.nil?\n # duped_rows[row_idx][col_idx] = current_cell.dup\n # end\n # end\n # duped_board = self.class.new(duped_rows, false)\n # duped_board.pieces.each do |piece|\n # piece.board = duped_board\n # end\n # duped_board\n\n end",
"def dup\n self.class.new(\n length: @length,\n genes: @genes.dup\n )\n end",
"def shoppingList\n a = []\n x = 1\n y = 1\n puts \"insert an item\"\n 5.times do\n a << gets.strip.upcase\n \n end\n b = a.sort.uniq\n\n 5.times do \n \n b.insert(x,y)\n x += 2\n y += 1\n # binding.pry\n end\n h=Hash[*b.flatten(1)]\n puts h\n end",
"def add_item(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def add_item(d_item, name=nil)\n item = d_item.item\n if !name then name = item.name end\n #if we already have an item in this box\n if @d_item\n #if same item or\n if (item.id == @d_item.item.id) && (item.quality == @d_item.item.quality)\n max = @d_item.max?\n total = @d_item.item.quantity+item.quantity\n if total > max\n @d_item.item.quantity = max\n item.quantity = (total - max)\n @d_item.refresh\n return 2\n else\n @d_item.item.quantity += item.quantity\n @d_item.refresh\n return 1\n end\n end\n #if different item or quality, cannot merge\n return 2\n end\n #if empty, add the item\n @d_item, @last_item = d_item, item.clone\n @d_item.refresh\n return 3\n end",
"def duplicate(stuff)\n duplicated_stuff = []\n stuff = [*stuff] unless stuff.is_a?(Enumerable)\n stuff.each do |obj|\n duplicated_stuff << duplicate_object(obj)\n end\n duplicated_stuff.length == 1 ? duplicated_stuff[0] : duplicated_stuff\n end",
"def duplicate(qty_ordered, qty_received = nil, qty_issued = nil)\n new_item = OrderedLineItem.create!(self.attributes.merge({\n :quantity_ordered => qty_ordered, \n :quantity_received => qty_received, \n :issued_quantity => qty_issued,\n :date_received => nil\n }))\n new_item.line_item_no = self.line_item_no\n new_item.save!\n end",
"def deep_clone\n b = dup\n b.generate_token\n b.save\n basket_items.each {|i| b.basket_items << i.dup}\n b\n end",
"def cartProd\n @items = []\n @arr1.each{ |a|\n @arr2.each{ |b|\n item = [] << a << b\n @items << item\n }\n }\n end",
"def new_puzzle_ids\n\t\t@puzzle_ids - @puzzle_packet_ids\n\tend",
"def expand!(original)\n from = original.size\n original.map! {|row|\n row.unshift 0\n row << 0\n }\n original.unshift(Array.new(from+2) {0})\n original << Array.new(from+2) {0}\nend",
"def consolidate_cart(cart:[])\n add_item_counts(cart:cart)\n remove_duplicates(cart:cart)\n cart.inject({}) { |hash, cart_item| hash.merge(cart_item) }\nend",
"def add_line_items_from_cart(cart)\n \tcart.line_items.each do |item|\n \t\titem.cart_id = nil\n \t\tline_items << item\n \tend \t\n end",
"def consolidate_cart(cart)\n # Consult README for inputs and outputs\n #\n # REMEMBER: This returns a new Array that represents the cart. Don't merely\n # change `cart` (i.e. mutate) it. It's easier to return a new thing.\n new_cart = []\n counter = 0\n\n while counter < cart.length\n new_item = find_item_by_name_in_collection(cart[counter][:item], new_cart)\n if new_item != nil\n new_item[:count] += 1\n else\n new_item = {\n :item => cart[counter][:item],\n :price => cart[counter][:price],\n :clearance => cart[counter][:clearance],\n :count => 1\n }\n new_cart << new_item #shoving the new hash into new array\n end\n counter += 1\n end\n\n new_cart\nend",
"def mappa_e_rimuovi_duplicati(&block)\n self.map.with_index(&block).uniq\n end",
"def bytes_to_items(raw_data)\n (0...raw_data.length).step(2).each do |i|\n @items[i/2] = Item.new raw_data[i], raw_data[i+1]\n end\n end",
"def add_items_from_cart(cart)\n\t\tcart.line_items.each do |item|\n\t\t\titem.cart_id = nil\n\t\t\tline_items << item\n\t\tend\n\tend",
"def pop_inv(inv, size) \n\n items = Array.new;\n\n # Populate with size\n case size\n when :pocket\n @book = Item.new([\"book\", \"novel\"], \"1984\", \"An Orwellian Nightmare\")\n @pen = Item.new([\"pen\", \"biro\"], \"4-Pen\", \"A four pen with red, green, blue and black inks\")\n @phone = Item.new([\"phone\", \"cell\"], \"iPhone\", \"An iPhone 5\") \n items.push(@book, @pen, @phone)\n \n when :wallet\n @myki = Item.new([\"myki\", \"travelcard\"], \"Myki\", \"An consession myki card\")\n @idcard = Item.new([\"id\", \"card\"], \"ID card\", \"Swinny ID card\")\n @cash = Item.new([\"cash\", \"money\"], \"$20 banknote\", \"A 20 dollar banknote\") \n items.push(@myki, @idcard, @cash)\n end\n \n #put the items in\n items.each do |item|\n inv.put(item)\n end\nend"
] | [
"0.65675336",
"0.6152339",
"0.58827555",
"0.5850411",
"0.58345705",
"0.5788555",
"0.5754244",
"0.57430786",
"0.57233846",
"0.56722075",
"0.5657133",
"0.5643768",
"0.5532891",
"0.5495206",
"0.54490507",
"0.5437809",
"0.54334766",
"0.5425746",
"0.5425102",
"0.5417686",
"0.5407453",
"0.54047716",
"0.5388873",
"0.5381329",
"0.5375322",
"0.5374295",
"0.5373098",
"0.53685725",
"0.5364974",
"0.5358683",
"0.534834",
"0.5345909",
"0.53409564",
"0.5337905",
"0.53339815",
"0.53288627",
"0.53265214",
"0.5324805",
"0.53180784",
"0.53141284",
"0.53112507",
"0.531091",
"0.53100336",
"0.53084284",
"0.5305419",
"0.5301958",
"0.52851397",
"0.52795213",
"0.5278999",
"0.5278875",
"0.5268467",
"0.5266458",
"0.5262229",
"0.52582985",
"0.5255775",
"0.52523154",
"0.52505183",
"0.5248789",
"0.5240514",
"0.5237094",
"0.5235836",
"0.52330273",
"0.5222429",
"0.5218299",
"0.52165085",
"0.5211125",
"0.5204495",
"0.52036434",
"0.51999134",
"0.51963603",
"0.51959795",
"0.519494",
"0.5192766",
"0.5191916",
"0.51911044",
"0.5188529",
"0.518845",
"0.51873654",
"0.51857555",
"0.51817477",
"0.5172072",
"0.5166091",
"0.516497",
"0.5160251",
"0.5159701",
"0.5157896",
"0.5156795",
"0.51558137",
"0.5155614",
"0.5154803",
"0.515338",
"0.51513296",
"0.5149476",
"0.5138929",
"0.513885",
"0.51279086",
"0.51270705",
"0.5126915",
"0.51245195",
"0.5123392",
"0.51161397"
] | 0.0 | -1 |
triggered while creating a record for first time | def convert_price_to_dollar
self.price = self.price.to_f/100
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_create_save(record); end",
"def enter_created; end",
"def before_create_save(record); end",
"def create\n run_callbacks :create do\n true\n end\n end",
"def after_create; end",
"def before_create()\n end",
"def after_created; end",
"def _create\n true\n end",
"def after_create\n true\n end",
"def before_create\n @added = true\n super\n end",
"def after_create(record)\n create_event_log(record, 'created')\n end",
"def new_record?; end",
"def new_record?; end",
"def adjust_after_create\n # The record is in @record, do what you will, this precedes a save.\n end",
"def before_create_save(record)\n record.usr_id = session[:usr_id]\n # I derive the name of the object to prevent user from naming it stupidly\n record.name = \"#{record.symbl.name}-#{record.rpttype.name}-#{record.enddate.to_s}\"\n end",
"def did_create\n @new_record = false\n self.class.identity_map[self.id] = self\n self.class.all.push self\n\n trigger_events(:create)\n end",
"def log_create\n if self.class.name == 'ParticipantsSportEntry'\n model = self.sport_entry\n action = 'UPDATE'\n else\n model = self\n action = 'CREATE'\n end\n\n ModelAuditJob.perform_now(model, action, audit_user_id)\n end",
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def after_create(record)\n contents = to_sql_insert(record)\n to_logfile(contents)\n # Send a notification to the admin, if requested:\n if @email_on_create\n AgexMailer.action_notify_mail(\n record.respond_to?(:user) ? record.user : nil,\n \"#{@table_name} row CREATED\",\n contents\n ).deliver\n end\n end",
"def before_create\n \tself.day_made ||= Date.current if new_record?\n \tself.got_bonus = false\n \tend",
"def create_record(model, *args)\n record = new_record(model, *args)\n record.save!\n record.reload\n record\n end",
"def create_record(model, *args)\n record = new_record(model, *args)\n record.save!\n record.reload\n record\n end",
"def create\n \t\n end",
"def before_create_save(record)\n do_save_logic(record)\n record.usr_id = session[:usr_id]\n end",
"def create_created\n controller.create_created(resource: resource)\n end",
"def autolog_created\n autolog_event(:created)\n end",
"def perform_create\n resource.save!\n end",
"def after_create(resource)\n add_activity(:create, resource)\n end",
"def _after_create(pk)\n # SEQUEL5: Remove\n @this = nil\n @new = false\n @was_new = true\n end",
"def create\r\n end",
"def on_creating_entry(state, event, *event_args)\n super\n\n # TODO: simulation - remove\n if simulating\n action =\n case existing_record\n when false then :set_record\n when true then :reset_record\n else :create_record\n end\n if action == :create_record\n # From UploadController#new:\n # @item = new_record(user_id: @user.id, base_url: request.base_url)\n __debug_sim('CODE') do\n args = 'user_id: @user.id, base_url: request.base_url'\n \"@item = new_record(#{args})\"\n end\n submission.set_item\n else\n action = :set_record\n end\n else\n action = :create_record\n end\n\n unless simulating\n wf_start_submission(*event_args)\n end\n\n # TODO: simulation - remove\n __debug_sim do\n case action\n when :set_record then 'Form error message displayed if present.'\n when :reset_record then 'New-item form emptied after cancel.'\n else 'System presents a new-item submission form.'\n end\n end\n\n # TODO: simulation - remove\n commit = file_valid? ? 'submit' : 'upload'\n __debug_sim('USER fills form until submit is enabled.')\n __debug_sim(\"USER must `cancel!` or `#{commit}!` to advance...\")\n\n self\n end",
"def before_create; self.created_on = Time.now.utc; end",
"def before_create\n self.created_at ||= Time.now\n super # ($)\n end",
"def create(*)\n super.tap do\n __debug_sim('USER initiates submission of new entries.')\n end\n end",
"def post_is_create?\n\t\ttrue\n\tend",
"def create\n \n end",
"def create\r\n\r\n\r\n end",
"def create \n end",
"def create \n end",
"def create\n self.id = connection.insert(\n \"INSERT INTO #{self.class.table_name} \" +\n \"(#{quoted_column_names.join(', ')}) \" +\n \"VALUES(#{attributes_with_quotes.values.join(', ')})\",\n \"#{self.class.name} Create\",\n self.class.primary_key, self.id\n )\n \n @new_record = false\n end",
"def after_create(obj); end",
"def create_record(init)\n subject.transaction(requires_new: true) do\n InternalId.create!(\n **scope,\n usage: usage_value,\n last_value: init.call(subject) || 0\n )\n end\n rescue ActiveRecord::RecordNotUnique\n lookup\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n #\n end",
"def create\n #\n end",
"def create\n #\n end",
"def validate_on_create; end",
"def create\n create_entry\n end",
"def create\n check_fields\n sql = \"INSERT INTO #{table} VALUES (NULL,#{to_create_record_str})\"\n Database.transaction(sql)\n sql = \"SELECT id FROM #{table} WHERE #{to_find_id_str}\"\n @id = Database.execute(sql).last[0]\n @log.debug \"Record[#{self}] is added to Table[#{table}]\"\n end",
"def create\n \n end",
"def _process_on_create(entity)\n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create!\n end",
"def create\n push_to_db\n end",
"def create\n push_to_db\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end"
] | [
"0.76792896",
"0.76379",
"0.75934875",
"0.7258986",
"0.7223479",
"0.7212328",
"0.7084132",
"0.70021677",
"0.6964432",
"0.69378865",
"0.6934749",
"0.6932605",
"0.6932605",
"0.69299996",
"0.6881073",
"0.6877005",
"0.68763435",
"0.6803837",
"0.6803837",
"0.6803837",
"0.6803837",
"0.6801057",
"0.6787492",
"0.6771129",
"0.6758068",
"0.6749411",
"0.67458016",
"0.6710624",
"0.6707607",
"0.67013896",
"0.6695321",
"0.66911894",
"0.66582817",
"0.6656092",
"0.6639596",
"0.66294885",
"0.661978",
"0.66106623",
"0.6596396",
"0.6566822",
"0.6564629",
"0.6564629",
"0.6532244",
"0.6529036",
"0.6524015",
"0.65169626",
"0.65169626",
"0.65169626",
"0.65136147",
"0.65136147",
"0.65136147",
"0.6511557",
"0.6507452",
"0.6505862",
"0.65012395",
"0.649352",
"0.64869916",
"0.64869916",
"0.64869916",
"0.64869916",
"0.64827526",
"0.64827526",
"0.64827526",
"0.64827526",
"0.64827526",
"0.6471348",
"0.64676595",
"0.64676595",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583",
"0.64628583"
] | 0.0 | -1 |
validates_presence_of :name, :title, :message | def update_images(image_ids)
Image.where(id: image_ids).update_all(blog_id: self.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n validates_presence([:title, :body])\n end",
"def validate\n validates_presence([:name, :phone])\n end",
"def validate_presence(attribute_name, message = nil)\n value = send(attribute_name)\n if !value || value.to_s.empty?\n append_error(attribute_name, message || :cant_be_empty)\n end\n end",
"def validate\n super\n errors.add(:name, \"can't be empty\") if name.blank?\n errors.add(:category_id, \"can't be empty\") if category_id.blank?\n errors.add(:price, \"can't be empty\") if price.blank?\n end",
"def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend",
"def validate()\n errors.add(:nombre, \"debe ser positivo\") if nombre.nil?\n end",
"def assert_valid\n raise ValidationError, \"no name\" unless name\n raise ValidationError, \"no version\" unless version\n raise ValidationError, \"no summary\" unless summary\n #raise ValidationError, \"no maintainer\" unless maintainer\n #raise ValidationError, \"no homepage\" unless homepage\n end",
"def name_is_valid\n errors.add(:name,'Invalid empty string for name.') unless name_is_valid?\n end",
"def name_present\n if name.blank?\n errors.add(:name, \"Can't be empty\")\n end\n end",
"def not_valid_message; nil; end",
"def not_valid_message; nil; end",
"def test_presence_of_name\n client = Client.new(:tat => 13, :partener_bank_group_code => 'HJ',\n :internal_tat => 89, :group_code => 'JO',:max_jobs_per_user_payer_wise => 5,\n :max_jobs_per_user_client_wise => 5, :max_eobs_per_job => 5)\n assert_equal(false, client.save, \"Name can't be blank!\")\n end",
"def validate_title_and_body\n return true unless self[:title].blank?\n return errors.add(:validate_title_and_body, \"Title and Body are required\") if self[:body].blank?\n self[:title] = self[:body][0..29]\n end",
"def validate_title\n if self.title.length < 3\n errors.add :base, :invalid, message: \"The title is invalid\"\n end\n end",
"def validate_title\n errors.add(:title, :must_be_null_in_this_slide) if !self.allows_title? && !self.title.nil?\n end",
"def name_not_blank\n if self.name.blank?\n self.errors.add(:name, I18n.t('stage.errors.blank_name'))\n end\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 valid?(message)\n true\n end",
"def valid_attributes\n {title: \"atitle\"}\n end",
"def validate_title\n if self.title.length < 3\n # throw error, a custom error would be nice\n errors.add :base, :invalid, message: \"The title is invalid, need at least 3 valid characters.\"\n end\n end",
"def validate\n unless params[:name] =~ /\\w+/\n @errors << 'A valid name is required'\n end\n unless params[:email] =~ /\\w+@\\w+\\.\\w+/\n @errors << 'A valid email address is required'\n end\n unless params[:message] =~ /\\w+/\n @errors << 'A message is required'\n end\n #unless simple_captcha_valid?\n # @errors << 'Captcha did not match'\n #end\n @errors.empty?\n end",
"def check_title_and_description(params)\n if params[:title] == nil\n @errors << \"Title can't be empty\"\n end\n if params[:description] == nil\n @errors << \"You need to add description\"\n elsif params[:description].length < 20\n @errors << \"description can't be less than 20 characters\"\n end\nend",
"def validate_title(item)\n error(msg: 'Title may not be blank', item: __method__.to_s) if blank?(item)\n end",
"def validate_name_and_entity_id\n @patient.valid?\n #@patient.errors.add(:entity_id, I18n.t('patients.create.no_entity')) if @patient.new_record? && [email protected]_id.present?\n @patient.errors.add(:name, I18n.t('patients.create.no_name')) unless @patient.name.present?\n @patient.errors.empty?\n end",
"def test_validate\n naming = Naming.new\n assert_not(naming.save)\n assert_equal(3, naming.errors.count)\n assert_equal(:validate_naming_name_missing.t, naming.errors[:name].first)\n assert_equal(:validate_naming_observation_missing.t,\n naming.errors[:observation].first)\n assert_equal(:validate_naming_user_missing.t, naming.errors[:user].first)\n end",
"def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end",
"def validation; end",
"def validation; end",
"def validate\n raise ValidationError, \"Subject is required\" if subject.nil?\n end",
"def message\n @props.fetch(:message, \"must be valid\")\n end",
"def validates_presence_of(*attr_names)\n configuration = { :on => :save }\n configuration.update(attr_names.extract_options!)\n\n # can't use validates_each here, because it cannot cope with nonexistent attributes,\n # while errors.add_on_empty can\n send(validation_method(configuration[:on]), configuration) do |record|\n record.errors.add_on_blank(attr_names, configuration[:message]) unless configuration[:message].is_a?(String) && configuration[:message].empty?\n end\n end",
"def basic_validations\n if title.blank?\n errors.add(:title, 'Title cannot be blank.')\n else\n self.menu_name = self.title if menu_name.blank?\n self.shortcut = self.title.parameterize.html_safe if shortcut.blank?\n errors.add(:shortcut, \"Shortcut cannot contain spaces\") if shortcut.include? \" \"\n errors.add(:shortcut, \"Shortcut cannot contain slashes\") if shortcut.include? \"/\"\n errors.add(:shortcut, \"Shortcut cannot contain '?'\") if shortcut.include? \"?\"\n end\n end",
"def test_presence\n item = Item.new\n assert !item.valid?\n assert_equal @@error[:blank], item.errors.on(:user_id)\n assert_equal @@error[:blank], item.errors.on(:date)\n assert_equal @@error[:blank], item.errors.on(:value)\n end",
"def message_params\n params.require(:message).permit(:name)\n end",
"def validacion_titulo_Nota\n if titulo != nil && titulo== \"Nota\" then\n errors.add(:titulo,\"El título no puede ser 'Nota'\")\n end\n end",
"def empty_name_error(type, what)\n validation_error(type, what, 'name is empty')\n end",
"def test_should_require_title\n city = create(:name => nil)\n assert city.errors.invalid?(:name), \":title should be required\"\n assert_invalid city, \"city shouldn't be created\"\n end",
"def test_generate_message_blank_with_default_message\n assert_equal \"can’t be blank\", @person.errors.generate_message(:title, :blank)\n end",
"def test_should_require_name\n intitution = create(:name => nil)\n assert intitution.errors.invalid?(:name), \":name should be required\"\n assert_invalid intitution, \"intitution shouldn't be created\"\n end",
"def assert_presence(model, field)\n model.valid?\n assert_match /can't be blank/, model.errors[field].join, \"Presence error for #{field} not found on #{model.class}\"\n end",
"def assert_presence(model, field)\n model.valid?\n assert_match /can't be blank/, model.errors[field].join, \"Presence error for #{field} not found on #{model.class}\"\n end",
"def should_validate_presence_of(*attributes)\n message = get_options!(attributes, :message)\n\n attributes.each do |attribute|\n matcher = validate_presence_of(attribute).with_message(message)\n should matcher.description do\n assert_accepts(matcher, subject)\n end\n end\n end",
"def validate\n errors.add(:username, \"already exists.\") if Player.get_player(username) != nil\n end",
"def message_params\n params.require(:message).permit(:title, :content)\n end",
"def first_name_is_valid\n errors.add(:first_name,'Invalid empty string for first name.') unless first_name_is_valid?\n end",
"def validate_presence_of (object, *symbol)\n symbol.each do |sym|\n #Rails::logger.debug \"Test_Presence_of: symbol: #{sym}\"\n assert_errors object.errors[sym], I18n.translate('errors.messages.blank')\n end\n end",
"def check_presence(model, field)\n assert model.invalid?, \"#{model.class} without #{field} should not be valid\"\n assert_not_empty model.errors[field]\n end",
"def message_params\n params.require(:message).permit(\n :email,\n :name,\n :message\n )\n end",
"def not_blank\n if (name.blank? and email.blank? and phone.blank?)\n errors.add(\"name, email, and phone cannot all be blank\")\n end\n end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def message_params\n params.require(:message).permit(:name, :text, :email)\n end",
"def validate_name\n unless name.length > 0\n add_error :name, 'name of the price item shall be provided'\n end\n\n unless price.to_i > 0\n add_error :price, 'price should be a number'\n end\n end",
"def message_params\n params.permit(:title, :body)\n end",
"def validate\n super\n end",
"def validate\n errors.add(:post_office, \"- must be filled for postalcode #{self.postal_code}\") if self.post_office.blank? && !self.postal_code.blank?\n errors.add(:postal_code, \"- must be filled for #{self.post_office}\") if self.postal_code.blank? && !self.post_office.blank? \n errors.add_to_base(\"- Person must have at least one phonenumber\") if (self.phone_home.blank? && self.phone_cell.blank? && self.phone_work.blank?) \n end",
"def validate\n super \n end",
"def validate\n if @name.empty?\n @message = \"Please input a username.\"\n elsif @password.empty?\n @message = \"Please input a password.\"\n elsif @names.include?(@name) == false\n @message = \"That username does not exist. Please make sure to check your spelling.\"\n elsif @names.include?(@password) == false\n @message = \"Wrong password. Please check your spelling and try again.\"\n elsif @names.include?(@name) && @names.include?(@password)\n @message = \"Welcome {@name}\"\n end\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def message_params\n params.require(:message).permit(\n :email,\n :name,\n :message\n )\n end",
"def message_params\n params.require(:message).permit(:name, :email, :body)\n end",
"def test_validates_presence_of_for_ruby_class\n repair_validations(Person) do\n Person.validates_presence_of :karma\n\n p = Person.new\n assert p.invalid?\n\n assert_equal [\"can't be blank\"], p.errors[:karma]\n\n p.karma = \"Cold\"\n assert p.valid?\n end\n end",
"def msg_params\n params.require(:message).permit(:name, :content, :valid_to, :published)\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def assert_presence_of_attributes(model, options = {}, *attributes)\n message = options[:message] || I18n.translate('activerecord.errors.messages.blank')\n\n attributes.each do |attribute|\n object = model.new\n assert_error object, attribute, message\n end\n end",
"def validate_display_name\nif ! validate_a_display_name( self.display_name )\nerrors.add( :display_name , \"Invalid display name (see RFC 3261).\" )\nend\nend",
"def validations\n {}\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def message_params\n params.require(:message).permit(:name, :email, :content)\n end",
"def message_params\n params.permit(:name, :email, :message)\n end",
"def validate_name?\n # if you create user from admin interface(or as a team member), then \"name\" param is provided, it is present or blank - not nil\n !name.nil?\n end",
"def validate\n super\n validates_presence [:code, :preference, :type_param_id, :application_id]\n end",
"def test_career_has_name_validator\n\t\t# Arrange\n\t\tcareer = Career.new\n\n\n\t\t# Act\n\t\tcareer.name = ''\n\n\t\t# Assert\n\t\tassert_equal career.valid?, false\n\tend",
"def initialize\n super :presence\n end",
"def validate\n \n \n end",
"def extra_validations\n success\n end",
"def valid_attributes\n {\n name: \"Event Name\"\n }\n end",
"def test_invalid_with_empty_attributes\r\n patient = Patient.new\r\n assert !patient.valid?, patient.errors.full_messages\r\n assert patient.errors.invalid?(:first_name)\r\n assert patient.errors.invalid?(:last_name)\r\n assert patient.errors.invalid?(:dob)\r\n assert patient.errors.invalid?(:ssn)\r\n assert patient.errors.invalid?(:address)\r\n assert patient.errors.invalid?(:city)\r\n assert patient.errors.invalid?(:state)\r\n assert patient.errors.invalid?(:zipcode)\r\n assert patient.errors.invalid?(:sex)\r\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 validate_create_params!(params); end",
"def is_valid; end",
"def test_invalid_with_empty_attributes\r\n responsible_party = ResponsibleParty.new\r\n assert !responsible_party.valid?, responsible_party.errors.full_messages\r\n assert responsible_party.errors.invalid?(:first_name)\r\n assert responsible_party.errors.invalid?(:last_name)\r\n assert responsible_party.errors.invalid?(:address)\r\n assert responsible_party.errors.invalid?(:city)\r\n assert responsible_party.errors.invalid?(:state)\r\n assert responsible_party.errors.invalid?(:zipcode)\r\n end",
"def test_presence\n task = Task.new\n assert !task.valid?\n assert_equal @@error[:blank], task.errors.on(:date)\n assert_equal @@error[:blank], task.errors.on(:job_id)\n assert_equal @@error[:blank], task.errors.on(:minutes)\n end",
"def validate_subject\n errors.add(:subject_id, 'not presence') if Subject.find_by_id( self[:subject_id] ) == nil\n end",
"def message_params\n params.require(:message).permit(:first_name, :last_name, :org_name, :email, :phone, :message)\n end",
"def validate\n # add errors if not validate\n end",
"def validation\n # Rails.logger.debug \"#{self.class}.#{__method__} Default validator is empty\"\n end",
"def validate\n if !new_record? && current?\n errors.add('contact_name', 'Please provide a contact name for your enquiry') unless contact_name.present?\n errors.add('contact_phone', 'Please provide a phone number where we may contact you at about your enquiry') unless contact_phone.present?\n end\n end",
"def validate!\n # pass\n end",
"def validate_name\n errors.add(:abstract, \"person_name or company_name must be present\") unless (person_name || company_name)\n end",
"def message_params\n params.permit(:first_name, :last_name, :email, :phone, :message)\n end",
"def validate\n\n end",
"def validates_presence(atts, opts={})\n validatable_attributes(atts, opts){|a,v,m| (m || \"is not present\") if model.db.send(:blank_object?, v) && v != false}\n end"
] | [
"0.7961016",
"0.72607696",
"0.68245965",
"0.6821016",
"0.6810354",
"0.6764489",
"0.67547685",
"0.6706585",
"0.66238576",
"0.66005015",
"0.66005015",
"0.65942824",
"0.6519605",
"0.6492172",
"0.64604485",
"0.63819003",
"0.6364475",
"0.6363069",
"0.63594365",
"0.6353447",
"0.63430965",
"0.63261145",
"0.63168037",
"0.63127327",
"0.6306878",
"0.63051933",
"0.6296163",
"0.6296163",
"0.6293128",
"0.6288616",
"0.6287212",
"0.62767226",
"0.6275042",
"0.62712324",
"0.6263156",
"0.62553126",
"0.62474895",
"0.6246747",
"0.6245085",
"0.6227135",
"0.6227135",
"0.6224681",
"0.6224252",
"0.6211611",
"0.6210718",
"0.62098277",
"0.6170712",
"0.6168012",
"0.6139938",
"0.613363",
"0.613363",
"0.613363",
"0.6133266",
"0.6129613",
"0.6113004",
"0.61042804",
"0.6095444",
"0.60889214",
"0.608445",
"0.6079656",
"0.6079656",
"0.6079656",
"0.6079656",
"0.60794395",
"0.60774875",
"0.6077073",
"0.60691667",
"0.60523754",
"0.60523754",
"0.60523754",
"0.60466444",
"0.60443974",
"0.6037769",
"0.60361725",
"0.60361725",
"0.60361725",
"0.60354215",
"0.60334665",
"0.6033275",
"0.60332644",
"0.6024528",
"0.60114527",
"0.6009383",
"0.60065097",
"0.60045385",
"0.5997895",
"0.59977245",
"0.59960526",
"0.5993746",
"0.59892267",
"0.59848046",
"0.5981357",
"0.5972948",
"0.59671986",
"0.5966257",
"0.5966136",
"0.5966081",
"0.596224",
"0.5957618",
"0.5955111",
"0.5948509"
] | 0.0 | -1 |
Don't bother creating a connection until we need one | def connection
@connection ||= if authenticated?
RestClient::Resource.new(api_uri.to_s, @username, @password)
else
RestClient::Resource.new(api_uri.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_connection; end",
"def connect_if_connection_initialized\n connection.connect if connection.initialized?\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def ensure_connection!\n fail \"Must have active connection\" unless connection\n end",
"def connection\n @connection ||= make_connection\n end",
"def open_connection\n if @sslca then\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name,\n sslca: @sslca)\n else\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name)\n end\n end",
"def connect\n @connection_pool.get_connection\n end",
"def aquire_connection\n conn = if @connection_pool\n @connection_pool.aquire_connection\n else\n @connection\n end\n @status = nil unless conn.connected?\n conn\n end",
"def make_conn(spec)\n case @handling_mode\n when :cache\n cache_connect(spec)\n when :pool\n # not yet implemented\n nil\n else\n nil\n end\n end",
"def connect_using conn\n @connection = conn\n end",
"def establish_connection\n end",
"def connection\n @connection = create_connection! unless connected?\n @connection\n end",
"def conn\n\t\treturn @conn ||= self.connect\n\tend",
"def conn\n @conn ||= connect\n if block_given?\n yield @conn\n else\n @conn\n end\n rescue *HttpExceptions\n @conn = connect\n return if defined?(once)\n once = true && retry\n end",
"def connection\n @connection ||= build_connection\n end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def create_connection\n self.setup\n RfmAdaptor::Connection.new(self.server_name)\n end",
"def connect\n force_connect unless @handler\n end",
"def spawn_connection\n connect\n end",
"def connect\n connection.connect\n nil\n end",
"def make_connection database=nil\n \n self.sql ||= Mysql2::Client.new(:host => \"#{self.url}\", :username => \"username#{self.user_id}\", :password => \"cis400\", :port => 3306, :database=>\"#{database}\")\n end",
"def retrieve_connection(klass) #:nodoc:\n self.ensure_ready\n pool = self.retrieve_connection_pool(klass)\n (pool && pool.connection) or raise ActiveRecord::ConnectionNotEstablished\n end",
"def ensure_connected\n client = @connection.client(self)\n \n # If this connection has expired somehow, try to get another one.\n unless connected?(client)\n @connection.drop(self)\n client = @connection.client(self)\n end\n\n fail \"Bad Connection\" unless connected?(client)\n\n client\n end",
"def test_connection\n @pool.hold {|conn|}\n true\n end",
"def attempt_connection\n @connection_future = Concurrent::Future.new do\n connection_method.call\n end\n connection_future.execute\n end",
"def connect\n @connection.create\n end",
"def test_connection\n synchronize{|conn|}\n true\n end",
"def open_connection\n\tbegin\n\t\tdb = Mysql.new $db_hostname, $db_user, $db_pass\n\trescue Mysql::Error\n\t\tabort \"Oops! Couldn't connect to database! Make sure you entered the correct information.\"\n\tend\n\treturn db\nend",
"def init\n # Open a socket for the server to connect on.\n @sock = TCPSocket.new(@address , @server.port)\n @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, false)\n unless RUBY_PLATFORM =~ /win32/\n @sock.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)\n end\n c = Connection.new(@server, @sock)\n if c.init\n log.info \"(#{c.object_id}) Connection made.\"\n publish(c)\n true\n else\n false\n end\n rescue Exception\n log.error \"Connector#init\"\n log.error $!\n false\n end",
"def ensure_db_connection\n conn = ActiveRecord::Base.connection\n begin\n try ||= 3\n conn.reconnect!\n rescue\n try -= 1\n # There is a issue where connection closed unexpectedly, need retry\n retry if try > 0\n end\n end",
"def connect!\n @connection = Connection::Factory.create(@options[:transport], @options[:transport_wrapper], @current_server, @options[:timeout])\n @connection.connect!\n @client = @client_class.new(@options[:protocol].new(@connection.transport, *@options[:protocol_extra_params]))\n rescue Thrift::TransportException, Errno::ECONNREFUSED => e\n @transport.close rescue nil\n raise e\n end",
"def connect\n Connection.new\n end",
"def open_connection\n\tbegin\n\t\tdb = Mysql.new($db_hostname, $db_user, $db_pass)\n\trescue Mysql::Error\n\t\tabort \"Oops! Couldn't connect to database! Make sure you entered the correct information.\"\n\tend\n\treturn db\nend",
"def open_conn(global = true, set_wait = true, host = DBHOST, user = DBUSER, pass = DBPASS, name = DBNAME)\n LOGGER.debug \"Opening db connection\"\n conn = nil\n\n #use global connection\n if global \n LOGGER.debug \"Using global database connection\"\n \n # global connection is already defined\n if is_global_db_connected?\n LOGGER.debug \"Global connection is set, just giving it back\"\n conn = $global_db_conn\n \n # global connection is not defined or not set\n else\n \n # open new global connection \n LOGGER.debug \"Global connection isn't defined or isn't set; attempting to reconnect...\"\n begin\n $global_db_conn = Mysql::new(host, user, pass, name)\n conn = $global_db_conn\n \n if set_wait && defined?(DBWAIT)\n LOGGER.debug \"Settign wait time for db connection to #{DBWAIT}\"\n sql = \"SET SESSION WAIT_TIMEOUT = #{DBWAIT};\" \n dbres = conn.query(sql)\n end\n\n rescue Mysql::Error => err\n LOGGER.error \"Error making db connection: #{$1}\"\n raise err\n end\n end\n \n # don't use global connection\n else\n LOGGER.debug \"Not using global connection, creating anew...\"\n # open new global connection \n\n begin\n conn = Mysql::new(host, user, pass, name)\n \n if set_wait && defined?(DBWAIT)\n LOGGER.debug \"Settign wait time for db connection to #{DBWAIT}\"\n sql = \"SET SESSION WAIT_TIMEOUT = #{DBWAIT};\" \n dbres = conn.query(sql)\n end\n rescue Mysql::Error => err\n LOGGER.error \"Error making db connection: #{$1}\"\n raise err\n end\n end\n \n conn\nend",
"def connection\n @db = Connection.client\nend",
"def connect_reset_safe\n\t\tbegin\n\t\t\tconnect\n\t\trescue Rex::ConnectionRefused\n\t\t\treturn :refused\n\t\tend\n\t\treturn :connected\n\tend",
"def connect(temp: false)\n return connection if connection && !temp\n return create_tcp_connection(temp: temp)\n end",
"def initialize\r\n @connection = nil\r\n end",
"def connect!; end",
"def connect!; end",
"def open()\n begin\n @my = Mysql.connect(@host, @user, @pw, @db)\n # Set the MySQL 'reconnect' flag -> Connection to the database will be \n # automatically maintained even if the Server closes it due to timed-out idle period\n @my.reconnect = true\n debug \" - Open Connection to MYSQL server - reconnect=#{@my.reconnect}\"\n rescue MysqlError => e\n debug \"SQL error message: #{e.error}.\"\n end\t\n end",
"def without_reconnect(&block); end",
"def prepare_http_connection\n conn = @http\n if conn.nil? || !options[:persistent]\n conn = HTTPClient.new(options[:proxy] || self.class.proxy)\n set_http_connection_options(conn, options)\n @http = conn # Always set to last used connection\n end\n conn\n end",
"def raw_connection; end",
"def cached_connection_established?\n @cached_connection_established ||= begin\n # NOTE This will not be called unless we have some messages to send,\n # so no useless connections are made\n @connection.try_connect\n @connection.established?\n end\n end",
"def open()\n begin\n @my = Mysql.connect(@host, @user, @pw, @db)\n # Set the MySQL 'reconnect' flag -> Connection to the database will be\n # automatically maintained even if the Server closes it due to timed-out idle period\n @my.reconnect = true\n debug \" - Open Connection to MYSQL server - reconnect=#{@my.reconnect}\"\n @connected = true\n rescue MysqlError => e\n debug \"SQL error message: #{e.error}.\"\n end\n end",
"def makeDBConnection()\n\n if ( !@db_conn.nil? && @db_conn.status == PGconn::CONNECTION_OK)\n return\n end\n\n # trying anyway to release the connection just in case\n closeDBConn()\n\n begin\n @db_conn = PGconn.open(\n :host => @db_conf['host'],\n :port => @db_conf['port'],\n :options => @db_conf['options'],\n :tty => @db_conf['tty'],\n :dbname => @db_conf['dbname'],\n :user => @db_conf['user'],\n :password => @db_conf['password']\n )\n\n @db_conn.prepare(\"mypreparedinsert\", @db_conf['queryinsert'])\n # @db_conn.prepare(\"mypreparedupdate\", @db_conf['queryupdate'])\n\n rescue PGError => e\n $stderr.puts \"ERROR: while connecting to Postgres server, class: #{e.class.name}, message: #{e.message}\"\n\n if @byebye\n return nil\n end\n\n $stderr.puts \"Sleep #{@db_conf['sleep']} seconds and retry\"\n slept = sleep @db_conf['sleep']\n $stderr.puts \"Slept #{slept} seconds\"\n retry\n end\n\n return\n end",
"def conn\n #if @conn exists and is open\n if @conn and begin @conn.status rescue PGError false end then\n return @conn\n else\n return @conn = connect_to_database\n end\n end",
"def wait_connection; end",
"def wait_connection; end",
"def connection\n @connection ||= Connection.new(nil)\n end",
"def db_cached_connect\n @dbh or db_connect\n end",
"def db_cached_connect\n @dbh or db_connect\n end",
"def with_connection\n conn = checkout\n yield conn\n ensure\n checkin conn\n end",
"def make_conn(conn)\n conn.h_conn = @dbm.make_conn(conn.spec)\n end",
"def connection\n raise NotImplementedError, \"Implement #{__callee__} in #{self.class.to_s}\"\n end",
"def with_reserved_connection(&block)\n @connection.acquire\n yield\n ensure\n @connection.release\n end",
"def attempt_connection\n @connection_future = Concurrent::Future.new do\n Roby::DRoby::Logfile::Client.new(host, port)\n end\n connection_future.execute\n end",
"def connection\n return nil if @dry_run\n raise Mysql::Error, \"Cannot connect without database information\" if @database.nil?\n if !@conn\n @conn = Mysql::new(@database[:host], @database[:user], @database[:password], @database[:database])\n create_pruned_table(@conn)\n end\n @conn\n end",
"def create_new_persistent_connection\n app_name = if @data[:options][:connection_ca_file] ||\n @data[:credentials][:cert] ||\n @data[:credentials][:key]\n 'right_cloud_api_gem_%s' % Utils::generate_token\n else\n 'right_cloud_api_gem'\n end\n connection = Net::HTTP::Persistent.new(app_name)\n set_persistent_connection_options!(connection)\n # Register a callback to close current connection\n @data[:callbacks][:close_current_connection] = Proc::new do |reason|\n connection.shutdown\n log \"Current connection closed: #{reason}\"\n end\n connection\n end",
"def test_connection_open?\n assert_equal true , @conn.open?\n @conn.disconnect\n assert_equal false, @conn.open?\n end",
"def initiate_connection\n Retriable.retriable on: [Errno::ECONNREFUSED, Errno::EHOSTUNREACH] do\n TCPSocket.new(ip, port).close\n end\n end",
"def close_connection; end",
"def connection\n begin\n @connections.hold { |dbh| yield(dbh) }\n rescue Mysql::Error => me\n \n @configuration.log.fatal(me)\n \n @connections.available_connections.each do |sock|\n begin\n sock.close\n rescue => se\n @configuration.log.error(se)\n end\n end\n \n @connections.available_connections.clear\n raise me\n end\n end",
"def connection\n raise ConnectionNotEstablished unless @@connection\n return @@connection\n end",
"def initialize\n open_connection!\n @transaction_open = false\n end",
"def connection\n @connection || Connection.new\n end",
"def checkin_connection(conn)\n @available_connections << conn\n conn\n end",
"def connect!\n # Keep existing connections\n return unless @backend.nil?\n\n @backend = train_connection.connection\n @backend.wait_until_ready\n\n # When the testing function `mock_instance` is used, it will set\n # this instance variable to false and handle this function call\n # after the platform data is mocked; this will allow binding\n # of mixin functions based on the mocked platform.\n mix_in_target_platform! unless @mocked_connection\n rescue Train::UserError => e\n raise ConnectionFailure.new(e, config)\n rescue Train::Error => e\n # These are typically wrapper errors for other problems,\n # so we'll prefer to use e.cause over e if available.\n raise ConnectionFailure.new(e.cause || e, config)\n end",
"def open_connection\n # DataObjects::Connection.new(uri) will give you back the right\n # driver based on the DataObjects::URI#scheme\n connection = connection_stack.last || DataObjects::Connection.new(normalized_uri)\n connection_stack << connection\n connection\n end",
"def test_connection_exists\n assert_not_nil @conn\n end",
"def with_connection\n connect.with do |conn|\n begin\n conn.current_time\n rescue RbVmomi::Fault, Errno::EPIPE, EOFError\n LabManager.logger.warn(\"Connection isn't working, created new one\")\n conn = Fog::Compute.new( { provider: :vsphere }.merge(VSphereConfig.connection) )\n end\n yield conn\n end\n end",
"def connect; end",
"def db_conn\n @db_conn_pool ||= ConnectionPool.new(size: 4, timeout: 2) do\n Mysql2::Client.new(self.db_settings)\n end\n end",
"def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end",
"def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end",
"def checkout_new_connection\n c = new_connection\n @connections << c\n checkout_and_verify(c)\n end",
"def initialize_connection(env)\n end",
"def test_connection\n end",
"def connect dbname=nil\n dbname ||= getdbname\n return nil unless dbname\n #$log.debug \"XXX: CONNECT got #{dbname} \"\n $current_db = dbname\n $db = SQLite3::Database.new(dbname) if dbname\n return $db\nend",
"def attempt_connection\n # All that we care about is that we are able to connect successfully via\n # https, so here we're simpling hitting a somewhat arbitrary low-impact URL\n # on the puppetdb server.\n path = \"/v2/metrics/mbean/java.lang:type=Memory\"\n headers = {\"Accept\" => \"application/json\"}\n if @use_ssl\n conn = Puppet::Network::HttpPool.http_instance(@puppetdb_server, @puppetdb_port, @use_ssl)\n else\n # the Puppet httppool only supports disabling ssl in Puppet > 3.x\n # this code allows ssl to be disabled for the connection on both 2.7 and 3.x\n conn = Net::HTTP.new(@puppetdb_server, @puppetdb_port)\n conn.read_timeout = Puppet[:configtimeout]\n conn.open_timeout = Puppet[:configtimeout]\n end\n\n response = conn.get(path, headers)\n unless response.kind_of?(Net::HTTPSuccess)\n Puppet.notice \"Unable to connect to puppetdb server (#{@puppetdb_server}:#{@puppetdb_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue Exception => e\n Puppet.notice \"Unable to connect to puppetdb server (#{@puppetdb_server}:#{@puppetdb_port}): #{e.message}\"\n return false\n end",
"def connect(*) end",
"def connection\n threaded[:connection] || raise('Please authenticate with GoodData.connect first')\n end",
"def connect\n @connection_manager.connect\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 connect()\r\n begin\r\n raise InvalidOperationException, 'connection is already open' unless @conn.nil?\r\n load_driver\r\n uri =\r\n if @host.nil?\r\n nil\r\n elsif running_on_windows\r\n \"tcp://#{ @host }:#{ @port }\"\r\n else\r\n \"tcp://#{ @host }:#{ @port }\"\r\n #\"unix:#{ @host }/.s.PGSQL.#{ @port }\"\r\n end\r\n @conn = PostgresPR::Connection.new( @catalog, @user, @pass, uri ) \r\n rescue Exception => ex\r\n on_connect_error( ex, self )\r\n end\r\n end",
"def new_connection(params)\n Pod4.logger.info(__FILE__){ \"Connecting to DB\" }\n client = TinyTds::Client.new(params)\n raise \"Bad Connection\" unless client.active?\n\n client.execute(\"use [#{self.class.db}]\").do\n\n client\n\n rescue => e\n handle_error(e)\n end",
"def test_conn_1p_0000\n assert @conn.open?\n end",
"def configure_connection\n end",
"def connect\n @connection.open\n end"
] | [
"0.7541748",
"0.7487058",
"0.735854",
"0.735854",
"0.735854",
"0.735854",
"0.735854",
"0.735854",
"0.7137877",
"0.7043957",
"0.6962577",
"0.6953826",
"0.68738353",
"0.6847752",
"0.6842711",
"0.6796541",
"0.67583257",
"0.672204",
"0.67161494",
"0.6693824",
"0.6693824",
"0.6693824",
"0.6693824",
"0.6693824",
"0.6693824",
"0.6693824",
"0.6693824",
"0.668755",
"0.6657596",
"0.6641327",
"0.66140676",
"0.66008943",
"0.6595844",
"0.65857315",
"0.65763366",
"0.6563984",
"0.65595156",
"0.6543746",
"0.65001464",
"0.6492738",
"0.6488375",
"0.6488229",
"0.6479657",
"0.64755213",
"0.64714646",
"0.64697987",
"0.64582974",
"0.6429402",
"0.6428449",
"0.642471",
"0.642471",
"0.6408081",
"0.6407138",
"0.64056516",
"0.6390348",
"0.63859165",
"0.63831306",
"0.63813597",
"0.6376492",
"0.63736695",
"0.63736695",
"0.63665074",
"0.63522017",
"0.63522017",
"0.63491046",
"0.6335409",
"0.6333405",
"0.6307039",
"0.63047445",
"0.6288661",
"0.6287101",
"0.6285522",
"0.6267949",
"0.6262981",
"0.6258435",
"0.6255552",
"0.6242794",
"0.62315816",
"0.623006",
"0.62197006",
"0.62107456",
"0.62019944",
"0.6190043",
"0.6189315",
"0.61888033",
"0.6187719",
"0.6187719",
"0.6187546",
"0.61875147",
"0.6180255",
"0.61760616",
"0.61747307",
"0.6170828",
"0.6164807",
"0.61620986",
"0.6161555",
"0.6159647",
"0.6149677",
"0.61421245",
"0.61369246",
"0.61365336"
] | 0.0 | -1 |
Keep track of the players in play order | def append_player(player)
@players ||= []
@players << player unless @players.include?(player)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def players\n @players ||= []\n end",
"def players\n @players ||= []\n end",
"def assign_order\n num = 1\n self.game_players.each do |player|\n player.username = player.user.username\n player.turn_order = num\n if num == 1\n self.up_next = player.user.username\n end\n num = num + 1\n player.save\n end\n end",
"def reorder_players_start\n @players = @premium_order\n @log << \"#{@players.first.name} has priority deal\"\n end",
"def choose_turn_order\r\n @players.shuffle!\r\n end",
"def switch_players\n @current_player_index += 1\n @current_player_index = 0 if @current_player_index >= @num_players\n @players[@current_player_index]\n end",
"def players\n @players.select(&:playing)\n end",
"def update_counters\n player.plays_count.increment\n opponent.plays_count.increment\n true\n end",
"def load_players\n\t\tif self.new_record? && self.players.empty?\n\t\t\tself.user_ids.shuffle!.each_with_index do |user_id, index|\n\t\t\t\tself.players.build(position: index, user_id: user_id)\n\t \tend\n\t end\n \tend",
"def reorder_players\n @players.sort_by! { |p| -p.cash }\n @log << '-- New player order: --'\n @players.each.with_index do |p, idx|\n pd = idx.zero? ? ' - Priority Deal -' : ''\n @log << \"#{p.name}#{pd} (#{format_currency(p.cash)})\"\n end\n end",
"def players\n [@player1, @player2].sort_by { |player| player.first ? 0 : 1 }\n end",
"def swap_players\n\t @cur_player = @players.find { |player| player != @cur_player }\n\tend",
"def play_game\n i = 0\n # loop which goes through each player and deals them a card from the beginning of the deck\n for player in self.players do\n # card given to other player as a hash\n player[:card] = self.deck[i]\n puts player\n i += 1\n end\n # calls the method to compare cards\n self.compare_cards\n end",
"def swap_players\n @cur_player = @players.find { |player| player != @cur_player }\n end",
"def players\n @players || []\n end",
"def join( player )\n player.number = @players.size+1\n @players << player\n end",
"def init_play\n # self.started_at = Time.now\n logger.info 'game.started_at: ' + started_at.to_s\n seq = 0\n gamers.order(:sequence_nbr).each do |g|\n turn = Turn.find_by(game_id: id, user_id: g.user_id)\n if g.accepted?\n seq += 1\n g.sequence_nbr = seq\n g.game_started # state --> waiting\n g.save\n turn.sequence_nbr = seq\n if seq == 1 #first player\n logger.info 'game.first player: ' + g.user_id.to_s\n turn.started = started_at\n turn.get_turn \n end\n turn.save!\n # delete turn of not accepting gamer\n else\n g.sequence_nbr = 0\n g.save\n turn.delete if turn\n end\n end\n save\n end",
"def add_player()\n @players.push(players)\n end",
"def add_player_to_players(player)\n players.push(player)\n end",
"def reordenate_team\n position = 1\n self.players.each do |player|\n player.update_attribute(:position, position)\n position += 1\n end\n end",
"def players\n (@players ||= []).map{|id| W.find_player id}.freeze\n end",
"def check_current_player\n @current_player += 1\n @current_player = 0 if @current_player == @players.length\n puts \"Player is now #{@players[@current_player]}\"\n @current_player\n end",
"def players(ordering = :raw)\n\t\t@@logger.info { \"Retrieving players.\" } if have_logger?\n\t\tmyplayers = Player.dataset.filter(:tournament_id => self.id).all\n\t\tcase ordering\n\t\t\twhen :random then\n\t\t\t\t@@logger.info { \"Ordering players: :random.\" } if have_logger?\n\t\t\t\tmyplayers.shuffle\n\t\t\twhen :criteria then\n\t\t\t\t@@logger.info { \"Ordering players: :criteria.\" } if have_logger?\n\t\t\t\tmyplayers.sort do |a, b|\n\t\t\t\t\ta_side = []\n\t\t\t\t\tb_side = []\n\t\t\t\t\tself.criteria.each do |func|\n\t\t\t\t\t\ta_side << a.send(func)\n\t\t\t\t\t\tb_side << b.send(func)\n\t\t\t\t\tend\n\t\t\t\t\tb_side <=> a_side\n\t\t\t\tend\n\t\t\twhen :score, :soft then\n\t\t\t\t@@logger.info { \"Ordering players: :score or :soft.\" } if have_logger?\n\t\t\t\tmyplayers.sort { |a, b| b.score <=> a.score }\n\t\t\twhen :hard then\n\t\t\t\t@@logger.info { \"Ordering players: :hard.\" } if have_logger?\n\t\t\t\tscores = []\n\t\t\t\tmyplayers.each { |player| scores << player.score unless scores.include?(player.score) }\n\t\t\t\tscores.each do |score|\n\t\t\t\t\t# Select those with same score\n\t\t\t\t\tplayers_tmp = myplayers.select { |player| player.score == score }\n\t\t\t\t\tnext if players_tmp.length <= 1 # If not more than one, get next group\n\t\t\t\t\t# Great... we have a group. Remove them from the main array\n\t\t\t\t\tmyplayers.delete_if { |player| player.score == score }\n\t\t\t\t\t# Shuffle the temp array\n\t\t\t\t\tplayers_tmp.shuffle!\n\t\t\t\t\t# Give it back to the main array\n\t\t\t\t\tmyplayers += players_tmp\n\t\t\t\tend\n\t\t\t\t# Sort it again in the end\n\t\t\t\tmyplayers.sort { |a, b| b.score <=> a.score }\n\t\t\telse\n\t\t\t\t# This include the :raw case\n\t\t\t\t@@logger.info { \"Ordering players: :raw or any other thing.\" } if have_logger?\n\t\t\t\tmyplayers\n\t\tend\n\tend",
"def pass_player_turn\n @active_player_idx += 1\n if @active_player_idx == @players.length\n @active_player_idx = 0\n end\n end",
"def setup\n @turn_order_delegate = self\n @end_game_delegate = self\n #a = self.players.length if self.players\n #puts \"first player id: #{@players.first.id}\"\n #broadcast_event Game::GAME_INITIALIZED, {}\nend",
"def get_players\n\n end",
"def winner\n players.sort.last\n end",
"def player\n\t\t# locate now-playing track\n\t\tnow_playing_track = Track.find_by(status: 'now playing')\n\t\tnow_playing_track.nil? ? @current_track_video_id = \"Q98_0Af8tG8\" : @current_track_video_id = now_playing_track.video_id\n\n\t\t#show remaining tracks to play\n\t\t@tracks = Track.where(status: 'waiting').order('created_at')\n\tend",
"def switch_players\n temp = @current_player\n @current_player = @opposing_player\n @opposing_player = temp\n end",
"def cards_played(player) \n @played[player]\n end",
"def set_played_games()\n @played_games += 1\n end",
"def name_all_players\n (0..num_players - 1).each { |i| @players[i].name_player('Player' + i.to_s)}\n end",
"def player_sort()\n\t\tsession[:player].sort {|a, b| a.total_score <=> b.total_score }\n\tend",
"def players; [@hunter, @prey] end",
"def play\n @@plays += 1\n end",
"def determine_starting_player\n @current_player_index = rand(0..num_players - 1)\n puts \"Looks like #{@players[@current_player_index].name} will be going first!\"\n @players[@current_player_index]\n end",
"def initialize_players\n\n end",
"def leaderboard\n @players = Player.order(number_of_wins: :desc)\n end",
"def games_played\n @games_played = @games_played += 1\n end",
"def play_the_game\n self.deal\n while player1.count && player2.count\n self.play_hand\n end\n\n p player1.packet\n p player2.packet\n\n end",
"def active_player\n @active_player ||= players.start\n end",
"def build_list_of_players\nend",
"def train_players\n self.players.each(&:train)\n end",
"def advance_players!\n until finished? != nil\n @players.times do |current_player|\n new_location = @current_location[current_player] + @dice.roll\n unless new_location > @length-1 || finished? != nil\n @track[current_player][@current_location[current_player]] = \".\"\n @current_location[current_player] = new_location\n @track[current_player][new_location] = \">\"\n end\n end\n print_track\n sleep 1\n end\n end",
"def each_player\n @players.each\n end",
"def player_win\n @player_win += 1\n end",
"def lead_card\n player = lead_player\n @played[player]\n end",
"def switch_player\n @current_player = @current_player == @players.first ? @players.last : @players.first\n end",
"def who_win\n @players.each do |player|\n result_sum = 0\n player.cards_wins.each do |cards|\n result_sum += cards.value.to_i\n end\n player.points = result_sum\n end\n players_win = @players.sort_by(&:points).reverse![0]\n puts 'GANADOR--------GANADOR---------GANADOR----'\n puts \"Nombre: #{players_win.name} || Puntos: #{players_win.points}\"\n #players_win.cards_wins.each do |cards|\n # puts cards.id\n #end\n @players.each do |player|\n puts ''\n puts player.name\n puts 'Cartas: '\n player.cards_wins.each do |cards|\n print \"#{cards.id}\"\n print ' || '\n end\n end\n end",
"def current_player_moves\r\n current_player.play(board)\r\n end",
"def start\n setPlayers\n question\nend",
"def select_position\n @players = @game.players\n end",
"def player_positions\n @board[@position] = @player\n end",
"def play_game_with_current_moves\n winners = get_games_winners\n save_winners(winners) unless winners.nil?\n winners\n end",
"def initialize\n self.player_hash = {}\n self.user_hash = {}\n self.playing_user_names=[]\n self.started = false\n self.disks_for_each_player=4#default\n self.shuffle_names = true\n end",
"def next_player!\n end",
"def play\n @players.each do |p|\n @events.handle(:player_play, p) do\n p.hands.each {|hand| play_hand(p, hand) }\n\n p.hands.reject! {|hand| hand.invalid }\n end\n end\n\n # Dealer plays his hand last.\n @events.handle(:dealer_play, @dealer) do\n dealer_play_hand\n end\n end",
"def sortPlayers\r\n\[email protected]_players = @table.sort\r\n\[email protected] = @table.current_players.dup\r\nend",
"def players\n go_fish.players\n end",
"def set_players\n @players = Player.where(account_id: params[:id]).order_by(match_id: :desc).page(params[:page]).per(20)\n end",
"def initialize\n @players = []\n @p1 = Player.new('player')\n @players << @p1\n @p2 = ComputerPlayer.new('com')\n @players << @p2\n play\n end",
"def before_players_ready\r\n end",
"def initialize\n @players = []\n @p1 = Player.new('p1')\n @players << @p1\n @p2 = ComputerPlayer.new('com')\n @players << @p2\n play\n end",
"def play\n outcome = ''\n [1, 2].each {|ix| _select_players(ix)}\n c_player, o_player = _init_players\n o_player.set_other!(c_player) if o_player.is_IA_S?\n c_player.set_other!(o_player) if c_player.is_IA_S?\n #\n move_already_played = []\n #\n loop do\n STDOUT.print(\"#{@board.to_s}\\n#==> #{c_player.name}/#{c_player.type}'s TURN:\\n\")\n loop do\n m, sym = _get_move_from(c_player, move_already_played) # current player do his move\n v = @board.set_cell(m, sym.to_s)\n if m == -1 || v == sym # if sym not valid symbol, set_cell(m, sym != sym\n move_already_played << m.to_i\n break\n end\n STDERR.print \"! cell[#{m}] already set, try something else - v was: #{v.inspect} // #{v.class}\\n\"\n end\n move_already_played.sort!\n outcome = @board.game_over?\n break if outcome == :draw || outcome == :winner\n c_player, o_player = _switch_players(c_player, o_player)\n end\n _conclusion(outcome, c_player)\n end",
"def run_game\n\n #creating the players\n\n player1 = Player.new(\"Player 1\")\n player2 = Player.new(\"Player 2\")\n @players << player1\n @players << player2\n\n @active_player = @players[1]\n\n while (@active_player.life > 0)\n run_round\n end\n\n game_over\n\n end",
"def after_players_ready\r\n end",
"def switch_players\n \n if @current_asker == @player1\n @current_asker = @player2\n @current_responder = @player1\n else\n @current_asker = @player1\n @current_responder = @player2\n end\n\n end",
"def all_play_a_card\n @players.each do |p|\n @hand_played << p.try(:cards).try(:first) if p.has_cards?\n @cards_on_table << p.try(:cards).try(:shift) if p.has_cards?\n end\n end",
"def get_positions\n all_players = consume_player_data\n keep_position_info(all_players)\n end",
"def next_player_no\n\t\twhile @player_order.first && @skip_next_move[@player_order.first - 1] do\n\t\t\t@skip_next_move[@player_order.first - 1] = false\n\t\t\t@player_order.push(@player_order.first)\n\t\t\t@player_order.shift\n\t\tend\n\t\t@player_order.first\n\tend",
"def players\n @a = Array.new\n @a << east \n @a << south\n @a << west\n @a\n end",
"def switch_players!\n if current_player==player1\n @current_player=player2\n else\n @current_player=player1\n end\n end",
"def get_players\n load_firebase\n # @player_list = Hash.new\n @player_list = Array.new\n @json_object.each do |key, value|\n @player_list << value\n end\n @player_list\n end",
"def increment_games_played\n self.games_played += 1\n end",
"def switch_players\n if @current_player.name == @player1.name\n @current_player = @player2\n @other_player = @player1\n else \n @current_player = @player1\n @other_player = @player2\n end\n return\n end",
"def start_new_match\n @player1.points = 0\n @player1.deuce = false\n @player1.advantage = false\n @player1.win = false\n @player1.games_won = 0\n @player1.sets_won = 0\n\n @player2.points = 0\n @player2.deuce = false\n @player2.advantage = false\n @player2.win = false\n @player2.games_won = 0\n @player2.sets_won = 0\n end",
"def players\n [player_one, player_two].compact\n end",
"def all_player_status\n linebreak\n @players.each{ |p| puts p; linebreak; }\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end",
"def upcoming_games_all\n (upcoming_games_host | upcoming_games_player).sort\n end",
"def print_players()\n\t\tfor i in 0...@num_players\n\t\t\tprint_player(i)\n\t\tend\n\tend",
"def request_orders\n @player.request_orders\n end",
"def setup_players(players)\n merge(\n players: players,\n scores: Hamster::Hash[players.map {|p| [p, 0] }],\n ).clear_tricks\n end",
"def initialize name\n @player = name\n @@player_count+=1\n end",
"def initialize\n @total_kills = 0\n @players = []\n end",
"def switch_players \n @active_player, @inactive_player = @inactive_player, @active_player\n end",
"def initialize_players\n hash = []\n p = players.sort_by {|player| player.strategy_id }\n p.each.with_index do |u,i|\n u.n_player_profile_id = self\n u.profile_index = i\n hash << u.strategy_id\n end\n write_attribute(:profile_hash, hash.join(',').to_s)\n end",
"def play(players)\n while !win?\n players.each do |player|\n self.end_if_tie\n self.draw\n puts \"#{player.name} turn with #{player.sign}\"\n self.write(player)\n if win?\n puts \"#{player.name} wins!\"\n exit\n end\n end\n end\n end",
"def previous_player\n players.last\n end",
"def entries_to_players\n\t\tplayers = []\n\t\[email protected] do |entry|\n\t\t\tif entry.enabled\n\t\t\t\tplayers << entry.player\n\t\t\tend\n\t\tend\n\t\tplayers\n\tend",
"def switch_players\n @current_player, @other_player = @other_player, @current_player\n end",
"def switch_players\n @current_player, @other_player = @other_player, @current_player\n end",
"def state\n players.map(&:inspect).join(\"\\n\")\n end",
"def add_player(player)\n @players[@players.count + 1] = player\n end",
"def index\n @players = Player.order(:id)\n end",
"def add_players(names)\n @me.name = names[1]\n @opponent.name = names[2]\n p @me, @opponent\n run\n end",
"def initialize(players)\n self.players = players\n end",
"def update_current_player\n\t\t@current_player = @players.rotate![0]\n\tend",
"def point_won_by(player)\n case player\n when player1 then active_set.increment(player: 1)\n when player2 then active_set.increment(player: 2)\n end\n end",
"def first_player_plays \n\t@choice_player1 = first_player.ask_play \n\tunless first_player.verification_coordonnees == true \n\t first_player.error \n\t \t @choice_player1 = first_player.ask_play\n\tend\n\n #pour chacun des elements du array stockant les cases\n #si le nom de la case = au choix du joueur et si la case et vide\n #changer la valeur de la case avec une petite croix\n #lance un message de succes (voir classe Player) qui dit que la case est bonne\n #si le nom de la case = au choix du joueur mais la case n'est pas vide\n #on lance la fonction error qui affiche un message d'erreur\n #on relance ask_play pour demander au joueur une autre coordonnee\n\[email protected] do |x| \n\t if x.value == @choice_player1 && x.check_if_empty\n\t x.fill_up_case(\"x\")\n\t first_player.success_case\n\t elsif x.value == @choice_player1 && !x.check_if_empty\n\t\t first_player.error\n\t\t @choice_player1 = first_player.ask_play\n\t end\n end\n\n #on lance la fonction ci-dessous pour modifier le board selon le choix du joueur\t\n\tupdate_board\n #on verifie si le joueur a gagne avec la fonction ci-dessous\n\tcheck_if_victory\n\n #si le joueur a gagne\n #on appelle la fonction winner (classer Player) qui affiche un message de victoire !\n #on lance la fonction ci-dessous qui demande a lancer un nouveau jeu\n\t if @victory == true\n\t first_player.winner \n\t another_game \n\t end\n end",
"def current_player\n players.first\n end"
] | [
"0.7203553",
"0.7203553",
"0.69835204",
"0.6976748",
"0.6917932",
"0.6899957",
"0.6876158",
"0.67553353",
"0.6734399",
"0.67293537",
"0.67174685",
"0.67142373",
"0.6668544",
"0.6646417",
"0.6596821",
"0.653175",
"0.65066534",
"0.64616036",
"0.64600724",
"0.645983",
"0.64527595",
"0.64425504",
"0.64274323",
"0.642466",
"0.640721",
"0.6388122",
"0.6370467",
"0.63683337",
"0.63670444",
"0.63638675",
"0.63595575",
"0.63520104",
"0.6343342",
"0.63406545",
"0.6332252",
"0.63132554",
"0.631277",
"0.6303156",
"0.6274273",
"0.62734455",
"0.62651974",
"0.62541854",
"0.6253217",
"0.62527585",
"0.62449896",
"0.62395626",
"0.6236985",
"0.62367296",
"0.6231779",
"0.62270665",
"0.6226882",
"0.6189744",
"0.618069",
"0.61768275",
"0.6165935",
"0.61565113",
"0.6152416",
"0.613837",
"0.61381954",
"0.61306643",
"0.6115737",
"0.6100297",
"0.6099608",
"0.6090361",
"0.6090216",
"0.608852",
"0.6074566",
"0.6069483",
"0.6068863",
"0.6066555",
"0.60623735",
"0.6060576",
"0.6051999",
"0.6039411",
"0.6032087",
"0.6025749",
"0.6024194",
"0.6021954",
"0.6016698",
"0.6011928",
"0.60027033",
"0.59972274",
"0.5987942",
"0.5970933",
"0.5970266",
"0.59693414",
"0.59664506",
"0.59655917",
"0.5964317",
"0.59621865",
"0.59621865",
"0.5953226",
"0.5952597",
"0.59499943",
"0.59416896",
"0.5941481",
"0.59406763",
"0.59378195",
"0.5936218",
"0.5932502"
] | 0.5941571 | 95 |
from a move (set) check the col & row for a winning move | def check_winner(col,row)
return true if win?
ranges = get_ranges_for(col, row)
return true if ranges.any?{|range| is_winner_on_range?(range) }
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winning_move?\n winning_moves = [[1,2,3], [4,5,6], [7,8,9], [1,4,7], [2,5,8], [3,6,9], [1,5,9], [3,5,7]]\n winning_moves.each do |set|\n #check game board to see if XXX or OOO combination exists\n if (@board[set[0]] == \"X\") && (@board[set[1]] == \"X\") && (@board[set[2]] == \"X\")\n @winner = \"X\"\n return true\n elsif (@board[set[0]] == \"O\") && (@board[set[1]] == \"O\") && (@board[set[2]] == \"O\")\n @winner = \"O\"\n return true\n end\n end\n return false\n end",
"def check_win(player,grid,coordinates)\n win = false\n win_array = []\n play_row = coordinates[0]\n play_col = coordinates[1]\n\n # horizontal checking\n grid[play_row].each_index do | col |\n if win_array.length != 4\n if grid[play_row][col] == player\n win_array.push([play_row,col])\n else\n win_array = []\n end\n end\n end\n\n if win_array.length == 4\n win = true\n end\n\n # vertical checking\n if win == false\n\n win_array = []\n\n grid.each_index do | row |\n if win_array.length != 4\n if grid[row][play_col] == player\n win_array.push([row,play_col])\n else\n win_array = []\n end\n end\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # diagonal checking SW to NE\n if win == false\n\n win_array = []\n row = play_row\n col = play_col\n\n # finds SW-most position in same diagonal line as most recently played piece\n # this is the starting point we check from\n until col == 0 || row == 7\n row += 1\n col -= 1\n end\n\n until col > 7 || row < 0\n if win_array.length != 4\n if grid[row][col] == player\n win_array.push([row,col])\n else\n win_array = []\n end\n end\n row -= 1\n col += 1\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # diagonal checking NW to SE\n if win == false\n\n win_array = []\n row = play_row\n col = play_col\n\n # finds NW-most position in same diagonal line as most recently played piece\n # this is the starting point we check from\n until col == 0 || row == 0\n row -= 1\n col -= 1\n end\n\n until col > 7 || row > 7\n if win_array.length != 4\n if grid[row][col] == player\n win_array.push([row,col])\n else\n win_array = []\n end\n end\n row += 1\n col += 1\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # winning four-in-a-row briefly \"flashes\" to show where it is\n if win == true\n flash_count = 0\n while flash_count < 4\n #flashing animation\n win_array.each do | element |\n grid[element[0]][element[1]] = \"@\"\n end\n print_board(grid)\n sleep(0.2)\n win_array.each do | element |\n grid[element[0]][element[1]] = player\n end\n print_board(grid)\n sleep(0.2)\n flash_count += 1\n end\n end\n\n return win\nend",
"def row_winning_move\n\t\[email protected]_with_index do |row, r|\n\t\t\tother_nil_index = contains_two_marks(row)\n\t\t\tif(other_nil_index)\n\t\t\t\treturn [r, other_nil_index]\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def find_move(board)\n\t\tcell_found = nil\n\t\t\tWIN_COMBINATIONS.each do |combo|\n\t\t\t\thash = Hash.new\n\t\t\t\thash[combo[0]] = board.cells[combo[0]]\n\t\t\t\thash[combo[1]] = board.cells[combo[1]]\n\t\t\t\thash[combo[2]] = board.cells[combo[2]]\n\t\t\t\t# finds a possible win move\n\t\t\tif(hash.values.count(\"O\") == 1 && hash.values.count(\" \") == 2)\n\t\t\t\tcell_found = hash.key(\" \")+1\n\t\t\tend\n\t\tend\n\t\tcell_found\n\tend",
"def is_valid_move?(proposed_row, proposed_col, solution)\n return true\nend",
"def winning_move?(temp_board, board, temp_token)\n\t\tGame::WIN_COMBINATIONS.detect do |set|\n temp_board[set[0]] == temp_board[set[1]] &&\n temp_board[set[1]] == temp_board[set[2]] &&\n temp_board[set[0]] == temp_token\n end\n end",
"def board_has_win?(positions)\n # x's\n if## Check for win ################################################\n # Check for horizontal wins\n (positions[:a] == positions[:b] and positions[:b] == positions[:c] and positions[:a] != \" \") or\n (positions[:d] == positions[:e] and positions[:e] == positions[:f] and positions[:d] != \" \") or\n (positions[:g] == positions[:h] and positions[:h] == positions[:i] and positions[:g] != \" \") or\n\n # Check for vertical wins\n (positions[:a] == positions[:d] and positions[:d] == positions[:g] and positions[:a] != \" \") or\n (positions[:b] == positions[:e] and positions[:e] == positions[:h] and positions[:b] != \" \") or\n (positions[:c] == positions[:f] and positions[:f] == positions[:i] and positions[:c] != \" \") or\n\n # Check for diagonal wins\n (positions[:a] == positions[:e] and positions[:e] == positions[:i] and positions[:a] != \" \") or\n (positions[:g] == positions[:e] and positions[:e] == positions[:c] and positions[:g] != \" \")\n # End conditional ########################################################\n\n # Determine who won -- if x won, he will have one more move than o. If o won, he will have the same amount of moves as x.\n num_of_x = 0\n num_of_o = 0\n\n positions.each do |k,v|\n if v == \"x\"\n num_of_x += 1\n elsif v == \"o\"\n num_of_o += 1\n end\n end\n\n if num_of_x > num_of_o\n # x won\n return true, :x\n else\n # o won\n return true, :o\n end\n else\n # No winner yet\n false\n end\nend",
"def win?(piece)\n check_rows(piece, grid) || check_rows(piece, grid.transpose) || check_diagonals(piece)\n end",
"def winning_move\n win_combo = WIN_COMBINATIONS.find do |combo|\n (@board.cells[combo[0]] == @token && @board.cells[combo[1]] == @token && @board.cells[combo[2]] == \" \") || (@board.cells[combo[0]] == @token && @board.cells[combo[2]] == @token && @board.cells[combo[1]] == \" \") || (@board.cells[combo[1]] == @token && @board.cells[combo[2]] == @token && @board.cells[combo[0]] == \" \")\n end\n if win_combo != nil\n win_cell = win_combo.find do |spot|\n @board.cells[spot] == \" \"\n end\n end\n end",
"def taken?(move)\n x = move.to_i - 1\n @cells[x] == \"X\" || @cells[x] == \"O\"\n end",
"def win?(array,move,color)\n\n user_row = move[0]\n user_col = move[1]\n\n # check horizontal rows\n return true if horizontal_vertical_win?(array[user_row],color)\n # check vertical rows\n return true if horizontal_vertical_win?(array.collect {|row| row[user_col]},color)\n #check backslash diagonals\n return true if check_diagonals(BACKWARD_DIAGONALS,array, color, move)\n #check forwardslash diagonals\n return true if check_diagonals(FORWARD_DIAGONALS,array, color, move)\n end",
"def valid_move?(board, index)\n index.between?(0, 8) && position_taken?(board, index) == false\n\nend",
"def win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend",
"def taken?(move)\n \t# Subtract 1 from move to correctly correspond with index\n if @board[move - 1] == \"X\" || @board[move - 1] == \"O\"\n return true\n end\n return false\n end",
"def valid_move?(row, col, queens)\n # Go through each of the current valid moves\n queens.each do |q_pos|\n # Grab the coords\n q_row, q_col = q_pos\n\n # If the coords to be checked land on either the same col or row as an existing\n # valid move, the coords are invalid\n return false if q_row == row || q_col == col\n # Check to see if the slope between the coords and any valid moves is equal to 1.\n # Having a slope of 1 on board means the two points are on the same diagonal line.\n return false if ((row - q_row) / (col - q_col).to_f).abs == 1\n end\n\n true\nend",
"def check_move(square)\n return @win_vecs[(square-1)/3].squares[(square-1)%3].fill==\"-\"\n end",
"def check_wins(column, player)\n\t\t# row checking\n\t\tfor i in 0...@@board.length\n\t\t\trow = @@board[i]\n\t\t\trow_counter = 0\n\t\t\tfor j in 0...row.length\n\t\t\t\tif row[j] === player\n\t\t\t\t\trow_counter += 1\n\t\t\t\t\tif row_counter === 4\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trow_counter = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# column checking\n\t\tcolumn_counter = 0\n\t\tfor k in 0...@@board.length\n\t\t\tif @@board[k][column] === player\n\t\t\t\tcolumn_counter += 1\n\t\t\t\tif column_counter === 4\n\t\t\t\t\treturn true;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# diagonal checking, chose to go to 11 because coordinates [5,6] can be\n\t\t#reached in this loop\n\t\tfor diagonal_sum in 0..11\n\t\t\tdiagonal_counter = 0\n\t\t\tfor x in 0..diagonal_sum\n\t\t\t\ty = diagonal_sum - x\n\t\t\t\tif (defined?(@@board[x][y])).nil?\n\t\t\t\t\t# some of the coordinates being checked are not defined, this is to\n\t\t\t\t\t# keep looping through the board to check values on the board\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif @@board[x][y] === player\n\t\t\t\t\tdiagonal_counter += 1\n\t\t\t\t\tif diagonal_counter === 4\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tdiagonal_counter = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# other diagonal checking\n\t\tfor diagonal_diff in (6).downto(-5)\n\t\t\ty = 0\n\t\t\tother_diagonal_counter = 0\n\t\t\tfor x in 0...7\n\t\t\t\ty = diagonal_diff + x\n\t\t\t\tif (defined?(@@board[x][y])).nil? #if a space is undefined, just keep checking\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif y < 7\n\t\t\t\t\tif @@board[x][y] === player\n\t\t\t\t\t\tother_diagonal_counter += 1\n\t\t\t\t\t\tif other_diagonal_counter === 4\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tother_diagonal_counter = 0\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tbreak;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# the check_wins method has many nested for loops, which is a\n\t\t# runtime complexity of O(n^2)\n\t\treturn false\n\tend",
"def winning_move(board, token) # this method should return the index to be played\n winning_line = WIN_COMBOS.detect {|combo| tokens_in_line(board, combo).sort == [\" \", token, token]} #winning_line should be something like [2,5,8] or nil\n # find the first empty cell in the winning_line array\n if winning_line != nil\n winning_line.find do |index|\n board.cells[index.to_i] != token\n end\n end\n end",
"def capture_move?(x_new, y_new)\n target = game.pieces.where(\"x_pos = ? AND y_pos = ?\", x_new, y_new).first\n return false if target.nil?\n if move_type(x_new, y_new) == :diagonal && x_diff(x_new) == 1 && y_diff(y_new) == 1\n target.color != self.color && target.type != \"King\"\n end\n end",
"def win(board, marker)\r\n\t\t#horizontal top\r\n\t\tif board[0] && board[1] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telsif board[0] && board[2] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\telsif board[1] && board[2] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#horiz middle\r\n\t\telsif board[3] && board[4] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[3] && board[5] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[5] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#horiz bottom\r\n\t\telsif board[6] && board[7] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[6] && board[8] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[7] && board[8] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\t#vertical left\r\n\t\telsif board[0] && board[3] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[3] && board[6] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\telsif board[0] && board[6] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#vert middle\r\n\t\telsif board[1] && board[4] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[1] && board[7] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[7] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\t#vert right\r\n\t\telsif board[2] && board[5] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[2] && board[8] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[5] && board[8] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\t#diagonal top left \r\n\t\telsif board[0] && board[4] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[0] && board[8] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[8] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#diag bottom left\r\n\t\telsif board[2] && board[4] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[2] && board[6] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[6] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telse\r\n\r\n\t\tend\r\n\tend",
"def perfect_move(marker, index)\r\n\t\tif board[index] == perfect_move\r\n\t\t\tboard[index] = marker\r\n\tend\r\n\r\n\t#final moves in order to win\r\n\tdef win(board, marker)\r\n\t\t#horizontal top\r\n\t\tif board[0] && board[1] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telsif board[0] && board[2] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\telsif board[1] && board[2] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#horiz middle\r\n\t\telsif board[3] && board[4] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[3] && board[5] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[5] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#horiz bottom\r\n\t\telsif board[6] && board[7] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[6] && board[8] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[7] && board[8] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\t#vertical left\r\n\t\telsif board[0] && board[3] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[3] && board[6] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\telsif board[0] && board[6] == marker\r\n\t\t\tboard[3] == perfect_move\r\n\t\t#vert middle\r\n\t\telsif board[1] && board[4] == marker\r\n\t\t\tboard[7] == perfect_move\r\n\t\telsif board[1] && board[7] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[7] == marker\r\n\t\t\tboard[1] == perfect_move\r\n\t\t#vert right\r\n\t\telsif board[2] && board[5] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[2] && board[8] == marker\r\n\t\t\tboard[5] == perfect_move\r\n\t\telsif board[5] && board[8] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\t#diagonal top left \r\n\t\telsif board[0] && board[4] == marker\r\n\t\t\tboard[8] == perfect_move\r\n\t\telsif board[0] && board[8] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[8] == marker\r\n\t\t\tboard[0] == perfect_move\r\n\t\t#diag bottom left\r\n\t\telsif board[2] && board[4] == marker\r\n\t\t\tboard[6] == perfect_move\r\n\t\telsif board[2] && board[6] == marker\r\n\t\t\tboard[4] == perfect_move\r\n\t\telsif board[4] && board[6] == marker\r\n\t\t\tboard[2] == perfect_move\r\n\t\telse\r\n\r\n\t\tend\r\n\tend\r\n\r\n\t#blocks an opponent from making the winning move\r\n\tdef block(human, marker, index)\r\n\t\tif human[marker] == win\r\n\t\t\tboard[index] = perfect_move\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\tend\r\n\tend\r\n\r\n\tdef fork()\r\n\tend\r\n\r\n\tdef fork_block()\r\n\tend\r\n\r\n\tdef opposite_corner()\r\n\tend\r\n\r\n\tdef empty_corner()\r\n\tend\r\n\r\n\tdef empty_side()\r\n\tend\r\n\r\nend",
"def has_won(new_board)\n #check rows\n new_board.each_with_index do |row, i|\n if new_board[i][0] == new_board[i][1] && new_board[i][1] == new_board[i][2] && new_board[i][2] != '-'\n return new_board[i][0]\n end\n end\n\n #check columns\n new_board.each_with_index do |col, j|\n if new_board[0][j] == new_board[1][j] && new_board[1][j] == new_board[2][j] && new_board[2][j] != '-'\n return new_board[0][j] \n end\n end\n\n #Check Diagonals\n if new_board[0][0] == new_board[1][1] && new_board[1][1] == new_board[2][2] && new_board[2][2] != '-'\n return new_board[0][0]\n end\n\n if new_board[2][0] == new_board[1][1] && new_board[1][1] == new_board[0][2] && new_board[0][2] != '-'\n return new_board[0][0]\n end\n\n #No one has won\n return '-'\nend",
"def won? (board)\n #for each row, column and diagnonal combination\n WIN_COMBINATIONS.each do | win_combination |\n #grab the winning combinaation of indices we are looking for\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n #extract the value of these winning indices from the board\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n\n\n #check if either team has won\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") ||\n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n #we break out of here if we have a winning row, col, or diagnonal\n return win_combination\n end #end if\n end #end for each\n\n #if we get here the board may be empty\n #if we get here the board may be filled, but no winning combos\n return false\nend",
"def is_winning_move_for?(color, column)\n copy_grid = Marshal.load( Marshal.dump(self) ) #deep copy\n copy_grid.drop_in_column(color, column)\n copy_grid.winning_state?\n end",
"def valid_move?(board,index)\n if index.between?(0,8) && position_taken?(board,index)\n true\n end\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |win_combo|\n win_in_1 = win_combo[0]\n win_in_2 = win_combo[1]\n win_in_3 = win_combo[2]\n\n position_1 = board[win_in_1]\n position_2 = board[win_in_2]\n position_3 = board[win_in_3]\n\n if position_1 == position_2 && position_2 == position_3 && position_taken?(board, win_in_1)\n return win_combo\n end\n end\n return false\nend",
"def perfect_move(marker, index)\n\t\tif board[index] == perfect_move\n\t\t\tboard[index] = marker\n\tend\n\n\t#final moves in order to win\n\tdef win(board, marker)\n\t\t#horizontal top\n\t\tif board[0] && board[1] == marker\n\t\t\tboard[2] == perfect_move\n\t\telsif board[0] && board[2] == marker\n\t\t\tboard[1] == perfect_move\n\t\telsif board[1] && board[2] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#horiz middle\n\t\telsif board[3] && board[4] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[3] && board[5] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[5] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#horiz bottom\n\t\telsif board[6] && board[7] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[6] && board[8] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[7] && board[8] == marker\n\t\t\tboard[6] == perfect_move\n\t\t#vertical left\n\t\telsif board[0] && board[3] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[3] && board[6] == marker\n\t\t\tboard[0] == perfect_move\n\t\telsif board[0] && board[6] == marker\n\t\t\tboard[3] == perfect_move\n\t\t#vert middle\n\t\telsif board[1] && board[4] == marker\n\t\t\tboard[7] == perfect_move\n\t\telsif board[1] && board[7] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[7] == marker\n\t\t\tboard[1] == perfect_move\n\t\t#vert right\n\t\telsif board[2] && board[5] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[2] && board[8] == marker\n\t\t\tboard[5] == perfect_move\n\t\telsif board[5] && board[8] == marker\n\t\t\tboard[2] == perfect_move\n\t\t#diaginal top left \n\t\telsif board[0] && board[4] == marker\n\t\t\tboard[8] == perfect_move\n\t\telsif board[0] && board[8] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[8] == marker\n\t\t\tboard[0] == perfect_move\n\t\t#diag bottom left\n\t\telsif board[2] && board[4] == marker\n\t\t\tboard[6] == perfect_move\n\t\telsif board[2] && board[6] == marker\n\t\t\tboard[4] == perfect_move\n\t\telsif board[4] && board[6] == marker\n\t\t\tboard[2] == perfect_move\n\t\telse\n\n\t\tend\n\tend\n\n\t#blocks an opponent from making the winning move\n\tdef block(human, marker, index)\n\t\tif human[marker] == win\n\t\t\tboard[index] = perfect_move\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend\n\n\tdef fork()\n\tend\n\n\tdef fork_block()\n\tend\n\n\tdef opposite_corner()\n\tend\n\n\tdef empty_corner()\n\tend\n\n\tdef empty_side()\n\tend\n\nend",
"def winner\n WIN_COMBINATIONS.each do |win_combination|\n #puts win_combination.inspect\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n \n position_1 = @board[win_index_1] \n position_2 = @board[win_index_2] \n position_3 = @board[win_index_3] \n \n if position_1 == position_2 && position_2 == position_3 && position_taken?(win_index_1)\n return position_1\n end\n end\n nil\n end",
"def get_moves_2(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?. && board[[3, valid_col]] == piece.name && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == piece.name\n moves << [[4, valid_col], (cols.count + 3) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == ?.\n moves << [[5, valid_col], (cols.count + 4) * piece.cost]\n end\n end\n # If right column and something is underneath and nothing above\n # If in wrong column completely and nothing above\n elsif piece.row >= 2\n below = (piece.row+1..5).to_a\n above = (2..piece.row-1).to_a\n if ((piece.col == valid_col && below.count{|c| board[[c, piece.col]] != piece.name} != 0 && below.length != 0) || (piece.col != valid_col)) && (above.count{|c| board[[c, piece.col]] == ?.} == above.length)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1 + above.length\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n end\n moves\nend",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def winning_move(board)\n winning_spot = nil\n \n board.empty_position.each do |spot|\n board.place_mark(*spot, marker)\n winning_spot = spot if board.won?\n board[*spot] = nil\n end\n \n winning_spot\n end",
"def valid_move?(board,index)\n if position_taken?(board,index)\n false\n elsif index.between?(0, 8)\n true\n end\nend",
"def validate_player_move(move)\r\n \r\n #Return a value of false is the square has already been\r\n #selected\r\n return false if move == \"A1\" && $A1 != \" \"\r\n return false if move == \"B1\" && $B1 != \" \"\r\n return false if move == \"C1\" && $C1 != \" \"\r\n return false if move == \"A2\" && $A2 != \" \"\r\n return false if move == \"B2\" && $B2 != \" \"\r\n return false if move == \"C2\" && $C2 != \" \"\r\n return false if move == \"A3\" && $A3 != \" \"\r\n return false if move == \"B3\" && $B3 != \" \"\r\n return false if move == \"C3\" && $C3 != \" \" \r\n \r\n #Return a value of true if the square is available\r\n return true\r\n \r\n end",
"def winnable? board\n win_pos = nil\n WIN_COMBINATIONS.each do |win_combo|\n #creates array from board positions in win_combo\n mapped_cells = win_combo.map {|i| board.cells[i]}\n if mapped_cells.count(self.token) == 2 && mapped_cells.count(' ') == 1\n #finds the index of the winning position\n win_pos = win_combo[mapped_cells.index(' ')]\n end\n end\n win_pos\n end",
"def check_all(move)\n\t\t(0...@@wins.length).each do |i|\n\t\t\tif checkline(move , @@wins[i][0] , @@wins[i][1] , @@wins[i][2]) == move then\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def won?(board)\n\nWIN_COMBINATIONS.find do |combo|\n board[combo[0]] == board[combo[1]] &&\n board[combo[1]] == board[combo[2]] &&\n position_taken?(board, combo[0])\n end\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend",
"def valid_move?(board,index)\n if index.between?(0,8)\n return !position_taken?(board,index)\n end\n end",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else position_taken?(board, index) == true\n nil\n end\nend",
"def valid_move\n display_current_turn\n \tcol = prompt_legal_move\n \treturn col, @turn%2\n end",
"def won?(board)\n # cycle through WIN_COMBINATIONS\n WIN_COMBINATIONS.detect { |winning_combo|\n # print win_index\n # print '\\n'\n position_taken?(board,winning_combo[0]) &&\n position_taken?(board,winning_combo[1]) &&\n position_taken?(board,winning_combo[2]) &&\n board[winning_combo[0]] == board[winning_combo[1]] &&\n board[winning_combo[1]] == board[winning_combo[2]]\n }\nend",
"def valid_move?(board,index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def check_ship (horv,x1,y1)\n if horv==1 #build in vertical position row increases\n (x1..x1+4).each { |r| # row changes y stayes same\n sq=self.squares.find{|s| s.rowid == r && s.colid==y1}\n if !sq.empty\n return true\n end #if\n }\n else\n (y1..y1+4).each { |c| # row changes y stayes same\n sq=self.squares.find{|s| s.rowid == x1 && s.colid==c}\n if !sq.empty\n return true\n end\n }\n end #horv\n return false # nothing to hit\n end",
"def won?(board)\n WIN_COMBINATIONS.find do |winning_combo|\n board[winning_combo[0]] == board[winning_combo[1]] &&\n board[winning_combo[1]] == board[winning_combo[2]] &&\n position_taken?(board, winning_combo[0])\n end\nend",
"def win_check(wins, player, opponent)\n position = [] # placeholder for position that will give 3-in-a-row\n wins.each do |win| # check each win pattern\n difference = win - player # difference between current win array and player position array\n # if player 1 move from win, take position unless already opponent mark\n position.push(difference[0]) unless (opponent & difference).size == 1 if difference.size == 1\n end\n position.size > 0 ? position.sample : block_check(wins, player, opponent) # .sample in case of multiple\n end",
"def position?(row, col)\n @move.key?([row, col])\n end",
"def won?(board)\n # !won?(board)\n WIN_COMBINATIONS.detect do |combo| # [0,1,2]\n if position_taken?(board, combo[0]) && board[combo[0]] == board[combo[1]] && board[combo[1]] == board[combo[2]]\n combo\n end\n end\nend",
"def is_win(x, y, player)\n create_pivot_vectors(x, y)\n\n # TODO: parameter key not used (fix)\n @moves.each do |key, array|\n win3 = 0\n array.each do |key, val|\n if val == player\n win3 += 1\n return true if win3 == @win_with\n else\n win3 = 0\n end\n end\n end\n false\n end",
"def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend",
"def valid_move?(board,index)\n if index < 0\n false\n else\n if index > 8\n false\n else\n !position_taken?(board,index)\n end\n end\nend",
"def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend",
"def won?\n WIN_COMBINATIONS.detect{|win| @board[win[0]] == @board[win[1]] && @board[win[1]] == @board[win[2]] && position_taken?(win[2])}\nend",
"def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index.between?(0, 8)\n true\n end\nend",
"def valid_move?(board, index)\r\n if index.between?(0, 8) && ! position_taken?(board, index)\r\n return TRUE\r\n else \r\n return FALSE\r\n end\r\nend",
"def winner_move(game, mark)\n (0..2).each do |x|\n (0..2).each do |y|\n board = game.board.dup #using the board's deep dup method\n pos = [x, y]\n\n next unless board.empty?(pos) #makes sure current position is empty\n board[pos] = mark #sets the current position on the dup'd board\n\n #returns the position if pos would make computer the winner\n # (remember, mark is set by the game object to track who is who)\n return pos if board.winner == mark\n end\n end\n\n # no winning move\n nil\n end",
"def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if position_taken?(board,combo[0]) && position_taken?(board,combo[1]) && position_taken?(board,combo[2])\n if board[combo[0]] == board[combo[1]] && board[combo[1]] == board[combo[2]]\n return combo\n end\n end\n end\n return false\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |win_array|\n\n win_index_1 = win_array[0]\n win_index_2 = win_array[1]\n win_index_3 = win_array[2]\n\n position_1 = board[win_index_1] # load the value of the board at win_index_1\n position_2 = board[win_index_2] # load the value of the board at win_index_2\n position_3 = board[win_index_3] # load the value of the board at win_index_3\n\n if ((position_taken?(board, win_index_1) && position_1 ==\"X\") && (position_taken?(board, win_index_2) && position_2 ==\"X\") && (position_taken?(board, win_index_3) && position_3 ==\"X\") or \n (position_taken?(board, win_index_1) && position_1 ==\"O\") && (position_taken?(board, win_index_2) && position_2 ==\"O\") && (position_taken?(board, win_index_3) && position_3 ==\"O\"))\n return win_array\n end\n end\n return false\nend",
"def check_for_winner\n\t\tdid_player_win = false\n\t\tx = 1\n\t\twhile x < 8\n\t\t\ty = 1\n\t\t\twhile y < 7\n\t\t\t\tcurrent_key = \"#{x}-#{y}\"\n\t\t\t\tcurrent_hole = game_board[current_key]\n\t\t\t\t@x_to_check = x\n\t\t\t\t@y_to_check = y\n\t\t\t\tif current_hole.owned_by_player == @current_player\n\t\t\t\t\tdid_player_win = check_for_line(x, y)\n\t\t\t\t\tif did_player_win\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ty += 1\n\t\t\tend\n\t\t\tx += 1\n\t\tend\n\t\treturn false\n\tend",
"def valid_move?(board, index)\r\n index.between?(0,8) && !position_taken?(board, index)\r\nend",
"def valid_move?(board, index)\n if position_taken?(board, index) then return false\n elsif index.between?(0, 8) then return true\n end\nend",
"def checkline(move , spot1 , spot2 , spot3)\n\t\tif @@board[spot1] == move && @@board[spot2] == move && @@board[spot3] == move then\n\t\t\treturn move\n\t\tend\n\tend",
"def valid_move?(board, index)\n if position_taken?(board, index) == true\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend",
"def valid_move?(board,index)\n if index >= 0 && index <= 8\n if !position_taken?(board, index)\n return true\n else \n return false\n end\n else \n return false\n end\nend",
"def valid_move?(board,index)\n if index.between?(0, 8) && !(position_taken?(board, index))\n true\n else \n false\n end\nend",
"def won?(board)\n WIN_COMBINATIONS.detect do |combo|\n board[combo[0]] == board[combo[1]] && board[combo[2]] == board[combo[1]] && position_taken?(board,combo[0])\n end\nend",
"def valid_move?(board,index)\n if position_taken?(board,index) == false && index.between?(0,8)\n true\n end \n end",
"def won?(board)\n WIN_COMBINATIONS.detect do |win|\n board[win[0]] == board[win[1]] && board[win[0]] == board[win[2]] &&\n position_taken?(board, win[0])\n end\nend",
"def won?(board)\n WIN_COMBINATIONS.detect do |win|\n board[win[0]] == board[win[1]] && board[win[0]] == board[win[2]] &&\n position_taken?(board, win[0])\n end\nend",
"def check_columns_for_winner\n # @player = nil\n if board[0][0] == board[1][0] and board[1][0] == board[2][0] and not board[0][0] == nil\n @player = board[0][0]\n elsif board[0][1] == board[1][1] and board[1][1] == board[2][1] and not board[0][1] == nil\n @player = board[0][1]\n elsif board[0][2] == board[1][2] and board[1][2] == board[2][2] and not board[0][2] == nil\n @player = board[0][2]\n end\n end",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"def valid_move?(board,index)\n if (index >= 0 && index <=8)\n if (position_taken?(board,index))\n return false\n else\n return true\n end\n else\n return false\n end\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |combination| #iterate over WIN_COMBINATIONS\n if position_taken?(board, combination[0]) #only check for a win if the position is taken\n if board[combination[0]] == board[combination[1]] && board[combination[0]] == board[combination[2]]\n return combination\n end\n end\n end\n nil\nend",
"def winner?\n directions = [[1,0], [1,-1], [1,1], [0,1]]\n max_x = grid[0].length\n max_y = grid.length\n directions.each do |dx, dy|\n for x in (0...max_x) do\n for y in (0...max_y) do\n last_x = x + 3 * dx\n last_y = y + 3 * dy\n if 0 <= last_x && last_x < max_x && 0 <= last_y && last_y < max_y\n val = get_cell(x, y).value\n if (!val.empty? && val == get_cell(x + dx, y + dy).value && \n val == get_cell(x + 2 * dx, y + 2 * dy).value &&\n val == get_cell(x + 3 * dx, y + 3 * dy).value)\n return true\n end\n end\n end\n end\n end\n return false\n end",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?( board, index )\n if index >= 0 && index <= 8\n if position_taken?( board, index ) # this is the one\n return false\n else\n return true\n end\n else\n return false\n end\nend",
"def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\n\nend",
"def valid_move?(board, index)\n if index.between?(0, 8)\n !position_taken?(board, index)\n else\n false\n end\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |single_win_combo|\n win_index_1 = single_win_combo[0]\n win_index_2 = single_win_combo[1]\n win_index_3 = single_win_combo[2]\n\n # Pos 1,2,3 will cycle thru all 9 spaces on board\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n\n if position_1 == position_2 && position_2 == position_3 && position_taken?(@board, win_index_1)\n return single_win_combo\n end\n end\n return false\n end",
"def valid_move?(board, ix)\n if position_taken?(board, ix) == false && move_val?(ix) == true\n return true\n else\n false\n end\nend",
"def is_player_winner(moves)\n grid = map_to_grid moves\n is_winner grid\n end",
"def valid_move?(board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"def valid_move? (board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n if index.between?(0,8)\n if !position_taken?(board, index)\n true\n end\n end\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end"
] | [
"0.771016",
"0.74987394",
"0.73713684",
"0.7296509",
"0.72825724",
"0.7278986",
"0.7272849",
"0.71941257",
"0.71807796",
"0.7166739",
"0.71369344",
"0.7125951",
"0.71029353",
"0.7100392",
"0.7067427",
"0.7027524",
"0.702122",
"0.7017957",
"0.7014674",
"0.70119536",
"0.70089036",
"0.70086503",
"0.69970393",
"0.69935924",
"0.6987296",
"0.69865483",
"0.69850135",
"0.6982644",
"0.6979101",
"0.69715893",
"0.69579136",
"0.69579136",
"0.6957551",
"0.69536865",
"0.69420516",
"0.6940329",
"0.69401115",
"0.69398445",
"0.6939192",
"0.69374317",
"0.69295615",
"0.6929532",
"0.69247955",
"0.6920747",
"0.69205153",
"0.6916854",
"0.691547",
"0.6912858",
"0.6912541",
"0.6910064",
"0.69098455",
"0.69096357",
"0.69079834",
"0.6906193",
"0.69060344",
"0.69057035",
"0.6905146",
"0.69014776",
"0.6899904",
"0.689679",
"0.6895618",
"0.6894726",
"0.6893894",
"0.68928945",
"0.68922377",
"0.68922347",
"0.6891992",
"0.68906856",
"0.6890199",
"0.6890199",
"0.6888176",
"0.6885729",
"0.688326",
"0.68831867",
"0.6882983",
"0.68811625",
"0.68811625",
"0.68811625",
"0.6876599",
"0.6874991",
"0.687416",
"0.68735886",
"0.68728346",
"0.6868698",
"0.6866662",
"0.6865276",
"0.686369",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.6862764",
"0.68608916"
] | 0.0 | -1 |
the winner is defined by having no other values on the range (rows, cols or diagonals) | def is_winner_on_range?(range)
return false unless range.uniq.size == 1 && !range.first.nil?
@winner = range.first
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_of_board(row,column)\n (!(0...@rows).include? row) ||\n (!(0...@columns).include? column)\n end",
"def winner\n result = nil\n @field.each do | row | result ||= winner_test(row) end # Horizontal\n @field.transpose.each do | row | result ||= winner_test(row) end # Vertical\n result || winner_test((0..2).map{|i| @field[i][i]}) || winner_test((0..2).map{|i| @field[2-i][i]}) # Diagonal\n end",
"def get_winner\n indexes_to_check = (0..@n-3).to_a\n\n # Check horizontal winners\n @board.each_with_index do |_, k|\n indexes_to_check.each do |idx|\n return @board[k][idx] if marked(k, idx) && similar_value([k, idx], [k, idx + 1], [k, idx + 2])\n end\n end\n\n # Check vertical winners\n @n.times do |k|\n indexes_to_check.each do |idx|\n return @board[idx][k] if marked(idx, k) && similar_value([idx, k], [idx + 1, k], [idx + 2, k])\n end\n end\n\n # Check diagonal winners\n indexes_to_check.product(indexes_to_check).each do |idx1, idx2|\n if marked(idx1, idx2) && similar_value([idx1, idx2], [idx1 + 1, idx2 + 1], [idx1 + 2, idx2 + 2])\n return @board[idx1][idx2]\n elsif marked(idx1, idx2 + 2) && similar_value([idx1, idx2 + 2], [idx1 + 1, idx2 + 1], [idx1 + 2, idx2])\n return @board[idx1][idx2+2]\n end\n end\n\n false\n end",
"def winner\n # shortcut for less typing\n b = @board\n\n # rows\n return b[0] if b[0] == b[1] && b[1] == b[2]\n return b[3] if b[3] == b[4] && b[4] == b[5]\n return b[6] if b[6] == b[7] && b[7] == b[8]\n\n # cols\n return b[0] if b[0] == b[3] && b[3] == b[6]\n return b[1] if b[1] == b[4] && b[4] == b[7]\n return b[2] if b[2] == b[5] && b[5] == b[8]\n\n # diagonals\n return b[4] if b[0] == b[4] && b[4] == b[8]\n return b[4] if b[2] == b[4] && b[4] == b[6]\n\n end",
"def winner\n (@rows + cols + diagonals).each do |row|\n return :x if row.all? { |mark| mark == :x }\n return :o if row.all? { |mark| mark == :o }\n end\n \n nil\n end",
"def winner\n [\n [[0,0],[0,1],[0,2]], # column 0\n [[1,0],[1,1],[1,2]], # column 1\n [[2,0],[2,1],[2,2]], # column 2\n [[0,0],[1,0],[2,0]], # row 0\n [[0,1],[1,1],[2,1]], # row 1\n [[0,2],[1,2],[2,2]], # row 2\n [[0,0],[1,1],[2,2]], # descending diagonal\n [[0,2],[1,1],[2,0]], # ascending diagonal\n ].each do |cells|\n vals = cells.map {|x, y| board[y][x] }\n return :x if vals == %w( X X X )\n return :o if vals == %w( O O O )\n end \n return nil\n end",
"def check_winner\n row_filled_with_same_element = ->(row) { row.reduce(row[0]) { |acc, elem| acc if elem == acc } }\n winners = [board, board.transpose, diagonals].map do |board_version|\n board_version.map(&row_filled_with_same_element).find { |row| row && row != 0 }\n end\n winners.find { |row| row }\n end",
"def check_winner\n cells_t = cells.transpose\n row_winner(cells)\n row_winner(cells_t)\n diagonal_winner unless winner\n announce_winner if winner\n winner\n end",
"def winner\n (rows + cols + diagonals).each do |triple|\n return :x if triple == [:x, :x, :x]\n return :o if triple == [:o, :o, :o]\n end\n \n nil\n end",
"def winner?\n return true if check_horizontal\n return true if check_vertical\n return true if check_diagonal1\n return true if check_diagonal2\n false\n end",
"def check_winner(col,row)\n return true if win?\n ranges = get_ranges_for(col, row)\n return true if ranges.any?{|range| is_winner_on_range?(range) }\n return false\n end",
"def winner\n horizontal_winner || vertical_winner || diagonal_winner\n end",
"def inside_board?(r, c)\n (r >= 0) && (c >= 0) && (r <= @row_limit) && (c <= @column_limit)\n end",
"def winner?(board)\n #vertical and horizonal equality checks\n j = 0\n for i in 0...3\n return true if (board[j]==board[j+1])&&(board[j+1]==board[j+2])\n\n j += 3\n end\n #verticals equality test\n j = 0\n for i in 0...3\n\n return true if (board[j]==board[j+3])&&(board[j+3]==board[j+6])\n j += 1\n end\n\n #diagonals equality test\n \n return true if (board[0]==board[4])&&(board[4]==board[8])\n return true if (board[2]==board[4])&&(board[4]==board[6])\n \n\n false\n end",
"def diagonal_win?\n (0..3).each do |column|\n (0..2).each do |row|\n return true if down_right_win?(row, column)\n end\n end\n (3..6).each do |column|\n (0..2).each do |row|\n return true if down_left_win?(row, column)\n end\n end\n false\n end",
"def adjacent_mines(row, col)\n 0\n end",
"def adjacent_mines(row, col)\n 0\n end",
"def adjacent_mines(row, col)\n 0\n end",
"def checkwinner\r\n\t\t\t\r\n\t\t\[email protected] do |row|\r\n\t\t\t\trow.join.gsub(\"|\",\"\")\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t#check horizontal winners\r\n\t\t\[email protected] do |row|\r\n\t\t\t if row.join.include? \"XXXX\"\r\n\t\t\t\t@winner = 2\t\r\n\t\t\t elsif row.join.include? \"OOOO\"\r\n\t\t\t\t@winner = 1\r\n\t\t\t end\r\n\t\t\tend\r\n\r\n\t\t\t#check vertical winners\r\n\t\t\[email protected] do |row|\r\n\t\t\t if row.join.include? \"XXXX\"\r\n\t\t\t\t@winner = 2\t\r\n\t\t\t elsif row.join.include? \"OOOO\"\r\n\t\t\t\t@winner = 1\r\n\t\t\t end\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tfor row_nr in [email protected]\r\n\t\t\t for col_nr in 0..@matrix[0].count-4\r\n\t\t\t\tel_1 = @matrix[row_nr] [col_nr]\r\n\t\t\t\tel_2 = @matrix[row_nr+1][col_nr+1]\r\n\t\t\t\tel_3 = @matrix[row_nr+2][col_nr+2]\r\n\t\t\t\tel_4 = @matrix[row_nr+3][col_nr+3]\r\n\r\n\t\t\t\tif el_1 + el_2 + el_3 + el_4 == 'XXXX'\r\n\t\t\t\t @winner = 2\t\r\n\t\t\t\telsif el_1 + el_2 + el_3 + el_4 == 'OOOO'\r\n\t\t\t\t @winner = 1\r\n\t\t\t\tend\r\n\t\t\t end\r\n\t\t\tend\r\n\t\t\t#right to left\r\n\t\t\tfor row_nr in [email protected]\r\n\t\t\t for col_nr in 0..@matrix[0].count-4\r\n\t\t\t\tel_1 = @matrix.reverse[row_nr] [col_nr]\r\n\t\t\t\tel_2 = @matrix.reverse[row_nr+1][col_nr+1]\r\n\t\t\t\tel_3 = @matrix.reverse[row_nr+2][col_nr+2]\r\n\t\t\t\tel_4 = @matrix.reverse[row_nr+3][col_nr+3]\r\n\r\n\t\t\t\tif el_1 + el_2 + el_3 + el_4 == 'XXXX'\r\n\t\t\t\t @winner = 2 \r\n\t\t\t\telsif el_1 + el_2 + el_3 + el_4 == 'OOOO'\r\n\t\t\t\t @winner = 1\r\n\t\t\t\tend\r\n\t\t\t end\r\n\t\t\tend\r\n\t\r\n\t\t\treturn @winner\r\n\t\tend",
"def winner_mark\n check_columns ||\n check_rows ||\n check_left_diagonal ||\n check_right_diagonal\n end",
"def check_diagonal\n RulesContracts.classic_model(@game_state_model)\n # testing for bitboard errors\n # (0..7).each { |y|\n # (0..7).each { |x|\n # if @grid[y][x] == 1 and y <= 4 and x >= 3\n # puts \" #{x}/#{y} #{@grid[y][x]} || #{x-1}/#{y+1} #{@grid[y + 1][x - 1]} || #{x-2}/#{y+2} #{@grid[y + 2][x - 2]} || #{x-3}/#{y+3} #{@grid[y + 3][x - 3]}\"\n # puts \"#{@grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1}\"\n # end\n # }\n # }\n \n (0..7).each { |y|\n (0..7).each { |x|\n if y <= 4 and x <= 4\n if @grid[y][x] == 2 and @grid[y + 1][x + 1] == 2 and @grid[y + 2][x + 2] == 2 and @grid[y + 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x + 1] == 1 and @grid[y + 2][x + 2] == 1 and @grid[y + 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y <= 4 and x >= 3\n if @grid[y][x] == 2 and @grid[y + 1][x - 1] == 2 and @grid[y + 2][x - 2] == 2 and @grid[y + 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1\n @winner = 0\n return true\n end\n end\n if y >= 3 and x <= 4\n if @grid[y][x] == 2 and @grid[y - 1][x + 1] == 2 and @grid[y - 2][x + 2] == 2 and @grid[y - 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x + 1] == 1 and @grid[y - 2][x + 2] == 1 and @grid[y - 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y >= 3 and x >= 3\n \n if @grid[y][x] == 2 and @grid[y - 1][x - 1] == 2 and @grid[y - 2][x - 2] == 2 and @grid[y - 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x - 1] == 1 and @grid[y - 2][x - 2] == 1 and @grid[y - 3][x - 3] == 1\n @winner = 0\n return true\n end \n \n end \n }\n }\n return false\n end",
"def board_win?(board)\n first_row_win?(board) ||\n second_row_win?(board) ||\n third_row_win?(board) ||\n first_column_win?(board) ||\n second_column_win?(board) ||\n third_column_win?(board) ||\n diag_right_win?(board) ||\n diag_left_win?(board) \nend",
"def winner\n #see if there are four in a row\n @columns.times do |c|\n @rows.times do |r|\n check = @slots[c][r]\n if check != nil\n if (r <= @rows - 4) && [check, @slots[c][r+1], @slots [c][r+2], @slots[c][r+3]].uniq.length == 1\n return check\n elsif (c <= (@columns - 4)) && [check, @slots[c+1][r], @slots[c+2][r], @slots[c+3][r]].uniq.length == 1\n return check\n elsif (r >= 3) && (c <= (@columns - 4)) && [check, @slots[c+1][r-1], @slots[c+2][r-2], @slots[c+3][r-3]].uniq.length ==1\n return check\n elsif (r >= 3) && (c >= (@columns - 4)) && [check, @slots[c-1][r-1], @slots[c-2][r-2], @slots[c-3][r-3]].uniq.length ==1\n return check\n end\n end\n end\n end\n return false\n end",
"def winner\n\n # Check every row\n winner = winner_rows()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # No row winner, so check every column\n winner = winner_columns()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # No row or column winner, so check every diagonal\n winner = winner_diagonals()\n\n # Winner?\n if winner\n\n # Yes, the game is over\n return winner\n\n end\n\n # Otherwise, no winner\n return\n\n end",
"def is_winner(b,l) \n return ((b[7] == l and b[8] == l and b[9] == l) or # across the top\n (b[4] == l and b[5] == l and b[6] == l) or # across the middle\n (b[1] == l and b[2] == l and b[3] == l) or # across the bttom\n (b[7] == l and b[4] == l and b[1] == l) or # down the left side\n (b[8] == l and b[5] == l and b[2] == l) or # down the middle\n (b[9] == l and b[6] == l and b[3] == l) or # down the right side\n (b[7] == l and b[5] == l and b[3] == l) or # diagonal\n (b[9] == l and b[5] == l and b[1] == l)) # diagonal\nend",
"def winner\n winner=winner_row()\n if winner\n return winner\n end\n\n winner=winner_col()\n if winner\n return winner\n end\n \n winner=winner_daigonal()\n if winner \n return winner\n end\n\n # if no winner \n return \n end",
"def win?\n # COLUMNS - 1\n return true if @boardcases[0].case_value == @boardcases[3].case_value && @boardcases[3].case_value == @boardcases[6].case_value && @boardcases[0].case_value != ' '\n # 2\n return true if @boardcases[1].case_value == @boardcases[4].case_value && @boardcases[4].case_value == @boardcases[7].case_value && @boardcases[1].case_value != ' '\n # 3\n return true if @boardcases[2].case_value == @boardcases[5].case_value && @boardcases[5].case_value == @boardcases[8].case_value && @boardcases[2].case_value != ' '\n # ROWS - A\n return true if @boardcases[0].case_value == @boardcases[1].case_value && @boardcases[1].case_value == @boardcases[2].case_value && @boardcases[0].case_value != ' '\n # B\n return true if @boardcases[3].case_value == @boardcases[4].case_value && @boardcases[4].case_value == @boardcases[5].case_value && @boardcases[3].case_value != ' '\n # C\n return true if @boardcases[6].case_value == @boardcases[7].case_value && @boardcases[7].case_value == @boardcases[8].case_value && @boardcases[6].case_value != ' '\n # DIAGONALS\n return true if @boardcases[0].case_value == @boardcases[4].case_value && @boardcases[4].case_value == @boardcases[8].case_value && @boardcases[0].case_value != ' '\n return true if @boardcases[6].case_value == @boardcases[4].case_value && @boardcases[4].case_value == @boardcases[2].case_value && @boardcases[6].case_value != ' '\n end",
"def win?\n horizontal || vertical || diagonal_left || diagonal_right\n end",
"def check_horizontal\n RulesContracts.classic_model(@game_state_model)\n (0..7).each { |y|\n (0..7).each { |x|\n if x < 5 and @grid[y][x] == 2\n if @grid[y][x + 1] == 2 and @grid[y][x + 2] == 2 and @grid[y][x + 3] == 2\n @winner = 1\n return true\n end\n elsif x < 5 and @grid[y][x] == 1\n if @grid[y][x + 1] == 1 and @grid[y][x + 2] == 1 and @grid[y][x + 3] == 1\n @winner = 0\n return true\n end\n end \n }\n }\n return false\n end",
"def straight(ranks)\n return (ranks.max - ranks.min) == 4 && ranks.uniq.size == 5\nend",
"def block_diagonal_win?\n \tblank_x = -1\n \tx_row_total = 0\n \t\n \t3.times do |i|\t\n\t\t\tif @game_board[i][i] == \"X\"\n\t\t\t\tx_row_total += 1\n\t\t\telse \n\t\t\t\tblank_x = i\n\t\t\tend\n\n\t\t\tif x_row_total == 2 && blank_x > -1\n\t\t\t\t@game_board[blank_x][blank_x] = \"O\"\n\t\t\t\ttrue\n\t\t\tend\n \tend\n \tfalse\n end",
"def is_winner(x, y, player)\n return true if check_row(x, player)\n return true if check_col(y, player)\n return true if check_diagonals(player)\n return false\n end",
"def winner_via_diagonal?(player)\n diagonals.any? do |diagonal|\n diagonal.cells.all? {|cell| cell.value == player.marker}\n end\n end",
"def winner?\n directions = [[1,0], [1,-1], [1,1], [0,1]]\n max_x = grid[0].length\n max_y = grid.length\n directions.each do |dx, dy|\n for x in (0...max_x) do\n for y in (0...max_y) do\n last_x = x + 3 * dx\n last_y = y + 3 * dy\n if 0 <= last_x && last_x < max_x && 0 <= last_y && last_y < max_y\n val = get_cell(x, y).value\n if (!val.empty? && val == get_cell(x + dx, y + dy).value && \n val == get_cell(x + 2 * dx, y + 2 * dy).value &&\n val == get_cell(x + 3 * dx, y + 3 * dy).value)\n return true\n end\n end\n end\n end\n end\n return false\n end",
"def square? \n (@rows == @cols) && @rows > 0 ? true : false\n end",
"def opposite_corner\n if @board.taken?(1) && [email protected]?(9)\n 9\n elsif @board.taken?(9) && [email protected]?(1)\n 1\n elsif @board.taken?(3) && [email protected]?(7)\n 7\n elsif @board.taken?(7) && [email protected]?(3)\n 3\n else\n nil\n end\n end",
"def check_win\n @win_vecs.each {|vec| return vec.winner if vec.winner != 0}\n return 0\n end",
"def check_win(player,grid,coordinates)\n win = false\n win_array = []\n play_row = coordinates[0]\n play_col = coordinates[1]\n\n # horizontal checking\n grid[play_row].each_index do | col |\n if win_array.length != 4\n if grid[play_row][col] == player\n win_array.push([play_row,col])\n else\n win_array = []\n end\n end\n end\n\n if win_array.length == 4\n win = true\n end\n\n # vertical checking\n if win == false\n\n win_array = []\n\n grid.each_index do | row |\n if win_array.length != 4\n if grid[row][play_col] == player\n win_array.push([row,play_col])\n else\n win_array = []\n end\n end\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # diagonal checking SW to NE\n if win == false\n\n win_array = []\n row = play_row\n col = play_col\n\n # finds SW-most position in same diagonal line as most recently played piece\n # this is the starting point we check from\n until col == 0 || row == 7\n row += 1\n col -= 1\n end\n\n until col > 7 || row < 0\n if win_array.length != 4\n if grid[row][col] == player\n win_array.push([row,col])\n else\n win_array = []\n end\n end\n row -= 1\n col += 1\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # diagonal checking NW to SE\n if win == false\n\n win_array = []\n row = play_row\n col = play_col\n\n # finds NW-most position in same diagonal line as most recently played piece\n # this is the starting point we check from\n until col == 0 || row == 0\n row -= 1\n col -= 1\n end\n\n until col > 7 || row > 7\n if win_array.length != 4\n if grid[row][col] == player\n win_array.push([row,col])\n else\n win_array = []\n end\n end\n row += 1\n col += 1\n end\n\n if win_array.length == 4\n win = true\n end\n end\n\n # winning four-in-a-row briefly \"flashes\" to show where it is\n if win == true\n flash_count = 0\n while flash_count < 4\n #flashing animation\n win_array.each do | element |\n grid[element[0]][element[1]] = \"@\"\n end\n print_board(grid)\n sleep(0.2)\n win_array.each do | element |\n grid[element[0]][element[1]] = player\n end\n print_board(grid)\n sleep(0.2)\n flash_count += 1\n end\n end\n\n return win\nend",
"def on_table?(x,y)\n (0 <= x && x < GRID_X) && (0 <= y && y < GRID_Y)\n end",
"def horizontal_victory(b)\n win = false\n\n (1..BOARD_HEIGHT).each do |i|\n row_values = board_row_values(b, i)\n win = i if victory_row?(row_values)\n end\n\n win\nend",
"def verticalWin? (player)\n (0..6).any? {|c| (0..2).any? {|r| fourFromTowards?(player, r, c, 1, 0)}}\n end",
"def game_over \n # all the grid's cells are full and different numbers \n end",
"def winner(ind1, ind2)\n (ind1 <=> ind2).zero? ? [ind1, ind2][rand(2)] : [ind1, ind2].min\n end",
"def check_board\n if in_row? || in_column? || in_descending_diagonal? || in_ascending_diagonal?\n puts \"BINGO!\"\n else\n puts \"SORRY!\"\n end\n end",
"def check_board\n\n # starting at top left, check top row, diagonal and left column\n if ( ($game_board[0][0] == $game_board[0][1] && $game_board[0][0] == $game_board[0][2]) ||\n ($game_board[0][0] == $game_board[1][1] && $game_board[0][0] == $game_board[2][2]) ||\n ($game_board[0][0] == $game_board[1][0] && $game_board[0][0] == $game_board[2][0]) )\n $winner = $game_board[0][0] \n\n # starting at top middle, check middle column\n elsif ($game_board[0][1] == $game_board[1][1] && $game_board[0][1] == $game_board[2][1])\n $winner = $game_board[0][1]\n\n #starting at top right, check right column and diagonal\n elsif (($game_board[0][2] == $game_board[1][2] && $game_board[0][2] == $game_board[2][2]) ||\n ($game_board[0][2] == $game_board[1][1] && $game_board[0][2] == $game_board[2][0]))\n $winner = $game_board[0][2]\n\n #starting at middle left, check middle row\n elsif ($game_board[1][0] == $game_board[1][1] && $game_board[1][0] == $game_board[1][2])\n $winner = $game_board[1][0]\n\n #starting at bottom left, check bottom row\n elsif ($game_board[2][0] == $game_board[2][1] && $game_board[2][0] == $game_board[2][2])\n $winner = $game_board[2][0]\n end\n \n if $winner\n puts $winner.to_s + \" wins!\" \n exit\n end\n \n #if we don't have a winner at this point, and all the spaces are filled (not nil), then it's a tie\n if $game_board.flatten.all?\n puts \"It's a tie!\"\n exit\n end\n \nend",
"def has_won(new_board)\n #check rows\n new_board.each_with_index do |row, i|\n if new_board[i][0] == new_board[i][1] && new_board[i][1] == new_board[i][2] && new_board[i][2] != '-'\n return new_board[i][0]\n end\n end\n\n #check columns\n new_board.each_with_index do |col, j|\n if new_board[0][j] == new_board[1][j] && new_board[1][j] == new_board[2][j] && new_board[2][j] != '-'\n return new_board[0][j] \n end\n end\n\n #Check Diagonals\n if new_board[0][0] == new_board[1][1] && new_board[1][1] == new_board[2][2] && new_board[2][2] != '-'\n return new_board[0][0]\n end\n\n if new_board[2][0] == new_board[1][1] && new_board[1][1] == new_board[0][2] && new_board[0][2] != '-'\n return new_board[0][0]\n end\n\n #No one has won\n return '-'\nend",
"def winner\n self.won?? self.board.cells[self.won?[0]] : nil\n end",
"def winning_condition?\n grid[0] == grid[1] && grid[1] == grid[2] ||\n grid[3] == grid[4] && grid[4] == grid[5] ||\n grid[6] == grid[7] && grid[7] == grid[8] ||\n grid[0] == grid[3] && grid[3] == grid[6] ||\n grid[1] == grid[4] && grid[4] == grid[7] ||\n grid[2] == grid[5] && grid[5] == grid[8] ||\n grid[0] == grid[4] && grid[4] == grid[8] ||\n grid[2] == grid[4] && grid[4] == grid[6]\n end",
"def winner\n row_winners = rows.select{|r| identical_symbols(r)}.map{|r| r[0]}\n column_winners = columns.select{|c| identical_symbols(c)}.map{|c| c[0]}\n diagonal_winners = diagonals.select{|d| identical_symbols(d)}.map{|d| d[0]}\n winners = (row_winners + column_winners + diagonal_winners).uniq - %w(_)\n players = winners.map{|w| to_player_number(w)}\n players[0] # this would default to nil if players is empty\n end",
"def adjacent_mines(row, col)\n count = 0\n if col < @column_count-1\n count+=1 unless @grid[row][col+1].fill.nil?\n end\n if col > 0\n count +=1 unless @grid[row][col-1].fill.nil?\n end\n if row < @row_count-1\n count+=1 unless @grid[row+1][col].fill.nil?\n end\n if row > 0\n count+=1 unless @grid[row-1][col].fill.nil?\n end\n if row < @row_count-1 && col < @column_count-1\n count+=1 unless @grid[row+1][col+1].fill.nil?\n end\n if row > 0 && col > 0\n count+=1 unless @grid[row-1][col-1].fill.nil?\n end\n if row > 0 && col < @column_count-1\n count +=1 unless @grid[row-1][col+1].fill.nil?\n end\n if row < @row_count-1 && col > 0\n count +=1 unless @grid[row+1][col-1].fill.nil?\n end\n count\n end",
"def win?\n win=[false,false] #[player1,player2]\n @y.times do |y|\n \t#Winning Conditions\n if @board[y][0...@x].all? {|x| x==\"X\"} # Rows\n \t win=[true,false]\n \telsif @board[y][0...@x].all? {|x| x==\"O\"}\n \t win=[false,true]\n \telsif #Diagonals (Currently limited to 3x3)\n \t if @board[0][0] == \"X\" && @board[1][1] == \"X\" && @board[2][2] == \"X\" \n \t win=[true,false]\n \t elsif @board[0][2] == \"X\" && @board[1][1] == \"X\" && @board[2][0] == \"X\"\n \t win=[true,false]\n \t elsif @board[0][0] == \"O\" && @board[1][1] == \"O\" && @board[2][2] == \"O\"\n \t win=[false,true]\n \t elsif @board[0][2] == \"O\" && @board[1][1] == \"O\" && @board[2][0] == \"O\"\n \t win=[false,true]\n \t end\n \tend\n end\n \t\n\n @x.times do |x|\n if @board[0][x] == \"X\" && @board[1][x] == \"X\" && @board[2][x] == \"X\" #Columns\n \t win=[true,false]\n \telsif @board[0][x] == \"O\" && @board[1][x] == \"O\" && @board[2][x] == \"O\" \n \t win=[false,true]\n \tend\n end\n \t \t\n \n \n return win\n end",
"def check_rows_for_winner\n\n if board[0][0] == board[0][2] and board[0][1] == board[0][2] and not board[0][1] == nil\n @player = board[0][0]\n elsif board[1][0] == board[1][2] and board[1][1] == board[1][2] and not board[1][1] == nil\n @player = board[1][1]\n elsif board[2][0] == board[2][2] and board[2][1] == board[2][2] and not board[2][1] == nil\n @player = board[2][2]\n end\n end",
"def select_winner(altered_grid)\n altered_grid.each do |row|\n winner = row.each_cons(4).to_a.select do |chunk|\n chunk.uniq.length == 1 && chunk.none? { |el| el.nil? }\n end\n\n return winner[0][0] unless winner.empty?\n end\n\n nil\n end",
"def check_for_winner\n winner = false\n until winner\n WINNING_CELLS.each do |combo|\n if board[combo[1] - 1] == board[combo[0] - 1] && board[combo[2] - 1] == board[combo[0] - 1]\n winner = true\n break\n else\n winner = false\n end\n end\n end\n winner\n end",
"def off_board(x, y)\n \tif (x < 0 || x > 7 || y < 0 || y > 7)\n \t\treturn true\n \tend\n \treturn false\n end",
"def win_condition_met?(player)\n # Horizontal\n for row in (0..5) do\n counter = 0\n \n @board[row].each do |disc|\n if(disc == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n end\n end\n \n # Vertical\n for col in (0..6) do\n counter = 0\n \n for row in (0..5) do\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n end\n end\n \n # Right diagonal\n starting_points = [[0, 0], [1, 0], [2, 0], [0, 1], [0, 2], [0, 3]]\n starting_points.each do |start|\n counter = 0\n \n row = start[0]\n col = start[1]\n \n while(row < 6 && col < 7)\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n \n row += 1\n col += 1\n end\n end\n \n # Left diagonal\n starting_points = [[0, 6], [1, 6], [2, 6], [0, 5], [0, 4], [0, 3]]\n starting_points.each do |start|\n counter = 0\n \n row = start[0]\n col = start[1]\n \n while(row < 6 && col >= 0)\n if(@board[row][col] == player)\n counter += 1\n return true if(counter >= 4)\n else\n counter = 0\n end\n \n row += 1\n col -= 1\n end\n end\n \n return false\n end",
"def win_checker\n @board.flatten.max == 16_384\n end",
"def winner\n [rows, columns, diagonals].each do |groups|\n win_groups = groups.select { |g| g.all? && g.uniq.size == 1 }\n return [@human_player, @computer_player].find { |p| p.to_s == win_groups[0][0] } if !win_groups.empty?\n end\n nil\n end",
"def win_diagonal?(mark)\n a = ([email protected]).all? {|i| self[[i,i]] == mark }\n b = ([email protected]).all? {|i| self[[i, @grid.length - 1 - i]] == mark }\n a || b\n end",
"def won?\n #diagonals first\n has_left_diagonal = true\n has_right_diagonal = true\n ([email protected]).each do |i|\n has_left_diagonal = false unless @board[i][i] == @board[0][0]\n has_right_diagonal = false unless @board[i][-1-i] == @board[0][-1]\n end\n return @board[0][0] if has_left_diagonal\n return @board[-1][0] if has_right_diagonal\n \n #check rows\n ([email protected]).each do |i|\n #slightly more concise but costly ( O(n^2) per uniq ) than a manual check\n return @board[i][0] if @board[i].uniq.length == 1\n end\n \n #check columns\n ([email protected]).each do |i|\n player = @board[0][i]\n has_column = true\n ([email protected]).each do |j|\n has_column = false unless @board[j][i] == player\n end\n return player if has_column\n end\n \n return 0\n end",
"def check_rows_for_winner\n # TODO\n end",
"def winner\n won? ? board.cells[won?[0]] : nil\n end",
"def potential_wins(x,some_array) \n currentboard_array = view_currentboard(some_array)\n rows = currentboard_array[0]\n cols = currentboard_array[1]\n diag1 = currentboard_array[2]\n diag2 = currentboard_array[3]\n \n if (sum_array(rows[0]) == x) && (rows[0].include?nil) \n some_array[0][rows[0].index(nil)] = 10\n elsif (sum_array(rows[1]) == x) && (rows[1].include?nil)\n some_array[1][rows[1].index(nil)] = 10\n elsif (sum_array(rows[2])== x) && (rows[2].include?nil)\n some_array[2][rows[2].index(nil)] = 10\n\t\n elsif (sum_array(cols[0])== x) && (cols[0].include?nil) && (some_array[cols[0].index(nil)][0] == nil)\n some_array[cols[0].index(nil)][0] = 10\n elsif (sum_array(cols[1])== x) && (cols[1].include?nil) && (some_array[cols[1].index(nil)][1] == nil)\n some_array[cols[1].index(nil)][1] = 10\n elsif (sum_array(cols[2])== x) && (cols[2].include?nil) && (some_array[cols[2].index(nil)][2] == nil)\n some_array[cols[2].index(nil)][2] = 10\n\t\n elsif (sum_array(diag1) == x) && (diag1.include?nil) && (some_array[diag1.index(nil)][diag1.index(nil)] == nil)\n some_array[diag1.index(nil)][diag1.index(nil)] = 10\n \n elsif sum_array(diag2) == x\n\t if diag2.index(nil) == 0\n some_array[0][2] = 10\n\t elsif diag2.index(nil) == 1\n\t some_array[1][1] = 10\n\t elsif diag2.index(nil) == 2\n\t some_array[2][0] = 10\n\t end\n end \n\t\n some_array\n\t\n end",
"def who_is_winner(pieces_position_list)\n representation = create_representation(pieces_position_list)\n\n diagonal = get_diagonal(representation)\n on_row = by_row(representation)\n on_column = by_column(representation)\n\n [diagonal, on_column, on_row].select { |x| x != 'Draw' }.first\nend",
"def won?\n if (diagonal_match || across_match || down_match)\n return true\n end\n return false\n end",
"def adjacent_mines(row, col)\n mines_nearby = 0\n range = [-1, 0, 1]\n range.each do |range_x|\n range.each do |range_y|\n x_adj = row + range_x\n y_adj = col + range_y\n if cell_exists?(x_adj,y_adj)\n mines_nearby += 1 if contains_mine?(x_adj, y_adj)\n end\n end\n end\n mines_nearby\n end",
"def check_wins(column, player)\n\t\t# row checking\n\t\tfor i in 0...@@board.length\n\t\t\trow = @@board[i]\n\t\t\trow_counter = 0\n\t\t\tfor j in 0...row.length\n\t\t\t\tif row[j] === player\n\t\t\t\t\trow_counter += 1\n\t\t\t\t\tif row_counter === 4\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trow_counter = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# column checking\n\t\tcolumn_counter = 0\n\t\tfor k in 0...@@board.length\n\t\t\tif @@board[k][column] === player\n\t\t\t\tcolumn_counter += 1\n\t\t\t\tif column_counter === 4\n\t\t\t\t\treturn true;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# diagonal checking, chose to go to 11 because coordinates [5,6] can be\n\t\t#reached in this loop\n\t\tfor diagonal_sum in 0..11\n\t\t\tdiagonal_counter = 0\n\t\t\tfor x in 0..diagonal_sum\n\t\t\t\ty = diagonal_sum - x\n\t\t\t\tif (defined?(@@board[x][y])).nil?\n\t\t\t\t\t# some of the coordinates being checked are not defined, this is to\n\t\t\t\t\t# keep looping through the board to check values on the board\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif @@board[x][y] === player\n\t\t\t\t\tdiagonal_counter += 1\n\t\t\t\t\tif diagonal_counter === 4\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tdiagonal_counter = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# other diagonal checking\n\t\tfor diagonal_diff in (6).downto(-5)\n\t\t\ty = 0\n\t\t\tother_diagonal_counter = 0\n\t\t\tfor x in 0...7\n\t\t\t\ty = diagonal_diff + x\n\t\t\t\tif (defined?(@@board[x][y])).nil? #if a space is undefined, just keep checking\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif y < 7\n\t\t\t\t\tif @@board[x][y] === player\n\t\t\t\t\t\tother_diagonal_counter += 1\n\t\t\t\t\t\tif other_diagonal_counter === 4\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tother_diagonal_counter = 0\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tbreak;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# the check_wins method has many nested for loops, which is a\n\t\t# runtime complexity of O(n^2)\n\t\treturn false\n\tend",
"def check_diagonals\n diagonal_winner = nil\n # stores the markers\n backward_diagonal = ''\n forward_diagonal = ''\n\n # for a diagonal to be a winner it takes the row[n], row[n+1], row[n+2] and so on..\n @board.each_with_index do |row,index|\n\n # check if left to right diagonal is a winner\n row.each_with_index do |marker, position|\n if position == index\n backward_diagonal += marker\n end\n end\n\n # check if right to left diagonal is a winner\n reversed_row = row.reverse\n reversed_row.each_with_index do |marker, position|\n if position == index\n forward_diagonal += marker\n end\n end\n end\n\n # checks iteration count of x or o in strings to find winner\n if backward_diagonal.count('x') == @board.size || forward_diagonal.count('x') == @board.size\n diagonal_winner = 'x'\n elsif backward_diagonal.count('o') == @board.size || forward_diagonal.count('o') == @board.size\n diagonal_winner = 'o'\n end\n\n diagonal_winner\n end",
"def winner_daigonal\n first_symbol=@board[0][0]\n for index in 1..BOARD_MAX_INDEX\n if first_symbol !=@board[index][index]\n break\n elsif index==BOARD_MAX_INDEX and first_symbol!=EMPTY_POS\n return first_symbol\n end\n end\n\n \n first_symbol=@board[0][BOARD_MAX_INDEX]\n row_index=0\n col_index=BOARD_MAX_INDEX\n\n while row_index < BOARD_MAX_INDEX\n row_index+=1\n col_index-=1\n\n if first_symbol !=@board[row_index][col_index]\n break\n elsif row_index==BOARD_MAX_INDEX and first_symbol!=EMPTY_POS\n return first_symbol\n end\n \n end\n return \n end",
"def adjacent_mines(row, col)\n left = @field[row][col - 1] unless col - 1 < 0\n top_left = @field[row -1][col -1] unless row -1 < 0 || col -1 < 0\n bot_left = @field[row +1][col -1] unless row + 1 > @row_count - 1 || col -1 < 0\n right = @field[row][col + 1] unless col + 1 > @column_count - 1\n top_right = @field[row -1][col +1] unless row -1 < 0 || col + 1 > @column_count - 1\n bot_right = @field[row +1][col +1] unless row + 1 > @row_count - 1 || col + 1 > @column_count -1\n top = @field[row -1][col] unless row - 1 < 0\n bottom = @field[row +1][col] unless row + 1 > @row_count - 1\n\n mines_nearby = 0\n mines_nearby += 1 if !left.clear? if !left.nil?\n mines_nearby += 1 if !top_left.clear? if !top_left.nil?\n mines_nearby += 1 if !bot_left.clear? if !bot_left.nil?\n mines_nearby += 1 if !right.clear? if !right.nil?\n mines_nearby += 1 if !top_right.clear? if !top_right.nil?\n mines_nearby += 1 if !bot_right.clear? if !bot_right.nil?\n mines_nearby += 1 if !top.clear? if !top.nil?\n mines_nearby += 1 if !bottom.clear? if !bottom.nil?\n mines_nearby\n end",
"def gaps_covered_by?(board)\n row_range.all? do |row|\n col_range.all? do |col|\n @positions.include?([row, col]) || board.nonempty_space?(row, col)\n end\n end\n end",
"def row_winning_move\n\t\[email protected]_with_index do |row, r|\n\t\t\tother_nil_index = contains_two_marks(row)\n\t\t\tif(other_nil_index)\n\t\t\t\treturn [r, other_nil_index]\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def check_vertical_win? \n \t\t([email protected]).each do |i| #assigns the count of rows in the array, board, to the variable i\n \t\t\tif(@board[0][i]!=0&&(@board[0][i])==@board[1][i]&&@board[1][i]==@board[2][i]&&@board[2][i]==@board[3][i]) \n \t\t\t#if the first element of column i is not equal to 0 and \n \t\t\t#the first element of column i is equal to the second element of column i and \n \t\t\t#the second element of column i is equal to third element of column i and \n \t\t\t#the third element of column i is equal to the fourth element, \n \t\t\t#then by the transitive property the statement is true\n \t\t\t\treturn true\n \t\t\tend\n \t\tend\n \t\treturn false\n \tend",
"def wins\n n = self.find_board_size\n streaks = (row_streaks(n) + column_streaks(n) + diagonal_streaks(n))\n wins = streaks_to_wins(streaks, n, 0) + diagonal_wins(n)\n return wins\n end",
"def on_board?(*args)\n x, y, length, direction = args.flatten\n\n x_max = x\n y_max = y\n case direction\n when :across\n x_max = x + length\n when :down\n y_max = y + length\n end\n\n @x_range.cover?(x) && @y_range.cover?(y) && @x_range.cover?(x_max) && @y_range.cover?(y_max)\n end",
"def won\n if check_rows || check_columns || check_diagonals\n return true\n else\n return false\n end\n end",
"def in_board?(x, y)\n x >= 0 && y >= 0 && x < @board.size && y < @board[x].size - 1\n end",
"def check_board\t\n # Winner checker\n @winner = false\n \n # Board's status\n @empty_board = false\n\n # Checking the rows\n 3.times do |x|\n if !@winner\n if vector_value(x,0) == vector_value(x,1) and vector_value(x,1) == vector_value(x,2) and vector_value(x,2) != C_V\n if vector_value(x,2) == C_X\n JOptionPane.showMessageDialog nil,\"Player X is the winner!\"\n @points_player1 += 1\n elsif vector_value(x,2) == C_O\n JOptionPane.showMessageDialog nil,\"Player O is the winner!\"\n @points_player2 += 1\n end\n reset_board\n @moves = 0\n @winner = true\n end\n end\n end\n\n #Checking the columns\n if !@winner\n 3.times do |y|\n if !@winner\n if vector_value(0,y) == vector_value(1,y) and vector_value(1,y) == vector_value(2,y) and vector_value(2,y) != C_V \n if vector_value(2,y) == C_X\n JOptionPane.showMessageDialog nil,\"Player X is the winner!\"\n @points_player1 += 1\n elsif vector_value(2,y) == C_O\n JOptionPane.showMessageDialog nil,\"Player O is the winner!\"\n @points_player2 += 1\n end \n reset_board\n @moves = 0\n @winner = true\n end\n end\n end\n end\n\n #Checking the diagonals\n if !@winner\n if vector_value(0,0) == vector_value(1,1) and vector_value(1,1) == vector_value(2,2) and vector_value(2,2) != C_V\n if vector_value(2,2) == C_X\n JOptionPane.showMessageDialog nil,\"Player X is the winner!\"\n @points_player1 += 1\n elsif vector_value(2,2) == C_O\n JOptionPane.showMessageDialog nil,\"Player O is the winner!\"\n @points_player2 += 1\n end\n reset_board\n @moves = 0\n @winner = true\n elsif vector_value(0,2) == vector_value(1,1) and vector_value(1,1) == vector_value(2,0) and vector_value(2,0) != C_V\n if vector_value(2,0) == C_X\n JOptionPane.showMessageDialog nil,\"Player X is the winner!\"\n @points_player1 += 1\n elsif vector_value(2,0) == C_O\n JOptionPane.showMessageDialog nil,\"Player O is the winner!\"\n @points_player2 += 1\n end\n reset_board\n @moves = 0\n @winner = true\n else #Checking no winner\n @board.each do |i|\n if i == C_V\n @empty_board = true\n break\n end\n end\n if !@empty_board\n JOptionPane.showMessageDialog nil, \"No winner, the game will restart\"\n reset_board\n @moves = 0\n end\n end\n end\n end",
"def contains_mine?(row, col)\n grid[row][col].fill == 1\n end",
"def negation_solution(x, y)\n negation_value(coords_of_square_neighbors(x, y), x, y) ||\n negation_value(coords_of_row_neighbors(x, y), x, y) ||\n negation_value(coords_of_column_neighbors(x, y), x, y)\n end",
"def check_columns_for_winner\n # @player = nil\n if board[0][0] == board[1][0] and board[1][0] == board[2][0] and not board[0][0] == nil\n @player = board[0][0]\n elsif board[0][1] == board[1][1] and board[1][1] == board[2][1] and not board[0][1] == nil\n @player = board[0][1]\n elsif board[0][2] == board[1][2] and board[1][2] == board[2][2] and not board[0][2] == nil\n @player = board[0][2]\n end\n end",
"def win?(mark)\n win_row?(mark) || win_col?(mark) || win_diagonal?(mark)\n end",
"def check_diaganol(x_target, y_target)\n\n x = coordinate_x\n y = coordinate_y\n \n\n #top to bottom and left to right\n if x < x_target and y > y_target\n while x < x_target do \n x = x + 1 \n y = y - 1\n\n return true if is_occupied?(x, y) == true\n end\n end\n\n #top to bottom and right to left\n if x > x_target and y > y_target\n while x > x_target do \n \n x = x - 1 \n y = y - 1\n return true if is_occupied?(x, y)\n \n end\n end\n\n #bottom to top and right to left\n if x > x_target and y < y_target\n while x > x_target do \n x = x - 1 \n y = y + 1\n \n return true if is_occupied?(x, y)\n end\n end\n\n #bottom to top and left to right\n if x < x_target and y < y_target\n while x < x_target do \n x = x + 1 \n y = y + 1\n return true if is_occupied?(x, y)\n end\n end\n\n return false\n end",
"def adjacent_mines(row, col)\n\n count = 0\n\n count += 1 if (row + 1) < row_count && grid[row+1][col].fill == 1\n count += 1 if (row - 1) >= 0 && grid[row-1][col].fill == 1\n count += 1 if (col + 1) < column_count && grid[row][col+1].fill == 1\n count += 1 if (col -1) >= 0 && grid[row][col-1].fill == 1\n count += 1 if (row + 1) < row_count && (col + 1) < column_count && grid[row+1][col+1].fill == 1\n count += 1 if (row + 1) < row_count && (col -1) >= 0 && grid[row+1][col-1].fill == 1\n count += 1 if (row - 1) >= 0 && (col + 1) < column_count && grid[row-1][col+1].fill == 1\n count += 1 if (row - 1) >= 0 && (col -1) >= 0 && grid[row-1][col-1].fill == 1\n\n return count\n end",
"def winner?(letter=:X)\n win_arr = [letter, letter, letter]\n\n # check rows\n return true unless @squares.index(win_arr).nil?\n\n # check columns\n return true unless @squares.index(win_arr).nil?\n end",
"def no_pieces_in_between?(from_row, from_column, to_row, to_column)\n if from_row == to_row\n column = from_column < to_column ? from_column : to_column\n ending_column = column == from_column ? to_column : from_column\n column += 1\n until column == ending_column\n return false unless @state[from_row][column] == nil\n column += 1\n end\n true\n elsif from_column == to_column\n row = from_row < to_row ? from_row : to_row\n ending_row = row == from_row ? to_row : from_row\n row += 1\n until row == ending_row\n return false unless @state[row][from_column] == nil\n row += 1\n end\n true\n else\n no_pieces_in_between_diagonal?(from_row, from_column, to_row, to_column)\n end\n end",
"def adjacent_mines(row, col)\n count = 0\n if @field[row + 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row + 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil?\n count = 0\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n elsif @field[row + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n elsif @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n else\n count = 0\n adjacent_cells(row, col).each do |cell|\n if cell.contains_mine?\n count += 1\n end\n end\n end\n count\n end",
"def over?(board)\n won?(board) || full?(board)\n end",
"def restrict_neighbours()\n\t# The grid starts out with values already. \n\t# Need to change the domain_grid to reflect the neighbours that can't \n\t# be certain values due to starting values\n\n\t$domain_grid.each_with_index do |row, index_r|\n\t\trow.each_with_index do |col, index_c|\n\t\t\tval = $value_grid[index_r][index_c]\n\t\t\t\n\t\t\tif val != 0 \n\t\t\t\tremove_from_neighbours(index_r,index_c,val)\n\t\t\tend\n\t\tend\n\tend\nend",
"def no_pieces_in_between_diagonal?(from_row, from_column, to_row, to_column)\n row = from_row\n column = from_column\n if to_row > from_row && to_column > from_column\n row += 1\n column += 1\n until row == to_row\n return false unless @state[row][column] == nil\n row += 1\n column += 1\n end\n elsif to_row > from_row && to_column <= from_column\n row += 1\n column -= 1\n until row == to_row\n return false unless @state[row][column] == nil\n row += 1\n column -= 1\n end\n elsif to_row <= from_row && to_column <= from_column\n row -= 1\n column -= 1\n until row == to_row\n return false unless @state[row][column] == nil\n row -= 1\n column -= 1\n end\n elsif to_row <= from_row && to_column > from_column\n row -= 1\n column += 1\n until row == to_row\n return false unless @state[row][column] == nil\n row -= 1\n column += 1\n end\n end\n true\n end",
"def contains_mine?(row, col)\n @board[row][col].mined\n end",
"def over?(board)\n full?(board) || won?(board)\nend",
"def find_vertical\n\n\t\t# (x * g) + y where y = (1...g), x = (0...g-1)\n\n\t\t@grid_size.times do |y|\n\t\t\t@winner = true if\n\t\t\t\t(0..(@grid_size-1)).each do |x|\n\t\t\t\t\tvertical_hit = x * @grid_size + y + 1\n\t\t\t\t\tif [email protected]? vertical_hit\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\tend",
"def valid_board_coordinates?(x, y)\n x >= 0 && y >= 0 && x < 3 && y < 3\n end",
"def has_winner?\n (@last_insert_x > 0) ? (check_column || check_row) : false\n \n end",
"def winning_horizontal?(piece)\n horizontals.any? do |horizontal|\n horizontal.all?{|cell| cell == piece }\n end\n end",
"def check_horizontal_win? \n \[email protected] do |i| #assigns the elements of the \"primary\" array in board (i.e. the rows) to the variable i\n \t \t\tif(i[0]!=0&&(i[0]==i[1]&&i[1]==i[2]&&i[2]==i[3])) #if the first element of row i is not equal to 0 and \n \t \t\t\t#the first element of row i is equal to the second element of row i and \n \t \t\t\t#the second element of row i is equal to the third element of row i and\n \t \t\t\t#the third element of row i equal to the fourth element of row i, \n \t \t\t\t#then by the transitive property the statement is true\n \t\treturn true\n \t\tend\n \t\tend\n \treturn false \n \tend",
"def winner_H(board,player) \n for i in 0..5\n check=0\n j=0\n\n while (j < 6)\n if (board[i][j] == player && board[i][j]!=\" \")\n check=check+1\n else\n check=0\n end\n\n if (check== 4) then\n return true\n end\n j=j+1\n end\n end\n\n return false\n end",
"def gameover?\n winning_row? || winning_column? || winning_diagonal? || full_board?\n end",
"def winning_vertical?(piece)\n verticals.any? do |vert|\n vert.all?{|cell| cell == piece }\n end\n end"
] | [
"0.7145024",
"0.7131199",
"0.700994",
"0.6911217",
"0.69062406",
"0.6860557",
"0.68375206",
"0.6821963",
"0.680867",
"0.67607576",
"0.67604506",
"0.6669689",
"0.665233",
"0.662261",
"0.660868",
"0.65973854",
"0.65973854",
"0.65973854",
"0.65950155",
"0.6594573",
"0.6570412",
"0.65627074",
"0.65404725",
"0.6538223",
"0.6518233",
"0.6509192",
"0.6474318",
"0.64680433",
"0.64657295",
"0.6462894",
"0.6462257",
"0.64339864",
"0.6414666",
"0.64089864",
"0.64063245",
"0.639319",
"0.6391143",
"0.6382659",
"0.6375481",
"0.6370875",
"0.63645065",
"0.6362256",
"0.63591874",
"0.6345708",
"0.63176554",
"0.63107926",
"0.63094527",
"0.6308518",
"0.63070214",
"0.6304785",
"0.6303545",
"0.62939453",
"0.6280476",
"0.6275925",
"0.6275529",
"0.62722284",
"0.6267503",
"0.6266633",
"0.6259827",
"0.62483245",
"0.6237772",
"0.62371767",
"0.6233823",
"0.62299895",
"0.6219637",
"0.62178713",
"0.62115026",
"0.62027735",
"0.61952984",
"0.6187539",
"0.6187313",
"0.6179801",
"0.61718553",
"0.6171124",
"0.61650604",
"0.6161392",
"0.6157738",
"0.615044",
"0.61468965",
"0.6139968",
"0.6129308",
"0.6123035",
"0.61221343",
"0.6109434",
"0.6100676",
"0.60997385",
"0.60990405",
"0.6097595",
"0.609494",
"0.6089453",
"0.60852385",
"0.60788524",
"0.6072787",
"0.60719573",
"0.60715425",
"0.60693127",
"0.6068517",
"0.60662526",
"0.6060437",
"0.6055992"
] | 0.6465493 | 29 |
need to figure out how to find tree items that are the same... | def delete_secGrp(groupName,vpc=nil)
start = @serverBranch if vpc == nil or vpc == ""
start = @vpc_serverBranch[vpc] if vpc != nil and vpc != ""
t = @tree.findItem(groupName,start)
if t != nil
p = t.parent
if p != nil
if (p.text() == "Servers" and (vpc == nil or vpc == "")) or
((vpc != nil and vpc != "") and p.text() == vpc)
@tree.removeItem(t)
end
else
puts "Security Group not found in tree"
end
else
puts "Security Group not found in tree"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leaf_similar(root1, root2)\n leaves1 = []\n leaves2 = []\n\n dfs(root1, leaves1)\n dfs(root2, leaves2)\n\n leaves1 == leaves2\nend",
"def findSet(originalname,checkitem) \n if @store[checkitem].is_a?(Integer) then\n #Updating refrence to speed up further query\n if originalname!=checkitem then\n @store[originalname]=checkitem\n end\n return Array.[](checkitem,@store[checkitem]) #Return the Absolute Parent name and the number of element it has\n else\n findSet(originalname,@store[checkitem]) \n end\n end",
"def item_check(tree)\n if tree[0] == nil\n tree[1]\n else\n tree[1] + item_check(tree[0]) - item_check(tree[2])\n end\nend",
"def is_same_tree(p, q)\n\tif (p == nil) ^ (q == nil) \n\t\treturn false\n\tend\n\tq1 = []\n\tq2 = []\n\tq1.push p\n\tq2.push q\n\twhile q1 != [] and q2 != []\n\t\tc1 = q1.shift\n\t\tc2 = q2.shift\n\t\tif c1 == nil and c2 == nil\n\t\telsif (c1 == nil) ^ (c2 == nil)\n\t\t\treturn false\n\t\telsif c1.val != c2.val\n\t\t\treturn false\n\t\telse\n\t\t\tq1.push c1.left\n\t\t\tq1.push c1.right\n\t\t\tq2.push c2.left\n\t\t\tq2.push c2.right\n\t\tend\n\tend\n\tif q1 != [] or q2 != []\n\t\treturn false\n\tend\n\treturn true\n \nend",
"def tes_gettree\n tree = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree { |b| tree.push b.rev_index }\n }\n tree_d = []\n Accounts.matches_by_account_id(0).to_a.each { |a|\n a.get_tree_debug { |b| tree_d.push b.rev_index }\n }\n\n assert_equal 389, tree.count\n assert_equal 389, tree_d.count\n end",
"def checkForDuplicateRoots(reqTree)\n reqTreeRootName = reqTree.root.name\n if reqTree.size == 1\n # $logger.log(reqTreeRootName + \" has no derived objects\")\n return\n end\n counter = 0\n for leaf in reqTree.each_leaf\n ancestry = leaf.parentage\n ancestry.unshift(leaf)\n ancestry.delete_at(-1)\n duplicates = ancestry.each_index.select { |i| ancestry[i].name == reqTreeRootName }\n for duplicate in duplicates\n $logger.log(ancestry[duplicate + 1].name + \" refers to \" + reqTreeRootName)\n counter += 1\n end\n if $printTree\n $logger.log(\"L: \" + leaf.name)\n for node in ancestry\n $logger.log(node.name)\n end\n end\n end\n # if counter == 0\n # $logger.log(reqTreeRootName + \" has no cyclical requirements\")\n # end\nend",
"def same_tree(node)\n same_tree_support(self.root, node)\n end",
"def sameNodes?(node1, node2, truthArray=[])\n\tif node1.nil? || node2.nil?\n\t\treturn false\n\tend\n\tif node1.name != node2.name\n\t\treturn false\n\tend\n if node1.text != node2.text\n return false\n end\n\tnode1Attrs = node1.attributes\n\tnode2Attrs = node2.attributes\n\tnode1Kids = node1.children\n\tnode2Kids = node2.children\n\tnode1Kids.zip(node2Kids).each do |pair|\n\t\ttruthArray << sameNodes?(pair[0],pair[1])\n\tend\n\t# if every value in the array is true, then the nodes are equal\n\treturn truthArray.all?\nend",
"def == other_tree\n one = []\n two = []\n each { |node| one << node }\n other_tree.each { |node| two << node }\n one == two\n end",
"def leaf_similar(root1, root2)\n stack1 = [root1]\n stack2 = [root2]\n\n until stack1.empty? && stack2.empty?\n return false if dfs(stack1) != dfs(stack2)\n end\n\n stack1.empty? && stack2.empty?\nend",
"def look_for_a_match(array)\n tree_match = false\n array.each do |x|\n (1...x.size).each do |i|\n if x[0] != x[i] || x[i] == \" \"\n return false\n end\n end\n return true\n end\n end",
"def bench_similar_elements\n skip 'TODO'\n q = qualifier(:DockItem, title: 'Finder')\n assert_performance_linear do |n|\n (items * n).each { |item| q.qualifies? item }\n end\n end",
"def identical?(node1, node2)\n if node1.nil? || node2.nil?\n return false\n elsif node1.value != node2.value\n return false\n elsif node1.left_child.nil? && node2.left_child.nil? && node1.right_child.nil? && node2.right_child.nil?\n return true\n else\n left_identical = identical?(node1.left_child, node2.left_child)\n right_identical = identical?(node1.right_child, node2.right_child)\n return left_identical && right_identical\n end\nend",
"def tree_equal?(other)\n self == other && children == other.children\n end",
"def compare_folders(a, b)\n\n puts \"* Comparing contents...\".light_yellow\n puts if OPTIONS.verbose\n \n common_a, unique_to_a = a.compare_to(b)\n common_b, unique_to_b = b.compare_to(a, common_a)\n common = common_a | common_b\n\n puts\n [unique_to_a, common, unique_to_b]\nend",
"def is_same_tree(p, q)\n return true if p == nil && q == nil\n return false if p == nil || q == nil\n return false if q.val != p.val\n is_same_tree(p.left, q.left) && is_same_tree(p.right, q.right)\nend",
"def same_children? other\n child_ids = @children.map(&:span_id)\n other_child_ids = other.children.map(&:span_id)\n ::Set.new(child_ids) == ::Set.new(other_child_ids)\n end",
"def find_same_files\n # loop over find_similar_files groups\n # diff -b file1 file2\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 symmetric_tree(arr)\n rows = Hash.new([])\n n = 0\n until arr.empty?\n (2**n).times { rows[n] += [arr.shift] }\n n += 1\n end\n rows.values.each do |row|\n return false unless row == row.reverse\n end\n true\nend",
"def tree_compare(tree, mask, path=[], index=nil)\n if mask == [:*] && tree.is_a?(Enumerable)\n []\n elsif mask == :+ && tree != :__missing__\n []\n elsif mask == :- && tree != :__missing__\n [diff(path, tree, :__absent__)]\n elsif mask.callable?\n are_equivalent = mask.call(tree)\n are_equivalent ? [] : [diff(path, tree, mask)]\n else\n case mask\n when Hash\n if tree.is_a?(Hash)\n mask.each_pair.flat_map do |k, v|\n tree_compare(tree.fetch(k, :__missing__), v, push_path(path, k))\n end\n else\n [diff(path, tree, mask)]\n end\n when SetMask # must check this before Enumerable because Structs are enumerable\n if tree.is_a?(Enumerable)\n # convert the enumerables to hashes, then compare those hashes\n tree_items = tree\n mask_items = mask.items.dup\n get_key = mask.get_key\n\n be_strict = !mask_items.delete(:*)\n new_tree = hashify_set(tree_items, get_key)\n new_mask = hashify_set(mask_items, get_key)\n tree_keys = Set.new(new_tree.keys)\n mask_keys = Set.new(new_mask.keys)\n tree_only = tree_keys - mask_keys\n\n # report duplicate keys\n if new_tree.size < tree_items.size\n diff(path, [:__duplicate_keys__, duplicates(tree_items.map(&get_key))], nil)\n elsif new_mask.size < mask_items.size\n diff(path, nil, [:__duplicate_keys__, duplicates(mask_items.map(&get_key))])\n # hash comparison allows extra values in the tree.\n # report extra values in the tree unless there was a :* in the mask\n elsif be_strict && tree_only.any?\n tree_only.map{|k| diff(push_path(path, k), new_tree[k], :__absent__)}\n else # compare as hashes\n tree_compare(new_tree, new_mask, path, index)\n end\n else\n [diff(path, tree, mask.items)]\n end\n when Enumerable\n if tree.is_a?(Enumerable)\n index ||= 0\n if !tree.any? && !mask.any?\n []\n elsif !tree.any?\n [diff(push_path(path, index.to_s), :__missing__, mask)]\n elsif !mask.any?\n [diff(push_path(path, index.to_s), tree, :__absent__)]\n else\n # if the mask is programmatically generated (unlikely), then\n # the mask might be really big and this could blow the stack.\n # don't support this case for now.\n tree_compare(tree.first, mask.first, push_path(path, index.to_s)) +\n tree_compare(tree.drop(1), mask.drop(1), path, index + 1)\n end\n else\n [diff(path, tree, mask)]\n end\n else\n tree == mask ? [] : [diff(path, tree, mask)]\n end\n end\n end",
"def test_can_get_account_tree\n expected = Rubox::Folder.new do |f|\n f.name = ''\n f.folder_id = 0\n f.shared = '0'\n f.folders = [\n Rubox::Folder.new do |f|\n f.folder_id = 4384\n f.name = \"Incoming\"\n f.shared = '0'\n f.tags = [34]\n f.files = [\n file1 = Rubox::File.new do |f|\n f.file_id = 68736\n f.file_name = 'cows.w3g'\n f.shared = '0'\n f.size = 232386\n f.created = 1129537520\n f.updated = 1129537520\n end,\n file2 = Rubox::File.new do |f|\n f.file_id = 68737\n f.file_name = 'silver.html'\n f.shared = '0'\n f.size = 15805\n f.created = 1129537520\n f.updated = 1129537520\n f.tags = [35]\n end\n ]\n end\n ]\n end\n \n tree = \n Rubox::Parser.new(@responses['account_tree_response']).get_account_tree\n\n assert_equal expected.name, tree.name\n assert_equal expected.folder_id, tree.folder_id\n assert_equal expected.shared, tree.shared\n\n compare_folder expected.folders[0], tree.folders[0]\n end",
"def is_same_tree(p, q)\n return true if p.nil? && q.nil?\n return false if p.nil? || q.nil? || p.val != q.val\n return is_same_tree(p.left, q.left) && is_same_tree(p.right, q.right)\nend",
"def weaker_or_equal\n Array(self) + descendants\n end",
"def check_duplicates(result, duplicates)\n duplicates.map do |duplicate|\n conflict = duplicate.position_held == result.parent_position_held\n ['Possible clash with parent position held', duplicate] if conflict\n end\n end",
"def compare(node, node2)\n\n hxlist, hxlist2 = hashedxml(node), hashedxml(node2) \n \n # elements which may have been modified are also \n # added to the added_indexes list \n added_or_changed_indexes = added(hxlist, hxlist2)\n added_indexes, updated_indexes = @fuzzy_match ? \\\n fuzzy_match(added_or_changed_indexes, node, node2) : \\\n [added_or_changed_indexes, []]\n added_indexes.each do |i|\n \n attributes = node2.elements[i+1].attributes\n attributes[:created] ||= Time.now.to_s\n \n node2.elements[i+1].traverse do |e|\n\n e.attributes[:created] ||= Time.now.to_s\n\n end\n end\n\n deleted_indexes = deleted(hxlist, hxlist2)\n \n unchanged_indexes = unchanged(hxlist, hxlist2)\n\n unchanged_indexes.each do |i, i2| \n\n compare(node.elements[i+1], node2.elements[i2+1]) if node\\\n .elements[i+1].has_elements?\n attributes2 = node2.elements[i2+1].attributes\n \n if attributes2[:created].nil? then\n attributes = node.elements[i+1].attributes\n attributes2[:created] = attributes[:created] if attributes[:created]\n end\n end\n\n end",
"def recurse_and_hash_tree(node)\n\n ## exit program if given a bunk file/dir\n print_and_exit \"given a bunk file/node\" unless File.exist? node\n\n ## if we have a file then return it's hash\n return Digest::MD5.hexdigest( node + File.read(node) ) if File.file? node\n\n ## we should have a directory now. exit otherwise...\n print_and_exit \"is there a strange device in this dir?\" unless File.directory? node\n\n ## recurse through each element in the directory and remember their hashes\n children_hash = \"\"\n Dir.glob(File.join node, '*' ) { |element| children_hash << recurse_and_hash_tree(element) }\n \n ## return the mashed up hash\n return Digest::MD5.hexdigest( node + children_hash ) \n\n end",
"def test_sort_by_ancestry_missing_parent_middle_of_tree\n AncestryTestDatabase.with_model do |model|\n n1, _, _, n4, n5, _ = build_tree(model)\n\n records = model.sort_by_ancestry([n5, n4, n1])\n if CORRECT\n assert_equal [n1, n4, n5].map(&:id), records.map(&:id)\n else\n assert_equal [n1, n5, n4].map(&:id), records.map(&:id)\n end\n end\n end",
"def items_children(item, items)\n \tuser = item.user\n # if item.new_owner\n # return []\n # end\n \tuser_wants = user.wants.find_all {|want| items.include?(want.possession) and want.value > item.value and want.possession.new_owner == nil}\n \tuser_wants.sort! {|x,y| x.value <=> y.value}.reverse\n \tchildren = user_wants.map {|want| want.possession }\n end",
"def diff_subtree(tree1, tree2, path)\n ret = []\n\n # compatible classes\n if tree1.class == tree2.class\n # both subtrees are Hash\n if tree1.is_a? Hash\n keys = (tree1.keys + tree2.keys).uniq\n\n keys.each do |key|\n if tree1.key?(key) && tree2.key?(key)\n ret << diff_subtree(tree1[key],\n tree2[key],\n path + [key])\n\n elsif tree1.key?(key)\n # delete hash key\n ret << {\n 'path' => path,\n 'key' => key,\n 'old' => tree1[key],\n 'state' => 'rm',\n 'extra' => {}\n }\n else\n # insert new hash key\n ret << {\n 'path' => path,\n 'key' => key,\n 'value' => tree2[key],\n 'state' => 'ins',\n 'extra' => {}\n }\n end\n end\n\n # both subtrees are Array\n elsif tree1.is_a? Array\n if @strict\n idx = 0\n idx1 = 0\n idx2 = 0\n\n while (idx1 < tree1.length) || (idx2 < tree2.length)\n val1 = tree1[idx1]\n val2 = tree2[idx2]\n\n # We need to be sure we are comparing values\n # still inside the arrays and not valid nil\n # value with item outside the array range.\n if (idx1 < tree1.length) && (idx2 < tree2.length)\n if OneCfg::Config::Utils.deep_compare(val1,\n val2,\n @strict)\n idx += 1\n idx1 += 1\n idx2 += 1\n else\n # Inserting values:\n # 1 = A, B, C, D, E, F\n # 2 = A, B, X, C, Y, D, E, F\n # INSERT X, idx 2\n # INSERT X, idx 4\n # when on pos 2, forward lookup for 'C'\n # in tree2, find on pos 3, so add new\n # 'X' on pos 2, idx2++\n #\n # Deleting values:\n # 1 = A, B, C, D, E, F\n # 2 = A, B, E, F\n # DELETE C, idx 2\n # DELETE D, idx 2\n # when on pos 2, forward lookup for 'C'\n # in tree, don't find any, so delete\n # 'C' from pos 2, idx1++\n\n # forward lookup for val1\n fwd_found = false\n fwd_idx2 = idx2 + 1\n\n # rubocop:disable Layout/LineLength\n while (fwd_idx2 < tree2.length) && !fwd_found\n if OneCfg::Config::Utils.deep_compare(tree2[fwd_idx2], val1, @strict)\n fwd_found = true\n else\n fwd_idx2 += 1\n end\n end\n # rubocop:enable Layout/LineLength\n\n if fwd_found\n # insert array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'value' => val2,\n 'old' => val1,\n 'state' => 'ins',\n 'extra' => { 'index' => idx }\n }\n\n idx += 1\n idx2 += 1\n\n else\n # delete array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'old' => val1,\n 'state' => 'rm',\n 'extra' => { 'index' => idx }\n }\n\n idx1 += 1\n end\n end\n\n # Process remaining array items on tree1\n # by dropping them (not found on tree2)\n elsif idx1 < tree1.length\n # delete array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'old' => val1,\n 'state' => 'rm',\n 'extra' => { 'index' => idx }\n }\n\n idx1 += 1\n\n # Process remaining new array items on tree2\n # by creating them.\n else\n # insert array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'value' => val2,\n 'old' => val1,\n 'state' => 'ins',\n 'extra' => { 'index' => idx }\n }\n\n idx += 1\n idx2 += 1\n end\n end\n else\n values = (tree1 + tree2).uniq\n\n values.each do |val|\n di1 = OneCfg::Config::Utils.deep_include?(\n tree1, val, @strict\n )\n\n di2 = OneCfg::Config::Utils.deep_include?(\n tree2, val, @strict\n )\n\n if di1 && di2\n # skip\n nil\n\n elsif di1\n # delete array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'old' => val,\n 'state' => 'rm',\n 'extra' => {}\n }\n else\n # insert array item\n ret << {\n 'path' => path,\n 'key' => nil,\n 'value' => val,\n 'state' => 'ins',\n 'extra' => {}\n }\n end\n end\n end\n\n # both subtrees are Nil\n elsif tree1.is_a? NilClass\n # skip\n nil\n\n # both subtrees are of some other type\n else\n unless OneCfg::Config::Utils.deep_compare(tree1,\n tree2,\n @strict)\n # set new value\n ret << {\n 'path' => path[0..-2],\n 'key' => path[-1],\n 'value' => tree2,\n 'old' => tree1,\n 'state' => 'set',\n 'extra' => {}\n }\n end\n end\n\n # Tree1 and tree2 are not same classes. We can't compare\n # them so we take tree2 as new value to set as-is.\n else\n # set new value\n ret << {\n 'path' => path[0..-2],\n 'key' => path[-1],\n 'value' => tree2,\n 'old' => tree1,\n 'state' => 'set',\n 'extra' => {}\n }\n end\n\n ret\n end",
"def search keyword\n result = Set.new\n matched = Array.new\n @frame_tree_root_node.each{|node|\n if node.content =~ /#{keyword}/i\n matched << node.name\n end\n } \n @frame_tree_root_node.each{|node|\n if node.is_root?\n result << node.name\n elsif matched.include? node.name\n result << node.name #add id\n node.parentage.each{|item|\n result << item.name\n }\n end\n }\n @frame_tree_root_node.print_tree\n result\n end",
"def has_xor_parents?(a, b)\n a.parents != b.parents && !(a.parents & b.parents).empty?\n end",
"def check_integrity(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"stray node found in level: #{l} which is #{list.to_a(nil,nil,nil,l)}\" if !difference.empty? \n expect(difference).to match_array([])\n end\nend",
"def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end",
"def item_before_in_list(check, list)\n list.each do |item|\n list.each do |inner_item|\n if item == inner_item\n puts \"do something\"\n end\n end\n end\nend",
"def duplicates\n\t\tw = ''\n\t\tids = [id]\n\t\tchildren = self.class.unscoped.where(archetype: self)\n\t\ti = 0\n\t\twhile i < children.size\n\t\t\tchild = children[i]\n\t\t\tids << child.id\n\t\t\tchildren += self.class.unscoped.where(archetype: child)\n\t\t\ti+=1\n\t\tend\n\t\tids.map! { |x| \"archetype_id=#{x}\" }\n\t\tids = ids.join ' or '\n\t\tids = \" and (#{ids})\" if ids.present?\n\t\tw = \"archetype_type = '#{self.class.name}' #{ids}\"\n\t\tself.class.unscoped.where(w)\n\tend",
"def test_sort_by_ancestry_no_parents_same_level\n AncestryTestDatabase.with_model do |model|\n _, _, n3, n4, n5, _ = build_tree(model)\n\n records = [n5, n4, n3]\n # records = model.sort_by_ancestry(model.all.ordered_by_ancestry_and(:id => :desc).offset(3).take(3))\n assert_equal [n5, n4, n3].map(&:id), records.map(&:id)\n end\n end",
"def test_return_sorted_array_two_nodes\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal [\"ab\"], @tree.sort\n end",
"def processdup_all(c)\n prev_base = nil\n show = false\n c.each do |l|\n base = get_base(l[:file])\n if prev_base && base != prev_base\n show = true\n break\n end\n prev_base = base\n end\n if show\n c.each do |l|\n puts \"#{get_file(l[:file])} similarity #{l[:count]}\"\n end\n puts \"\"\n end\nend",
"def all_same?\n self.all? { |element| element == self[0] }\n end",
"def all_same?\n self.all? { |element| element == self[0] }\n end",
"def remove_duplicates(list)\n list.each do |unique_node|\n if unique_node.next\n unique_node.next.each do |possible_duplicate|\n if possible_duplicate.value == unique_node.value\n list.delete_node(possible_duplicate)\n end\n end\n end\n end\n\n return list\nend",
"def test_sort_by_ancestry_no_parents_siblings\n AncestryTestDatabase.with_model do |model|\n _, _, n3, n4, _, _ = build_tree(model)\n\n records = model.sort_by_ancestry(model.all.ordered_by_ancestry_and(:id => :desc).offset(3).take(2))\n assert_equal [n4, n3].map(&:id), records.map(&:id)\n end\n end",
"def find_dups2\n uniq.select{ |e| (self-[e]).size < self.size - 1 }\n end",
"def find_dups2\n uniq.select{ |e| (self-[e]).size < self.size - 1 }\n end",
"def verify\n 1.upto(@leaf_count - 1) do |node|\n next if @nodes[node] ==\n HashTree.node_hash(node, @nodes[HashTree.left_child(node)],\n @nodes[HashTree.right_child(node)])\n raise \"Tree integrity verification failed\" \n end\n self\n end",
"def nodesEquivalent?(n1, n2)\n depth do\n r = if n1.is_a?(Array) && n2.is_a?(Array) && n1.length == n2.length\n equiv = true\n n1.each_with_index do |v1, i|\n equiv &&= nodesEquivalent?(v1, n2[i]) if equiv\n end\n equiv\n elsif value?(n1) && value?(n2)\n n1 == n2\n elsif list?(n1)\n list?(n2) &&\n n1.fetch('@index', true) == n2.fetch('@index', true) &&\n nodesEquivalent?(n1['@list'], n2['@list'])\n elsif (node?(n1) || node_reference?(n2))\n (node?(n2) || node_reference?(n2)) && n1['@id'] == n2['@id']\n else\n false\n end\n\n debug(\"nodesEquivalent?(#{n1.inspect}, #{n2.inspect}): #{r.inspect}\")\n r\n end\n end",
"def find_trade(item, items)\n \troute = [item]\n \titems_children(item, items).each do |child|\n if child.new_owner\n next\n end\n \t\tresult = recurse_trade(child, route, items)\n #not confident with the next line\n if result and result.count > 0\n puts \"ACTUAL RESULT? FIND_TRADE RESULT COUNT = #{result.count}\"\n puts \"RESULT FIRST IS #{result.first.name}\"\n puts \"RESULT LAST IS #{result.last.name}\"\n return result\n end\n \t\t# return result if result\n \tend\n end",
"def common_ancestor(node1, node2)\n\nend",
"def findCicle(nodes, idInicio, passed)\n if(!passed.any?{|id| id == nodes.operationId})\n passed.push(nodes.operationId)\n nodes.entradas.each { \n |node|\n if(node.operationId != idInicio)\n return findCicle(node, idInicio, passed)\n else\n return true\n end \n }\n else \n return true\n end\n return false\nend",
"def jenkins_node_compare(current_node, new_node)\n new_node = jenkins_node_defaults(new_node)\n default = jenkins_node_defaults({})\n default.keys.each do |key|\n val = new_node[key] || default[key]\n if !val.nil? && current_node[key.to_s] != val\n Chef::Log::debug(\"#{new_node[:name]} node.#{key} changed (#{current_node[key.to_s]} != #{val})\")\n return true\n end\n end\n Chef::Log::debug(\"#{new_node[:name]} node unchanged\")\n false\nend",
"def test_list_nested_items\n h, r = @elfinder.run(:cmd => 'open', :init => 'true', :target => '', :tree => true)\n assert_equal 1, r[:tree][:dirs].count\n end",
"def equal_by_tree?(graph_obj1, graph_obj2)\n check_pre((graph_obj?(graph_obj1) and graph_obj?(graph_obj2)))\n if (not equal_by_dim?(graph_obj1, graph_obj2)) then false\n elsif graph_obj1.union1d? and graph_obj2.union1d? then equal_by_tree?(graph_obj1.left, graph_obj2.left) and \n equal_by_tree?(graph_obj1.right, graph_obj2.right)\n# elsif (range1d?(graph_obj1) and range1d?(graph_obj2)) or\n# (point1d?(graph_obj1) and point1d?(graph_obj2)) then (graph_obj1 == graph_obj2)\n elsif graph_obj1.union2d? and graph_obj2.union2d? then equal_by_tree?(graph_obj1.left, graph_obj2.left) and \n equal_by_tree?(graph_obj1.right, graph_obj2.right)\n elsif (graph_obj1.range2d? and graph_obj2.range2d?) or \n (graph_obj1.point2d? and graph_obj2.point2d?) or\n (range1d?(graph_obj1) and range1d?(graph_obj2)) or\n (point1d?(graph_obj1) and point1d?(graph_obj2)) then true\n \n# (graph_obj1.x_range == graph_obj2.x_range) and\n# (graph_obj1.y_range == graph_obj2.y_range)\n# elsif (graph_obj1.point2d? and graph_obj2.point2d?) then (graph_obj1.x == graph_obj2.x) and (graph_obj1.y == graph_obj2.y)\n else false\n end\nend",
"def test_tree_representation\n e =\n'ROOT (0.94)\n outlook => rainy (0.694)\n windy => TRUE (0.0)\n play => no (0.0)\n windy => FALSE (0.0)\n play => yes (0.0)\n outlook => overcast (0.694)\n play => yes (0.0)\n outlook => sunny (0.694)\n humidity => normal (0.0)\n play => yes (0.0)\n humidity => high (0.0)\n play => no (0.0)\n'\n assert_equal e, @tree.to_s\n end",
"def check_tree\n @trees = {}\n @blobs = {}\n \n data = @base.lib.ls_tree(@objectish)\n\n data['tree'].each do |key, tree| \n @trees[key] = Git::Object::Tree.new(@base, tree[:sha], tree[:mode]) \n end\n \n data['blob'].each do |key, blob| \n @blobs[key] = Git::Object::Blob.new(@base, blob[:sha], blob[:mode]) \n end\n\n {\n :trees => @trees,\n :blobs => @blobs\n }\n end",
"def child_check(level, child_data, local_nesting, expected, match_value)\n matched = child_data.select do |item|\n nest_match_attributes(item, local_nesting, expected, match_value)\n end\n level[:comparison].compare(matched.count)\nend",
"def same_ids?(item_ids)\n all_item_ids.sort == item_ids.sort\n end",
"def same(x, y)\n find(x) == find(y)\n end",
"def findChildren (parent, structure)\n #search for items in structure where item.manager = parent\n children = []\n \n #puts parent\n \n structure.each do |employee|\n \n #puts '> ' + employee.join(', ')\n \n if employee[2].eql? parent\n \n #puts 'got it!'\n \n children << employee\n end\n end\n \n return children\n\nend",
"def compare_to(other, skip=[])\n common = []\n unique = []\n #p [\"skip:\", skip.size]\n #p [\"first few:\", skip[0..10]]\n \n skip = Set.new(skip.map{|p| p.path})\n \n name_to_path.each do |name, path|\n size = path_to_size[path]\n\n opath_samesize = other.size_to_path[size]\n opath_samename = other.name_to_path[name] \n\n next if skip.include? opath_samename or skip.include? opath_samesize\n\n r = Result.new(root, path)\n\n if opath_samesize and opath_samename\n # same size, same name\n common << r\n\n elsif opath_samename\n # same name, different content\n osize = other.path_to_size[opath_samename]\n diff = (size - osize).abs\n r.message = \"#{diff} bytes #{size > osize ? \"<light_green>larger</light_green>\" : \"<light_red>smaller</light_red>\"}\"\n unique << r\n\n elsif opath_samesize\n # same size, different name\n if OPTIONS.verbose\n puts \"<yellow>* Size matches, comparing content:\\n <light_cyan>#{path}\\n <light_white>#{opath_samesize}\".colorize\n end\n\n if content_probably_matches?(path, opath_samesize)\n # same content (probably)\n oname = File.split(opath_samesize).last\n r.message = \"other name: #{oname}\"\n common << r\n else\n # different content\n unique << r\n end\n\n puts if OPTIONS.verbose\n \n else\n\n unique << r\n\n end\n end\n \n [common, unique]\n end",
"def checkNode()\n source_set = []\n neighbor_set = []\n $networks.each do |s, nb|\n source_set << s\n nb[\"neighbors\"].each do |s_, dist|\n neighbor_set << s_\n end\n end\n source_set.sort!\n source_set.uniq!\n neighbor_set.sort!\n neighbor_set.uniq!\n return source_set == neighbor_set\nend",
"def all_duplicates(a)\n a.uniq.select{|v| a.select{|b| b == v}.count > 1}\n end",
"def find_target(root, k)\n return nil if root == nil\n hash = Set.new([])\n queue = [root]\n \n while !queue.empty?\n node = queue.shift\n \n return true if hash.include?(node.val)\n \n hash.add(k-node.val)\n \n if node.left; queue.push(node.left) end\n if node.right; queue.push(node.right) end\n end\n \n return false\nend",
"def equal_by_tree?(g1, g2)\n check_pre((\n (graph_obj?(g1)) and\n (graph_obj?(g2))\n ))\n\n if not equal_by_dim?(g1, g2)\n return false\n end\n\n if comp_shape?(g1) and comp_shape?(g2)\n return (equal_by_tree?(g1.left, g2.left) and equal_by_tree?(g1.right, g2.right))\n elsif g1.range2d? and g2.range2d?\n return (equal_by_tree?(g1.x_range, g2.x_range) and equal_by_tree?(g1.y_range, g2.y_range))\n elsif g1.range1d? and g2.range1d?\n return (\n (g1.first == g2.first) and\n (g1.last == g2.last)\n )\n else\n return false\n end\nend",
"def findDups(objArray, dupsHashArray, emptyFileArray)\n objArray.each_with_index do |obj, idx1|\n if obj.is_empty?\n emptyFileArray.push(obj.fileName)\n next \n end\n objArray.each_with_index do |obj2, idx2|\n next if idx1 >= idx2 \n if obj.md5 === obj2.md5\n foundDupHash= {:filePath => obj.fileName, :duplicatePath => obj2.fileName}\n dupsHashArray.push(foundDupHash)\n end\n end\n end \n end",
"def tree_transactions\n Transaction.where(admpart_tag_id: self_and_descendants.map(&:id))\n end",
"def touch?( other )\n\t\tcommon_leaves = [ ]\n\t\tother.leaves.each do |leaf|\n\t\t\[email protected]?(leaf) and common_leaves << leaf\n\t\tend\n\t\tif common_leaves.size > 0\n\t\t\tcommon_leaves.first\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def commonChild(s1, s2)\nend",
"def match_string( tree, string )\n # puts \"Checking for `#{string}` in tree (#{tree}).\"\n\n if tree.empty?\n # puts \"Tree is empty, returning empty\"\n return [ ]\n\n elsif string.empty?\n # puts \"No search string, returning empty\"\n return [ ]\n\n else\n matches = [ ]\n\n tree.each do |key,val|\n # puts \"Checking for `#{string}` in `#{key}` branch.\"\n\n simdex = string.simdex(key)\n\n if 0 < simdex\n if string == key\n # puts \"Matched full word! #{string} is #{key}\"\n # matches = collect_keys(val, key).unshift(key)\n return collect_keys(val, key).unshift(key)\n # puts \"Got matches: #{matches}\"\n\n else\n leaf = string.leaf(simdex)\n # puts \"Got leaf #{leaf}\"\n\n check = match_string(val, leaf)\n # puts \"Got check: #{check}\"\n\n if !check.empty?\n # matches = (check.map { |m| key + m })\n return check.map { |m| key + m }\n # puts \"New matches: #{matches}\"\n end\n end\n\n # break\n\n else\n check = match_string(val, string)\n\n if !check.empty?\n matches += check\n end\n end\n end\n\n # if matches.empty?\n # # puts \"No matches (#{string})\"\n # else\n # # puts \"Returning matches (#{string}): #{matches}\"\n # end\n\n return matches\n end\n end",
"def siblings\n tree_search_class.where({\n :_id => { \"$ne\" => self._id },\n tree_parent_id_field => self[tree_parent_id_field]\n }).sort(self.class.tree_sort_order()).all\n end",
"def test_ticket1573\n $TOP_MODULE = \"TOP\"\n $VERBOSE = true\n printf \"\\n@T:#{__method__}\\n\"\n @root = XMLParse.read(\"./tp/1573.xml\")\n\n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_b3\",\"adr\",true) # Input signal\n# p connect_list\n# revised = get_path(connect_list)\n# p revised\n# assert_equal(golden,revised)\n\n golden = [\n [[\"sub_a\", \"a3\"], [\"sub_b3\", \"data\"]], \n [[\"sub_a\", \"a3\"], [\"sub_b3\", \"data\"], [\"sub_b3.sub_b_sub\", \"A0\"]]\n ]\n connect_list = XMLParse::search_Connection(true,@root,\"TOP\",\"sub_a\",[\"a3\",nil],true) # Input signal\n\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n golden = [\n [[\"sub_a\", \"a0\"], [\"sub_b3\", \"data\"]], \n [[\"sub_a\", \"a0\"], [\"sub_b3\", \"data\"], [\"sub_b3.sub_b_sub\", \"A3\"]]\n ]\n connect_list = XMLParse::search_Connection(true,@root,\"TOP\",\"sub_a\",[\"a0\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n golden = [\n [[\"sub_b3\", \"data\"], [\"sub_a\", \"a3\"]], \n [[\"sub_b3\", \"data\"], [\"sub_a\", \"a2\"]], \n [[\"sub_b3\", \"data\"], [\"sub_a\", \"a1\"]], \n [[\"sub_b3\", \"data\"], [\"sub_a\", \"a0\"]]\n ]\n\n connect_list = XMLParse::search_Connection(true,@root,\"TOP\",\"sub_b3\",[\"data\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a1\",true) # Input signal\n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a2\",true) # Input signal\n # connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a0\",true) # Input signal\n #\n end",
"def test_sort_by_ancestry_full_tree\n AncestryTestDatabase.with_model do |model|\n n1, n2, n3, n4, n5, n6 = build_tree(model)\n\n records = model.sort_by_ancestry(model.all.ordered_by_ancestry_and(:id => :desc))\n assert_equal [n1, n5, n6, n2, n4, n3].map(&:id), records.map(&:id)\n end\n end",
"def remove_duplicates_2(list)\n seen = {}\n to_delete = []\n\n list.each do |node|\n if seen[node.value]\n to_delete << node\n end\n seen[node.value] = true\n end\n\n to_delete.each do |node|\n list.delete_node(node)\n end\n\n return list\nend",
"def nests\n Nest.all.select do |nest|\n nest.tree == self\n end\n end",
"def common_ancestor(node1, node2)\n depth1 = find_depth(node1)\n depth2 = find_depth(node2)\n\n if(depth1 >= depth2)\n long_depth = depth1\n short_depth = depth2\n long_node = node1\n short_node = node2\n else\n long_depth = depth2\n short_depth = depth1\n long_node = node2\n short_node = node1\n end\n\n until(long_depth == short_depth)\n long_node = long_node.parent\n long_depth -= 1\n end\n\n return simul_parents(short_node, long_node)\n\nend",
"def prune_conservatively\n hashes_to_prune = {}\n\n # extract all subtree hashes from all nodes\n self.hashes.values.each do |nodes|\n nodes.first.all_structural_subhashes.each do |h|\n hashes_to_prune[h] = true\n end\n end\n\n # nuke subtrees so we show the biggest matching tree possible\n self.hashes.delete_if { |h,_| hashes_to_prune[h] }\n end",
"def find_dup(arr)\n arr.each do |item|\n item_count = arr.count(item)\n return item if item_count > 1\n end\nend",
"def grouped_duplicates(collection); end",
"def test_ticket1579\n\n $TOP_MODULE = \"TOP_1579\"\n $VERBOSE = true\n printf \"\\n@T:#{__method__}\\n\"\n @root = XMLParse.read(\"./tp/1579.xml\")\n \n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_b3\",\"adr\",true) # Input signal\n# p connect_list\n# revised = get_path(connect_list)\n# p revised\n# assert_equal(golden,revised)\n\n golden = [\n [[\"Asub_a\", \"a3\"], [\"Asub_b3\", \"data\"]], \n [[\"Asub_a\", \"a3\"], [\"Asub_b3\", \"data\"], [\"Asub_b3.Asub_b3\", \"A0\"]]\n ]\n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579\",\"Asub_a\",[\"a3\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n golden = [\n [[\"Asub_a\", \"a0\"], [\"Asub_b3\", \"data\"]], \n [[\"Asub_a\", \"a0\"], [\"Asub_b3\", \"data\"], [\"Asub_b3.Asub_b3\", \"A3\"]]\n ]\n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579\",\"Asub_a\",[\"a0\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n\n golden = [\n [[\"Asub_b3.Asub_b3\", \"A0\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A0\"], [\"Asub_b3\", \"data\"], [\"Asub_a\", \"a3\"]]\n ]\n \n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579.ASubB\",\"Asub_b3.Asub_b3\",[\"A0\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n golden = [\n [[\"Asub_b3.Asub_b3\", \"A1\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A1\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A1\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A1\"], [\"Asub_b3\", \"data\"], [\"Asub_a\", \"a1\"]] \n ]\n \n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579.ASubB\",\"Asub_b3.Asub_b3\",[\"A1\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n golden = [\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"]],\n [[\"Asub_b3.Asub_b3\", \"A3\"], [\"Asub_b3\", \"data\"], [\"Asub_a\", \"a0\"]]\n ]\n \n connect_list = XMLParse::search_Connection(true,@root,\"TOP_1579.ASubB\",\"Asub_b3.Asub_b3\",[\"A3\",nil],true) # Input signal\n revised = get_path(connect_list)\n assert_equal(golden,revised)\n\n\n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a1\",true) # Input signal\n# connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a2\",true) # Input signal\n # connect_list = XMLParse::search_Connection(@root,\"TOP\",\"sub_a\",\"a0\",true) # Input signal\n #\n end",
"def test_sort_by_ancestry_with_block_no_parents_all_children\n AncestryTestDatabase.with_model :extra_columns => {:rank => :integer} do |model|\n _, _, n3, n4, n5, n6 = build_ranked_tree(model)\n\n records = model.sort_by_ancestry(model.all.ordered_by_ancestry_and(:rank).offset(2), &RANK_SORT)\n if CORRECT || records[0] == n5\n assert_equal [n5, n3, n4, n6].map(&:id), records.map(&:id)\n else\n assert_equal [n4, n6, n5, n3].map(&:id), records.map(&:id)\n end\n end\n end",
"def is_subtree(root)\n\nend",
"def cutTree(array)\n if array.sort == array\n return array.length\n end\n array_copied = array.dup\n i = 0\n count = 0\n while i <= array.length\n array = array_copied.dup\n array.delete_at(i)\n if (array == array.sort)\n count += 1\n end\n i += 1\n end\n return count\nend",
"def dfs_rec(tree, value)\n return nil if tree.nil?\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\n p tree.value\n return tree if tree.value == value\n\nend",
"def minimum_tree_for_leafs(ids)\n # 1. Find all ids in leafs id_path\n # 2. Fetch those ids by tree depth order.\n id_in = ids.join(',')\n leafs = self.find(:all, :conditions => \"id in (#{id_in})\")\n id_paths = leafs.collect{ |l| l.id_path }\n id_in_paths = id_paths.join(',')\n self.find(:all, :conditions => \"id in (#{id_in_paths})\", :order => \"id_path asc\")\n end",
"def is_valid_tree(tree)\n\nend",
"def each_ancestor # :nodoc:\n end",
"def prune_liberally\n update_masses\n\n hashes_to_prune = Hash.new { |h,k| h[k] = [] }\n\n # record each subtree by subhash, but skip if subtree mass > parent mass\n self.hashes.values.each do |nodes|\n nodes.each do |node|\n tophash = node.structural_hash\n topscore = self.masses[tophash]\n\n node.deep_each do |subnode|\n subhash = subnode.structural_hash\n subscore = self.masses[subhash]\n\n next if subscore and subscore > topscore\n\n hashes_to_prune[subhash] << subnode\n end\n end\n end\n\n # nuke only individual items by object identity\n self.hashes.each do |h,v|\n v.delete_eql hashes_to_prune[h]\n end\n\n # nuke buckets we happened to fully empty\n self.hashes.delete_if { |k,v| v.size <= 1 }\n end",
"def connected(index1, index2)\n root(index1) == root(index2)\n end",
"def unique_items(ary)\r\n ary.select {|x| ary.count(x) == 1}\r\nend",
"def dup_tree\n return @tree.dup\n end",
"def all_items(item)\r\n result = false\r\n\r\n if(self.items.size > 0)\r\n self.items.each {|val|\r\n if (val.get_name == item.get_name )\r\n return true\r\n else\r\n result = false\r\n end\r\n }\r\n else\r\n result = false\r\n end\r\n\r\n return result\r\n end",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def prune_from_tree\n return if self.right.nil? || self.left.nil?\n diff = self.right - self.left + 1\n\n #TODO: implemente :dependent option\n # delete_method = acts_as_nested_set_options[:dependent] == :destroy ?\n # :destroy_all : :delete_all\n\n #TODO: implement prune method\n # self.class.base_class.transaction do\n # nested_set_scope.send(delete_method,\n # [\"#{quoted_left_column_name} > ? AND #{quoted_right_column_name} < ?\",\n # left, right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_left_column_name} = (#{quoted_left_column_name} - ?)\", diff],\n # [\"#{quoted_left_column_name} >= ?\", right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)\", diff],\n # [\"#{quoted_right_column_name} >= ?\", right]\n # )\n # end\n end",
"def find_dup(array)\n checked_array = []\n array.each do |el|\n if checked_array.include?(el)\n return el\n else\n checked_array << el\n end\n end\nend",
"def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end",
"def diff(root, compared, structure = [])\n root.each_key do |key|\n next_root = root[key]\n next_compared = compared.nil? ? nil : compared[key]\n new_structure = structure.dup << key\n puts \"#{new_structure.join(\".\")}\" if compared.nil? || compared[key].nil?\n diff(next_root, next_compared, new_structure) if next_root.kind_of? Hash\n end\nend",
"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 dfs_rec(tree, value)\n return nil if tree.nil?\n\n p tree.value\n return tree if tree.value == value\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\nend",
"def node_match?(other_node, self_node)\n keys_with_expected_diffs = ['facts_timestamp', 'catalog_timestamp']\n same_num_elements?(other_node, self_node) && same_contents?(other_node, self_node, keys_with_expected_diffs)\n end",
"def dfs_rec(data)\n @root.each { |node| return node if data == node.data }\n end",
"def deep_equals?(arr1, arr2)\n return false if arr1.length != arr2.length\n\n arr1.each_with_index do |x, i|\n return false if x.instance_of?(Array) && !deep_equals?(x, arr2[i])\n return false if x != arr2[i]\n end\n\n true\nend"
] | [
"0.66177845",
"0.61900204",
"0.6100806",
"0.60627586",
"0.6042924",
"0.60416543",
"0.60361564",
"0.5958678",
"0.59428614",
"0.58916795",
"0.57454145",
"0.5659736",
"0.5654334",
"0.5620236",
"0.56017274",
"0.5601023",
"0.5600481",
"0.55781376",
"0.5577995",
"0.5545188",
"0.554178",
"0.55264336",
"0.55035967",
"0.5500482",
"0.54913336",
"0.54829973",
"0.5471817",
"0.54670423",
"0.5457159",
"0.54502136",
"0.54376215",
"0.54293996",
"0.5429221",
"0.5409703",
"0.53743976",
"0.5370651",
"0.5368194",
"0.536732",
"0.53662324",
"0.5354723",
"0.5354723",
"0.5347065",
"0.5336307",
"0.533475",
"0.533475",
"0.53282756",
"0.5320825",
"0.5319237",
"0.5317492",
"0.53142244",
"0.5307072",
"0.5306961",
"0.53007424",
"0.52968335",
"0.5294668",
"0.5293198",
"0.527404",
"0.5271757",
"0.52660406",
"0.5263461",
"0.5255204",
"0.52406085",
"0.5211378",
"0.5201757",
"0.51949924",
"0.519404",
"0.51926464",
"0.51910657",
"0.51881325",
"0.51878566",
"0.51867044",
"0.5175604",
"0.5172371",
"0.5161758",
"0.5143207",
"0.51420957",
"0.5138728",
"0.51330286",
"0.5129926",
"0.5126853",
"0.5126332",
"0.5122122",
"0.5117138",
"0.5083164",
"0.5079995",
"0.5079165",
"0.50759196",
"0.5074079",
"0.5073528",
"0.50698644",
"0.50588",
"0.5056458",
"0.50546116",
"0.505271",
"0.50496036",
"0.5048051",
"0.5047279",
"0.504162",
"0.5037872",
"0.5036073",
"0.50283843"
] | 0.0 | -1 |
GET /u/dashboard/1 GET /u/dashboard/1.json | def dashboard
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dashboards = current_user.dashboards\n if !params[:detail]\n render json: @dashboards, each_serializer: DashboardSummarySerializer \n else\n render json: @dashboards\n end\n end",
"def dashboard\n __log_activity\n __debug_route\n opt = url_parameters\n fast = opt.key?(:fast) ? true?(opt[:fast]) : Rails.env.test?\n @item, @preferences, @history = get_account_details(fast: fast)\n response.status =\n case flash.now[:alert]\n when '', nil then 200 # OK\n when /already signed in/ then 403 # Forbidden\n else 401 # Unauthorized\n end\n respond_to do |format|\n format.html\n format.json { render_json show_values }\n format.xml { render_xml show_values(nil, as: :array) }\n end\n end",
"def dashboard\n service_response = AdminManagement::AdminUser::Dashboard.new(params).perform\n render_api_response(service_response)\n end",
"def get_dashboards\n @dash_service.get_dashboards\n end",
"def dashboard\n\n end",
"def dashboard\n\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dashboard }\n end\n end",
"def show\n @dashboard = Account.find(session[:account_id]).dashboards.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dashboard }\n end\n end",
"def get_dashboard(dashboard_options, grafana_options)\n session_id = login(grafana_options[:host], grafana_options[:port], grafana_options[:user], grafana_options[:password])\n http = Net::HTTP.new(grafana_options[:host], grafana_options[:port])\n request = Net::HTTP::Get.new(\"/api/dashboards/db/#{dashboard_options[:name]}\")\n request.add_field('Cookie', \"grafana_user=#{grafana_options[:user]}; grafana_sess=#{session_id};\")\n request.add_field('Accept', 'application/json')\n\n response = with_limited_retry tries: 10, exceptions: Errno::ECONNREFUSED do\n http.request(request)\n end\n\n handle_response(\n request,\n response,\n success: 'The dashboard has been successfully retrieved.',\n not_found: 'The dashboard does not exist.',\n unknown_code: 'DashboardApi::get_dashboard unchecked response code: %{code}'\n )\n\n JSON.parse(response.body)\n rescue BackendError\n nil\n end",
"def get_dashboard(dash_id)\n @dash_service.get_dashboard(dash_id)\n end",
"def home_dashboard\n\n endpoint = '/api/dashboards/home'\n\n @logger.debug(\"Attempting to get home dashboard (GET #{endpoint})\") if @debug\n\n get(endpoint)\n end",
"def dashboard\n self.root\n self.follow('dtime:dashboard')\n self.get\n self\n end",
"def get_dashboards\n begin\n @msg = { status: STATUS_SUCCESS, doctor_lists: Doctor.get_lists, patient_lists: Patient.get_lists, appointments: Appointment.get_lists, message: SUCCESS_MESSAGE, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n rescue Exception => e\n @msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG, token: request.headers[:Authorization].split(\"Token token=\").last, user: current_user.email }\n end\n render json: @msg\n end",
"def show\n content = User.all\n render response: { dashboard: content }\n end",
"def dashboard\r\n end",
"def index\n statuses_dashboard\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n @patients = patient_dashboard\n } \n end \n end",
"def set_dashboard\n @dashboard = current_user.dashboards.find(params[:id])\n end",
"def set_dashboard\n @dashboard = Dashboard.find(params[:id])\n end",
"def set_dashboard\n @dashboard = Dashboard.find(params[:id])\n end",
"def set_dashboard\n @dashboard = Dashboard.find(params[:id])\n end",
"def set_dashboard\n @dashboard = Dashboard.find(params[:id])\n end",
"def set_dashboard\n @dashboard = Dashboard.find(params[:id])\n end",
"def set_dashboard\n @dashboard = Dashboard.find(params[:id])\n end",
"def set_dashboard\n @dashboard = Dashboard.find(params[:id])\n end",
"def dashboard; end",
"def dashboard\n\tend",
"def index\n dashboard = fetch_email_dashboard\n respond_with dashboard, represent_with: DashboardRepresenter\n end",
"def get_dashboard\n # Setp 3: Try to access to the dashboard\n dashboard_req = setup_http_request($dashboard, @cookie)\n res = @http.request(dashboard_req)\n if res.code=='400' or res['location'] == \"https://www.blablacar.fr/identification\"\n raise AuthenticationError, \"Can't get logged in\"\n end\n res.body.force_encoding('utf-8')\n end",
"def index\n @admin_dashboards = Admin::Dashboard.all\n end",
"def set_dashboard\n @dashboard = Dashboard.find(params[:id])\n end",
"def show\n @dashboard = Dashboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dashboard }\n end\n end",
"def dashboard\n @clients = current_user.clients\n end",
"def set_dashboard\n# @dashboard = Dashboard.find(params[:id])\n end",
"def show\n dashboard_4\n end",
"def show\n dashboard_4\n end",
"def org_dashboard\n respond_to do |format|\n format.html { @organization = Organization.first }\n format.json { render json: Organization.first }\n end\n end",
"def dashboard\n 'dashboard'\n end",
"def dashboard\n @title = 'Admin'\n render 'admin/dashboard', :layout => 'layouts/main', :cachable => true\n end",
"def dashboard_1\n end",
"def show\n render \"dashboards/detail\"\n end",
"def begin_loading_dashboard(url)\n ::Gitlab::Metrics::Dashboard::Finder.find(\n project,\n embedded: true,\n grafana_url: url\n )\n end",
"def get_dashboard_with_http_info(dashboard_id, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DashboardsAPI.get_dashboard ...'\n end\n # verify the required parameter 'dashboard_id' is set\n if @api_client.config.client_side_validation && dashboard_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dashboard_id' when calling DashboardsAPI.get_dashboard\"\n end\n # resource path\n local_var_path = '/api/v1/dashboard/{dashboard_id}'.sub('{dashboard_id}', CGI.escape(dashboard_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Dashboard'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_dashboard,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DashboardsAPI#get_dashboard\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def dashboard_by_uid( uid )\n\n if( uid.is_a?(String) && uid.is_a?(Integer) )\n raise ArgumentError.new(format('wrong type. dashboard \\'uid\\' must be an String (for an title name) or an Integer (for an Datasource Id), given \\'%s\\'', uid.class.to_s))\n end\n raise ArgumentError.new('missing \\'uid\\'') if( uid.size.zero? )\n\n v, mv = version.values\n return { 'status' => 404, 'message' => format( 'uid has been supported in Grafana since version 5. you use version %s', v) } if(mv < 5)\n\n return { 'status' => 404, 'message' => format( 'The uid can have a maximum length of 40 characters, but it is %s characters long', uid.length) } if( uid.length > 40 )\n\n endpoint = format( '/api/dashboards/uid/%s', uid )\n @logger.debug( \"Attempting to get dashboard (GET #{endpoint})\" ) if @debug\n\n get( endpoint )\n end",
"def load_dashboard_from_api\n logger.info 'Loading dashboard...'\n max_elements = 5\n username = current_user.keytech_username\n ms_from_epoch = 7.day.ago.to_i * 1000\n from_date = \"/Date(#{ms_from_epoch})/\"\n options = { fields: \"created_by=#{username}:changed_at>#{from_date}\", size: max_elements, sortBy: 'changed_at,desc' }\n\n self_created = keytechAPI.search.query(options)\n\n options = { fields: \"created_by=#{username}:changed_at>#{from_date}\",\n size: max_elements,\n sortBy: 'changed_at,desc' }\n self_changed = keytechAPI.search.query(options)\n logger.debug \"Changed items: #{self_changed}\"\n logger.debug \"Created Items: #{self_created}\"\n element_list = (self_created.elementList + self_changed.elementList)\n logger.info 'Finished loading dashboard'\n element_list.sort_by!(&:changedAt)\n element_list.reverse\n end",
"def dashboard\n\n\tparams[:id] = session[:id] if params[:id].nil?\n\t@user = User.find_by_authentication_id(params[:id])\n\n\tif not @user.nil?\n\t\t@username = @user.name\n\t\t@company = @user.company\n\telse\n\t\t@username = \"Demo\"\n\t\t@company = \"Clicktree\"\n\tend\n\n\tdomain = params[:api_domain]\n\tif domain == \"picturegram\"\n\t\t@api_domain = \"Picturegram\"\n\n\t\t@api_title1 = \"Front Page\"\n\t\t@api_maindesc1 = \"This API call returns pictures which are currently on the front page.\"\n\t\t@raw_request1 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=frontpage'\n\t\traw_response = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 40}, \"objects\": [{\"index\": 0, \"thumbnail_href\": \"/picture/695989882920892158_50599348/\"}, {\"index\": 1, \"thumbnail_href\": \"/picture/695964974116033434_179149915/\"}, {\"index\": 2, \"thumbnail_href\": \"/picture/695977429678748736_403498132/\"}, {\"index\": 3, \"thumbnail_href\": \"/picture/695993756213785472_7930203/\"}, {\"index\": 4, \"thumbnail_href\": \"/picture/695983326619607782_31624199/\"}, {\"index\": 5, \"thumbnail_href\": \"/picture/696006278083124060_23776413/\"}, {\"index\": 6, \"thumbnail_href\": \"/picture/695998807090494678_18483678/\"}, {\"index\": 7, \"thumbnail_href\": \"/picture/695998437887702553_185175380/\"}, {\"index\": 8, \"thumbnail_href\": \"/picture/696006091523367043_207789231/\"}, {\"index\": 9, \"thumbnail_href\": \"/picture/696027666809693694_29810584/\"}, {\"index\": 10, \"thumbnail_href\": \"/picture/695970965669018824_47543070/\"}, {\"index\": 11, \"thumbnail_href\": \"/picture/696007751922471837_13514211/\"}, {\"index\": 12, \"thumbnail_href\": \"/picture/696012216974527626_453366618/\"}, {\"index\": 13, \"thumbnail_href\": \"/picture/695998741751055102_1241458119/\"}, {\"index\": 14, \"thumbnail_href\": \"/picture/696025760104333970_25435655/\"}, {\"index\": 15, \"thumbnail_href\": \"/picture/696006627359974363_144646783/\"}, {\"index\": 16, \"thumbnail_href\": \"/picture/696032044517635611_689484300/\"}, {\"index\": 17, \"thumbnail_href\": \"/picture/695981822177767557_185480571/\"}, {\"index\": 18, \"thumbnail_href\": \"/picture/696013274787432577_32527641/\"}, {\"index\": 19, \"thumbnail_href\": \"/picture/696031340508489644_19870776/\"}, {\"index\": 20, \"thumbnail_href\": \"/picture/695989882920892158_50599348/\"}, {\"index\": 21, \"thumbnail_href\": \"/picture/695964974116033434_179149915/\"}, {\"index\": 22, \"thumbnail_href\": \"/picture/695977429678748736_403498132/\"}, {\"index\": 23, \"thumbnail_href\": \"/picture/695993756213785472_7930203/\"}, {\"index\": 24, \"thumbnail_href\": \"/picture/695983326619607782_31624199/\"}, {\"index\": 25, \"thumbnail_href\": \"/picture/696006278083124060_23776413/\"}, {\"index\": 26, \"thumbnail_href\": \"/picture/695998807090494678_18483678/\"}, {\"index\": 27, \"thumbnail_href\": \"/picture/695998437887702553_185175380/\"}, {\"index\": 28, \"thumbnail_href\": \"/picture/696006091523367043_207789231/\"}, {\"index\": 29, \"thumbnail_href\": \"/picture/696027666809693694_29810584/\"}, {\"index\": 30, \"thumbnail_href\": \"/picture/695970965669018824_47543070/\"}, {\"index\": 31, \"thumbnail_href\": \"/picture/696007751922471837_13514211/\"}, {\"index\": 32, \"thumbnail_href\": \"/picture/696012216974527626_453366618/\"}, {\"index\": 33, \"thumbnail_href\": \"/picture/695998741751055102_1241458119/\"}, {\"index\": 34, \"thumbnail_href\": \"/picture/696025760104333970_25435655/\"}, {\"index\": 35, \"thumbnail_href\": \"/picture/696006627359974363_144646783/\"}, {\"index\": 36, \"thumbnail_href\": \"/picture/696032044517635611_689484300/\"}, {\"index\": 37, \"thumbnail_href\": \"/picture/695981822177767557_185480571/\"}, {\"index\": 38, \"thumbnail_href\": \"/picture/696013274787432577_32527641/\"}, {\"index\": 39, \"thumbnail_href\": \"/picture/696031340508489644_19870776/\"}]}'\n\t\t@response1 = JSON.pretty_generate(JSON.parse(raw_response))\n\t\t@desc1 = {:thumbnail_href => \"Path of where the picture can be found on the website.\"}\n\n\t\t@api_title2 = \"Specific Picture\"\n\t\t@api_maindesc2 = \"This API call returns information on a specific picture given it's path.\"\n\t\t@raw_request2 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=picture\\&path=695948427283543832_2003724'\n\t\traw_response2 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 1}, \"objects\": [{\"authorlink\": \"! purposeofenvy Cincinnati @purposeofenvy\", \"comments\": \"182 Comments\", \"fillWidth_src\": \"http://distilleryimage8.s3.amazonaws.com/80252edcc12111e3b5450002c9c70a44_8.jpg\", \"index\": 0, \"likes\": \"15889 Likes\"}]}'\n\t\t@response2 = JSON.pretty_generate(JSON.parse(raw_response2))\n\t\t@desc2 = {:authorlink => \"Username of author who posted the picture\", :comments => \"The amount of comments the picture has.\", :likes => \"The amount of likes the picture has.\", :fillWidth_src => \"The source of the picture so that it can be saved.\"}\n\n\t\t@api_title3 = \"Search\"\n\t\t@api_maindesc = \"This API call returns pictures found given a search query.\"\n\t\t@raw_request3 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=search\\&path=music'\n\t\traw_response3 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 40}, \"objects\": [{\"index\": 0, \"thumbnail_href\": \"/picture/696039834523582284_24664910/\"}, {\"index\": 1, \"thumbnail_href\": \"/picture/696044604202176597_32594883/\"}, {\"index\": 2, \"thumbnail_href\": \"/picture/695311969467005218_275992589/\"}, {\"index\": 3, \"thumbnail_href\": \"/picture/696044602432292041_263869992/\"}, {\"index\": 4, \"thumbnail_href\": \"/picture/696042971617792563_31873043/\"}, {\"index\": 5, \"thumbnail_href\": \"/picture/696044598142306442_51436665/\"}, {\"index\": 6, \"thumbnail_href\": \"/picture/696044579924036665_1252853410/\"}, {\"index\": 7, \"thumbnail_href\": \"/picture/696044578256254023_194634924/\"}, {\"index\": 8, \"thumbnail_href\": \"/picture/696043190694411997_496307782/\"}, {\"index\": 9, \"thumbnail_href\": \"/picture/696043271276887500_11189254/\"}, {\"index\": 10, \"thumbnail_href\": \"/picture/696044548733307591_1158451569/\"}, {\"index\": 11, \"thumbnail_href\": \"/picture/692508637012214856_1244085048/\"}, {\"index\": 12, \"thumbnail_href\": \"/picture/695795110524596419_4234459/\"}, {\"index\": 13, \"thumbnail_href\": \"/picture/696044531680575712_401377847/\"}, {\"index\": 14, \"thumbnail_href\": \"/picture/632837011111993341_494750822/\"}, {\"index\": 15, \"thumbnail_href\": \"/picture/696044526599055726_182169777/\"}, {\"index\": 16, \"thumbnail_href\": \"/picture/695778840590180750_314866815/\"}, {\"index\": 17, \"thumbnail_href\": \"/picture/696041125723018299_22234644/\"}, {\"index\": 18, \"thumbnail_href\": \"/picture/694920807350365715_274652394/\"}, {\"index\": 19, \"thumbnail_href\": \"/picture/696041749101425989_30735524/\"}, {\"index\": 20, \"thumbnail_href\": \"/picture/696039834523582284_24664910/\"}, {\"index\": 21, \"thumbnail_href\": \"/picture/696044604202176597_32594883/\"}, {\"index\": 22, \"thumbnail_href\": \"/picture/695311969467005218_275992589/\"}, {\"index\": 23, \"thumbnail_href\": \"/picture/696044602432292041_263869992/\"}, {\"index\": 24, \"thumbnail_href\": \"/picture/696042971617792563_31873043/\"}, {\"index\": 25, \"thumbnail_href\": \"/picture/696044598142306442_51436665/\"}, {\"index\": 26, \"thumbnail_href\": \"/picture/696044579924036665_1252853410/\"}, {\"index\": 27, \"thumbnail_href\": \"/picture/696044578256254023_194634924/\"}, {\"index\": 28, \"thumbnail_href\": \"/picture/696043190694411997_496307782/\"}, {\"index\": 29, \"thumbnail_href\": \"/picture/696043271276887500_11189254/\"}, {\"index\": 30, \"thumbnail_href\": \"/picture/696044548733307591_1158451569/\"}, {\"index\": 31, \"thumbnail_href\": \"/picture/692508637012214856_1244085048/\"}, {\"index\": 32, \"thumbnail_href\": \"/picture/695795110524596419_4234459/\"}, {\"index\": 33, \"thumbnail_href\": \"/picture/696044531680575712_401377847/\"}, {\"index\": 34, \"thumbnail_href\": \"/picture/632837011111993341_494750822/\"}, {\"index\": 35, \"thumbnail_href\": \"/picture/696044526599055726_182169777/\"}, {\"index\": 36, \"thumbnail_href\": \"/picture/695778840590180750_314866815/\"}, {\"index\": 37, \"thumbnail_href\": \"/picture/696041125723018299_22234644/\"}, {\"index\": 38, \"thumbnail_href\": \"/picture/694920807350365715_274652394/\"}, {\"index\": 39, \"thumbnail_href\": \"/picture/696041749101425989_30735524/\"}]}'\n\t\t@response3 = JSON.pretty_generate(JSON.parse(raw_response3))\n\t\t@desc3 = {:thumbnail_href => \"Path of where the picture can be found on the website.\"}\n\t\n\n\telse\n\t\t@api_domain = \"Listnerd\"\n\n\t\t@api_title1 = \"Front Page\"\n\t\t@api_maindesc1 = \"This API call returns lists which are currently on the front page.\"\n\t\t@raw_request1 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=frontpage'\n\t\traw_response = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 20}, \"objects\": [{\"index\": 0, \"meta\": \"2.601 views\\n 26 votes\", \"name\": \"Best Office Chairs\", \"resource_uri\": \"\"}, {\"index\": 1, \"meta\": \"4.898 views\\n 2.208 votes\", \"name\": \"Top 10 Video Game Developers\", \"resource_uri\": \"\"}, {\"index\": 2, \"meta\": \"1.825 views\\n 54 votes\", \"name\": \"Best Horror Shows for Kids\", \"resource_uri\": \"\"}, {\"index\": 3, \"meta\": \"2.333 views\\n 122 votes\", \"name\": \"Best Pink Floyd Album\", \"resource_uri\": \"\"}, {\"index\": 4, \"meta\": \"65.276 views\\n 1.316 votes\", \"name\": \"Top Video Games\", \"resource_uri\": \"\"}, {\"index\": 5, \"meta\": \"5.451 views\\n 1.457 votes\", \"name\": \"TOP 100 TV Series\", \"resource_uri\": \"\"}, {\"index\": 6, \"meta\": \"6.373 views\\n 182 votes\", \"name\": \"Top 10 3D Printers for consumers\", \"resource_uri\": \"\"}, {\"index\": 7, \"meta\": \"2.063 views\\n 22 votes\", \"name\": \"Watch: Funniest Japanese TV Pranks\", \"resource_uri\": \"\"}, {\"index\": 8, \"meta\": \"6.979 views\\n 1.063 votes\", \"name\": \"Greatest Presidents of the USA\", \"resource_uri\": \"\"}, {\"index\": 9, \"meta\": \"9.529 views\\n 134 votes\", \"name\": \"TOP 100 Clothing Brands\", \"resource_uri\": \"\"}, {\"index\": 10, \"meta\": \"14.767 views\\n 93 votes\", \"name\": \"Books You Have To Read Before You Die\", \"resource_uri\": \"\"}, {\"index\": 11, \"meta\": \"10.231 views\\n 414 votes\", \"name\": \"Awesome fantasy fiction books and series\", \"resource_uri\": \"\"}, {\"index\": 12, \"meta\": \"3.734 views\\n 280 votes\", \"name\": \"Actors Who Should Have Won Oscars But Have Not\", \"resource_uri\": \"\"}, {\"index\": 13, \"meta\": \"16.430 views\\n 142 votes\", \"name\": \"Best Beatles Album\", \"resource_uri\": \"\"}, {\"index\": 14, \"meta\": \"3.627 views\\n 155 votes\", \"name\": \"Best Character in Arrested Development TV-series\", \"resource_uri\": \"\"}, {\"index\": 15, \"meta\": \"3.333 views\\n 77 votes\", \"name\": \"Best Series on Netflix\", \"resource_uri\": \"\"}, {\"index\": 16, \"meta\": \"4.653 views\\n 68 votes\", \"name\": \"Best 90s Toy\", \"resource_uri\": \"\"}, {\"index\": 17, \"meta\": \"11.571 views\\n 767 votes\", \"name\": \"Top 100 Animated Movies\", \"resource_uri\": \"\"}, {\"index\": 18, \"meta\": \"10.922 views\\n 73 votes\", \"name\": \"Best Internet Video Series of All Time\", \"resource_uri\": \"\"}, {\"index\": 19, \"meta\": \"43.949 views\\n 7.461 votes\", \"name\": \"Best Birds of Angry Birds\", \"resource_uri\": \"\"}]}'\n\t\t@response1 = JSON.pretty_generate(JSON.parse(raw_response))\n\t\t@desc1 = {:name => \"The name of the list.\", :meta => \"Displays the number of votes and views for the list.\"}\n\n\t\t@api_title2 = \"Specific List\"\n\t\t@api_maindesc2 = \"This API call returns information on a specific list given it's path.\"\n\t\t@raw_request2 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=list\\&path=top-10-songs-by-savant'\n\t\traw_response2 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 88}, \"objects\": [{\"index\": 0, \"position\": \"1\", \"title\": \"Bananonymous\", \"vote\": \"Rate\\n\\n\\n7.92\\n\\n\\n\\n\\n\\n36 votes\"}, {\"index\": 1, \"position\": \"2\", \"title\": \"SPLINTER\", \"vote\": \"Rate\\n\\n\\n9.31\\n\\n\\n\\n\\n\\n26 votes\"}, {\"index\": 2, \"position\": \"3\", \"title\": \"Melody Circus\", \"vote\": \"Rate\\n\\n\\n8.50\\n\\n\\n\\n\\n\\n24 votes\"}, {\"index\": 3, \"position\": \"4\", \"title\": \"FUCK NEXUS\", \"vote\": \"Rate\\n\\n\\n8.76\\n\\n\\n\\n\\n\\n21 votes\"}, {\"index\": 4, \"position\": \"5\", \"title\": \"LIVING IPOD\", \"vote\": \"Rate\\n\\n\\n8.15\\n\\n\\n\\n\\n\\n20 votes\"}, {\"index\": 5, \"position\": \"6\", \"title\": \"STARFISH\", \"vote\": \"Rate\\n\\n\\n8.63\\n\\n\\n\\n\\n\\n19 votes\"}, {\"index\": 6, \"position\": \"7\", \"title\": \"Sledgehammer\", \"vote\": \"Rate\\n\\n\\n9.06\\n\\n\\n\\n\\n\\n17 votes\"}, {\"index\": 7, \"position\": \"8\", \"title\": \"Ghetto Blastah\", \"vote\": \"Rate\\n\\n\\n8.39\\n\\n\\n\\n\\n\\n18 votes\"}, {\"index\": 8, \"position\": \"9\", \"title\": \"ISM\", \"vote\": \"Rate\\n\\n\\n9.13\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 9, \"position\": \"10\", \"title\": \"Pirate bay\", \"vote\": \"Rate\\n\\n\\n8.44\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 10, \"position\": \"11\", \"title\": \"Black Magic\", \"vote\": \"Rate\\n\\n\\n8.31\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 11, \"position\": \"12\", \"title\": \"The Horror\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n15 votes\"}, {\"index\": 12, \"position\": \"13\", \"title\": \"Nightmare Adventures\", \"vote\": \"Rate\\n\\n\\n7.94\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 13, \"position\": \"14\", \"title\": \"BREAKDOWN\", \"vote\": \"Rate\\n\\n\\n9.21\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 14, \"position\": \"15\", \"title\": \"Sayonara\", \"vote\": \"Rate\\n\\n\\n9.21\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 15, \"position\": \"16\", \"title\": \"Alchemist (feat. Gyno Sydal)\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 16, \"position\": \"17\", \"title\": \"CHAMPAGNE\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 17, \"position\": \"18\", \"title\": \"The Beginning Is Near\", \"vote\": \"Rate\\n\\n\\n8.86\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 18, \"position\": \"19\", \"title\": \"NINUR\", \"vote\": \"Rate\\n\\n\\n7.93\\n\\n\\n\\n\\n\\n15 votes\"}, {\"index\": 19, \"position\": \"20\", \"title\": \"OVERWORLD\", \"vote\": \"Rate\\n\\n\\n9.31\\n\\n\\n\\n\\n\\n13 votes\"}, {\"index\": 20, \"position\": \"21\", \"title\": \"STARSCREAM FOREVER\", \"vote\": \"Rate\\n\\n\\n9.42\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 21, \"position\": \"22\", \"title\": \"BURGERTIME (SAVANT THEME)\", \"vote\": \"Rate\\n\\n\\n9.17\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 22, \"position\": \"23\", \"title\": \"FIRECLOUD\", \"vote\": \"Rate\\n\\n\\n8.92\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 23, \"position\": \"24\", \"title\": \"Sustainer\", \"vote\": \"Rate\\n\\n\\n8.92\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 24, \"position\": \"25\", \"title\": \"TRUST ISSUES\", \"vote\": \"Rate\\n\\n\\n8.83\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 25, \"position\": \"26\", \"title\": \"DIRTY MARY\", \"vote\": \"Rate\\n\\n\\n9.64\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 26, \"position\": \"27\", \"title\": \"YOU CAN PLAY\", \"vote\": \"Rate\\n\\n\\n9.36\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 27, \"position\": \"28\", \"title\": \"FLASHBACH\", \"vote\": \"Rate\\n\\n\\n8.42\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 28, \"position\": \"29\", \"title\": \"The Beat\", \"vote\": \"Rate\\n\\n\\n9.09\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 29, \"position\": \"30\", \"title\": \"Face Off\", \"vote\": \"Rate\\n\\n\\n8.64\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 30, \"position\": \"31\", \"title\": \"Dancer in the Dark\", \"vote\": \"Rate\\n\\n\\n8.45\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 31, \"position\": \"32\", \"title\": \"BAD BAWS\", \"vote\": \"Rate\\n\\n\\n9.20\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 32, \"position\": \"33\", \"title\": \"Prelude\", \"vote\": \"Rate\\n\\n\\n9.10\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 33, \"position\": \"34\", \"title\": \"HERO FROM THE PAST\", \"vote\": \"Rate\\n\\n\\n9.33\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 34, \"position\": \"35\", \"title\": \"HOLY GHOST\", \"vote\": \"Rate\\n\\n\\n9.33\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 35, \"position\": \"36\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n9.22\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 36, \"position\": \"37\", \"title\": \"VINTER\", \"vote\": \"Rate\\n\\n\\n9.11\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 37, \"position\": \"38\", \"title\": \"8-BIT LIGHTSABER\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 38, \"position\": \"39\", \"title\": \"Redemption\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 39, \"position\": \"40\", \"title\": \"Mother Earth\", \"vote\": \"Rate\\n\\n\\n8.10\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 40, \"position\": \"41\", \"title\": \"Paradisco\", \"vote\": \"Rate\\n\\n\\n8.78\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 41, \"position\": \"42\", \"title\": \"Fat Cat Shuffle\", \"vote\": \"Rate\\n\\n\\n8.67\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 42, \"position\": \"43\", \"title\": \"MYSTERY\", \"vote\": \"Rate\\n\\n\\n8.67\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 43, \"position\": \"44\", \"title\": \"MEGABOY\", \"vote\": \"Rate\\n\\n\\n9.63\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 44, \"position\": \"45\", \"title\": \"THUNDERCLOUT\", \"vote\": \"Rate\\n\\n\\n9.50\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 45, \"position\": \"46\", \"title\": \"VARIO\", \"vote\": \"Rate\\n\\n\\n9.13\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 46, \"position\": \"47\", \"title\": \"THE THIRD EYE\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 47, \"position\": \"48\", \"title\": \"ARCADE NIGHT CRUISE\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 48, \"position\": \"49\", \"title\": \"NO SHIT SHERLOCK\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 49, \"position\": \"50\", \"title\": \"SHADOW\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 50, \"position\": \"51\", \"title\": \"STORMTROOPER\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 51, \"position\": \"52\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n9.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 52, \"position\": \"53\", \"title\": \"DESTROY THE DRAGON\", \"vote\": \"Rate\\n\\n\\n8.75\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 53, \"position\": \"54\", \"title\": \"BA-DA BING!\", \"vote\": \"Rate\\n\\n\\n9.43\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 54, \"position\": \"55\", \"title\": \"No Time For Pussy\", \"vote\": \"Rate\\n\\n\\n8.38\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 55, \"position\": \"56\", \"title\": \"DIAMOND BLUSH\", \"vote\": \"Rate\\n\\n\\n9.29\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 56, \"position\": \"57\", \"title\": \"OUTFOX\", \"vote\": \"Rate\\n\\n\\n8.25\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 57, \"position\": \"58\", \"title\": \"ANTIPIXEL\", \"vote\": \"Rate\\n\\n\\n8.13\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 58, \"position\": \"59\", \"title\": \"RIDE LIKE THE WIND\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 59, \"position\": \"60\", \"title\": \"Sky is the Limit (feat. Donny Goines)\", \"vote\": \"Rate\\n\\n\\n7.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 60, \"position\": \"61\", \"title\": \"CRY FOR LOVE\", \"vote\": \"Rate\\n\\n\\n8.71\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 61, \"position\": \"62\", \"title\": \"MECHA BLECKA\", \"vote\": \"Rate\\n\\n\\n8.71\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 62, \"position\": \"63\", \"title\": \"ROBOT PEOPLE MONSTER\", \"vote\": \"Rate\\n\\n\\n8.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 63, \"position\": \"64\", \"title\": \"ZEITGEIST\", \"vote\": \"Rate\\n\\n\\n8.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 64, \"position\": \"65\", \"title\": \"Konami Kode (feat. Donny Goines)\", \"vote\": \"Rate\\n\\n\\n7.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 65, \"position\": \"66\", \"title\": \"ROLLERCOASTER\", \"vote\": \"Rate\\n\\n\\n7.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 66, \"position\": \"67\", \"title\": \"OCARINE\", \"vote\": \"Rate\\n\\n\\n8.83\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 67, \"position\": \"68\", \"title\": \"BACH TO THE PHUTURE\", \"vote\": \"Rate\\n\\n\\n7.57\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 68, \"position\": \"69\", \"title\": \"PARTY MACHINE\", \"vote\": \"Rate\\n\\n\\n8.50\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 69, \"position\": \"70\", \"title\": \"EGGS\", \"vote\": \"Rate\\n\\n\\n8.33\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 70, \"position\": \"71\", \"title\": \"GUNSLINGER JONES\", \"vote\": \"Rate\\n\\n\\n8.33\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 71, \"position\": \"72\", \"title\": \"Hungry Eyes (feat. Qwentalis)\", \"vote\": \"Rate\\n\\n\\n7.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 72, \"position\": \"73\", \"title\": \"Light Years (feat. Razihel)\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 73, \"position\": \"74\", \"title\": \"RABBIT WHORE\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 74, \"position\": \"75\", \"title\": \"Manslaughter (feat Svanur Papparazzi)\", \"vote\": \"Rate\\n\\n\\n7.50\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 75, \"position\": \"76\", \"title\": \"HEART-SHAPED MUSHROOM CLOUD\", \"vote\": \"Rate\\n\\n\\n8.40\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 76, \"position\": \"77\", \"title\": \"OMNI\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 77, \"position\": \"78\", \"title\": \"SYKO\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 78, \"position\": \"79\", \"title\": \"THE A TEAM\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 79, \"position\": \"80\", \"title\": \"Witchcraft\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 80, \"position\": \"81\", \"title\": \"Shark\", \"vote\": \"Rate\\n\\n\\n9.25\\n\\n\\n\\n\\n\\n4 votes\"}, {\"index\": 81, \"position\": \"82\", \"title\": \"QUANTUM MECHANICS\", \"vote\": \"Rate\\n\\n\\n7.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 82, \"position\": \"83\", \"title\": \"I WANT YOU\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n4 votes\"}, {\"index\": 83, \"position\": \"84\", \"title\": \"MAKE YOU DREAM\", \"vote\": \"Rate\\n\\n\\n7.00\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 84, \"position\": \"85\", \"title\": \"SLAUGHTERFACE\", \"vote\": \"Rate\\n\\n\\n5.83\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 85, \"position\": \"86\", \"title\": \"Shark\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}, {\"index\": 86, \"position\": \"87\", \"title\": \"Wade in the Water\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}, {\"index\": 87, \"position\": \"88\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}]}'\n\t\t@response2 = JSON.pretty_generate(JSON.parse(raw_response2))\n\t\t@desc2 = {:position => \"Position of the item in the list.\", :title => \"Title of the item on the list.\", :vote => \"Number of votes for the specific item in the list.\"}\n\n\t\t@api_title3 = \"Search\"\n\t\t@api_maindesc3 = \"This API call returns lists found given a search query.\"\n\t\t@raw_request3 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=search\\&path=fun'\n\t\traw_response3 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 12}, \"objects\": [{\"description\": \"A venture funded company is any company which has received funding from a venture capital investor.\", \"index\": 0, \"meta\": \"1.188 views\\n 623 votes\\n 27.11.12\", \"name\": \"Best Venture Funded Company of All Time\"}, {\"description\": \"Fan of Knock Knock jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Knock Knock jokes! Find your favorite? Then vote on the best Knock Knock jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Knock Knock jokes.\", \"index\": 1, \"meta\": \"142 views\\n 623 votes\\n 16.09.13\", \"name\": \"Funny Knock Knock jokes\"}, {\"description\": \"\", \"index\": 2, \"meta\": \"133 views\\n 623 votes\\n 27.11.12\", \"name\": \"Best fun of All Time\"}, {\"description\": \"A defunct sports team is a sports team that no longer exists.\", \"index\": 3, \"meta\": \"98 views\\n 621 votes\\n 27.11.12\", \"name\": \"Best Defunct Sports Team of All Time\"}, {\"description\": \"A defunct organization is an organization that no longer operates.\", \"index\": 4, \"meta\": \"530 views\\n 619 votes\\n 27.11.12\", \"name\": \"Best Defunct Organization of All Time\"}, {\"description\": \"Fan of Dog jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Dog jokes! Find your favorite? Then vote on the best Dog jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Dog jokes.\", \"index\": 5, \"meta\": \"70 views\\n 574 votes\\n 16.09.13\", \"name\": \"Funny Dog jokes\"}, {\"description\": \"the general reason, purpose for the building at any time. Usually, it is why it was built.\", \"index\": 6, \"meta\": \"179 views\\n 516 votes\\n 27.11.12\", \"name\": \"Best Building function of All Time\"}, {\"description\": \"Fan of Blonde jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Blonde jokes! Find your favorite? Then vote on the best Blonde jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Blonde jokes.\", \"index\": 7, \"meta\": \"37 views\\n 501 votes\\n 16.09.13\", \"name\": \"Funny Blonde jokes\"}, {\"description\": \"Fan of Yo momma jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Yo momma jokes! Find your favorite? Then vote on the best Yo momma jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Yo momma jokes.\", \"index\": 8, \"meta\": \"46 views\\n 480 votes\\n 16.09.13\", \"name\": \"Funny Yo momma jokes\"}, {\"description\": \"Fan of School jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best School jokes! Find your favorite? Then vote on the best School jokes below. If your favorite isnt listed, you can also add a new joke to our selection of School jokes.\", \"index\": 9, \"meta\": \"49 views\\n 465 votes\\n 16.09.13\", \"name\": \"Funny School jokes\"}, {\"description\": \"Fan of Insect jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Insect jokes! Find your favorite? Then vote on the best Insect jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Insect jokes.\", \"index\": 10, \"meta\": \"48 views\\n 443 votes\\n 16.09.13\", \"name\": \"Funny Insect jokes\"}, {\"description\": \"Fan of Dirty jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Dirty jokes! Find your favorite? Then vote on the best Dirty jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Dirty jokes.\", \"index\": 11, \"meta\": \"53 views\\n 435 votes\\n 16.09.13\", \"name\": \"Funny Dirty jokes\"}]}'\n\t\t@response3 = JSON.pretty_generate(JSON.parse(raw_response3))\n\t\t@desc3 = {:name => \"The name of the specific list.\", :description => \"The description of the specific list.\", :meta => \"Displays the number of votes and views for the specific list.\"}\n\tend\n\nend",
"def dashboard\n if current_user.api_id != nil\n @apikey = Api.find(current_user.api_id).apikey\n else\n end\n end",
"def show\n @dashboard = Dashboard.find_by(:website_id => params[:id]) || Dashboard.find(params[:id])# this show gets the params when there is not ID ( websites/index => dashbaord_new)\n # @dashboard = Dashboard.find(params[:id]) if params[:id].blank? # gets ID when the params is created with an ID\n find_params_for_data_dashboard # calls @dashboard params to Application\n \n end",
"def dashboard\n # dashboard.html.erb\n end",
"def dashboard\n #sendEmailTest('[email protected]', 'Blou Ratinahirana', 'M03200202', 'Arrivé au centre de dépot')\n load_dashboard(nil, nil)\n\n render 'dashboard'\n end",
"def dashboard\n # shows data for just current user\n @user = current_user\n @writings = Writing.all\n @worksheets = Worksheet.all\n end",
"def default_dashboard\n dashboards.first\n end",
"def show\n render json: UserBoards.find(params[\"id\"])\n end",
"def show\n if current_user.present?\n #@work_dashboard = Work::Dashboard.find(params[:id])\n @worked_list = Setting.version_mod.split(' ')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_dashboard }\n end\n end\n end",
"def index\n @api_v1_metrics_dashboards_segments = Api::V1::MetricsDashboardsSegment.all\n end",
"def show\n @dashboard = Dashboard.find(params[:id])\n @chart_selectors_data = {}\n \n tables = [] \n (ActiveRecord::RdsDb.connection.tables - ['schema_migrations']).each do |table_name|\n next unless ar_class_exist?(table_name)\n \n table = {\n name: table_name.titleize,\n value: table_name,\n dimensions: [],\n metrics: [],\n dates: []\n }\n \n table_class = table_name.classify.constantize\n table_class.columns.each do |column|\n next unless [:string, :integer, :datetime].include?(column.type)\n \n # TODO: Dimension can be either string field or belongs_to association\n \n if [:string, :integer].include?(column.type)\n table[:dimensions] << prepare_column(column)\n table[:metrics] << prepare_column(column) \n elsif column.type == :datetime\n table[:dates] << prepare_column(column)\n end\n \n end \n \n tables << table \n end\n \n \n \n @chart_selectors_data[:tables] = tables\n @dashboard_modules = @dashboard.dashboard_modules.order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dashboard }\n end\n end",
"def set_data_dashboard\n @data_dashboard = DataDashboard.find(params[:id])\n end",
"def set_admin_dashboard\n @admin_dashboard = Admin::Dashboard.find(params[:id])\n end",
"def dashboard_profile\n @user = current_user\n render \"dashboard/dashboard_profile\" and return\n end",
"def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end",
"def set_dashboard\n end",
"def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def index\n data = get_index_data\n @dayoffs = data.page(params[:current_page]).per(PER_PAGE)\n respond_to do |format|\n format.html {\n render \"dashboards/admin_dashboard\"\n }\n\n format.json {\n render json: {\n total_page: @data.total_page,\n data: ActiveModel::SerializableResource.new(@dayoffs, each_serializer: AdminDayoffSerializer)\n }, status: :ok\n }\n end\n end",
"def dashboard(limit: nil, offset: nil, before_id: nil, since_id: nil, \n reblog_info: true, notes_info: nil, type: nil, npf: nil, **args)\n get_body('v2/user/dashboard', limit: limit, offset: offset, before_id: before_id, since_id: since_id, reblog_info: reblog_info, notes_info: notes_info, npf: npf, **args)\n end",
"def api_v11_timeseries_dashboards_dashboard_name_get_with_http_info(dashboard_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_timeseries_dashboards_dashboard_name_get ...\"\n end\n \n # verify the required parameter 'dashboard_name' is set\n fail \"Missing the required parameter 'dashboard_name' when calling api_v11_timeseries_dashboards_dashboard_name_get\" if dashboard_name.nil?\n \n # resource path\n path = \"/api/v11/timeseries/dashboards/{dashboardName}\".sub('{format}','json').sub('{' + 'dashboardName' + '}', dashboard_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\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 = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_timeseries_dashboards_dashboard_name_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n # render plain: params.to_json\n @dashboard = Dashboard.new(dashboard_params)\n @dashboard.set_user(current_user)\n @dashboard.token = @token\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render :show, status: :created, location: @dashboard }\n else\n format.html { render :new }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dashboard = Dashboard.new(params[:dashboard])\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render json: @dashboard, status: :created, location: @dashboard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n render json: UserBoards.all\n end",
"def dashboard\n @event = Event.find(params[:id]) || not_found\n @event_activity_logs = @event.event_activity_logs.paginate(:page => params[:page]).order('created_at desc')\n @lookup_event_sequences = LookupEventSequence.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def index\n @activities = Activity.all\n render json: @activities\n end",
"def list_dashboards_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DashboardsAPI.list_dashboards ...'\n end\n # resource path\n local_var_path = '/api/v1/dashboard'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'filter[shared]'] = opts[:'filter_shared'] if !opts[:'filter_shared'].nil?\n query_params[:'filter[deleted]'] = opts[:'filter_deleted'] if !opts[:'filter_deleted'].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[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'DashboardSummary'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_dashboards,\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 :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DashboardsAPI#list_dashboards\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def dashboard\n @players = User.all\n verify_session() #ApplicationHelper::UserInterface\n retreiveChallenges #UserHelper::ChallengeInterface\n end",
"def dashboard\n\n @response = CompanyApi::Request::Economy.new(\n CompanyApi::Response::Formatter::Economy,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_dashboard_details\n\n # Check if error present or not?\n unless @response.success?\n render_error_response(@response)\n return\n end\n\n @presenter_obj = ::WebPresenter::Economy::Dashboard.new(@response, params)\n unless @presenter_obj.client_token.step_three_done?\n redirect_to :planner, status: GlobalConstant::ErrorCode.temporary_redirect\n return\n end\n\n end",
"def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end",
"def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end",
"def create\n @dashboard = Dashboard.new(dashboard_params)\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dashboard }\n else\n format.html { render action: 'new' }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dashboard_params\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\r\n render json: { status: \"Test API\"}\r\n end",
"def dashboard\n # render :partial =>'dashboard'\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def create\n @dashboard = Dashboard.new(dashboard_params)\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render :show, status: :created, location: @dashboard }\n else\n format.html { render :new }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dashboard = Dashboard.new(dashboard_params)\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render :show, status: :created, location: @dashboard }\n else\n format.html { render :new }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dashboard = Dashboard.new(dashboard_params)\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render :show, status: :created, location: @dashboard }\n else\n format.html { render :new }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n # Dashboard only done in English\n @selected = 'home'\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user }\n end\n end",
"def index\n render json: current_org.users\n end",
"def index\n @api_v2_dashboard_shop360s = Api::V2::Dashboard::Shop360.all\n end",
"def show\n @dash_type = DashType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dash_type }\n end\n end",
"def dashboard\n # get my projects\n @eab_projects = current_user.eab_projects\n @favs = current_user.favorites\n @user = current_user\n @transactions = @user.recent_transactions\n end",
"def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end",
"def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end",
"def dashboard_params\n params.fetch(:dashboard, {})\n end"
] | [
"0.73191476",
"0.7042014",
"0.6952365",
"0.68764853",
"0.6840577",
"0.6840577",
"0.683669",
"0.683669",
"0.683669",
"0.683669",
"0.6810283",
"0.67448145",
"0.67432964",
"0.67069924",
"0.66859394",
"0.66765153",
"0.6666256",
"0.6657843",
"0.66410047",
"0.6610535",
"0.6588395",
"0.6525595",
"0.6503095",
"0.6503095",
"0.6503095",
"0.6503095",
"0.6503095",
"0.6503095",
"0.6503095",
"0.643543",
"0.64332604",
"0.64324033",
"0.6422476",
"0.6416979",
"0.6412421",
"0.63466233",
"0.6335949",
"0.63006604",
"0.62961215",
"0.62869334",
"0.6271104",
"0.6265273",
"0.6260904",
"0.62416315",
"0.61727",
"0.61501795",
"0.61433536",
"0.61355317",
"0.61327624",
"0.61317855",
"0.61191535",
"0.6097606",
"0.60840136",
"0.6069677",
"0.6069414",
"0.6030341",
"0.6016861",
"0.60024494",
"0.5997951",
"0.5990641",
"0.597741",
"0.5969096",
"0.596391",
"0.5956291",
"0.5951394",
"0.5938852",
"0.59321016",
"0.5930295",
"0.5921383",
"0.59094244",
"0.58832496",
"0.58783704",
"0.5869676",
"0.5865621",
"0.5859352",
"0.58483505",
"0.584434",
"0.5832663",
"0.5822003",
"0.5818813",
"0.5817196",
"0.5813356",
"0.5811562",
"0.57924944",
"0.57921326",
"0.577963",
"0.577963",
"0.577963",
"0.57753974",
"0.577032",
"0.57592654",
"0.5752848",
"0.5747688",
"0.5738044",
"0.5738044",
"0.5736563"
] | 0.679921 | 15 |
GET /u/profile/1 GET /u/profile/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end",
"def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def profile\n @oneuser = User.find_by(username: params[:username]) \n profile = user_profile(@oneuser.id, @oneuser.username, @oneuser.email, @oneuser.first_name, @oneuser.last_name, @oneuser.avatar_img, @oneuser.created_at) \n render json: profile\n end",
"def profile\n p @user.as_json\n render json: @user.as_json\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end",
"def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end",
"def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def profile\n @user = UserService.getUserById(params[:id])\n end",
"def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end",
"def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end",
"def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def profile\n render_json 0,\"ok\",current_member.as_profile\n end",
"def profile\n \t@user = UsersService.findUserById(params[:id])\n end",
"def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end",
"def profile\n render json: @current_user\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def profile\n @user = User.find(params[:id])\n end",
"def show_current_user_profile\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end",
"def my_profile\n render json: { user: current_user}\n end",
"def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end",
"def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def get_profile\n self.class.get '/members/private', @options\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_profile }\n end\n end",
"def show\n p params\n p \"just herer for checking\"\n #@profile = Profile.find(params[:id])\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end",
"def find_profile\n\t\t# Find particular Profile \n\t\t@profile = Profile.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Profile ID !'}, status: 400 if @profile.nil?\n\tend",
"def find_profile\n @user = User.find_by_username(params[:id])\n @profile = @user.profile\n end",
"def user\n\n \n @profile = Profile.find_by_user_id(params[:id])\n\n\nend",
"def show_current\n user = current_user\n profile = Profile.find_by user_id: user.id\n\n render json: profile\n end",
"def show\n @profile = Profile.find(params[:id])\n @checkin = CheckIn.find_last_by_user_id(@profile.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n @checkin = CheckIn.find_last_by_user_id(@profile.user_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @private_profile = PrivateProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @private_profile }\n end\n end",
"def show\n @profile = Profile.find(:first, :conditions => {:user_id => params[:user_id]})\n end",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end",
"def profile_url\n @json['profile']['url'] rescue nil\n end",
"def show\n @profile = Profile.find(params[:id])\n render json: @profile.to_json(include_hash)\n end",
"def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend",
"def profile; Profile.get(self.profile_id); end",
"def profile\n if object = send(:\"current_#{resource_name}\")\n self.resource = resource_class.to_adapter.get!(object.to_key)\n respond_with self.resource\n else\n render json: '', status: 404\n end\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"def profile\n _uuid = uuid.gsub(/-/, '')\n url = \"https://sessionserver.mojang.com/session/minecraft/profile/#{_uuid}\"\n response = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(response.body)\n end",
"def show\n @profile = @user.profile\n end",
"def profile\n render json: {user: UserSerializer.new(current_user)}, status: :accepted\n end",
"def getProfile\n account = current_user.account\n if account.nil?\n render status: 400, json: {error: \"Invalid User\"}\n else\n if current_user.registered && (account.referral_code.nil? || account.referral_code.blank?)\n account.generate_referral_code\n end\n render status: 200, json: {username: current_user.username,\n email: current_user.email,\n firstName: current_user.first_name,\n lastName: current_user.last_name,\n company: current_user.company,\n balance: account.balance,\n registered: current_user.registered,\n referralCode: account.referral_code}\n end\n end",
"def show\n\t\t# begin\n\t\t\tprofile = Profile.find(params[:id])\n\t @conversation = current_profile.find_conversation(profile)\n\t respond_to do |format|\n\t format.html {render \"profiles/#{profile._type.underscore}_show\"}\n\t format.json { render :json => @profile }\n\t end\n\t\t# rescue => error\n\t\t# \trender \"profiles/not_found\"\n\t\t# \tputs error.message\n\t\t# end\n end",
"def profile\n render json: { user: UserSerializer.new(current_user) }, status: :accepted\n end",
"def profile\n\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def get_user_instagram_profile\n response = @client.get(\"#{@base_url}/v1/users/self\", access_token: get_user_access_token)\n user_profile = JSON.parse(response.body)\n end",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def retrieve_profile(id, content_type)\n call(:get, path(\"#{id}/profiles/#{content_type}/\"))\n end",
"def profile(username)\n Person.profile(username, @api_key, @https)\n end",
"def profile\r\n if params[:id] && User.exists?(params[:id])\r\n @prof = User.find(params[:id])\r\n else\r\n redirect_to_info_page t(:redir)\r\n return\r\n end\r\n end",
"def show\n \n begin\n @profile = Profile.find(params[:id])\n @[email protected]\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attemp to access an invaild profile #{params[:id]}\"\n redirect_to root_url,:notice=>\"Invaild profile\"\nelse\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end\n end",
"def profile \n # @user = current_user\n @token = encode_token(user_id: current_user.id)\n render json: { user: UserSerializer.new(current_user)}, status: :accepted\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def show\n @profile = Profile.find(params[:id])\n end",
"def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end",
"def show\n @profile = Profile.find_by_user_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile.to_json(:include => [:faculty, :course]) }\n end\n end",
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def get_profile(session, user_id)\n $client.authorization.update_token!(session[:token].to_hash)\n plus = $client.discovered_api('plus')\n\n Rails.logger.debug \"TokenPair: #{$client.authorization.to_yaml}\"\n result = $client.execute(\n :api_method => plus.people.get,\n :parameters => {'userId' => user_id})\n\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n Rails.logger.debug \"GoogleClient: NM #{result.data['displayName']}\"\n Rails.logger.debug \"GoogleClient: IM #{result.data['image']['url']}\"\n Rails.logger.debug \"GoogleClient: PR #{result.data['url']}\"\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n\n @profile = Hash.new\n @profile[:name] = result.data['displayName']\n @profile[:profile_url] = result.data['url']\n\n # Avatar sizes\n @profile[:img_url] = result.data['image']['url']\n @profile[:img_url].gsub!(/sz=\\d+$/, \"\")\n\n @profile[:img_thumb_url] = @profile[:img_url] + 'sz=100'\n @profile[:img_tiny_url] = @profile[:img_url] + 'sz=32'\n @profile[:img_badge_url] = @profile[:img_url] + 'sz=15'\n\n return @profile\n end",
"def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end",
"def profile_data(uid, field)\n begin\n JSON.parse(RestClient.get construct_url(\"user/#{uid}/#{field}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end \n end",
"def profile\n \n end",
"def get_profile(id)\n \t\tfb_profile_url = FB_PROFILE + id + FB_PROFILE_FIELDS\n \t\tprofile_details = HTTParty.get(fb_profile_url)\n \t\t@first_name = profile_details[\"first_name\"]\n \t\t@last_name = profile_details[\"last_name\"]\n \t\t@profile_pic = profile_details[\"profile_pic\"]\n \t\t@locale = profile_details[\"locale\"]\n \t\t@gender = profile_details[\"gender\"]\n \tend",
"def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id]) || current_user.profile\n end",
"def show\n if current_user.try(:admin?)\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n else\n redirect_to :permission_error\n end\n end",
"def show\n \t@profile = Profile.where(profile_name: params[:id]).first\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 show\n @profile_attribute = current_user.profile_attributes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile_attribute }\n format.json { render :json => @profile_attribute }\n end\n end",
"def profile_url\n \"#{Steam::API::COMMUNITY_URL}/profiles/#{steam_id}\"\n end",
"def profile\n unless @profile\n if associated_profile\n @profile = Profile.new(associated_profile)\n else\n options = {:fields => 'user_id', :includes => 'Profile'}\n options = options.merge(:access_token => token, :access_secret => secret) if (token && secret)\n tmp = User.find(username, options)\n @profile = Profile.new(tmp.associated_profile)\n end\n end\n @profile\n end",
"def profile\n # grab the username from the URL as :id\n @user = User.find(session[:user_id])\n #@followers = Relationship.all.where(\"followed_id = ?\", User.find_by_username(params[\"id\"]).id)\n #@following = Relationship.all.where(\"follower_id = ?\", User.find_by_username(params[\"id\"]).id)\n #@posts = Post.all.where(\"user_id = ?\", User.find_by_username(params[\"id\"]).id)\n end",
"def profile\n @profile ||= @request.do_request { FacebookUserProfile.populate(user) }\n end",
"def profile\n\t\t# determine which user's profile page\n\t\t@user = User.find_by_login(params[:username])\n\t\t# retrieve all bids by this user\n\t @bids = Bid.find_all_by_bidder_id(@user.id, :group => 'item_id')\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = @user.posted_items\n\n\t\t# code for facebox\n\t respond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend",
"def profile_url\n @json['user']['links']['self']\n end",
"def profile(token, secret)\n self.access_token = self.get_access_token(token, secret)\n req = self.access_token.request(:get, PAL_EPNTS['profile_url']+PAL_EPNTS['profile_fields'],{'x-li-format' => 'json','Content-Type'=>'application/json'})\n req.body\n end",
"def GetProfileData()\n uri = URI(API_URL + 'me')\n\n return PerformRestrictedGet(uri)\n end"
] | [
"0.7831829",
"0.76969075",
"0.7562164",
"0.75329024",
"0.7519524",
"0.7519524",
"0.750621",
"0.7501591",
"0.74229556",
"0.7416458",
"0.7401251",
"0.7389491",
"0.7374967",
"0.73513246",
"0.7324969",
"0.7273774",
"0.72464174",
"0.7244626",
"0.7206244",
"0.71958977",
"0.71824324",
"0.71824324",
"0.71824324",
"0.7179935",
"0.7177158",
"0.71705157",
"0.7134",
"0.7122198",
"0.7112142",
"0.70642215",
"0.705808",
"0.70487547",
"0.7022106",
"0.7021399",
"0.70122784",
"0.6997477",
"0.69780666",
"0.6972125",
"0.69701636",
"0.6949736",
"0.69337076",
"0.69278556",
"0.69278556",
"0.6926082",
"0.6917328",
"0.69079304",
"0.6904986",
"0.6903318",
"0.6892399",
"0.6879808",
"0.68590724",
"0.6855566",
"0.6852072",
"0.68421453",
"0.68420154",
"0.68403345",
"0.6834856",
"0.6831146",
"0.6824278",
"0.6822973",
"0.6814627",
"0.6812208",
"0.68102425",
"0.6803908",
"0.67930776",
"0.6773742",
"0.6751053",
"0.6748864",
"0.6746012",
"0.6746012",
"0.6746012",
"0.6746012",
"0.6746012",
"0.6746012",
"0.67312205",
"0.6729361",
"0.67286325",
"0.67278326",
"0.67245716",
"0.6717891",
"0.67157704",
"0.67050445",
"0.6698906",
"0.66976607",
"0.66836965",
"0.66829735",
"0.6678074",
"0.6678074",
"0.6678074",
"0.6678074",
"0.6678074",
"0.6678074",
"0.66779757",
"0.66761965",
"0.6669044",
"0.6650513",
"0.66466296",
"0.66436744",
"0.6640749",
"0.66326123",
"0.66273546"
] | 0.0 | -1 |
PATCH/PUT /u/profile/1 PATCH/PUT /u/profile/1.json | def update
if @user.update_with_password(params[:user])
# Sign in the user by passing validation in case his password changed
sign_in @user, :bypass => true if @user.id == current_user.id
flash[:notice] = "User was successfully updated."
end
respond_with @user, location: user_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end",
"def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend",
"def update\r\n params = profile_params\r\n params.delete(\"id\")\r\n params.delete(\"user\")\r\n respond_to do |format|\r\n if @profile.update(params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to user_path, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to (user_profile_path(current_user)), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @profile.update(profile_params)\n respond_with(@profile)\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n current_user.admin? ? true : params[:profile][:id] = current_user.id\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end",
"def update_profile\n \t@user = User.find_by_id(params[:id])\n \tif @user.nil?\n render :json => {:message => \"User not exists\"}, :status => :not_acceptable\n else\n \tbegin\n\t @user.update_attributes(params[:user])\n\t @user.save!\n\t render :json => {:success => true, :message => \"User updated\", :user =>@user}, :status => :ok\n\t rescue Exception => e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n logger.debug(\"UPDATE PROFILE @profile = #{@profile.inspect}\")\n logger.debug(\"UPDATE PROFILE params = #{params[:profile].inspect}\")\n logger.debug(\"UPDATE PROFILE update_attributes #{@profile.update_attributes(params[:profile]).inspect}\")\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_url, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\[email protected]_columns(profile_params)\n\t\trespond_with @profile \n\tend",
"def update\n @profile = Profile.find_by_user_id(current_user.id)\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n #format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n #format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n Rails.logger.info(\"PARAMS: #{profile_params}\")\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @profile\n respond_to do |format|\n if @user.update_attributes(params[:user].permit(:username)) && @profile.update_attributes(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to '/', notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html do\n redirect_to @profile,\n notice: \"Profile was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @profile\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to quit_user_profile_path , notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n if @user_profile.update_attributes(params[:user_profile])\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n if @user_profile.update_attributes(params[:user_profile])\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @profile.update(profile_params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_profile(params)\n post 'account/update_profile', :post => params\n end",
"def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n else\n format.html { render :edit }\n format.json { render json: @profiles.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n good_change(format, :ok)\n else\n bad_change(format, :edit)\n end\n end\n end",
"def update\n # render :text => \"<pre>#{params.to_yaml}</pre>\" and return\n @profile = Profile.find(params[:id])\n # @profile = Profile.find_or_create_by_user_id(@user.id)\n unless params.empty?\n @profile.update_attributes(params[:profile])\n @profile.user.update_attributes(params[:user])\n end\n respond_to do |format|\n if @profile.errors.empty? && @profile.user.errors.empty?\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors + @profile.user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_profile(params)\n post('/account/update_profile.json', params)\n end",
"def updateProfile\r\n errors ||= Array.new\r\n\t\tdataHash = {\r\n user_id: params[:user].id,\r\n asset_id: params[:asset_id],\r\n\t\t\tfname: params[:fname],\r\n\t\t\tlname: params[:lname],\r\n\t\t\tgender: params[:gender],\r\n\t\t\tbio: params[:bio],\r\n\t\t\tfamilyStatus: params[:familyStatus],\r\n\t\t\tbdate: params[:bdate]\r\n\t\t}\r\n\t\terrors = Api::Init.MembersControl.checkProfileParams(dataHash)\r\n\t\tif errors.count != 0 \r\n\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['profile_errors'],I18n.t(\"errors.messages.users.profile_errors\"), errors).to_json\r\n else\r\n \tuserProfileObject = UsersProfile.byUser(params[:user].id).first\r\n userProfileObject.updateProfile(dataHash)\t\r\n self.default_response\r\n end\r\n\tend",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(profile_attributes)\n format.html { redirect_to root_path, notice: 'Анкета успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html {\n flash[:notice] = t('Profile was successfully update.')\n redirect_to home_path\n }\n format.json { render json: {ok: true}, status: :ok }\n else\n format.html { redirect_to profile_edit_url, notice: t('Profile not saved !') }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n @profile = current_user.profile\n respond_to do |format|\n if @profile\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :text => \"You currently do not have a profile.\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Din profil uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile_user.update(profile_user_params)\n format.html { redirect_to @profile_user, notice: 'Profile user was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile_user }\n else\n format.html { render :edit }\n format.json { render json: @profile_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(show_user_path(current_user.username)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: \"User profile was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n # byebug\n if @profile.update(profile_params)\n format.html { redirect_to vendor_path(current_user.username), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Ваш профиль успешно обновлён\"\n format.html { redirect_to(profile_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to profile_path, notice: \"Book was successfully updated.\" }\n format.json { render profile_path, status: :ok, location: @profile }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to profile_user_path(@user), notice: 'Your profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to [@stakeholder, @profile], notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: [@stakeholder, @profile] }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n # This must be update_attributes, to do validations\n if @profile.update(profile_params)\n format.html { redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to profile_path(@profile.user_id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\t\t\n\t\t# Check to see if this user matches the profile, if not don't let them do anything\n\t\tif @profile.id != Profile.find_by_user_id(current_user.id).id\n \tredirect_to :permission_error\n end\n\t\t\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Your profile was successfully updated'\n format.html { render action: 'edit', notice: 'Profile was successfully updated' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = User.find(params[:id])\n \n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to profile_path(@profile) }\n else\n flash[:alert] = \"unable to update. Please check the data.\"\n format.html { render 'edit' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to edit_user_profile_path, notice: 'Daten erfolgreich aktualisiert.' }\n format.json { render :edit, status: :ok, location: @user_profile }\n else\n format.html { render :edit }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n if params[:user][:profile_pic]\n uploaded_file = params[:user][:profile_pic].path\n @user.update(profile_pic: Cloudinary::Uploader.upload(uploaded_file, :folder => \"user/profile\")[\"public_id\"])\n end\n format.html {\n flash[:success] = \"Your profile has been updated.\"\n redirect_to users_url\n }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes profile_params\n format.html { redirect_to(@profile, notice: 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n @original_profile = Profile.find(@profile.id)\n format.html { render action: \"edit\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to user_profile_show_path, notice: \"user_profile was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find_by_user_id(params[:user_id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to profile_url(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @userprofile.update(userprofile_params)\n format.html { redirect_to @userprofile, notice: 'Userprofile was successfully updated.' }\n format.json { render :show, status: :ok, location: @userprofile }\n else\n format.html { render :edit }\n format.json { render json: @userprofile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to(@profile, \n :notice => 'Perfil actualizado correctamente.') }\n else\n format.html {render :action => \"edit\"}\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # @profile = Profile.find(profile_params[:id])\n @user = current_user\n @profile = @user.profile\n # @user.profile = @profile\n # redirect_to(profile_path)\n\n # @user.update(user_params) #from the private method below - whitelist check\n\n \n\n respond_to do |format|\n if @profile.update(profile_params)\n\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless current_user == @user.user\n respond_to do |format|\n format.html { redirect_to profiles_path, alert: 'You have improper permissions to edit this profile.' }\n format.json { head :no_content }\n end\n return\n end\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personal_profile.update(personal_profile_params)\n format.html { redirect_to resume_path, notice: 'Your Personal profile was successfully updated.' }\n format.json { render :show, status: :ok, location: resume_path }\n else\n format.html { render :edit }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(pro_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n @profile = @user.profile\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile].except(:image)) && @user.update_attribute(:image, params[:profile][:image])\n @profile.update_user_role\n format.html { redirect_to show_current_user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_profile.update(client_profile_params)\n format.json { render :show, status: :ok, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @profile.update(req_params)\n redirect_to show_path, notice: 'Profile was successfully updated.'\n else\n respond_with_submission_error(@profile.errors.messages, edit_path)\n end\n end",
"def update\n\n #can be done by correct_user function\n #@user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'Profile successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: t(\"controller.shared.flash.update.notice\", model: pick_model_from_locale(:profile)) }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(current_user.id)\n @profile = @user.profile\n \n if @profile = params[:profile]\n redirect_to user_profile_path(current_user.name)\n else\n redirect_to edit_user_profile_path\n end\n end"
] | [
"0.74081624",
"0.73876625",
"0.7341647",
"0.72933096",
"0.7292685",
"0.7240915",
"0.7236433",
"0.7210315",
"0.71867067",
"0.71742845",
"0.71742845",
"0.71606743",
"0.71383184",
"0.7136014",
"0.71239114",
"0.7117873",
"0.7117873",
"0.7117873",
"0.7117873",
"0.71102315",
"0.7090893",
"0.7086107",
"0.7083929",
"0.7080673",
"0.70779455",
"0.70779294",
"0.70779294",
"0.70779294",
"0.7070736",
"0.706662",
"0.7065084",
"0.7048967",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7046973",
"0.7036208",
"0.70309263",
"0.7029341",
"0.70017946",
"0.6998477",
"0.6998229",
"0.6998229",
"0.6986728",
"0.6980069",
"0.6974391",
"0.6960775",
"0.6949491",
"0.6937007",
"0.69281137",
"0.69191724",
"0.6877951",
"0.6877951",
"0.68747485",
"0.6874694",
"0.6861513",
"0.6858604",
"0.68478227",
"0.6827888",
"0.6824075",
"0.681461",
"0.6812049",
"0.6807432",
"0.6797194",
"0.67964095",
"0.67957926",
"0.67835295",
"0.6776861",
"0.67704314",
"0.67701393",
"0.67587477",
"0.6758133",
"0.67560977",
"0.67535484",
"0.67394936",
"0.67281514",
"0.6726738",
"0.6710043",
"0.67086077",
"0.6700419",
"0.6687304",
"0.66811585",
"0.6668204",
"0.6660642",
"0.66522527",
"0.6651642",
"0.66470766",
"0.6641978",
"0.6641326",
"0.6639563"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\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 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\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\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 init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 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 setup\n #implement in subclass;\n end",
"def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; 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 setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] | 0.0 | -1 |
Old school Roman numerals My attempt. I actually did not get what the Roman Numerals were all about until I checked at the end of the book for some answers. I am sending a note to the author on giving us some sample examples of what the old numerals are like. | def oldrconv number
set = [1,5,10,50,100,500,1000]
x = 0
len = set.length
while x < len
result = number/set[x]
break if result < 1
sres = result
x = x + 1
end
base = set[x -1]
if (base !=1)
fresult = number%base
else
fresult = number%5
end
if (base == 1)
form = 'I'* sres
elsif (base == 5)
form = 'V' * sres
elsif (base == 10)
form = 'X'* sres
elsif (base ==50)
form = 'L'* sres
elsif (base ==100)
form = 'C'* sres
elsif (base == 500)
form = 'D'* sres
elsif (base == 1000)
form = 'M'* result
end
if (fresult == 0)
puts form
elsif (fresult != 0 && base != 1)
puts form + 'I'*fresult
else
puts 'I' * fresult
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_roman_numeral num\n\t\n\tif num >= 1000\n\t\tthousands = 'M' * (num / 1000)\n\tend\n\n\tif num >= 100\n\t\ttemp_hundreds = (num % 1000) / 100\n\t\tif temp_hundreds > 5\n\t\t\thundreds = 'D' + 'C' * (temp_hundreds - 5)\n\t\telsif temp_hundreds == 5\n\t\t\thundreds = 'D'\n\t\telse\n\t\t\thundreds = 'C' * temp_hundreds\n\t\tend\n\tend\n\t\n\tif num >= 10\n\t\ttemp_tens = (num % 100) / 10\n\t\tif temp_tens > 5\n\t\t\ttens = 'L' + 'X' * (temp_tens - 5)\n\t\telsif temp_tens == 5\n\t\t\ttens = 'L'\n\t\telse\n\t\t\ttens = 'X' * temp_tens\n\t\tend\n\tend\n\t\n\tif num > 0\n\t\ttemp_ones = num % 10\n\t\tif temp_ones > 5\n\t\t\tones = 'V' + 'I' * (temp_ones - 5)\n\t\telsif temp_ones == 5\n\t\t\tones = 'V'\n\t\telse\n\t\t\tones = 'I' * temp_ones\n\t\tend\n\tend\n\t\n\tputs \"#{num} in Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend",
"def roman_numeral num\n \n if num >= 1000\n thousands = 'M' * (num / 1000)\n end\n\n # We now account for cases of 400 and 900 (CD, CM, respectively)\n # CCC=300, CD=400, D=500, DCCC=800, CM=900\n if num >= 100\n temp_hundreds = (num % 1000) / 100\n if temp_hundreds == 9\n hundreds = 'CM'\n elsif (temp_hundreds < 9 && temp_hundreds > 5)\n hundreds = 'D' + 'C' * (temp_hundreds - 5)\n elsif temp_hundreds == 5\n hundreds = 'D'\n elsif temp_hundreds == 4\n hundreds = 'CD'\n else\n hundreds = 'C' * temp_hundreds\n end\n end\n \n # We now account for cases of 40 and 90 (XL, XC, respectively)\n # XXX=30, XL=40, L=50, LXXX=80, XC=90\n if num >= 10\n temp_tens = (num % 100) / 10\n if temp_tens == 9\n tens = 'XC'\n elsif (temp_tens < 9 && temp_tens > 5)\n tens = 'L' + 'X' * (temp_tens - 5)\n elsif temp_tens == 5\n tens = 'L'\n elsif temp_tens == 4\n tens = 'XL'\n else\n tens = 'X' * temp_tens\n end\n end\n \n # We now account for cases of 4 and 9 (IV, IX, respectively)\n # III=3, IV=4, V=5, XIII=8, IX=9\n if num > 0\n temp_ones = num % 10\n if temp_ones == 9\n ones = 'IX'\n elsif (temp_ones < 9 && temp_ones > 5)\n ones = 'V' + 'I' * (temp_ones - 5)\n elsif temp_ones == 5\n ones = 'V'\n elsif temp_ones == 4\n ones = 'IV'\n else\n ones = 'I' * temp_ones\n end\n end\n \n puts \"#{num} in \\\"Modern\\\" Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend",
"def old_roman_numeral number\n\n if number >= 1000\n thousands = 'M' * (number / 1000)\n end\n\n if number >= 100\n hundreds = (number % 1000) / 100\n if hundreds >= 5\n hundreds = 'D' + 'C' * (hundreds - 5)\n else\n hundreds = 'C' * ((number % 1000) / 100)\n end\n end\n\n if number >= 10\n tens = (number % 100) / 10\n if tens >= 5\n tens = 'L' + 'X' * (tens - 5)\n else\n tens = 'X' * ((number % 100) / 10)\n end\n end\n\n if number >= 1\n ones = (number % 10) / 1\n if ones >= 5\n ones = 'V' + 'I' * (ones - 5)\n else\n ones = 'I' * ((number % 10) / 1)\n end\n end\n\n puts \"#{number} in old-school Roman numerals is \"+\"#{thousands}\"+\"#{hundreds}\"+\"#{tens}\"+\"#{ones}\"\nend",
"def old_roman_numeral(num)\n\t@romanNumeral = \"\"\t\n\n\twhile num > 0\n\t\tquotient, modulus = num.divmod(1000)\n\t\t\tif quotient > 0 \t\t\t\t\t\t\t\t\t\t#using a divisor \n\t\t\t@romanNumeral << (\"M\" * quotient) #using divisor again\n\t\t\tnum = modulus\t\t\t\t\t\t\t\t\t\t\t\t#using modulus\n\t\telsif\n\t\t\tnum / 500 > 0\n\t\t\t@romanNumeral << (\"D\" * (num/500))\n\t\t\tnum %= 500\n\t\telsif\n\t\t\tif num / 100 > 0\n\t\t\t\t@romanNumeral << (\"C\" * (num/100))\n\t\t\t\tnum %= 100\n\t\t\telsif \n\t\t\t\tnum / 90 > 0 \n\t\t\t\t@romanNumeral << (\"XC\" * (num/90))\n\t\t\t\tnum %= 90\n\t\t\tend\n\t\telsif\n\t\t\tif num / 50 > 0\n\t\t\t@romanNumeral << (\"L\" * (num/50))\n\t\t\tnum %= 50\n\t\t\telsif \n\t\t\t\tnum / 40 > 0\n\t\t\t\t@romanNumeral << (\"XL\" * (num/40))\n\t\t\t\tnum %= 40 \t\t\t\n\t\t\tend\n\t\telsif\n\t\t\tif num / 10 > 0\n\t\t\t\t@romanNumeral << (\"X\" * (num/10))\n\t\t\t\tnum %= 10\n\t\t\telsif\n\t\t\t\tnum / 9 > 0\n\t\t\t\t@romanNumeral << (\"IX\" * (num/9))\n\t\t\t\tnum %= 9 \n\t\t\tend\n\t\telsif\n\t\t\tnum / 5 > 0\n\t\t\t@romanNumeral << (\"V\" * (num/5))\n\t\t\tnum %= 5\n\t\telse\n\t\t\tif\n\t\t\t\tnum / 4 > 0 \n\t\t\t\t@romanNumeral << (\"I\" * (num/4))\n\t\t\t\tnum %= 4\n\t\t\telse\n\t\t\t\tnum / 1 > 0 \n\t\t\t\t@romanNumeral << (\"I\" * (num/1))\n\t\t\t\tnum %= 1\n\t\t\tend\t\n\t\tend\n\tend\n\n\t@romanNumeral\n\nend",
"def old_roman_numeral num\nnumerals = \"\"\nnumerals << \"M\" * (num / 1000)\nnumerals << \"D\" * (num % 1000 /500)\nnumerals << \"C\" * (num % 500 / 100)\nnumerals << \"L\" * (num % 100 / 50)\nnumerals << \"X\" * (num % 50 / 10)\nnumerals << \"V\" * (num % 10 / 5)\nnumerals << \"I\" * (num % 5 / 1)\nnumerals\nend",
"def roman_numeral(num)\n digits = [[1000, 500, 100, 50, 10, 5, 1], [0, 0, 0, 0, 0, 0, 0], ['M','D','C','L','X','V','I']]\n answer = ' '\n h = 0\n \n digits[0].each do |z|\n if num / z > 0\n digits[1][h] = (num / z) #Counting the number of 10s, 50s, 100s, etc in num\n num = num % z #Using the remainder as the next value of num\n end\n h += 1\n end\n \n for a in 0..digits[1].size - 1 do #Iterate through array to calculate roman numerals old school style\n answer << digits[2][a] * digits[1][a]\n answer = answer.gsub(\"DCCCC\",\"CM\").gsub(\"CCCC\",\"CD\").gsub(\"LXXXX\",\"XC\").gsub(\"XXXX\",\"XL\").gsub(\"VIIII\",\"IX\").gsub(\"IIII\",\"IV\") #Catching edge cases to update old school roman numeral\n end\n\n answer.strip\nend",
"def roman_numeral(num)\n thousands = (num / 1000)\n hundreds = (num % 1000 / 100)\n tens = (num % 100 / 10)\n ones = (num % 10)\n\n roman = 'M' * thousands\n\n if hundreds == 9\n roman = roman + 'CM'\n elsif hundreds == 4\n roman = roman + 'CD'\n else\n roman = roman + 'D' * (num % 1000 / 500)\n roman = roman + 'C' * (num % 500 / 100)\n end\n\n if tens == 9\n roman = roman + 'XC'\n elsif tens == 4\n roman = romann + 'XL'\n else\n roman = roman + 'L' * (num % 100 / 50)\n roman = roman + 'X' * (num % 50 / 10)\n end\n\n if ones == 9\n roman = roman + 'IX'\n elsif ones == 4\n roman = roman + 'IV'\n else\n roman = roman + 'V' * (num % 10 / 5)\n roman = roman + 'I' * (num % 5 / 1)\n end\n roman\nend",
"def roman_numeral num\n thous = (num / 1000)\n hunds = (num % 1000 / 100)\n tens = (num % 100 / 10)\n ones = (num % 10 )\n\n roman = \"M\" * thous\n if hunds == 9\n roman = roman + \"CM\" \n elsif hunds == 4\n roman = roman + \"CD\"\n else\n roman = roman + \"D\" * (num % 1000 / 500)\n roman = roman + \"C\" * (num % 500 / 100)\n end\n\n if tens == 9 \n roman = roman + \"XC\"\n elsif tens == 4\n roman = roman + \"XL\"\n else\n roman = roman + \"L\" * (num % 100 / 50) \n roman = roman + \"X\" * (num % 50 / 10)\n end\n\n if ones == 9 \n roman = roman + \"IX\"\n elsif ones == 4\n roman = roman + \"IV\"\n else\n roman = roman + \"V\" * (num % 10/ 5)\n roman = roman + \"I\" * (num % 5 / 1)\n end\n roman\n end",
"def old_school_roman_numeral(num)\n arabs_to_romans = [\n ['M', 1000],\n ['D', 500],\n ['C', 100],\n ['L', 50],\n ['X', 10],\n ['V', 5],\n ['I', 1]\n ]\n\n result = ''\n\n arabs_to_romans.each do |arab_to_roman|\n arab = arab_to_roman[1]\n roman = arab_to_roman[0]\n\n if num / arab != 0\n result += roman * (num / arab)\n num = num % arab\n end\n end\n result\nend",
"def old_roman_numeral number\n digits = []\n i = 4\n while i>0\n digits.push (number%10)\n number = (number/10).to_i\n i -= 1\n end\n thousandth = 'M'*digits[3]\n hundredth = 'D'*(digits[2]/5).to_i+'C'*(digits[2]%5)\n tenth = 'L'*(digits[1]/5).to_i+'X'*(digits[1]%5)\n unit = 'V'*(digits[0]/5).to_i+'I'*(digits[0]%5)\n puts thousandth+hundredth+tenth+unit\nend",
"def old_roman_numeral number\n numeral = \"\"\n\n numeral = numeral + \"M\" * (number / 1000)\n numeral = numeral + \"D\" * (number % 1000/500)\n numeral = numeral + \"C\" * (number % 500/ 100) \n numeral = numeral + \"L\" * (number % 100/ 50) \n numeral = numeral + \"X\" * (number % 50/ 10) \n numeral = numeral + \"V\" * (number % 10/ 5) \n numeral = numeral + \"I\" *(number % 5/ 1) \n numeral\nend",
"def roman_numerals number\n roman_numerals = ''\n\n roman_numerals += 'M' * (number / 1000)\n number %= 1000\n\n roman_numerals += 'D' * (number / 500)\n number %= 500\n\n roman_numerals += 'C' * (number / 100)\n number %= 100\n\n roman_numerals += 'L' * (number / 50)\n number %= 50\n\n roman_numerals += 'X' * (number / 10)\n number %= 10\n\n roman_numerals += 'V' * (number / 5)\n number %= 5\n\n roman_numerals += 'I' * (number / 1)\n number %= 1\n\n roman_numerals\nend",
"def roman_numeral num\n\n number1000s = (num / 1000)\n number100s = (num % 1000) / 100\n number10s = (num % 100) / 10\n number1s = (num % 10) / 1\n\n numberDs = (num % 1000) / 500\n numberCs = (num % 500) / 100\n numberLs = (num % 100) / 50\n numberXs = (num % 50) / 10\n numberVs = (num % 10) / 5\n numberIs = (num % 5) / 1\n\n result = \"M\" * number1000s\n\n if number100s == 9\n result = result + \"CM\"\n elsif number100s == 4\n result = result + \"CD\"\n else\n result = result + \"D\" * numberDs\n result = result + \"C\" * numberCs\n end\n\n if number10s == 9\n result = result + \"XC\"\n elsif number10s == 4\n result = result + \"XL\"\n else\n result = result + \"L\" * numberLs\n result = result + \"X\" * numberXs\n end\n\n if number1s == 9\n result = result + \"IX\"\n elsif number1s == 4\n result = result + \"IV\"\n else\n result = result + \"V\" * numberVs\n result = result + \"I\" * numberIs\n end\n\n result\n\nend",
"def new_roman_numeral number\n digits = []\n i = 4\n while i>0\n digits.push (number%10)\n number = (number/10).to_i\n i -= 1\n end\n thousandth = 'M'*digits[3]\n hundredth = 'D'*(digits[2]/5).to_i+'C'*(digits[2]%5)\n tenth = 'L'*(digits[1]/5).to_i+'X'*(digits[1]%5)\n unit = 'V'*(digits[0]/5).to_i+'I'*(digits[0]%5)\n hundredth = 'CD' if hundredth == 'C'*4\n hundredth = 'CM' if hundredth == 'D'+'C'*4\n tenth = 'XL' if tenth == 'X'*4\n tenth = 'XC' if tenth == 'L'+'X'*4\n unit = 'IV' if unit == 'I'*4\n unit = 'IX' if unit == 'V'+'I'*4\n puts thousandth+hundredth+tenth+unit\nend",
"def modern_roman_numeral number\n numeral = \"\"\n\n numeral_1 = (number / 1000)\n numeral_2 = (number % 1000/100)\n numeral_3 = (number % 100/ 10) \n numeral_4 = (number % 10) \n \n roman = \"M\" * numeral_1\n\nif numeral_2 == 9\n roman = roman + \"CM\"\nelsif numeral_2 == 4\n roman = roman + \"CD\"\nelse\n roman = roman + \"D\" * (number % 1000 / 500)\n roman = roman + \"C\" *(number % 500/100) \n end\nif numeral_3 == 9\n roman = roman + \"XC\"\nelsif numeral_3 == 4\n roman = roman + \"XL\"\nelse\n roman=roman +\"L\" *(number % 100/ 50)\n roman=roman + \"X\"*(number % 50/ 10) \n end\nif numeral_4 == 9\n roman = roman + \"IX\"\nelsif numeral_4 == 4\n roman = roman + \"IV\"\nelse\n roman = roman + \"V\" * (number % 10/ 5)\n roman = roman + \"I\" * (number % 5/ 1) \nend\n\nroman\n\nend",
"def old_roman_numeral num\n\troman = ''\n\n\troman = roman + 'M' * (num / 1000)\n\troman = roman + 'D' * (num % 1000 / 500)\n\troman = roman + 'C' * (num % 500 / 100)\n\troman = roman + 'L' * (num % 100 / 50)\n\troman = roman + 'X' * (num % 50 / 10)\n\troman = roman + 'V' * (num % 10 / 5)\n\troman = roman + 'I' * (num % 5 / 1)\n\n\troman\nend",
"def Old_Roman_Numerals number #THANKS SATAN, for such a stress inducing exercise.\n m_length = 0\n d_length = 0\n c_length = 0\n l_length = 0\n x_length = 0\n v_length = 0\n i_length = 0\n\n if number >= 1000 #Is this unconventional? Yes. Does it work? Yes.\n m_length = number / 1000\n number = number % 1000\nend\n\n if number >= 500\n d_length = number / 500\n number = number % 500\nend\n\n if number >= 100\n c_length = number / 100\n number = number % 100\nend\n\n if number >= 50\n l_length = number / 50\n number = number % 50\nend\n\n if number >= 10\n x_length = number / 10\n number = number % 10\nend\n\n if number >= 5\n v_length = number / 5\n number = number % 5\nend\n\n if number < 5\n i_length = number / 1\n number = number % 10\nend\n\nputs 'M'*m_length + # Prefer clean order list vs. one long code line.\n 'D'*d_length +\n 'C'*c_length +\n 'L'*l_length +\n 'X'*x_length +\n 'V'*v_length +\n 'I'*i_length\nend",
"def new_roman_numeral num\n roman = ''\n\n roman << 'M' * (num / 1000)\n\n digit_hundred = num % 1000 / 100\n if digit_hundred >= 5\n if digit_hundred == 9\n roman << 'CM'\n else\n roman << 'D'\n roman << 'C' * (digit_hundred % 5)\n end\n else\n if digit_hundred == 4\n roman << 'CD'\n else\n roman << 'C' * digit_hundred\n end\n end\n\n digit_ten = num % 100 / 10\n if digit_ten >= 5\n if digit_ten == 9\n roman << 'XC'\n else\n roman << 'L'\n roman << 'X' * (digit_ten % 5)\n end\n else\n if digit_ten == 4\n roman << 'XL'\n else\n roman << 'X' * digit_ten\n end\n end\n\n digit_one = num % 10\n if digit_one >= 5\n if digit_one == 9\n roman << 'IX'\n else\n roman << 'V'\n roman << 'I' * (digit_one % 5)\n end\n else\n if digit_one == 4\n roman << 'IV'\n else\n roman << 'I' * digit_one\n end\n end\n\n roman\nend",
"def new_roman_numeral(number)\n \n roman = \"\"\n\n thousands_place = number/1000\n hundreds_place = (number%1000)/100\n tens_place = (number%100)/10\n ones_place = (number%10)\n\n roman << \"M\"*thousands_place\n\n if hundreds_place == 9\n roman << \"CM\"\n elsif hundreds_place == 4\n roman << \"CD\"\n else\n roman = roman << 'D' * (number%1000 /500)\n roman = roman << 'C' * (number%500 /100)\n end\n\n if tens_place == 9\n roman << \"XC\"\n elsif tens_place == 4\n roman << \"XL\"\n else\n roman = roman << 'L' * (number%100 /50)\n roman = roman << 'X' * (number%50 /10)\n end\n\n\n if ones_place == 9\n roman << \"IX\"\n elsif ones_place == 4\n roman << \"IV\"\n else\n roman = roman << 'V' * (number%10 /5)\n roman = roman << 'I' * (number%5)\n end\n \n\n\nend",
"def old_roman number\n\tnumerals = []\n\twhile number < 0\n\t\tputs 'please use a whole number => 1 and <= 3000'\n\tend\n\tif number % 1000 > 0\n\t\tthousands = number / 1000\n\t\tm_numerals = 'M' * thousands\n\t\tnumerals.push m_numerals\n\t\tnumber = number - (thousands * 1000)\n\tend\n\tif number % 500 > 0\n\t\tnumerals.push 'D'\n\t\tnumber = number - 500\n\tend\n\tif number % 100 > 0\n\t\thundreds = number / 100\n\t\tc_numerals = 'C' * hundreds\n\t\tnumerals.push c_numerals\n\t\tnumber = number - (hundreds * 100)\n\tend\n\tif number % 50 > 0\n\t\tnumerals.push 'L'\n\t\tnumber = number - 50\n\tend\n\tif number % 10 > 0\n\t\ttens = number / 10\n\t\tx_numerals = 'X' * tens\n\t\tnumerals.push x_numerals\n\t\tnumber = number - (tens * 10)\n\tend\n\tif number % 5 > 0\n\t\tnumerals.push 'V'\n\t\tnumber = number - 5\n\tend\n\n\tones = number\n\ti_numerals = 'I' * ones\n\tnumerals.push i_numerals\n\n\tputs numerals\nend",
"def old_roman_numeral(num)\n return \"Please use a positive integer.\" if num <= 0\n \n roman = \"\"\n \n roman << \"M\" * (num / 1000)\n roman << \"D\" * (num % 1000 / 500)\n roman << \"C\" * (num % 500 / 100)\n roman << \"L\" * (num % 100 / 50)\n roman << \"X\" * (num % 50 / 10)\n roman << \"V\" * (num % 10 / 5)\n roman << \"I\" * (num % 5 / 1)\n \n roman\nend",
"def roman_numeral num\n\tif num > 999999\n\t\treturn \"number too big for roman numerals\"\n\tend\n\n\trom_digits = ['I','V','X','L','C','D','M','P','Q','R','S','T','A','B','E','F']\n\tnum_of_digits = (num).to_s.length\n\troman_num = ''\n\n\tfor i in 0...num_of_digits\n\t\troman_num = romnum_1_to_9(num,rom_digits[i*2],rom_digits[i*2+1],rom_digits[i*2+2],10**i) + roman_num\n\tend\n\t\n\treturn roman_num.downcase\n\nend",
"def old_roman_numeral num\n working_num = num\n roman_val = ''\n \n numeral_ref = [[1, 'I'],\n [5, 'V'],\n [10, 'X'],\n [50, 'L'],\n [100, 'C'],\n [500, 'D'],\n [1000, 'M']]\n \n (0...numeral_ref.length).reverse_each { |i|\n if working_num >= numeral_ref[i][0]\n mult = working_num/numeral_ref[i][0]\n roman_val += numeral_ref[i][1]*(mult)\n working_num %= numeral_ref[i][0]\n end\n }\n roman_val\nend",
"def roman_numeral roman\n\tnumerals_hash = {\n\t\t\"i\" => 1, \n\t\t\"iv\"=> 4,\n\t\t\"v\" => 5, \n\t\t\"ix\"=> 9,\n\t\t\"x\" => 10, \n\t\t\"xl\" => 40,\n\t\t\"l\" => 50, \n\t\t\"xc\" => 90,\n\t\t\"c\" => 100, \n\t\t\"cd\" => 400,\n\t\t\"d\" => 500, \n\t\t\"cm\" => 900,\n\t\t\"m\" => 1000,\n\t\t}\n\tnumber_array = []\n\n\troman = roman.downcase\n\tinteger =0\n\n\tif roman == \"iv\"\n\t\tinteger = 4\n\telsif\troman.include? \"iv\" \n\t\tinteger += 4\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"ix\"\n\t\tinteger = 9\n\telsif roman.include? \"ix\"\n\t\tinteger+=9\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"xl\"\n\t\tinteger = 40\n\telsif roman.include? \"xl\"\n\t\tinteger+=40\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"xc\"\n\t\tinteger = 90\n\telsif roman.include? \"xc\"\n\t\tinteger+=90\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"cd\"\n\t\tinteger = 400\n\telsif roman.include? \"cd\"\n\t\tinteger+=400\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telsif roman == \"cm\"\n\t\tinteger = 900\n\telsif roman.include? \"cm\"\n\t\tinteger+=900\n\t\troman = roman[0..roman.length-3]\n\t\troman_array = roman.downcase.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\telse\n\t\troman_array = roman.split(//)\n\t\tstop_at = roman_array.length-2\n\t\t\n\t\troman_array.each do |numeral|\n\t\teach_num = numerals_hash[numeral]\n\t\tnumber_array.push each_num\n\t\tend\n\n\t\tstop_at = number_array.length-1\n\n\t\t(0..stop_at).each do |number|\n\t\tinteger += number_array[number]\n\t\tend\n\tend\n\n\tinteger\n\n\t\n# # Replaces the numeral letters in our array with integers via our hash\n# roman_array.each do |numeral|\n# each_num = numerals_hash[numeral]\n# number_array.push each_num\n# end\n\n# # Creates a new 2d array, filled with smaller arrays representing each pair of \"letters\"\n# \tresult = []\n\n# \t(0..stop_at).each do |i|\n# \t\tresult.push number_array[i..i+1]\n# \tend\n\n=begin\n\t\n our code stops working here. We were trying to compare\n each pair of values in the original array to determine\n if the value should be added or subtracted from a running\n integer total that would total up the value of the \n numeral. \n\t\n\n \t\n \tstop_at_2 = result.length-1\n \tinteger = 0\n \t\n\n \t(0..stop_at_2).each do |i|\n \t\tif result[i][i] >= result[i][i+1]\n \t \t\tinteger += result[i][i]\n \t \telse\n \t \t\tinteger += (result[i][i+1]-result[i][i])\n \t \tend\n \tend\n \t\n integer\nend\n\n\nOur tests don't make much sense at this point. We were\nbuilding smaller problems and small tests to fix them, \nbuilding up to bigger problems with our original method of\ncomparing pairs of numbers against each other.\n\nclass TestNumerals < Minitest::Test\n\t def test_x\n\t \tassert_equal roman_numeral(\"x\"), 10\n\t end\t\n\n\t def test_array_split\n\t \tassert_equal roman_numeral(\"XI\"),[\"X\",\"I\"]\n\t end\n\n\t def test_array2\n\t \tassert_equal roman_numeral(\"XIVXIL\"), [10,1,5,10,1,50]\n\t end\n\n\t def test_integer1\n\t \tassert_equal 60, roman_numeral(\"LX\")\n\t end\n\n\t def test_pair_up\n\t\tassert_equal roman_numeral(\"LXXIV\"), [[50,10],[10,10],[10,1],[1,5]]\n\t end\nend\n=end\nend",
"def num_to_roman_numeral num\n \n orig_num = num\n \n # Clear values for all characters before starting\n m = ''\n d = ''\n c = ''\n l = ''\n x = ''\n v = ''\n i = ''\n \n # Get 1000s\n if num/1000 >= 1\n m = 'M'*(num/1000)\n num = num%1000\n end\n \n # Get 500s\n if num/500 >= 1\n if num/100 == 9\n d = ''\n c = 'CM'\n num = num%100\n else\n d = 'D'*(num/500)\n num = num%500\n end\n end\n \n # Get 100s\n if num/100 >= 1\n c = 'C'*(num/100)\n num = num%100\n end\n \n # Get 50s\n if num/50 >= 1\n if num/10 == 9\n l = ''\n x = 'XC'\n num = num%10\n else\n l = 'L'*(num/50)\n num = num%50\n end\n end\n \n # Get 10s\n if num/10 >= 1\n if num/10 == 4\n x = 'XL'\n else\n x = 'X'*(num/10)\n end\n num = num%10\n end\n \n # Get 5s\n if num/5 >= 1\n if num == 9\n v = ''\n i = 'IX'\n num = 0\n else\n v = 'V'*(num/5)\n num = num%5\n end\n end\n \n # Get 1s\n if num >= 1\n if num == 4\n i = 'IV'\n num = 0\n else\n i = 'I'*num\n end\n end\n \n roman_numeral = m + d + c + l + x + v + i\n \n puts orig_num.to_s + ' in old roman numerals is ' + roman_numeral\nend",
"def from_roman(roman)\n roman = roman.strip.upcase\n roman_a = roman.chars\n integer = 0\n roman_a.zip(roman_a[1..-1]).each do |ch, nch|\n if CHAR_PRECEDENCE.has_key?(ch) and CHAR_PRECEDENCE[ch].include?(nch)\n integer -= CHAR_VALUES[ch]\n else\n integer += CHAR_VALUES[ch]\n end\n end\n integer\nend",
"def modern_roman_numeral(num)\n arabs_to_romans = [\n ['M', 1000],\n ['CM', 900],\n ['D', 500],\n ['CD', 400],\n ['C', 100],\n ['XC', 90],\n ['L', 50],\n ['XL', 40],\n ['X', 10],\n ['IX', 9],\n ['V', 5],\n ['IV', 4],\n ['I', 1]\n ]\n\n result = ''\n\n arabs_to_romans.each do |arab_to_roman|\n arab = arab_to_roman[1]\n roman = arab_to_roman[0]\n\n if num / arab != 0\n result += roman * (num / arab)\n num = num % arab\n end\n end\n result\nend",
"def old_roman_numeral num\n orn = ''\n \torn += 'M' * (num/1000)\n \tnum = num % 1000\n \torn += 'D' * (num/500)\n \tnum = num % 500\n \torn += 'C' * (num/100)\n \tnum = num % 100\n \torn += 'L' * (num/50)\n \tnum = num % 50\n \torn += 'X' * (num/10)\n \tnum = num % 10\n \torn += 'V' * (num/5)\n \tnum = num % 5\n \torn += 'I' * (num)\n \treturn orn\nend",
"def to_roman(num)\n \n output = ''\n\n if num\n how_many_thousand = (num - num % 1000) / 1000\n num = num - (num - num % 1000)\n\n how_many_hundred = (num - num % 100) / 100\n num = num - (num - num % 100)\n\n how_many_tens = (num - num % 10) / 10\n num = num - (num - num % 10)\n\n how_many_ones = num - (num - num % 10)\n else\n \treturn nil\n end\n\n #adding thousands\n output << 'M' * how_many_thousand\n #adding hundreds\n if how_many_hundred == 9\n \t output << 'CM'\n \telsif how_many_hundred >= 5\n \t output << 'D' + 'C' * (how_many_hundred - 5)\n elsif how_many_hundred == 4\n output << 'CD'\n else\n output << \"C\" * how_many_hundred\n end\n #adding tens\n if how_many_tens == 9\n \t output << 'XC'\n \telsif how_many_tens >= 5 \n \t output << 'L' + 'X' * (how_many_tens - 5)\n elsif how_many_tens == 4\n output << 'XL'\n else\n output << \"X\" * how_many_tens\n end\n #adding ones\n if how_many_ones == 9\n \t output << 'IX'\n \telsif how_many_ones >= 5 \n \t output << 'V' + 'I' * (how_many_ones - 5)\n elsif how_many_ones == 4\n output << 'IV'\n else\n output << \"I\" * how_many_ones\n end\n\n output\n\nend",
"def old_school_roman_numerial number\n roman = ''\n\n # 1000\n roman << \"M\" * (number / 1000)\n # 500\n roman << \"D\" * (number % 1000 / 500)\n # 100\n roman << \"C\" * (number % 1000 % 500 / 100)\n # 50\n roman << \"L\" * (number % 1000 % 500 % 100 / 50)\n # 10\n roman << \"X\" * (number % 1000 % 500 % 100 % 50 / 10)\n # 5\n roman << \"V\" * (number % 1000 % 500 % 100 % 50 % 10 / 5)\n # 1\n roman << \"I\" * (number % 1000 % 500 % 100 % 50 % 10 % 5 / 1)\n\n puts roman\nend",
"def old_roman_numeral num\r\n\traise 'must use + integer' if num <= 0\r\n\troman = ''\r\n\r\n\troman << 'M' * (num / 1000)\r\n\t\t# -> 1.925 -> 1 (floor)\r\n\troman << 'D' * (num % 1000 / 500)\r\n\t\t# -> 925/500 -> 1.85 -> 1 (floor)\r\n\troman << 'C' * (num % 500 / 100)\r\n\t\t# -> 425/100 -> 4.25 -> 4 (floor)\r\n\troman << 'L' * (num % 100 / 50)\r\n\t\t# -> 25/50 -> 0.5 -> 0 (floor)\r\n\troman << 'X' * (num % 50 / 10)\r\n\t\t# -> 25/10 -> 2.5 -> 2 (floor)\r\n\troman << 'V' * (num % 10 / 5)\r\n\t\t# -> 5/5 -> 1 -> 1\r\n\troman << 'I' * (num % 5 / 1)\r\n\t\t# -> 0/10 -> 0 -> 0\r\n\r\n\troman\r\nend",
"def roman_numeral year\n thou = year/1000\n thou_remain = year%1000\n five_hundreds = thou_remain/500\n hundreds = (thou_remain%500)/100\n fifties = ((thou_remain%500)%100)/50\n tens = (((thou_remain%500)%100)%50)/10\n fives = ((((thou_remain%500)%100)%50)%10)/5\n ones = (((((thou_remain%500)%100)%50)%10)%5)/1\n \n \n #this is just to clear the terminal screen so you only see the result.\n100.times do puts \"\" \n end\n \n #outputs the letters times the number returned.\n puts \"M\" * thou + \"D\" * five_hundreds + \"C\" * hundreds + \"L\" * fifties + \"X\" * tens + \"V\" * fives + \"I\" * ones\nend",
"def roman_numeral num\n working_num = num\n roman_val = ''\n \n # [number value, roman value, index of its modifier (if any)]\n numeral_ref = [[1, 'I'], #0\n [5, 'V', 0],\n [10, 'X', 0], #2\n [50, 'L', 2],\n [100, 'C', 2], # 4\n [500, 'D', 4],\n [1000, 'M', 4]] #6\n \n (0...numeral_ref.length).reverse_each { |i|\n \n ref_num = numeral_ref[i][0]\n ref_rom = numeral_ref[i][1]\n ref_mod_i = numeral_ref[i][2]\n ref_mod_num = ref_mod_i ? numeral_ref[ref_mod_i][0] : 0\n ref_mod_rom = ref_mod_i ? numeral_ref[ref_mod_i][1] : ''\n \n if working_num >= ref_num # The 'normal' case\n mult = working_num/ref_num\n roman_val += ref_rom*(mult)\n working_num %= ref_num\n end\n if working_num >= (ref_num - ref_mod_num) # The 'subtraction case'\n roman_val += ref_mod_rom+ref_rom\n working_num -= (ref_num - ref_mod_num)\n end\n \n }\n roman_val\nend",
"def new_roman_numeral num\n number = \"\"\n if (num / 1000) > 0\n number = \"M\" * (num / 1000)\n end\n if (num % 1000) >= 900 \n number += \"CM\"\n end\n if (num % 1000) >= 500 && (num % 1000) < 900\n number += \"D\"\n end\n if (num % 1000) >= 400 && (num % 1000) < 500\n number += \"CD\"\n end\n if ((num % 1000) % 500) >= 100 && ((num % 1000) % 500) < 400\n number += \"C\" * (((num % 1000) % 500) / 100)\n end\n if (((num % 1000) % 500) % 100) >= 90\n number += \"XC\"\n end\n if (((num % 1000) % 500) % 100) >= 50 && (((num % 1000) % 500) % 100) < 90\n number += \"L\"\n end\n if (((num % 1000) % 500) % 100) >= 40 && (((num % 1000) % 500) % 100) < 50\n number += \"XL\"\n end\n if (((num % 1000) % 500) % 50) >= 10 && (((num % 1000) % 500) % 50) < 40\n number += \"X\" * ((((num % 1000) % 500) % 50) / 10)\n end\n if ((((num % 1000) % 500) % 50) % 10) == 9\n number += \"IX\"\n end\n if ((((num % 1000) % 500) % 50) % 10) >= 5 && ((((num % 1000) % 500) % 50) % 10) < 9\n number += \"V\" + \"I\" * (((((num % 1000) % 500) % 50) % 10) % 5)\n end\n if ((((num % 1000) % 500) % 50) % 10) == 4\n number += \"IV\"\n end\n if ((((num % 1000) % 500) % 50) % 10) < 4\n number += \"I\" * (((((num % 1000) % 500) % 50) % 10) % 5)\n end\n puts number\nend",
"def roman_to_integer roman\r\n digit_vals = {'i' => 1,\r\n 'v' => 5,\r\n 'x' => 10,\r\n 'l' => 50,\r\n 'c' => 100,\r\n 'd' => 500,\r\n 'm' => 1000}\r\n total = 0\r\n prev = 0\r\n roman.reverse.each_char do |c_or_C|\r\n c = c_or_C.downcase\r\n val = digit_vals[c]\r\n if !val\r\n puts 'this is not a valid roman numeral!'\r\n return\r\n end\r\n if val < prev\r\n val *= -1\r\n else\r\n prev = val\r\n end\r\n\r\n total += val\r\n end\r\n\r\n total\r\nend",
"def roman_numeral num\n\tif num > 999999\n\t\treturn \"number too big for roman numerals\"\n\tend\n\n\trom_digits = ['I','V','X','L','C','D','M','P','Q','R','S','T','A','B','E','F']\n\tnum_of_digits = (num).to_s.length\n\troman_num = ''\n\n\tfor i in 0...num_of_digits\n\t\troman_num = romnum_1_to_9(num,rom_digits[i*2],rom_digits[i*2+1],rom_digits[i*2+2],10**i) + roman_num\n\tend\n\t\n\treturn roman_num\n\nend",
"def roman_numeral num\r\n\r\n\tthous = (num \t\t\t/ 1000)\r\n\thunds = (num \t% 1000 \t/ 100)\r\n\ttens = (num \t% 100 \t/ 10)\r\n\tones = (num \t% \t\t\t10)\r\n\r\n\troman = 'M' * thous\r\n\r\nend",
"def old_school(num) \n roman = ''\n roman = roman + 'M' * (num / 1000)\n roman = roman + 'D' * (num % 1000/ 500)\n roman = roman + 'C' * (num % 500/ 100)\n roman = roman + 'L' * (num % 100/ 50)\n roman = roman + 'X' * (num % 50/ 10)\n roman = roman + 'V' * (num % 10/ 5)\n roman = roman + 'I' * (num % 5/ 1)\n roman \nend",
"def roman_numerals(number)\n\n puts (\"M\" * (number/1000)).to_s\n if ((number%1000)%500) == 0\n puts (\"D\" * (number%1000/500)).to_s\n if ((number%500)%100) == 0\n puts (\"C\" * (number%500/100)).to_s\n if ((number%100)%50) == 0\n puts (\"L\" * (number%100/50)).to_s\n if ((number%50)%10) == 0\n puts (\"X\" * (number%50/10)).to_s\n if ((number%10)%5) == 0\n puts (\"V\" * (number%10/5)).to_s\n if ((number%5)%1)) == 0\n puts (\"I\" * (number%5/1)).to_s\n end\n end\n end\n end\n end\n end\n\n\nend",
"def old_roman num\r\n\r\n\taux = num\r\n\troman_num = ''\r\n\t\r\n\twhile true\r\n\t\r\n\t\tif((aux / 1000) >= 1)\r\n\t\t\troman_num = roman_num + 'M'\r\n\t\t\taux = aux - 1000\r\n\t\telsif ((aux / 500) >= 1)\r\n\t\t\tif(aux >= 900)\r\n\t\t\t\troman_num = roman_num + 'CM'\r\n\t\t\t\taux = aux - 900\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'D'\r\n\t\t\t\taux = aux - 500\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 100) >= 1)\r\n\t\t\tif(aux >= 400)\r\n\t\t\t\troman_num = roman_num + 'CD'\r\n\t\t\t\taux = aux - 400\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'C'\r\n\t\t\t\taux = aux - 100\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 50) >= 1)\r\n\t\t\tif(aux >= 90)\r\n\t\t\t\troman_num = roman_num + 'XC'\r\n\t\t\t\taux = aux - 90\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'L'\r\n\t\t\t\taux = aux - 50\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 10) >= 1)\r\n\t\t\tif(aux >= 40)\r\n\t\t\t\troman_num = roman_num + 'XL'\r\n\t\t\t\taux = aux - 40\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'X'\r\n\t\t\t\taux = aux - 10\t\t\r\n\t\t\tend\r\n\r\n\t\telsif((aux / 5) >= 1)\r\n\t\t\tif(aux >= 9)\r\n\t\t\t\troman_num = roman_num + 'IX'\r\n\t\t\t\taux = aux - 9\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'V'\r\n\t\t\t\taux = aux - 5\t\t\r\n\t\t\tend\r\n\t\telsif((aux / 1) >= 1)\r\n\t\t\tif(aux >= 4)\r\n\t\t\t\troman_num = roman_num + 'IV'\r\n\t\t\t\taux = aux - 4\t\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\troman_num = roman_num + 'I'\r\n\t\t\t\taux = aux - 1\t\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tbreak\t\t\t\r\n\t\tend\r\n\tend\r\n\t\r\n\troman_num\r\nend",
"def old_r_conv nums\n\troman = ''\n\troman = roman + 'M' * (nums/1000)\n\troman = roman + 'D' * ((nums%1000)/500)\n\troman = roman + 'C' * ((nums%500)/100)\n\troman = roman + 'L' * ((nums%100)/50)\n\troman = roman + 'X' * ((nums%50)/10)\n\troman = roman + 'V' * ((nums%10)/5)\n\troman = roman + 'I' * ((nums%5)/1)\n\n\tputs roman\nend",
"def roman_numbers num\n case num\n when 'CM'\n return 900\n when 'CD'\n return 400\n when 'XC'\n return 90\n when 'XL'\n return 40\n when 'IX'\n return 9\n when 'IV'\n return 4\n else\n return false\n end\nend",
"def roman_numeral num_to_convert\n\t\n\tnum_converted = ''\n\n\tthousands = num_to_convert / 1000\n\tnum_converted = 'M'*thousands\n\tremainder = num_to_convert % 1000\n\n\tfivehundreds = remainder / 500\n\tif remainder >= 900\n\t\tnum_converted += 'CM'\n\t\tremainder = remainder % 900\n\telse\n\t\tnum_converted += 'D'*fivehundreds\n\t\tremainder = remainder % 500\n\tend\n\n\tonehundreds = remainder / 100\n\tif onehundreds == 4\n\t\tnum_converted += 'CD'\n\t\tremainder = remainder % 400\n\telse\n\t\tnum_converted += 'C'*onehundreds\n\t\tremainder = remainder % 100\n\tend\n\t\n\n\tfifties = remainder / 50\n\tif remainder >= 90\n\t\tnum_converted += 'XC'\n\t\tremainder = remainder % 90\n\telse\n\t\tnum_converted += 'L'*fifties\n\t\tremainder = remainder % 50\t\n\tend\n\t\n\ttens = remainder / 10\n\tif tens == 4\n\t\tnum_converted += 'XL'\n\t\tremainder = remainder % 40\n\telse\n\t\tnum_converted += 'X'*tens\n\t\tremainder = remainder % 10\n\tend\n\t\n\tfives = remainder / 5\n\tif remainder >= 9\n\t\tnum_converted += 'IX'\n\t\tremainder = remainder % 9\n\telse\n\t\tnum_converted += 'V'*fives\n\t\tremainder = remainder % 5\n\tend\n\n\tones = remainder\n\tif ones == 4\n\t\tnum_converted += 'IV'\n\telse \n\t\tnum_converted += 'I'*ones\n\tend\n\n\tputs num_converted\n\treturn num_converted\nend",
"def solution(number)\n\nm, r_1 = number.divmod(1000)\ncd, r_2 = r_1.divmod(100)\nlx, r_3 = r_2.divmod(10)\nvi, r_4 = r_3.divmod(1)\n\nroman = []\n\nm.times { roman << \"M\" }\n\nif cd <= 3\n\tcd.times { roman << \"C\" }\nelsif cd == 4\n\troman << \"CD\"\nelsif cd == 5\n\troman << \"D\"\nelsif cd > 5 && cd < 9\n\troman << \"D\"\n\t(cd - 5).times { roman << \"C\" }\nelsif cd == 9\n\troman << \"CM\"\nend\n\nif lx <= 3\n\tlx.times { roman << \"X\" }\nelsif lx == 4\n\troman << \"XL\"\nelsif lx == 5\n\troman << \"L\"\nelsif lx > 5 && lx < 9\n\troman << \"L\"\n\t(lx - 5).times { roman << \"X\" }\nelsif lx == 9\n\troman << \"XC\"\nend\n\nif vi <= 3\n\tvi.times { roman << \"I\" }\nelsif vi == 4\n\troman << \"IV\"\nelsif vi == 5\n\troman << \"V\"\nelsif vi > 5 && vi < 9\n\troman << \"V\"\n\t(vi - 5).times { roman << \"I\" }\nelsif vi == 9\n\troman << \"IX\"\nend\n\nroman.join\n\nend",
"def roman_numeral num\n roman_to_arabic = {\n M: 1_000, CM: 900, D: 500, CD: 400,\n C: 100, XC: 90, L: 50, XL: 40,\n X: 10, IX: 9, V: 5, IV: 4,\n I: 1\n }\n\n return '' if num <= 0\n roman_to_arabic.each { |key, val| return key.to_s + roman_numeral(num - val) if num >= val }\nend",
"def to_roman2 number\t\r\n\t@roman = ''\r\n\tmarker = ['I','V','X','L','C','D','M']\r\n\t(0..Math.log10(number).to_i).each do |i|\r\n\t\tputs i\r\n\t\t@unit_number = (number % (10^(i+1)))/10^i\r\n\t\tputs @unit_number\t\r\n\t\t@roman = @roman + show_power_of_ten(@unit_number,marker[2*i+2],marker[2*i+1],marker[2*i])\t\r\n\tend\r\n\[email protected]\r\nend",
"def to_roman(num)\n place_value_digits = num.to_s.split('').map { |digit| digit.to_i}\n\n if place_value_digits.length == 0 \n return \"\"\n end \n\n if place_value_digits[0] == 0 \n place_value_digits.shift \n return \"\" + to_roman(place_value_digits) if place_value_digits.empty? == false\n return \"\"\n end \n\n if place_value_digits.length == 1 \n digit = place_value_digits.shift\n if digit <= 3\n return \"I\" * digit\n elsif digit == 4\n return \"IV\" \n elsif digit == 5 \n return \"V\" \n elsif digit > 5 && digit < 9\n return \"V\" + (\"I\" * (digit - 5))\n else \n return \"IX\"\n end \n\n elsif place_value_digits.length == 2 \n digit = place_value_digits.shift\n if digit <= 3\n return \"X\" * digit + to_roman(place_value_digits.join.to_i)\n elsif digit == 4\n return \"XL\" + to_roman(place_value_digits.join.to_i)\n elsif digit == 5 \n return \"L\" + to_roman(place_value_digits.join.to_i)\n elsif digit > 5 && digit < 9\n return \"L\" + (\"X\" * (digit - 5)) + to_roman(place_value_digits.join.to_i)\n else \n return \"XC\" + to_roman(place_value_digits.join.to_i)\n end \n\n elsif place_value_digits.length == 3\n digit = place_value_digits.shift\n if digit <= 3\n return \"C\" * digit + to_roman(place_value_digits.join.to_i)\n elsif digit == 4\n return \"CD\" + to_roman(place_value_digits.join.to_i)\n elsif digit == 5 \n return \"D\" + to_roman(place_value_digits.join.to_i)\n elsif digit > 5 && digit < 9\n return \"D\" + (\"C\" * (digit - 5)) + to_roman(place_value_digits.join.to_i)\n else \n return \"CM\" + to_roman(place_value_digits.join.to_i)\n end \n\n elsif place_value_digits.length == 4 \n digit = place_value_digits.shift\n return \"M\" * digit + to_roman(place_value_digits.join.to_i)\n end \n end",
"def old_roman num\r\n\r\n\taux = num\r\n\troman_num = ''\r\n\t\r\n\twhile true\r\n\t\r\n\t\tif((aux / 1000) >= 1)\r\n\t\t\troman_num = roman_num + 'M'\r\n\t\t\taux = aux - 1000\r\n\t\t\tputs aux\r\n\t\telsif ((aux / 500) >= 1)\r\n\t\t\troman_num = roman_num + 'D'\r\n\t\t\taux = aux - 500\t\t\r\n\t\t\tputs aux\r\n\t\telsif((aux / 100) >= 1)\r\n\t\t\troman_num = roman_num + 'C'\r\n\t\t\taux = aux - 100\r\n\t\t\tputs aux\r\n\t\telsif((aux / 50) >= 1)\r\n\t\t\troman_num = roman_num + 'L'\r\n\t\t\taux = aux - 50\r\n\t\t\tputs aux\r\n\t\telsif((aux / 10) >= 1)\r\n\t\t\troman_num = roman_num + 'X'\r\n\t\t\taux = aux - 10\r\n\t\t\tputs aux\r\n\t\telsif((aux / 5) >= 1)\r\n\t\t\troman_num = roman_num + 'V'\r\n\t\t\taux = aux - 5\r\n\t\t\tputs aux\r\n\t\telsif((aux / 1) >= 1)\r\n\t\t\troman_num = roman_num + 'I'\r\n\t\t\taux = aux - 1\r\n\t\t\tputs aux\r\n\t\telse\r\n\t\t\tbreak\t\t\t\r\n\t\tend\r\n\tend\r\n\t\r\n\troman_num\r\nend",
"def modern_roman (z)\n\tfirst = (z / 1000)\n\tsecond = (z % 1000 / 100)\n\tthird = (z % 100 / 10)\n\tlast = (z % 10 )\n\n\troman = \"\"\n\troman << \"M\" * first\n\n\tif second == 9\n\t\troman << \"CM\"\n\telsif second == 4\n\t\troman << \"CD\"\n\telse\n\t\troman << \"D\" * (z % 1000 / 500)\n\t\troman << \"C\" * (z % 500 / 100)\n\tend\n\n\tif third == 9\n\t\troman << \"XC\"\n\telsif third == 4\n\t\troman << \"XL\"\n\telse\n\t\troman << \"L\" * (z % 100 / 50)\n\t\troman << \"X\" * (z % 50 / 10)\n\tend\n\n\tif last == 9\n\t\troman << \"IX\"\n\telsif last == 4\n\t\troman << \"IV\"\n\telse\n\t\troman << \"V\" * (z % 10 / 5)\n\t\troman << \"I\" * (z % 5 / 1)\n\tend\nend",
"def old_roman_string num\n raise \"Use positive integer\" if num <= 0\n roman_str = ''\nroman_str << 'M' * (num /1000)\nroman_str << 'D' * (num % 1000 / 500)\nroman_str << 'C' * (num % 500 / 100)\nroman_str << 'L' * (num % 100 / 50)\nroman_str << 'X' * (num % 50 / 10)\nroman_str << 'V' * (num % 10 / 5)\nroman_str << 'I' * (num % 5 / 1)\n\n#build up the strings by * H,T,U\nend",
"def old_school_roman (y)\n\troman = \"\"\n\troman << \"M\" * (y / 1000)\n\troman << \"D\" * (y % 1000 / 500)\n\troman << \"C\" * (y % 500 / 100)\n\troman << \"L\" * (y % 100 / 50)\n\troman << \"X\" * (y % 50 / 10)\n\troman << \"V\" * (y % 10 / 5)\n\troman << \"I\" * (y % 5 / 1)\n\troman\nend",
"def roman number\n\t\nm_length = 0\nd_length = 0\nc_length = 0\nl_length = 0\nx_length = 0\nv_length = 0\ni_length = 0\n\nif number >= 1000\n\tm_length = number/1000\n\tnumber = number%1000\nend\nif number >= 500\n\td_length = number/500\n\tnumber = number%500\nend\nif number >= 100\n\tc_length = number/100\n\tnumber = number%100\nend\nif number >= 50\n\tl_length = number/50\n\tnumber = number%50\nend\nif number >= 10\n\tx_length = number/10\n\tnumber = number%10\nend\nif number >= 5\n\tv_length = number/5\n\tnumber = number%5\nend\nif number < 5\n\ti_length = number/1\n\tnumber = number%10\nend\n\nputs 'M'*m_length + 'D'*d_length + 'C'*c_length + 'L'*l_length + \"X\"*x_length + \"V\"*v_length + \"I\"*i_length\n\nend",
"def to_roman\n n = self\n roman = ''\n ROMAN_NUMBERS.each do |value, letter|\n roman << letter * (n / value)\n n = n % value\n end\n roman\n end",
"def to_roman\n result = ''\n number = self\n ROMAN_NUMERALS.each do |key, value|\n numeral, remainder = number.divmod(value)\n if numeral > 0 \n result += (key * numeral)\n end\n number = remainder\n end\n result\n end",
"def to_roman(num)\nend",
"def to_roman(num)\nend",
"def old_roman_numberals num\n roman = \"\"\n roman += \"M\" * (num/1000)\n roman += \"D\" * ((num%1000)/500)\n roman += \"C\" * ((num%500)/100)\n roman += \"L\" * ((num%100)/50)\n roman += \"X\" * ((num%50)/10)\n roman += \"V\" * ((num%10)/5)\n roman += \"I\" * ((num%5)/1)\nputs roman\nend",
"def to_roman(n)\n resto = []\n num = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]\n num.each do |element|\n resto.push(n / element)\n n = n % element\n end\n chars = %w[M CM D CD C XC L XL X IX V IV I]\n resto.each_with_index.map do |element, index|\n chars[index] * element\n end.join\nend",
"def to_modern_roman(number)\n\n\twhile number.to_i <= 3000\n\t\t# split number into an array\n\t\tarray = number.split(//).map { |x| x.to_i }\n\t\tresult =[]\n\t\t# array has length of 4\n\t\tuntil array.length == 4\n\t\tarray.unshift(0)\n\t\tend\n\t\t# 1000s of number\n\t\tif array[-4] < 4 \n\t\t\t\tnum = array[-4]\n\t\t\t\tnum.times { result << \"M\" }\n\t\tend\n\t\t# 100s of number\n\t\tif array[-3] < 4\n\t\t\t\tnum = array[-3]\n\t\t\t\tnum.times { result << \"C\" }\n\t\telsif array[-3] == 4\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"CD\"\n\t\telsif array[-3] == 6\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"DC\"\n\t\telsif array[-3] == 9\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"CM\"\n\t\telse\n\t\t\t\tnum = array[-3]\n\t\t\t\tresult << \"D\" \n\t\t\t\t(num-5).times { result << \"C\" }\n\t\tend\n\t\t# 10s of number\n\t\tif array[-2] < 4\n\t\t\t\tnum = array[-2]\n\t\t\t\tnum.times { result << \"X\" }\n\t\telsif array[-2] == 4\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"XL\"\n\t\telsif array[-2] == 6\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"LX\"\n\t\telsif array[-2] == 9\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"XC\"\n\t\telse\n\t\t\t\tnum = array[-2]\n\t\t\t\tresult << \"L\" \n\t\t\t\t(num-5).times { result << \"X\" }\n\t\tend\n\t\t# single digits of number\n\t\tif array[-1] < 4\n\t\t\t\tnum = array[-1]\n\t\t\t\tnum.times { result << \"I\" }\n\t\telsif array[-1] == 4\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"IV\"\n\t\telsif array[-1] == 6\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"VI\"\n\t\telsif array[-1] == 9\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"IX\"\n\t\telse\n\t\t\t\tnum = array[-1]\n\t\t\t\tresult << \"V\" \n\t\t\t\t(num-5).times { result << \"I\" }\t\n\t\tend\n\t\t# return number in roman numerals\n\t\tputs \"#{number} in New Style Roman Numerals is #{result.join(\"\")}.\"\n\t\texit\n\tend\n\tputs \"Number must be greater than 3000.\"\n\texit\nend",
"def BasicRomanNumerals(str)\n romans = { 'M' => 1000, 'D' => 500, 'C' => 100, 'L' => 50, 'X' => 10, 'V' => 5, 'I' => 1 }\n \n sum = 0\n str.chars.each_with_index do |char, idx|\n next sum += romans[char] if idx >= str.size - 1\n if romans[str[idx + 1]] > romans[char]\n sum -= romans[char]\n else\n sum += romans[char]\n end\n end\n sum\nend",
"def to_roman1(num)\n # Your code here\n ans = \"\"\n\n while (num / 1000 > 0)\n ans << 'M'\n num -= 1000\n end\n\n while (num / 500 > 0)\n ans << 'D'\n num -= 500\n end\n\n while (num / 100 > 0)\n ans << 'C'\n num -= 100\n end\n\n while (num / 50 > 0)\n ans << 'L'\n num -= 50\n end\n\n while (num / 10 > 0)\n ans << 'X'\n num -= 10\n end\n\n while (num / 5 > 0)\n ans << 'V'\n num -= 5\n end\n\n while (num > 0)\n ans << 'I'\n num -= 1\n end\n\n ans.gsub!(/DCCCC/, 'CM')\n ans.gsub!(/CCCC/, 'CD')\n ans.gsub!(/LXXXX/, 'XC')\n ans.gsub!(/XXXX/, 'XL')\n ans.gsub!(/VIIII/, 'IX')\n ans.gsub!(/IIII/, 'IV')\n\n ans\nend",
"def roman_numeral(arabic_numeral)\n arabic_array = arabic_numeral.to_s.split(//)\n arabic_array_int = arabic_array.map { |int| int.to_i }\n if arabic_array.length >= 8\n puts \">> This feature only supports numbers up to 9,999,999, as the unicode for Roman numerals above 1,000 is not universally displayable. Please enter a positive whole number less than 10,000,000:\"\n arabic_numeral = gets.to_i\n roman_numeral(arabic_numeral)\n loop do\n break if arabic_numeral > 0\n if arabic_numeral <= 0\n puts \">> Make sure that the number you enter is greater than 0:\"\n end\n arabic_numeral = gets.to_i\n end\n end\n# begin millions place\n if arabic_array_int[-7] != nil\n millions = arabic_array_int[-7] * 1000\n millions.times { |mmmmm| print \"M\" }\n end\n# begin hundred thousands place\n if arabic_array_int[-6] != nil\n hundred_thousands = arabic_array_int[-6] * 100\n hundred_thousands.times { |mmm| print \"M\" }\n end\n# begin ten thousands place\n if arabic_array_int[-5] != nil\n ten_thousands = arabic_array_int[-5] * 10\n ten_thousands.times { |mm| print \"M\" }\n end\n# begin thousands place\n if arabic_array_int[-4] != nil\n m = arabic_array_int[-4]\n m.times { |m| print \"M\" }\n end\n# begin hundreds place\n unless arabic_array_int[-3] != true || arabic_array_int[-3] == 9 || arabic_array_int[-3] == 4 || arabic_array_int[-3] >= 5 && arabic_array_int[-3] <= 8\n arabic_array_int[-3].times { |c| print \"C\" }\n end\n if arabic_array_int[-3] == 1\n print \"C\"\n end\n if arabic_array_int[-3] == 2\n print \"CC\"\n end\n if arabic_array_int[-3] == 3\n print \"CCC\"\n end\n if arabic_array_int[-3] == 4\n print \"CD\"\n end\n if arabic_array_int[-3] == 5\n print \"D\"\n elsif arabic_array_int[-3] == 6 \n print \"DC\"\n elsif arabic_array_int[-3] == 7\n print \"DCC\"\n elsif arabic_array_int[-3] == 8\n print \"DCCC\"\n end \n if arabic_array_int[-3] == 9\n print \"CM\"\n end\n \n# begin tens place\n unless arabic_array_int[-2] != true || arabic_array_int[-2] == 9 || arabic_array_int[-2] == 4 || arabic_array_int[-2] >= 5 && arabic_array_int[-2] <= 8\n arabic_array_int[-2].times { |x| print \"X\" }\n end\n if arabic_array_int[-2] == 1\n print \"X\" \n elsif arabic_array_int[-2] == 2\n print \"XX\"\n elsif arabic_array_int[-2] == 3\n print \"XXX\"\n elsif arabic_array_int[-2] == 4\n print \"XL\"\n elsif arabic_array_int[-2] == 5\n print \"L\"\n elsif arabic_array_int[-2] == 6 \n print \"LX\"\n elsif arabic_array_int[-2] == 7\n print \"LXX\"\n elsif arabic_array_int[-2] == 8\n print \"LXXX\"\n elsif arabic_array_int[-2] == 9\n print \"XC\"\n end\n \n# begin ones place\n unless arabic_array_int[-1] == 9 || arabic_array_int[-1] == 4 || arabic_array_int[-1] >= 5 && arabic_array_int[-1] <= 8\n arabic_array_int[-1].times { |ones| print \"I\" }\n end\n if arabic_array_int[-1] == 5\n print \"V\"\n elsif arabic_array_int[-1] == 6 \n print \"VI\"\n elsif arabic_array_int[-1] == 7\n print \"VII\"\n elsif arabic_array_int[-1] == 8\n print \"VIII\"\n end \n if arabic_array_int[-1] == 9\n print \"IX\"\n end\n if arabic_array_int[-1] == 4\n print \"IV\"\n end\n# end line for readability\nprint \"\\n\"\nend",
"def roman (remainder, digit)\r\n if remainder < digit # ie you do not have any of this roman letter\r\n x = nil.to_i\r\n else\r\n x = remainder / digit\r\n end\r\n\r\n y = remainder % digit\r\n\r\n return [x,y]\r\nend",
"def convertToRoman(n)\n #divide by roman num taken out\n #num is remainder \n #repeat\n roman = { 1000 => \"M\", 900 => \"CM\", 500 => \"D\", 400 => \"CD\", 100 => \"C\", 90 => \"XC\", 50 => \"L\", 40 => \"XL\", 10 => \"X\", 9 => \"IX\", 5 => \"V\", 4 => \"IV\", 1 => \"I\" }\n\n ans = \"\"\n roman.keys.each do |divisor|\n quotient, modulus = n.divmod(divisor)\n ans << roman[divisor] * quotient\n n = modulus\n end\n return ans \nend",
"def to_roman(num)\n roman_sym=[\"M\",\"CM\",\"D\",\"CD\",\"C\",\"XC\",\"L\",\"XL\",\"X\",\"IX\",\"V\",\"IV\",\"I\"]\n roman_val=[1000,900,500,400,100,90,50,40,10,9,5,4,1]\n roman = \"\"\n roman_sym.each_index do |i|\n roman += roman_sym[i] * (num/roman_val[i])\n num = num%roman_val[i]\n end\n return roman\nend",
"def get_roman()\n num = @number\n answer = \"\"\n# you can also use: If num >= 10 \n\n while num >= 10\n answer += \"X\"\n num -= 10\n end\n if num == 9\n answer += \"IX\"\n num -= 9\n end\n if num >= 5\n answer += \"V\"\n num -= 5\n end\n if num == 4\n answer += \"IV\"\n num -= 4\n end\n answer += \"I\" * num # * @number\n return answer\n end",
"def roman_to_integer roman \n digit_vals = {'i' => 1,\n 'v' => 5,\n 'x' => 10,\n 'l' => 50,\n 'c' => 100,\n 'd' => 500,\n 'm' => 1000}\n total = 0 \n prev = 0 \n index = roman.length - 1 \n while index >= 0 \n c = roman[index].downcase \n index = index - 1 \n val = digit_vals[c]\n if !val \n puts \"This is not a valud roman numeral\"\n return \n end \n if val < prev\n val = val * -1\n else \n prev = val \n end \n total = total + val \n end \n total \nend",
"def roman_convert(input)\n numerals_string = []\n input_array = input.split('')\n\n until input_array.empty?\n case input_array.length\n when 4\n puts \"#{input_array.first}000 = #{@thousands[input_array.first.to_i]}\"\n numerals_string.push(@thousands[input_array.shift.to_i])\n when 3\n puts \" #{input_array.first}00 = #{@hundreds[input_array.first.to_i]}\"\n numerals_string.push(@hundreds[input_array.shift.to_i])\n when 2\n puts \" #{input_array.first}0 = #{@tens[input_array.first.to_i]}\"\n numerals_string.push(@tens[input_array.shift.to_i])\n when 1\n puts \" #{input_array.first} = #{@units[input_array.first.to_i]}\"\n numerals_string.push(@units[input_array.shift.to_i])\n else\n break\n end\n end\n\n puts ''\n puts 'Your number converted to Roman Numerals is: '\n puts \"#{numerals_string.join}\"\n puts ''\n end",
"def roman\n return \"-#{(-self).roman}\" if self < 0\n return \"\" if self == 0\n @@roman_values_assoc.each do | (i, v) | return(i+(self-v).roman) if v <= self end\n end",
"def to_roman\n\n roman = ''\n\n roman = roman + 'M' * (self / 1000)\n roman = roman + 'D' * (self % 1000 / 500)\n roman = roman + 'C' * (self % 500 / 100)\n roman = roman + 'L' * (self % 100 / 50)\n roman = roman + 'X' * (self % 50 / 10)\n roman = roman + 'V' * (self % 10 / 5)\n roman = roman + 'I' * (self % 5 / 1)\n\n roman\n end",
"def roman_mappings\n {\n 1000 => 'M',\n 900 => 'CM',\n 500 => 'D',\n 400 => 'CD',\n 100 => 'C',\n 90 => 'XC',\n 50 => 'L',\n 40 => 'XL',\n 10 => 'X',\n 9 => 'IX',\n 5 => 'V',\n 4 => 'IV',\n 1 => 'I',\n }\n end",
"def new_roman_numeral num\n roman = \"\"\n if num == 400\n roman = \"CD\"\n elsif num == 40\n roman = \"XL\"\n elsif num == 4\n roman = \"IV\"\n elsif num == 9\n roman == \"IX\"\n elsif num == 90\n roman == \"XC\"\n elsif num == 900\n roman == \"CM\"\n end\n roman += \"M\" * (num/1000)\n roman += \"D\" * ((num%1000)/500)\n roman += \"C\" * ((num%500)/100)\n roman += \"L\" * ((num%100)/50)\n roman += \"X\" * ((num%50)/10)\n roman += \"V\" * ((num%10)/5)\n roman += \"I\" * ((num%5)/1)\n puts roman\n end",
"def to_roman2(num)\n result = \"\"\n \n @roman_mapping.each do |pair|\n value = pair[0]\n roman = pair[1]\n division_result = num / value\n result += roman * division_result\n num = num - (value * division_result)\n end\n return result\nend",
"def from_roman(str)\n hash = {}\n str.each_char do |letter|\n hash.default = 0\n hash[rn_to_decimal(letter)] += 1 \n end\n array = []\n hash.each do |k, v|\n array << k*v\n end\n array.reduce(:+)\nend",
"def to_roman\n roman = ''\n\n roman = roman + 'M' * (self / 1000)\n roman = roman + 'D' * (self % 1000 / 500)\n roman = roman + 'C' * (self % 500 / 100)\n roman = roman + 'L' * (self % 100 / 50)\n roman = roman + 'X' * (self % 50 / 10)\n roman = roman + 'V' * (self % 10 / 5)\n roman = roman + 'I' * (self % 5 / 1)\n\n roman\n\n end",
"def solution(roman)\n dict = { \"I\" => 1, \"V\" => 5, \"X\" => 10, \"L\" => 50, \"C\" => 100, \"D\" => 500, \"M\" => 1000, \"N\" => 0 }\n return 0 if roman == \"N\"\n arr = roman.split(//)\n \n arr.each do |char| # check if all characters are valid\n if !dict.keys.include?(char)\n raise \"Invalid\"\n end \n end\n \n fre = Hash.new(0)\n arr.each do |char|\n fre[char] += 1\n end\n \n raise \"Invalid\" if fre[\"V\"], fre[\"L\"], fre[\"D\"] == 2 # these characters can't appear twice\n \n fre.each_value do |value| # a character can't repeat more than 3 times\n if value > 3\n raise \"Invalid\"\n end\n end\n \n # translation starts\n\n num = 0\n last = arr.length\n arr<<'N'\n i = 0\n while i < last\n if dict[arr[i]] < dict[arr[i+1]]\n num += (dict[arr[i+1]] - dict[arr[i]])\n i += 2\n else\n num += dict[arr[i]]\n i += 1\n end\n end \n return num \nend\n \n",
"def romanNumerator(romanString)\n charArray = romanString.chars\n romanSum = 0\n\n charArray.each_with_index do |char, index|\n\n nextChar = charArray[index + 1]\n charCombo = []\n charCombo << charArray[index]\n charCombo << charArray[index+1]\n charCombo = charCombo.join.upcase\n\n\n if charCombo == \"IV\" || charCombo == \"IX\" || charCombo == \"XL\" || charCombo == \"XC\" || charCombo == \"CD\" || charCombo == \"CM\"\n if charCombo == \"IV\"\n romanSum += 4\n charArray[index+1] = 0\n elsif charCombo == \"IX\"\n romanSum += 9\n charArray[index+1] = 0\n elsif charCombo == \"XL\"\n romanSum += 40\n charArray[index+1] = 0\n elsif charCombo == \"XC\"\n romanSum += 90\n charArray[index+1] = 0\n elsif charCombo == \"CD\"\n romanSum += 400\n charArray[index+1] = 0\n elsif charCombo == \"CM\"\n romanSum += 900\n charArray[index+1] = 0\n end\n elsif char == \"I\"\n romanSum += 1\n elsif char == \"V\"\n romanSum += 5\n elsif char == \"X\"\n romanSum += 10\n elsif char == \"L\"\n romanSum += 50\n elsif char == \"C\"\n romanSum += 100\n elsif char == \"D\"\n romanSum += 500\n elsif char == \"M\"\n romanSum += 1000\n end\n end\n\n return romanSum\n\nend",
"def to_arabic_numeral(roman)\n number = sum = 0\n roman.bytes do |char| \n sum += number - 2 * number % number = 10 ** (205558 % char % 7) % 9995\n end\n sum + number\n end",
"def to_roman\n result = \"\"\n num_str = self.to_s\n str_a = num_str.split(//) # [\"1\", \"9\", \"9\", \"0\"]\n \n # case on number digits of the string array\n case str_a.size\n when 4\n result << do_digit(str_a[0], 1000)\n result << do_digit(str_a[1], 100)\n result << do_digit(str_a[2], 10 )\n result << do_digit(str_a[3], 1)\n when 3\n result << do_digit(str_a[0], 100)\n result << do_digit(str_a[1], 10)\n result << do_digit(str_a[2], 1) \n when 2\n result << do_digit(str_a[0], 10)\n result << do_digit(str_a[1], 1)\n when 1\n result << do_digit(str_a[0], 1) \n end\n result\n end",
"def roman_to_int(s)\n # Declare a variable with converting info from roman to integer\n roman = {\n \"I\" => 1,\n \"V\" => 5,\n \"X\" => 10,\n \"L\" => 50,\n \"C\" => 100,\n \"D\" => 500,\n \"M\" => 1000\n }\n # Declare a count variable for adding up numbers\n counts = 0\n # Iterate each letters in the array\n (0...s.length-1).each do |idx|\n # If the next number is small than the current one, add the number to the counts\n if roman[s[idx]] < roman[s[idx+1]]\n counts -= roman[s[idx]]\n else\n counts += roman[s[idx]] \n # else minus the number from the counts\n end\n # return the counts\n end\n counts += roman[s[-1]]\n\nend",
"def to_roman\n result = \"\"\n num_str = self.to_s\n str_a = num_str.split(//) # [\"1\", \"9\", \"9\", \"0\"]\n \n # case on number digits of the string array\n case str_a.size\n when 4\n result << do_digit(str_a[0], 1000)\n result << do_digit(str_a[1], 100)\n result << do_digit(str_a[2], 10 )\n result << do_digit(str_a[3], 1)\n when 3\n result << do_digit(str_a[0], 100)\n result << do_digit(str_a[1], 10)\n result << do_digit(str_a[2], 1) \n when 2\n result << do_digit(str_a[0], 10)\n result << do_digit(str_a[1], 1)\n when 1\n result << do_digit(str_a[0], 1) \n end\n result \n end",
"def to_roman\n result = \"\"\n number = self\n roman_mapping.keys.each do |divisor|\n quotient, modulus = number.divmod(divisor)\n result << roman_mapping[divisor] * quotient\n number = modulus\n end\n result\n end",
"def roman_to_integer str\r\n result = 0\r\n idx = 0\r\n\r\n # thousands\r\n while true\r\n if str[idx, 1].downcase != 'm'\r\n break\r\n end\r\n result += 1000\r\n idx += 1 \r\n end\r\n\r\n # 900 or 400 or 500\r\n if str[idx, 2].downcase == 'cm'\r\n result += 900\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'cd'\r\n result += 400\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'd'\r\n result += 500\r\n idx += 1\r\n end\r\n\r\n # hundreds\r\n while true\r\n if str[idx, 1].downcase != 'c'\r\n break\r\n end\r\n result += 100\r\n idx += 1\r\n end\r\n\r\n # 90 or 50 or 40\r\n if str[idx, 2].downcase == 'xc'\r\n result += 90\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'xl'\r\n result += 40\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'l'\r\n result += 50\r\n idx += 1\r\n end\r\n\r\n # tens\r\n while true\r\n if str[idx, 1].downcase != 'x'\r\n break\r\n end\r\n result += 10\r\n idx += 1 \r\n end\r\n\r\n # 9 or 4 or 5\r\n if str[idx, 2].downcase == 'ix'\r\n result += 9\r\n idx += 2\r\n elsif str[idx, 2].downcase == 'iv'\r\n result += 4\r\n idx += 2\r\n elsif str[idx, 1].downcase == 'v'\r\n result += 5\r\n idx += 1\r\n end\r\n\r\n # ones\r\n while true\r\n if str[idx, 1].downcase != 'i'\r\n break\r\n end\r\n result += 1\r\n idx += 1\r\n end\r\n\r\n if idx == str.length\r\n return result\r\n else\r\n puts \"#{str} is not a valid roman number\"\r\n end\r\nend",
"def solution(number)\n roman_numeral = { 1 => 'I', 4 => 'IV', 5=> 'V', 6 => 'VI', 10=> 'X', 50=> 'L', 100=> 'C', 500=> 'D', 1000=> 'M' }\n numbers = number.digits.map.with_index{ |int, idx| int * 10**idx }\n numbers.map{ |number| roman_numeral[number] }.reverse.join\nend",
"def int_to_roman val\n ROMAN_NUMERALS.map do |l, i|\n repeat, val = val.divmod i\n l * repeat\n end.join\n end",
"def convert_to_roman(i)\n\troman_numeral = \"\"\n\ti = i\n\t(i/1000).times {print \"M\"}\t\t\t\t# 3 * M\n\ti = i % 1000\t\t\t\t\t\t\t# i = 780\n\t\n\t(i/500).times {print \"D\"}\t\t\t\t# 1 * C\n\ti = i % 500\t\t\t\t\t\t\t\t# i = 280\n\n\t(i/100).times {print \"C\"}\t\t\t\t# 2 * C\n\ti = i % 100\t\t\t\t\t\t\t\t# i = 80\n\n\t(i/50).times {print \"L\"}\t\t\t\t# 1 * L\n\ti = i % 50\t\t\t\t\t\t\t\t# i = 30\n\n\t(i/10).times {print \"X\"}\t\t\t\t# 3 * X\n\ti = i % 10\t\t\t\t\t\t\t\t# i = 0\n\n\t(i/1).times {print \"I\"}\t\t\t\t\t# 0 * I\nend",
"def roman_to_integer(roman)\n values = {i: 1, v: 5, x: 10, l: 50, c: 100, d: 500, m: 1000}\n total = 0\n prev = 0\n index = roman.length - 1\n while index >= 0\n c = roman[index].downcase\n c = c.to_sym\n index = index - 1\n value = values[c]\n if !value\n return \"Not a valid roman numeral\"\n end\n if value < prev\n value = value * -1\n else\n prev = value\n end\n total = total + value\n end\n total\nend",
"def roman_to_int(s)\n\n sum = 0\n words = s.chars\n\n words.to_enum.with_index.reverse_each do |word, index|\n\n if index == words.length - 1\n sum += num_is(word)\n else\n if (index - 1 >= -1)\n curr = num_is(word)\n pre = num_is(words[index+1])\n\n if (pre > curr)\n sum -= curr\n else\n sum += curr\n end\n end\n\n end\n end\n\n return sum\nend",
"def to_roman3(num)\n result = \"\"\n @roman_mapping.each do |pair|\n value = pair[0]\n binding.pry\n roman = pair[1]\n level_occurance = num / value\n level_occurance.times do |x|\n result << roman\n end\n num = num - value * level_occurance\n end\n return result\nend",
"def convert(c)\n out = []\n if c == 100\n out << \"C\"\n c -= 100\n end\n if c >= 90\n out << \"XC\"\n c -= 90\n end\n if c >= 50\n out << \"L\"\n c -= 50\n end\n if c >= 40\n out << \"XL\"\n c -= 40\n end\n while c >= 10\n out << \"X\"\n c -= 10\n end\n if c == 9\n out << \"IX\"\n c -= 9\n end\n if c >= 5\n out << \"V\"\n c -= 5\n end\n if c == 4\n out << \"IV\"\n c -= 4\n end\n while c > 0\n out << \"I\"\n c -= 1\n end\n puts \"Your number in Roman Numeral is:\"\n puts out.join\nend",
"def to_roman\n old_roman_num = ''\n\n old_roman_num << 'M' * (self / 1000)\n\n old_roman_num << 'D' * (self % 1000 / 500)\n\n old_roman_num << 'C' * (self % 500 / 100)\n\n old_roman_num << 'L' * (self % 100 / 50)\n\n old_roman_num << 'X' * (self % 50 / 10)\n\n old_roman_num << 'V' * (self % 10 / 5)\n\n old_roman_num << 'I' * (self % 5 / 1)\n\n return old_roman_num\n end",
"def roman\n\t\treturn \"-#{(-self).roman}\" if self < 0\n\t\treturn \"\" if self == 0\n\t\t@@roman_values_assoc.each do | (i, v) |\treturn(i+(self-v).roman) if v <= self\tend\n\tend",
"def int_to_roman_2(num)\n result = \"\"\n while num > 0\n if num >= 1000\n num -= 1000\n result += \"M\"\n elsif num >= 900\n num -= 900\n result += \"CM\"\n elsif num >= 500\n num -= 500\n result += \"D\"\n elsif num >= 400\n num -= 400\n result += \"CD\"\n elsif num >= 100\n num -= 100\n result += \"C\"\n elsif num >= 90\n num -= 90\n result += \"XC\"\n elsif num >= 50\n num -= 50\n result += \"L\"\n elsif num >= 40\n num -= 40\n result += \"XL\"\n elsif num >= 10\n num -= 10\n result += \"X\"\n elsif num >= 9\n num -= 9\n result += \"IX\"\n elsif num >= 5\n num -= 5\n result += \"V\"\n elsif num >= 4\n num -= 4\n result += \"IV\"\n else\n num -= 1\n result += \"I\"\n end\n end\n\n return result\nend",
"def roman_to_integer passcode\n\n\tdigit_vals = { 'i' => 1,\n\t\t\t\t 'v' => 5,\n\t\t\t\t 'x' => 10,\n\t\t\t\t 'l' => 50,\n\t\t\t\t 'c' => 100,\n\t\t\t\t 'd' => 500,\n\t\t\t\t 'm' => 1000}\n\n\ttotal = 0\n\tprev = 0\n\tindex = passcode.length-1\n\t\n\twhile index >=0\n\t\tc = passcode[index].downcase\n\t\tindex = index - 1\n\t\tval = digit_vals[c]\n\t\tif !val\n\t\t\tputs 'This is not a valid roman numeral!'\t\n\t\t\treturn\n\t\tend\n\n\t\tif val < prev\n\t\t\tval = val * -1\n\t\telse\n\t\t\tprev = val\n\t\tend\n\t\ttotal = total + val\n\tend\n\ttotal\n\nend",
"def ReduceRoman(myroman)\n lesschar = 0;\n newroman = \"\"\n puts \"orig roman = #{myroman}\"\n\n for i in 0...myroman.to_s.length-1 do\n count = 0\n j=i\n basechar = myroman[i]\n \n while ( $numbers[myroman[j]] == $numbers[myroman[j+1]]) do\n count = count + 1\n j = j+1\n end\n \n if(count == 4)\n case basechar\n when 'I'\n \n when 'V'\n \n when 'L'\n \n when 'C'\n \n when 'D'\n\n when 'M'\n \n end\n\n else\n for k in 0..count do\n newroman[k]=basechar\n end\n end\n\n end\n puts \"new roman is #{newroman}\"\n return lesschar\nend",
"def decimal_to_roman decimal\n roman = \"\"\n i = 0\n\n # Greedily append the highest roman numeral that fits\n while i < ROMANS.size\n numeral = ROMANS[i]\n if VALUE[numeral] <= decimal\n roman += numeral\n decimal -= VALUE[numeral]\n else\n i += 1\n end\n end\n\n # Find groups of unnecessary repeated numerals, replace with subtractive \n # pairs.\n for repeat in REPEATS do\n roman = roman.sub(repeat, SUB_PAIRS[repeat])\n end\n\n return roman\nend",
"def to_roman(num)\n\toutput = \"\"\n\t@roman_num.each do |key, val|\n\t\tremainder = num%key.to_i\n\t\twhile remainder < num\n\t\t\toutput << val\n\t\t\tnum = num - key.to_i\n\t\tend\n\tend\n\toutput\nend",
"def calculate_roman_numeral\n remaining_value = value\n roman_string = ''\n while (remaining_value > 0)\n value = biggest_number_that_fits_into(remaining_value)\n roman_string += numbers_to_numerals[value]\n remaining_value -= value\n end\n roman_string\n end",
"def roman_to_int(str)\n hash = {\n 'M' => 1000,\n 'D' => 500,\n 'C' => 100,\n 'L' => 50,\n 'X' => 10,\n 'V' => 5,\n 'I' => 1,\n }\n sum = 0\n cur = 0\n\n str.chars.each do |l|\n prev = cur\n cur = hash[l]\n sum += cur\n sum -= (prev * 2) if prev < cur\n end\n\n sum\nend",
"def roman_numeral number\n\nend",
"def first_roman_for( number )\n map = {\n 1 => 'I',\n 5 => 'V',\n 10 => 'X',\n 50 => 'L',\n 100 => 'C',\n 500 => 'D',\n 1000 => 'M'\n }\n \n decimal_place = number.to_s.size - 1 # the number of digits in the number passed\n factor = 10 ** decimal_place # the factor : 1 for one's place , 10 for tens place : the factor for the digit we are working on \n \n #append the roman_representation according to the digit\n return ( map[factor] ) * ( number/(factor) ) if number < 4 * factor \n return ( map[factor] + map[ 5*factor ] ) if number >= 4 * factor && number < 5 * factor\n return ( map[ 5 * factor ] ) if number >= ( 5 * factor ) && number < ( 6 * factor )\n return ( map[ 5 * factor ] + ( map[ factor ] * (( number - 5*factor )/factor) )) if number >= 6 * factor && number < 9 * factor\n return ( map[factor] + map[ 10 * factor ] ) if number >= 9 * factor\n end"
] | [
"0.8268601",
"0.8162354",
"0.81545943",
"0.8100603",
"0.80930024",
"0.80885345",
"0.8082562",
"0.7971593",
"0.7951563",
"0.79267955",
"0.7888079",
"0.78568465",
"0.78292936",
"0.7825537",
"0.7813372",
"0.7812969",
"0.7801929",
"0.7792692",
"0.7779612",
"0.77774316",
"0.7763954",
"0.775025",
"0.77392834",
"0.77380097",
"0.7724707",
"0.7720412",
"0.77115405",
"0.767972",
"0.7667466",
"0.76611894",
"0.7658013",
"0.765487",
"0.7652514",
"0.76410556",
"0.7621034",
"0.76198703",
"0.7605195",
"0.7596099",
"0.7583151",
"0.75443715",
"0.7538417",
"0.7530933",
"0.7508288",
"0.7506481",
"0.7504914",
"0.7490687",
"0.7484562",
"0.7477466",
"0.7464494",
"0.74571234",
"0.7453275",
"0.74478567",
"0.7447275",
"0.74169326",
"0.74024695",
"0.74024695",
"0.73820955",
"0.7375313",
"0.737503",
"0.7372806",
"0.73612297",
"0.7358348",
"0.7354772",
"0.7350767",
"0.73395115",
"0.7333386",
"0.73265153",
"0.7297612",
"0.7297406",
"0.7296527",
"0.7290231",
"0.7286849",
"0.7271725",
"0.726132",
"0.7245639",
"0.72406095",
"0.72380745",
"0.7236722",
"0.7236375",
"0.7231313",
"0.7226932",
"0.7224243",
"0.7180796",
"0.7177488",
"0.71562696",
"0.71421033",
"0.7140058",
"0.71390545",
"0.71284443",
"0.71208686",
"0.71166134",
"0.7115525",
"0.71133196",
"0.70603436",
"0.7048909",
"0.70484084",
"0.703086",
"0.70278394",
"0.70238036",
"0.70149726",
"0.70087004"
] | 0.0 | -1 |
Solution by author reimplementation | def old_r_conv nums
roman = ''
roman = roman + 'M' * (nums/1000)
roman = roman + 'D' * ((nums%1000)/500)
roman = roman + 'C' * ((nums%500)/100)
roman = roman + 'L' * ((nums%100)/50)
roman = roman + 'X' * ((nums%50)/10)
roman = roman + 'V' * ((nums%10)/5)
roman = roman + 'I' * ((nums%5)/1)
puts roman
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"def probers; end",
"def suivre; end",
"def anchored; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def formation; end",
"def verdi; end",
"def internal; end",
"def schumann; end",
"def intensifier; end",
"def villian; end",
"def terpene; end",
"def transformations; end",
"def refutal()\n end",
"def berlioz; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def operations; end",
"def operations; end",
"def strategy; end",
"def original_result; end",
"def stderrs; end",
"def transform; end",
"def identify; end",
"def feruchemist; end",
"def custom; end",
"def custom; end",
"def jack_handey; end",
"def trd; end",
"def offences_by; end",
"def weber; end",
"def celebration; end",
"def malts; end",
"def processor; end",
"def transforms; end",
"def wrapper; end",
"def r; end",
"def r; end",
"def original; end",
"def reflector; end",
"def reflector; end",
"def romeo_and_juliet; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def scientist; end",
"def isolated; end",
"def isolated; end",
"def internship_passed; end",
"def who_we_are\r\n end",
"def silly_adjective; end",
"def hiss; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def bs; end",
"def greibach_normal_form\n raise NotImplementedError\n end",
"def operation; end",
"def mitch_hedberg; end",
"def calculated; end",
"def returns; end",
"def rassoc(p0) end",
"def dh; end",
"def strain; end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def herald; end",
"def king_richard_iii; end",
"def internal?; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def gounod; end",
"def ibu; end",
"def manufacture; end",
"def zuruecksetzen()\n end",
"def final; end",
"def common\n \n end",
"def compilereturn\n\n end",
"def apply\n\t\t\t\t\n\t\t\tend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end"
] | [
"0.7484431",
"0.66558784",
"0.6488447",
"0.6488447",
"0.6484637",
"0.64493936",
"0.64450246",
"0.6346427",
"0.6346427",
"0.6346427",
"0.6346427",
"0.63020873",
"0.6098203",
"0.6056682",
"0.6056549",
"0.60565233",
"0.6036468",
"0.6012553",
"0.60120404",
"0.59948075",
"0.59726626",
"0.5968512",
"0.5968512",
"0.595886",
"0.595886",
"0.59556",
"0.5943979",
"0.588952",
"0.58703107",
"0.58696616",
"0.5856901",
"0.5842158",
"0.5842158",
"0.5840032",
"0.5813584",
"0.5794921",
"0.57892734",
"0.57778203",
"0.57587093",
"0.5750882",
"0.57176375",
"0.57042354",
"0.5703373",
"0.5703373",
"0.5700021",
"0.5690502",
"0.5690502",
"0.56888664",
"0.5665199",
"0.5665199",
"0.5665199",
"0.5665199",
"0.5665199",
"0.5663092",
"0.5654787",
"0.5654787",
"0.5644927",
"0.56374323",
"0.56224203",
"0.56158566",
"0.56042784",
"0.56042784",
"0.56042784",
"0.56042784",
"0.56042784",
"0.56042784",
"0.56042784",
"0.56042784",
"0.5601312",
"0.5589849",
"0.5589649",
"0.55874956",
"0.55733395",
"0.55656695",
"0.5548916",
"0.5544139",
"0.55432284",
"0.5535944",
"0.5535944",
"0.5535944",
"0.5535944",
"0.55312496",
"0.5529633",
"0.5516276",
"0.551046",
"0.551046",
"0.551046",
"0.55082434",
"0.5505689",
"0.550205",
"0.5501993",
"0.54907006",
"0.54849726",
"0.54798955",
"0.54767835",
"0.54752845",
"0.54752845",
"0.54752845",
"0.54752845",
"0.54752845",
"0.54752845"
] | 0.0 | -1 |
checks if conv is a replied to message | def replied_conv? usr
if @conv.posts.count > 1 && @conv.posts.last.user_id != usr.id
@conv.posts.each do |post|
return true if post.user_id == usr.id
end
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replied_conv? usr\n ConversationProcessor.new(self).replied_conv? usr\n end",
"def msg_sent?\n true\n end",
"def reply?\n self.operation == OP_REPLY\n end",
"def replied_to?\n !replied_at.nil?\n end",
"def reply?\n !!in_reply_to_status_id\n end",
"def receive_recipient rcpt\n true\n end",
"def receive_recipient rcpt\n true\n end",
"def receive_recipient rcpt\n true\n end",
"def receive_po\n is_received?\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def is_reply?\n\t\tthis.is_reply\n\tend",
"def sent?\n status == \"sent\"\n end",
"def can_reply_to(conversation)\n true\n end",
"def successfully_sent?(resource)\n message_kind = resolve_message_kind!(resource)\n\n return false if message_kind.nil?\n\n @message = find_message(message_kind, {})\n true\n end",
"def sent?\n status.sent? || status.received? || status.read?\n end",
"def isMyMessage(message)\r\n return message[:type] == :Sent\r\n end",
"def can_send?\n !sent?\n end",
"def sent?\n self.status == 'sent'\n end",
"def conversation_waiting_for_reply? conversation, by='Structure'\n if conversation.mailboxer_label_id == Mailboxer::Label::INFORMATION.id\n senders = conversation.messages.map(&:sender).compact.uniq\n if senders.length == 1 and !conversation.treated_by_phone\n return true\n end\n elsif conversation.mailboxer_label_id == Mailboxer::Label::REQUEST.id\n participation_request = conversation_participation_request(conversation)\n return (participation_request.present? and participation_request.pending? and participation_request.last_modified_by != by and !participation_request.past?)\n end\n\n return false\n end",
"def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend",
"def response?\n\t\treturn ((self.type == PACKET_TYPE_RESPONSE) ||\n\t\t (self.type == PACKET_TYPE_PLAIN_RESPONSE))\n\tend",
"def triggered?(msg)\n if understood?(msg)\n return reply\n end\n nil\n end",
"def replyable?\n true\n end",
"def response_received?\n !! @status\n end",
"def response_received?\n !! @status\n end",
"def reply?\n !self.in_reply_to.nil?\n end",
"def reply?\n !self.in_reply_to.nil?\n end",
"def needs_sending?\n !sent? && !flagged?\n end",
"def RESPOND?(message)\n @it.respond_to?(message)\n end",
"def check_outgoing_acknowledged message\n unless @outgoing_acknowledged[message.type]\n @outgoing_acknowledged[message.type] = true\n acknowledged_first_outgoing message\n end\n end",
"def sent?\n @sent\n end",
"def conversated?\n session[:conversations].include?(@conversation.id)\n end",
"def replyable?\n false\n end",
"def sent?\n sender_id.present?\n end",
"def check_ok_response( socket, msg )\n result = socket.recv( 100 )\n logger.debug( \"Result for #{msg} : #{result}\" )\n raise \"Invalid response for #{msg}\" unless result == \"OK\\n\"\n end",
"def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end",
"def respond\n\t\tconversation = current_user.mailbox.conversations.find(params[:id])\n\t\tif current_user.reply_to_conversation(conversation, params[:message])\n\t\t\trender json: { message: \"Replied conversation\"}\n\t\telse\n\t\t\trender json: { message: \"Could not send message\"}, status: :bad_request\n\t\tend\n\tend",
"def ok?\n first[OK] == 1 || reply.nil?\n end",
"def valid_response?(message)\n return true\n end",
"def success?\n reply_code == 0\n end",
"def received?\r\n self['trans_status']=='99'\r\n end",
"def is_message?\n in_reply_to && self.private\n end",
"def new_msg?\n msg && !event[:subtype]\n end",
"def respond_to_question(url, token, encrypted_id, resp)\n dputs __method__.to_s\n messages_req = setup_http_request($respond_to_message, @cookie, {:url => url, :arg => [resp, encrypted_id, token]})\n res = @http.request(messages_req)\n body = CGI.unescapeHTML(res.body.force_encoding('utf-8'))\n # Checking...\n if res.code == \"302\"\n found = false\n # Should not be a problem calling public instead private or other way\n get_public_conversations(res['location']).map{|m|\n m[:msgs].map{|c| found = true if c[:msg].include?(resp)}\n if found\n return true\n end\n }\n return false\n end\n raise SendReponseMessageError, \"Cannot received expected 302 code...\"\n end",
"def has_accepted_response?\n self.responses.accepted.any? {|response| response.accepted?}\n end",
"def message?\n false\n end",
"def process_rcpt_to rcpt\n unless @state.include?(:mail_from)\n send_data \"503 MAIL is required before RCPT\\r\\n\"\n else\n succeeded = proc {\n send_data \"250 Ok\\r\\n\"\n @state << :rcpt unless @state.include?(:rcpt)\n }\n failed = proc {\n send_data \"550 recipient is unacceptable\\r\\n\"\n }\n\n d = receive_recipient rcpt\n\n if d.respond_to?(:set_deferred_status)\n d.callback(&succeeded)\n d.errback(&failed)\n else\n (d ? succeeded : failed).call\n end\n\n=begin\n unless receive_recipient rcpt\n send_data \"550 recipient is unacceptable\\r\\n\"\n else\n send_data \"250 Ok\\r\\n\"\n @state << :rcpt unless @state.include?(:rcpt)\n end\n=end\n end\n end",
"def notifies_commenter? # ...of direct responses to this comment\n wants_notifications?\n end",
"def can_reply_to?(topic) false end",
"def sent?\n id.present? && error.blank?\n end",
"def acknowledged?\n !!@replies\n end",
"def sent?\n [email protected]?\n end",
"def can_be_replied_by?(attempting_user)\n if attempting_user\n published? && (is_public? || is_protected? || member?(attempting_user) || attempting_user.is_admin? ||\n (is_subscription_only? && attempting_user.is_paid_subscriber?))\n else\n false # must be logged in to make a reply\n end\n end",
"def alerted?\n !alert_sent.nil?\n end",
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end",
"def sent_to_channel?\n IRC.channel_name?(dest)\n end",
"def conversion_successful?\n ipaper_document && ipaper_document.conversion_status =~ /^DISPLAYABLE|DONE$/\n end",
"def converted?\n status[:status] == :done\n end",
"def valid_reply?\n # People can send multiple replies to the same message, in which case\n # the recipient is the same as the parent recipient.\n # For most replies, the message recipient should be the parent sender.\n # We use Set to handle both cases uniformly.\n Set.new([sender, recipient]) == Set.new([parent.sender, parent.recipient])\n end",
"def message_rendered?\n @_message_rendered\n end",
"def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end",
"def message_exists?(response)\n response.respond_to?(:name) && response.name == 'EXISTS'\n end",
"def received?\n status.received? || status.read?\n end",
"def can_recv?\n @socket.events & ZMQ::Poller::POLLIN == ZMQ::Poller::POLLIN\n end",
"def message?\n @command.eql? 'PRIVMSG'.freeze\n end",
"def test!\n begin\n send_message!(:recipient_number => '_', :body => '')\n rescue Excon::Errors::Error\n false\n rescue MessageRejectedError\n true\n else\n false # Gateway is being weird, should never accept that message\n end\n end",
"def delivered?\n processed? && !held? && !bounced? && message.present?\n end",
"def respond\n @sent_command = true\n res = @pending_command\n @pending_command = nil\n RightLinkLog.debug(format_log_message(\"Responding with pending command #{res}\"))\n return res\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end",
"def user_can_reply user \n \n if Connection.exists?(self.connection_id)\n return connection.is_active\n end\n false\n end",
"def autoresponse?(message)\n !!(\n # If any of the following headers are present and have the given value.\n {\n 'Delivered-To' => 'Autoresponder',\n 'Precedence' => 'auto_reply',\n 'Return-Path' => nil, # in most cases, this would signify a bounce\n 'X-Autoreply' => 'yes',\n 'X-FC-MachineGenerated' => 'true',\n 'X-POST-MessageClass' => '9; Autoresponder',\n 'X-Precedence' => 'auto_reply',\n }.find do |name,value|\n message[name] && message[name].decoded == value\n end ||\n # If any of the following headers are present.\n [\n 'X-Autogenerated', # value is one of Forward, Group, Letter, Mirror, Redirect or Reply\n 'X-AutoReply-From', # value is an email address\n 'X-Autorespond', # value is an email subject\n 'X-Mail-Autoreply', # value is often \"dtc-autoreply\" but can be another tag\n ].any? do |name|\n message[name]\n end ||\n # If the Auto-Submitted header is present and is not equal to \"no\".\n (\n message['Auto-Submitted'] &&\n message['Auto-Submitted'].decoded != 'no'\n ) ||\n # If the message subject matches the autoresponse pattern.\n (\n MultiMail.autoresponse_pattern &&\n message.subject &&\n message.subject[MultiMail.autoresponse_pattern]\n )\n )\n end",
"def transact_successful?(doc)\n doc != nil &&\n doc.elements['XTMAILING_RESPONSE'] != nil &&\n doc.elements['XTMAILING_RESPONSE'].elements['ERROR_CODE'] != nil\n end",
"def should_mail_submission_message? # -> email rejection message\n self.authorized == false && (self.message_sent == false && !self.message.blank?)\n end",
"def command_response?\n type == :command_response\n end",
"def sent?\n id.present?\n end",
"def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n when :ACK\n when :CANCEL\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response_to_cancel(@msg)\n return\n end\n else\n if client_transaction = @msg.connection.class.non_invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n end\n log_system_debug \"ignoring a response non matching a client transaction (#{@msg.sip_method} #{@msg.status_code})\" if $oversip_debug\n end",
"def pending_answer?\r\n\t\t\treturn (@type == 'answer' && @state == 're')\r\n\t\tend",
"def can_be_replied_to?\n !locked?\n end",
"def process_message_response\n # Is this email confirming receipt of a previous message? \n msg_id = find_message_id_tag(:subject=>@subject, :body=>@body)\n#puts \"**** body=#{@body}, msg_id=#{msg_id}\"\n if msg_id \n # Does the \"confirmed message\" id actually match a message?\n message = Message.find_by_id(msg_id)\n if message\n msg_tag = message_id_tag(:id => msg_id, :action => :confirm_tag) # e.g. !2104\n search_target = Regexp.new('[\\'\\s\\(\\[]*' + \"#{Regexp.escape(msg_tag)}\" + '[\\'\\s\\.,\\)\\]]*')\n # The main reason to strip out the tag (like !2104) from the message is that it may be the\n # first part of the response, if there is one; e.g. \"!2104 Kafanchan\" replying to a message\n # requesting location. \n user_reply = first_nonblank_line(@body)\n#puts \"**** user_reply='#{user_reply}'\"\n user_reply = user_reply.sub(search_target, ' ').strip if user_reply\n # Mark all members with this email address as having responded to this message\n @possible_senders.each do |a_member|\n message.process_response(:member => a_member, :text => user_reply, :mode => 'email')\n end\n else\n msg_tag = message_id_tag(:id => msg_id, :action => :create, :location => :body)\n Notifier.send_generic(@from_address, I18n.t('error_msg.invalid_confirmation')).deliver\n end\n end\n end",
"def canceled?\n special_message == \"This talk has been canceled/deleted\"\n end",
"def is_trashed?(conversation)\n conversation.is_trashed?(messageable)\n end",
"def is_trashed?(conversation)\n conversation.is_trashed?(messageable)\n end",
"def expected_messages_received?\n count >= expected\n end",
"def accounting_reply?\n return true if (self.kind_of?(AccountingReply))\n return false\n end",
"def pretend_message_was_sent(*args)\n if Process.pid == @host_pid\n Marshal.dump(args, @to_host)\n else\n Marshal.dump(args, @to_container)\n end\n end",
"def has_responses?\n if is_standard?\n respond_to?(:copy_responses_count_col) ? (copy_responses_count_col || 0) > 0 : copies.any?(&:has_responses?)\n else\n responses_count > 0\n end\n end",
"def respondent_is_not_author_poll?\n #\n # respondend.id == author.id\n\n if question.poll.author.id == user.id\n errors[:user_id] << 'author should not answer to his/her poll'\n end\n end",
"def isPriv?\n case @command\n when Event::RECV_CMND_PRIVMSG,Event::RECV_CMND_NOTICE\n #\n # Name which starts with '#','&' or '!' is channel name.\n #\n if(@to=~/^[\\#\\&\\!].+/)\n return false\n else\n return true\n end\n \n else\n return false\n end\n end",
"def remove_conv conv, user \n if user.id == conv.user_id\n return update_status(conv, user, 'status')\n elsif user.id == conv.recipient_id \n return update_status(conv, user, 'recipient_status')\n end\n false\n end",
"def has_message?\n has_message\n # && messages.count > 0\n end",
"def still_valid?\n return false if self.reply_type == 'conversation'\n participation_request = ParticipationRequest.find self.participation_request_id\n\n return false if participation_request.state != 'pending'\n return false if participation_request.date < Time.current\n\n !used\n end",
"def response?\n @type == :response\n end",
"def waiting_for?(packet)\n\t\treturn (packet.rid == rid)\n\tend",
"def resendable?\n (self.sent_at + 15.minutes) < Time.current\n end",
"def responded_to?(kase)\n !!self.responses.find(:first, :conditions => [\"responses.kase_id = ?\", kase.id])\n end",
"def reply(of_msg, content, cookies = nil)\n begin\n PUNK.start('reply','replying msg ...')\n response = of_msg.clone\n response.parent_id = of_msg.id\n response.id = CC.indigen_next_id(response.asset)\n response.content = content\n response.meta['protogen_cookies'] = cookies\n response.sender = '@@server@@'\n response.recipient = of_msg.asset\n user_api.mdi.tools.protogen.protogen_encode(response).each {|message| message.push}\n # success !\n PUNK.end('reply','ok','out',\"SERVER -> MSG[#{crop_ref(response.id,4)}] [reply of #{crop_ref(of_msg.id,4)}]\")\n # stats:\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['reply_sent_to_device'] += 1\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['total_sent'] += 1\n return response\n rescue Exception => e\n user_api.mdi.tools.log.error(\"Error on reply\")\n user_api.mdi.tools.print_ruby_exception(e)\n PUNK.end('reply','ko','out',\"SERVER -> MSG (reply)\")\n # stats:\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['err_on_reply'] += 1\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['total_error'] += 1\n return false\n end\n end",
"def received?\n !!self.received_at?\n end"
] | [
"0.7671172",
"0.6758361",
"0.6430282",
"0.6423208",
"0.63591963",
"0.62989885",
"0.62989885",
"0.62989885",
"0.62628335",
"0.62210596",
"0.62210596",
"0.61984015",
"0.6186934",
"0.61807084",
"0.614865",
"0.6137858",
"0.6130745",
"0.6126751",
"0.6051924",
"0.6044637",
"0.60351074",
"0.60351074",
"0.6031268",
"0.60174596",
"0.5999048",
"0.5999048",
"0.5978247",
"0.5978247",
"0.593266",
"0.59215415",
"0.5892773",
"0.58871466",
"0.5877566",
"0.5849164",
"0.584657",
"0.58338636",
"0.58211726",
"0.5805732",
"0.57874393",
"0.5782985",
"0.5763529",
"0.5759834",
"0.5750071",
"0.5742104",
"0.573228",
"0.57265675",
"0.5724285",
"0.5712316",
"0.5698616",
"0.5692057",
"0.5687048",
"0.56788254",
"0.56378543",
"0.56315976",
"0.5614336",
"0.56132567",
"0.56132567",
"0.56077504",
"0.55940664",
"0.5590271",
"0.5589695",
"0.5587727",
"0.5585208",
"0.55752766",
"0.5568443",
"0.5565976",
"0.5562083",
"0.55604607",
"0.5551591",
"0.5549761",
"0.5537276",
"0.55255705",
"0.55114746",
"0.550862",
"0.5505948",
"0.5503546",
"0.5499968",
"0.549406",
"0.54936916",
"0.54916435",
"0.54879063",
"0.54878914",
"0.54852176",
"0.5475628",
"0.5475628",
"0.54730445",
"0.54723245",
"0.54593647",
"0.5459238",
"0.54383105",
"0.5432547",
"0.54312974",
"0.5430682",
"0.5426186",
"0.54231524",
"0.5404744",
"0.54033107",
"0.5399073",
"0.539757",
"0.53946716"
] | 0.6440597 | 2 |
returns whether conversation has any associated unread posts | def any_unread? usr
@conv.posts.each do |post|
if post.unread?(usr) && post.recipient_id == usr.id
return true
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_unread?\n Message.any_in(conversation_id: conversations.map(&:id)).ne(read_by: id).present?\n end",
"def has_unread_messages?\n received_messages.count > 0\n end",
"def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end",
"def unread? user_id\n !unread_messages(user_id).blank?\n end",
"def unread_messages\n current_user.messages_in.where(read: false).count\n end",
"def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end",
"def unread?\n self.status == 'unread'\n end",
"def unread?\n (status == UNREAD)\n end",
"def unread?\n return (self.status == Email::STATUS_UNREAD)\n end",
"def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def is_unread?\n !is_read\n end",
"def unread?\n !read?\n end",
"def unread?\n read_at.nil?\n end",
"def unread?\n !read?\n end",
"def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end",
"def is_unread?(participant)\n return false if participant.nil?\n return self.receipts_for(participant).not_trash.is_unread.count!=0\n end",
"def any?\n messages.count.positive?\n end",
"def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end",
"def is_unread?(participant)\n return false unless participant\n receipts_for(participant).not_trash.is_unread.count != 0\n end",
"def has_message?\n has_message\n # && messages.count > 0\n end",
"def unread_messages\n @user_wise_unread_messages = current_user.user_messages\n .where(is_read: false)\n .joins(:message)\n .group('messages.user_id').count\n end",
"def unread_discussions\n discussions.find_unread_by(self)\n end",
"def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end",
"def has_unread_messages?(user)\n latest_message = self.last_message\n if latest_message\n chat_participation = self.chat_participations.where(user_id: user.id).first\n chat_participation.try(:unread_message?, latest_message)\n end\n end",
"def unread?\n !read?\nend",
"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 unread_qotds\n admin_conversations.current.recent.find_unread_by(self)\n end",
"def unread_messages_count\n @unread_messages_count ||= messages.unread.count\n end",
"def num_unread_messages\n return Message.where({:receiver_id => self.id, :read => false}).count\n end",
"def is_unread?(participant)\n return false if participant.nil?\n !receipt_for(participant).first.is_read\n end",
"def has_inbox\n @attributes[:has_inbox]\n end",
"def is_pending?\n (self.pending_feeds.count > 0)\n end",
"def unread_message_count(current_user)\n \tself.messages.where(\"user_id != ? AND read = ?\", current_user.id, false).count\n \tend",
"def unread_messages_count\n Rails.cache.fetch(\"user-unread_messages_count-#{id}\") do\n unread_conversations.count('messages.id')\n end\n end",
"def has_messages?\n\t\t\treturn !(messages.empty?)\n\t\tend",
"def unread_inbox_count\n mailbox.inbox(unread: true).count\n end",
"def unread_inbox_count\n mailbox.inbox(unread: true).count\n end",
"def unread_inbox_count\n mailbox.inbox(unread: true).count\n end",
"def acknowledged?\n !!@replies\n end",
"def replied_conv? usr\n if @conv.posts.count > 1 && @conv.posts.last.user_id != usr.id\n @conv.posts.each do |post|\n return true if post.user_id == usr.id\n end\n end\n false\n end",
"def unread_notification_count\n unread_notifications.count\n end",
"def is_denied?\n (self.denied_feeds.count > 0)\n end",
"def replies?\n !replies.empty?\n end",
"def replies?\n !replies.empty?\n end",
"def unread_count\n @status = Messenger.inbox_status(current_user)\n return_message(200, :ok, :count => @status[:unread])\n end",
"def is_in_conversation?(_user_id)\n conversation_members.where(user_id: _user_id).any?\n end",
"def unread_messages\n @attributes[\"unread_messages\"]\n end",
"def is_approved?\n (self.approved_feeds.count > 0) && ((self.pending_feeds.count + self.denied_feeds.count) == 0)\n end",
"def get_unpublished_count\n @unpublished_posts = Post.where(:published => false).size\n end",
"def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end",
"def unread_message_count\n eval 'messages.count(:conditions => [\"recepient_id = ? AND read_at IS NULL\", self.beamer_id])'\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def category_has_posts?\n\n current_status = false\n\n self.sub_categories.each do |sub_cat|\n current_status = sub_cat.posts.any?\n break if current_status == true\n end\n\n return current_status\n\n end",
"def unread_messages user_id\n messages.unread(user_id)\n end",
"def user_has_content(user)\n return (user.posts.count > 0 || user.comments.count > 0)\nend",
"def new_message_check\n if(!current_user.nil?)\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n if ids.count > 0\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n render text: '{\"unread\":\"true\", \"ids\":[' + ids.join(',') + ']}'\n else\n render text: '{\"unread\":\"false\"}'\n end\n else \n render text: '{\"unread\":\"false\"}'\n end\n end",
"def chat_unread_count\n unread = 0\n chats = Chat.or(\n { employer_username: self.username },\n { freelancer_username: self.username },\n { service_provider_username: self.username }\n )\n\n # Count each message as unread\n if chats.any?\n chats.each do |c|\n u = c.events.in(\n :\"_type\" => [\n \"ChatMessageEvent\",\n \"ChatBidEvent\",\n \"ChatBidAcceptEvent\"\n ]\n ).where(\n read: false\n ).nin(\n member_id: [self.id]\n ).count\n\n unread = unread + u\n end\n end\n\n return unread\n end",
"def unread_count(sender)\n if current_airline.present?\n sender.messages.where('customer_id = ? AND airline_id = ? AND sender = ? AND seen = ?', sender.id, current_airline.id, 'user-message', false).count\n elsif current_customer.present?\n sender.messages.where('customer_id = ? AND airline_id = ? AND sender = ? AND seen = ?', current_customer.id, sender.id, 'airline-message', false).count\n end\n end",
"def unpublished?\n (status == UNPUBLISHED)\n end",
"def unpublished?\n (status == UNPUBLISHED)\n end",
"def unpublished?\n (status == UNPUBLISHED)\n end",
"def unpublished?\n (status == UNPUBLISHED)\n end",
"def unpublished?\n (status == UNPUBLISHED)\n end",
"def current_user_hasmsg?\n response = get_current_user_meta('hasmsg')\n return false unless response\n\n response['query']['userinfo']['messages'] == ''\n end",
"def check_for_posts\n if self.posts.any?\n errors[:base] << \"cannot delete Topic tag when posts are using it!\"\n return false\n else\n return true\n end\n end",
"def unread\n all(UNREAD)\n end",
"def has_notifications?\n !notification_queue.empty?\n end",
"def total_messages_not_viewed\n @conversations = @current_user.conversations\n @not_viewed = 0\n @conversations.each do |c|\n @not_viewed += c.how_many_not_viewed(@current_user) unless c.how_many_not_viewed(@current_user) == nil\n end\n end",
"def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end",
"def has_feed?\n !feed.nil?\n end",
"def is_there_notification\n current_user.notifications\n end",
"def workspace_unread_count\n unread = 0\n workspaces = WorkspaceLancer.or(\n { employer_username: self.username },\n { freelancer_username: self.username },\n { service_provider_username: self.username }\n )\n\n\n # Count each message as unread\n if workspaces.any?\n workspaces.each do |w|\n u = w.events.where(\n read: false,\n :member_id.ne => self.id\n ).count\n\n unread = unread + u\n end\n end\n\n return unread\n end",
"def has_topics?\n !self.topics.empty?\n end",
"def following?(post)\n posts.include?(post)\n end",
"def mark_all_posts usr\n return false if usr.blank?\n @conv.posts.each do |post|\n post.mark_as_read! for: usr if post\n end\n end",
"def discussions?\n !!user && user.admin?\n end",
"def system_msg?\n posts.first.system_msg? rescue nil\n end",
"def sender_due_invoice?\n !posts.detect { |post| post.due_invoice? user }.nil?\n end",
"def sender_can_bill?\n !posts.detect { |post| post.can_bill? user }.nil?\n end",
"def has_unopened_notifications?(options = {})\n _unopened_notification_index(options).exists?\n end",
"def retweeted?\n retweeted_ids = h.current_user.retweeted_replies.pluck(:id)\n retweeted_ids.include?(self.id)\n end",
"def has_following?\n\t self.following_count > 0\n\tend",
"def unread\n read_attribute(:unread)\n end",
"def index\n @from_user = User.find(params[:user_id])\n @published = @from_user.discussions.published\n if @user.owns? @from_user\n @unpublished = @from_user.discussions.unpublished\n end\n end",
"def published?\r\n (publish_at.nil? || (publish_at <=> Time.now) <= 0) && (unpublish_at.nil? || (unpublish_at <=> Time.now) >= 0)\r\n end",
"def unread_topics user\r\n topics.find_all{|topic| topic.unread_comment?(user) }\r\n end",
"def unread_count(user)\n public_replies(user).unread_by(user).size + (unread?(user) ? 1 : 0)\n end",
"def unpublished?\n self.status == \"Unpublished\"\n end",
"def how_many?\n return default_article_sync if articles.length == 0\n last_db = articles.last.published\n count = 0\n feed.entries.each do |entry|\n count += 1 if entry.published > last_db\n end\n count > 20 ? 20 : count\n end",
"def attachments?\n self.attachments.size > 0\n end",
"def attachments?\n self.attachments.size > 0\n end",
"def has_comments?\n @comments_count > 0\n end",
"def recipient_due_invoice?\n !posts.detect { |post| post.due_invoice? recipient }.nil?\n end",
"def unread_feed_news_count(feed_id)\n count(:all, :conditions => [\"feed_id = ? AND user_id = ? AND read = ?\",\n feed_id, User.current_user_id, false])\n end",
"def read_notifications\n # Update post notification\n post_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Post', @post.id)\n .first\n post_notification.update_attributes(read: true) unless post_notification.nil?\n\n # Update post's messages notifications\n @post.messages.each do |message|\n message_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Message', message.id)\n .first\n message_notification.update_attributes(read: true) unless message_notification.nil?\n end\n end",
"def recipient_can_bill?\n !posts.detect { |post| post.can_bill? recipient }.nil?\n end",
"def read?\n !recipient_read_at.nil?\n end",
"def draft?\n data[\"draft\"] ||= relative_path.index(collection.relative_directory).nil? &&\n collection.label == \"posts\"\n end"
] | [
"0.79774034",
"0.7608553",
"0.73700744",
"0.730161",
"0.7006697",
"0.6941816",
"0.6934406",
"0.6927607",
"0.69178337",
"0.6910893",
"0.68594486",
"0.68594486",
"0.68594486",
"0.6850814",
"0.68155205",
"0.6780257",
"0.6730168",
"0.6643015",
"0.66117275",
"0.66050315",
"0.66005343",
"0.6566318",
"0.65255284",
"0.65106845",
"0.65015",
"0.648717",
"0.64706874",
"0.6452868",
"0.63372976",
"0.6330513",
"0.63085073",
"0.6291485",
"0.629038",
"0.6254673",
"0.6248426",
"0.62341106",
"0.6204837",
"0.61996305",
"0.61996305",
"0.61996305",
"0.6194939",
"0.6186151",
"0.6179423",
"0.61782515",
"0.6136582",
"0.6136582",
"0.61359084",
"0.61049414",
"0.60913485",
"0.6054764",
"0.60381544",
"0.6033142",
"0.6033075",
"0.60251766",
"0.60239",
"0.6019006",
"0.6012346",
"0.60057354",
"0.59960985",
"0.5993198",
"0.5986725",
"0.5986725",
"0.5986725",
"0.5986725",
"0.5986725",
"0.59839374",
"0.5955796",
"0.5954796",
"0.5954654",
"0.5937038",
"0.59240526",
"0.5876496",
"0.58657897",
"0.5858069",
"0.5849609",
"0.58441496",
"0.58351326",
"0.5833882",
"0.5823909",
"0.5806981",
"0.580526",
"0.5799488",
"0.5797943",
"0.57839835",
"0.5782478",
"0.57779735",
"0.5775224",
"0.57615453",
"0.57565403",
"0.5747121",
"0.5744717",
"0.57348514",
"0.57348514",
"0.5730908",
"0.5725946",
"0.5725569",
"0.5720202",
"0.57132924",
"0.5712723",
"0.5711263"
] | 0.80610716 | 0 |
check if user has a message in the conversation | def usr_msg? convo, usr
(usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_in_conversation?(_user_id)\n conversation_members.where(user_id: _user_id).any?\n end",
"def has_message?\n has_message\n # && messages.count > 0\n end",
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def show\n if user_signed_in?\n @message_has_been_sent = conversation_exist?\nend\n end",
"def current_user_hasmsg?\n response = get_current_user_meta('hasmsg')\n return false unless response\n\n response['query']['userinfo']['messages'] == ''\n end",
"def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end",
"def has_conversation?(conversation_id)\r\n self.conversations.has_key?(conversation_id.to_s)\r\n end",
"def has_messages?\n\t\t\treturn !(messages.empty?)\n\t\tend",
"def me?\n @msg.me?\n end",
"def is_message?\n in_reply_to && self.private\n end",
"def in_conversation? person = nil\n\t\treturn mode? :conversation if (person.nil?)\n\t\treturn @in_conversation if (person && person.is?(:person) && mode?(:conversation))\n\t\treturn nil\n\tend",
"def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end",
"def has_unread_messages?(user)\n latest_message = self.last_message\n if latest_message\n chat_participation = self.chat_participations.where(user_id: user.id).first\n chat_participation.try(:unread_message?, latest_message)\n end\n end",
"def conversated?\n session[:conversations].include?(@conversation.id)\n end",
"def check_for_messages\n @message_unviewed = Message.all(:recipient_id => current_user.id, :viewed => false, :opportunity => Opportunity.all(:active => true))\n if @message_unviewed != []\n flash.now[:warning] = 'You have unread messages'\n end\n end",
"def matches_message?(message)\n match_message(message).any?\n end",
"def fetch_conversation_if_exists\n # all members phone numbers should be included to do a proper lookup\n numbers = parsed_phones + [inviter.phone_normalized]\n inviter.conversations.find_by_phones(numbers).first\n end",
"def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end",
"def replied_conv? usr\n ConversationProcessor.new(self).replied_conv? usr\n end",
"def has_message_id?\n !fields.select { |f| f.responsible_for?('Message-ID') }.empty?\n end",
"def isMyMessage(message)\r\n return message[:type] == :Sent\r\n end",
"def has_unread?\n Message.any_in(conversation_id: conversations.map(&:id)).ne(read_by: id).present?\n end",
"def has_message?(mess_id)\r\n found = false\r\n @messages.each {|m| found = true if m.message_id.to_s == mess_id.to_s}\r\n return found\r\n end",
"def unread? user_id\n !unread_messages(user_id).blank?\n end",
"def msg_exists(msg) \n not msg.nil? and not msg.empty?\n end",
"def participates?(user)\n \tsender == user || recipient == user\n\tend",
"def new_message_check\n if(!current_user.nil?)\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n if ids.count > 0\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n render text: '{\"unread\":\"true\", \"ids\":[' + ids.join(',') + ']}'\n else\n render text: '{\"unread\":\"false\"}'\n end\n else \n render text: '{\"unread\":\"false\"}'\n end\n end",
"def message?\n @command.eql? 'PRIVMSG'.freeze\n end",
"def can_reply_to(conversation)\n true\n end",
"def has_message_id?\n header.has_message_id?\n end",
"def message?\n false\n end",
"def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end",
"def sent_by?(user)\n from_user_id == user&.id\n end",
"def thread_member?(user)\n user == self.user || (messagable_type == \"User\" && messagable_id == user.id) || self.replies.map(&:user).include?(user)\n end",
"def msg_sent?\n true\n end",
"def message_exists?(response)\n response.respond_to?(:name) && response.name == 'EXISTS'\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def any?\n messages.count.positive?\n end",
"def message_seen?(message_id)\n self.seen_messages.include?(message_id)\n end",
"def update_message?\r\n # If message window is showing\r\n return $game_temp.message_window_showing\r\n end",
"def can_view(message)\r\n true if current_user.id == message.sender_id || current_user.id == message.receiver_id\r\n end",
"def conversation_exist?(receiver_uid)\n !DatabaseConnection.query(\"SELECT * \n FROM \n (SELECT * FROM conversations \n WHERE\n u1_id = #{receiver_uid}\n OR u2_id = #{receiver_uid}) AS z\n WHERE\n u1_id = #{@uid}\n OR u2_id = #{@uid}\" \n ).num_tuples.zero?\n end",
"def update_message?\r\n # If showing message window\r\n if $game_temp.message_window_showing\r\n return true\r\n end\r\n return false\r\n end",
"def can_chat_with(user)\n\n end",
"def reply?\n !self.in_reply_to.nil?\n end",
"def reply?\n !self.in_reply_to.nil?\n end",
"def has_unread_messages?\n received_messages.count > 0\n end",
"def conversation_waiting_for_reply? conversation, by='Structure'\n if conversation.mailboxer_label_id == Mailboxer::Label::INFORMATION.id\n senders = conversation.messages.map(&:sender).compact.uniq\n if senders.length == 1 and !conversation.treated_by_phone\n return true\n end\n elsif conversation.mailboxer_label_id == Mailboxer::Label::REQUEST.id\n participation_request = conversation_participation_request(conversation)\n return (participation_request.present? and participation_request.pending? and participation_request.last_modified_by != by and !participation_request.past?)\n end\n\n return false\n end",
"def has_manage_messages_permission?\n return get_bot_profile.permission?(:manage_messages, command.event.channel)\n end",
"def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end",
"def user_can_reply user \n \n if Connection.exists?(self.connection_id)\n return connection.is_active\n end\n false\n end",
"def isAllowMessage(request)\n return httpRequest('check_message',request)\n end",
"def reply?\n !!in_reply_to_status_id\n end",
"def is_valid?\n is_group_conversation? ? user_participants.count >= 1 : user_participants.count >= 2\n end",
"def conversation\n message.conversation if message.is_a? Mailboxer::Message\n end",
"def conversation\n message.conversation if message.is_a? Mailboxer::Message\n end",
"def chat?\n self.state == :chat\n end",
"def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end",
"def is_trashed?(conversation)\n conversation.is_trashed?(messageable)\n end",
"def is_trashed?(conversation)\n conversation.is_trashed?(messageable)\n end",
"def has_chatter\n return @has_chatter\n end",
"def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end",
"def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end",
"def participates?(user)\n author == user || receiver == user\n end",
"def check_user\n \t\tif not (current_user.id == @conversation.sender_id or current_user.id == @conversation.recipient_id)\n \t\t\trender json: {\n \t\t\terror: \"Invalid user!\",\n \t\t\tstatus: 401\n\t\t\t}, status: 401\n\t\tend\n\n\tend",
"def can_message? o\n return true\n # return true if admin?\n # false\n end",
"def checkIfAlreadyOnline\n # check the presence chat channel to see if the current users is subscribed to the channel\n # if the user is then render return true, else return false\n allUsers = Pusher.get('/channels/presence-chat/users')\n allUsers[:users].each do |userHash|\n return true if userHash.first.last == current_user.id.to_s\n end\n return false\n end",
"def sender? usr\n usr.id == user_id\n end",
"def sent?\n sender_id.present?\n end",
"def is_completely_trashed?(conversation)\n conversation.is_completely_trashed?(messageable)\n end",
"def is_completely_trashed?(conversation)\n conversation.is_completely_trashed?(messageable)\n end",
"def answered_by?(user)\n replies.exists?(:user_id => user)\n end",
"def isSelfMessage?\n if(@fromNick==@selfNick)\n return true\n else\n return false\n end\n end",
"def is_text_message?(message)\n !message.text.nil?\nend",
"def match_availability_message_to_convo\n if conversation_id.nil? && !availability_id.nil?\n conversation = Conversation.where(availability_id: availability_id).first\n if conversation.nil?\n conversation = Conversation.create(availability_id: availability_id, name: \"Teaching #{availability.start_time.strftime('%H:%M %d/%m/%Y')}\")\n availability.availability_users.each do |join|\n conversation.conversation_members.create!(user: join.user, admin: join.admin)\n end\n end\n self.conversation = conversation\n end\n end",
"def show\n\t\tif @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation\n\t\t\tif @conversation.is_participant?(@actor)\n\t\t\t\tredirect_to conversation_path(@conversation, :box => @box, :anchor => \"message_\" + @message.id.to_s)\n\t\t\treturn\n\t\t\tend\n\t\tend\n\tend",
"def first_time_authorized?\n self.authorized == true && self.message_sent == false\n end",
"def isSendToRoom?\n @room_id != nil\n end",
"def request_sent?(_user_id)\n pending_user_relationships.where(user_id: _user_id).any?\n end",
"def can_mail? user\n can_send_messages? && profile.is_active?\n end",
"def still_valid?\n return false if self.reply_type == 'conversation'\n participation_request = ParticipationRequest.find self.participation_request_id\n\n return false if participation_request.state != 'pending'\n return false if participation_request.date < Time.current\n\n !used\n end",
"def is_group_conversation?\n group_title.present?\n end",
"def duplicate_message?(user, message, structure, interval=2.day)\n recipient = structure.admin\n conversations = user.mailbox.sentbox.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id)\n\n messages = []\n conversations.each do |conversation|\n messages += conversation.messages.where(created_at: (Time.now - interval)..Time.now)\n end\n\n duplicate = messages.find do |original|\n original.body == message[:body] && recipient.in?(original.recipients)\n end\n\n return duplicate.present?\n end",
"def system_msg?\n posts.first.system_msg? rescue nil\n end",
"def recipient_is_sender?\n event = Event.where(id: \"#{params[:id]}\")[0]\n user = User.where(username: \"#{invite_params[:username]}\")[0]\n if event.creator.id == user.id\n flash[:notice] = \"You cannot invite yourself.\"\n redirect_to event_path(event)\n end\n end",
"def already_welcomed?(user)\n notification = Notification.welcomed_by(self.id, user.id)\n !notification.empty?\n end",
"def find_conversation!\n if params[:receiver_id]\n @receiver = User.find_by(id: params[:receiver_id])\n @conversation = Conversation.between(current_user.id, @receiver.id)[0]\n if @conversation\n redirect_to conversation_personal_messages_path(@conversation)\n else\n @conversation = Conversation.create(params.permit(:author_id, :receiver_id))\n redirect_to conversation_personal_messages_path(@conversation)\n end\n else\n @conversation = Conversation.find_by(id: params[:conversation_id])\n # redirect_to(root_path) unless @conversation && @conversation.participates?(current_user)\n end\nend",
"def valid_message?(response)\n _command, identifier, @group = response.args\n\n return unless valid_group?(response, identifier)\n\n return unless valid_user?(response, identifier)\n\n true\n end",
"def has_recent_message?\n prev_messages = conversation\n .messages\n .from_user(self.user_id)\n .order(created_at: :desc)\n .limit(2)\n # the last message is the first by created_at\n prev_message = prev_messages.last\n\n # has a recent message, excluding self, and\n # previous message is greater than 30 minutes ago\n return (\n self.id != prev_message.id &&\n (self.created_at.utc - prev_message.created_at.utc) <= 30.minutes.to_i\n )\n end",
"def replied_conv? usr\n if @conv.posts.count > 1 && @conv.posts.last.user_id != usr.id\n @conv.posts.each do |post|\n return true if post.user_id == usr.id\n end\n end\n false\n end",
"def show\n if @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation\n if @conversation.is_participant?(@user)\n redirect_to conversation_path(@conversation, :box => @box, :anchor => \"message_\" + @message.id.to_s)\n return\n end\n end\n redirect_to conversations_path(:box => @box)\n end",
"def show_sent_message\n\t\t# find message with specified ID \n @message = Message.find(params[:id])\n @unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n \n\t\t# check if reciever is current user, security\n\t\tif current_user.id == @message.sender.id\n render :action => 'show_sent_message'\n else\n gflash :error => \"Unknown request.\"\n redirect_back_or_default('/sent_messages')\n end\n end",
"def has_recipient\n return false if @voucher.recipient.nil?\n return true\n end",
"def sent_already?\n @user = User.find_by_email(self.rcvr_email)\n return false if @user.blank?\n @sent_invitation = Invitation.where(\"user_id = ? AND project_id = ?\", @user.id, self.project_id)\n if @sent_invitation.present?\n return true\n else\n return false\n end\n end",
"def read?(person)\n msgs = MessageReceiver.find(:all, :conditions => [\"person_id = ? AND message_id = ? AND has_read_bool = ?\", person.id, self.id, true])\n return msgs.length \n end",
"def conversation\n Conversation\n .where(\"creator_id = ? or member_id = ?\", user_id, user_id)\n .order(\"latest_message_id DESC\").first\n end",
"def bot_can_respond?(bot, event)\r\n botProfile = bot.profile.on(event.server)\r\n canSpeak = botProfile.permission?(:send_messages, event.channel)\r\n return canSpeak\r\n end",
"def show_message\n\t\t# find message with specified ID and set its 'unread' attribute to FALSE\n \t@message = Message.find(params[:id])\n @message.update_attribute(:unread,false)\n @unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n\n\t\t# check if reciever is current user, security \n if current_user.id == @message.receiver.id\n render :action => 'show_message'\n else\n gflash :error => \"Unknown request.\"\n redirect_back_or_default('/messagebox')\n end\n end"
] | [
"0.7807762",
"0.76709825",
"0.76076967",
"0.76076967",
"0.75791794",
"0.7477209",
"0.7438737",
"0.7148298",
"0.7003683",
"0.6972134",
"0.6939719",
"0.6931666",
"0.69269556",
"0.6914397",
"0.69119173",
"0.6868971",
"0.6854507",
"0.68348354",
"0.6808971",
"0.6783754",
"0.67296654",
"0.6691141",
"0.66489226",
"0.6632521",
"0.66073924",
"0.6604965",
"0.6595024",
"0.6592105",
"0.6569622",
"0.65261304",
"0.65115863",
"0.6501655",
"0.6490116",
"0.6488491",
"0.64862263",
"0.64774877",
"0.64743966",
"0.6466476",
"0.6466476",
"0.64641917",
"0.64318746",
"0.6415691",
"0.6409961",
"0.6401542",
"0.6370167",
"0.636338",
"0.6352544",
"0.6352544",
"0.6336084",
"0.6316641",
"0.6283218",
"0.6256484",
"0.6253144",
"0.6250532",
"0.62379605",
"0.62230355",
"0.6215092",
"0.6215092",
"0.6212112",
"0.6180575",
"0.6175356",
"0.6175356",
"0.6174679",
"0.61619127",
"0.61619127",
"0.61587673",
"0.6156487",
"0.6135312",
"0.6120606",
"0.60931087",
"0.6089145",
"0.6077175",
"0.6077175",
"0.6067477",
"0.6061255",
"0.6036958",
"0.6036098",
"0.6024983",
"0.6019088",
"0.6016073",
"0.60149366",
"0.60144436",
"0.60116696",
"0.6005587",
"0.59957457",
"0.59914196",
"0.59893805",
"0.5985594",
"0.59743756",
"0.59637225",
"0.59593993",
"0.59505045",
"0.5945921",
"0.59296733",
"0.5928541",
"0.5915889",
"0.5914865",
"0.59064394",
"0.5899644",
"0.5899009"
] | 0.7094983 | 8 |
get conversations where user has sent/received at least one message in conversation and conversation is active | def get_specific_conversations usr, c_type
conv_ids = Array.new
convos = Conversation.get_conversations(usr)
convos.find_each do |convo|
convo.posts.find_each do |post|
if (c_type == "received" && post.recipient_id == usr.id && post.recipient_status == 'active') ||
(c_type == "sent" && post.user_id == usr.id && post.status == 'active')
conv_ids << convo.id if usr_msg?(convo, usr); break
end
end
end
return convos.where(["id in (?)", conv_ids]).sort_by {|x| x.posts.last.created_at }.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conversations\n Conversation.where(\"sender_id = ? or recipient_id = ?\",self.id,self.id)\n end",
"def conversations\n Conversation.where(\"sender_id = ? OR recipient_id = ?\", id,id)\n end",
"def get_conversations\n n = Notification.where(user_id:current_user)\n conversation_ids = Array.new\n n.each do |v|\n conversation_ids << v.conversation_id\n end\n conversations = Conversation.where(id:conversation_ids)\n\n end",
"def find_open_conversations()\n Conversation.find_open_conversations( @sms.to, @sms.from ).order( 'challenge_sent_at' )\n end",
"def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end",
"def system_conversations\n system.conversations\n end",
"def search_conversations(query)\n search(\"conversations\", query)\n end",
"def counseling_conversations\n Conversation.single_conversations_between(id, User.all_mentors.pluck(:id) - [id])\n end",
"def conversation\n Conversation\n .where(\"creator_id = ? or member_id = ?\", user_id, user_id)\n .order(\"latest_message_id DESC\").first\n end",
"def search_conversations(query)\n search(\"search/conversations\", query)\n end",
"def conversations(options = {})\n scope = MessageCenter::Conversation.participant(messageable)\n scope = scope.where(:message_center_receipts => {:mailbox_type => options[:mailbox_type]}) if options[:mailbox_type]\n scope = scope.merge(MessageCenter::Receipt.not_trash.not_deleted) unless 'trash'==options[:mailbox_type]\n\n if options[:read] == false || options[:unread]\n scope = scope.merge(MessageCenter::Receipt.is_unread)\n end\n\n scope\n end",
"def get_conversation(user)\n cnv = self.conversations.where(id: user.conversations.where(multiple_users_flag: false).select(:id), multiple_users_flag: false).first\n if cnv.nil?\n cnv = Conversation.create(cnv_users: [self.id, user.id], name: user.name, multiple_users_flag: false)\n end\n return cnv\n end",
"def set_conversations\n conversations = Conversation.where(\n \"user1_id = :current_user_id OR user2_id =:current_user_id\",\n current_user_id: current_user.id\n )\n\n @conversations = conversations.sort_by do |conversation|\n last_message = conversation.last_message\n\n if last_message\n last_message.created_at\n else\n Time.zone.now\n end\n end\n\n @conversations.reverse!\n end",
"def fetch_conversation_if_exists\n # all members phone numbers should be included to do a proper lookup\n numbers = parsed_phones + [inviter.phone_normalized]\n inviter.conversations.find_by_phones(numbers).first\n end",
"def is_in_conversation?(_user_id)\n conversation_members.where(user_id: _user_id).any?\n end",
"def conversated?\n session[:conversations].include?(@conversation.id)\n end",
"def conversations\n object.conversations.map {|a| ConversationSerializer.new(a).as_json }\n end",
"def messages\n Message\n .where(\"messages.user_id = :user OR messages.recipient_id = :user\", user: id)\n .where.not(\"messages.recipient_id = :user AND messages.status = :status\", user: id, status: 0)\n .where.not(\"messages.recipient_id = :user AND messages.status = :status\", user: id, status: 4)\n .includes(:permissions).order(\"permissions.created_at DESC\")\n end",
"def find_new_conversations\n #get chat rooms users where last_viewed is nil\n user_rooms = ChatRoomsUser.where(\"user_id = ?\", current_user.id)\n new_rooms = Array.new\n user_rooms.each do |room|\n if room.last_viewed.nil?\n new_rooms << ChatRoom.find_by(id: room.chat_room_id)\n end\n end\n new_rooms\n end",
"def conversations(options = {})\n conv = get_conversations(options[:mailbox_type])\n\n if options[:read] == false || options[:unread]\n conv = conv.unread(messageable)\n end\n\n conv\n end",
"def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end",
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end",
"def conversation\n @messages = Message.get_conversation(current_user, params[:user_id])\n render json: @messages, each_serializer: MessageConversationSerializer\n end",
"def sent_message\n\t\t@current_user_conversations = Conversation.where('sender_id = ?',current_user.id)\n\t\t# @sent_messages = current_user_conversations.first.messages\n\t\t@sent_messages = []\n\t\t@current_user_conversations.each do |current_user_conversation|\n\t\t\t# @test_sent_messages = current_user_conversation.messages.map {|message| message}\n\t\t\tcurrent_user_conversation.messages.each do |message|\n\t\t\t\t@sent_messages << message\n\t\t\tend\n\t\tend\n\tend",
"def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end",
"def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end",
"def has_conversation?(conversation_id)\r\n self.conversations.has_key?(conversation_id.to_s)\r\n end",
"def index\n @conversations = current_user.conversations\n end",
"def index\n #find the current user object\n @user = User.find(session[:user_id])\n #get the id of current user\n user_id = User.find(session[:user_id]).id\n #get all conversations of current user\n @started_conversations = @user.started_conversations\n @joined_conversations = @user.joined_conversations\n end",
"def conversation_participant_ids\n self.conversation ?\n self.conversation.participant_ids + [self.conversation.user_id] : []\n end",
"def chat_history\n \t@chat_history = EmailConversation.where(receiver_id: params[:lead_id], is_sent: true)\n end",
"def get_messages\n if Conversation.previous_talks(params[:sender_id],params[:recipient_id]).present?\n @conversation = Conversation.previous_talks(params[:sender_id],params[:recipient_id]).first\n else\n @conversation = Conversation.create!(conversation_params)\n end\n end",
"def call\n all_private_conversations = Private::Conversation.all_by_user(@user.id)\n .includes(:messages)\n all_group_conversations = @user.group_conversations.includes(:messages)\n all_conversations = all_private_conversations + all_group_conversations\n\n ##filtered_conversations = []\n\n ##all_conversations.each do |conv|\n ## empty_conversations << conv if conv.messages.last\n ##end\n\n ##filtered_conversations = filtered_conversations.sort{ |a, b|\n ## b.messages.last.created_at <=> a.messages.last.created_at\n ##}\n\n return all_conversations\n end",
"def accepted_invitees\n (collaborations.where(is_accepted: true) + Collaboration.where(collaboration_level: documents, is_accepted: true)).uniq(&:collaborator_id)\n end",
"def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end",
"def get_conversations(opts = {})\n data, _status_code, _headers = get_conversations_with_http_info(opts)\n return data\n end",
"def conversations_with(other_messageable)\n Mailboxer::Conversation.between(messageable, other_messageable)\n end",
"def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end",
"def index\n # @conversations = Conversation.all\n @conversations = current_user.conversations\n end",
"def index\n\t\t@conversations = current_user.mailbox.conversations\n\tend",
"def set_conversations\n if current_user == @listing.seller\n @conversations = @listing.conversations\n else\n @conversations = @listing.conversations.between(@listing.seller, current_user)\n if @conversations.empty? \n @conversations = create_conversation\n end\n end\n end",
"def get_chat_messages\n # get chat messages\n chats = Message.includes(:user).where(receiver_id: @current_user.id, user_id: params[:user_id], request_id: params[:request_id]).or(Message.includes(:user).where(user_id: @current_user.id, receiver_id: params[:user_id], request_id: params[:request_id])).order(created_at: :asc)\n if chats.any?\n render json: chats, :include => {\n :user => {\n :only => [:id, :firstname, :lastname]\n },\n },\n status: :ok\n else\n render json: {\n status: 'no-content',\n message: 'No chat on this request yet'\n },\n status: :no_content\n end\n end",
"def has_unread?\n Message.any_in(conversation_id: conversations.map(&:id)).ne(read_by: id).present?\n end",
"def index\n @user_conversations = UserConversation.all\n end",
"def all_for(user)\n self.includes(:chat_participations).where(chat_participations: {user_id: user.id})\n end",
"def show\n if user_signed_in?\n @message_has_been_sent = conversation_exist?\nend\n end",
"def active_exchanges\n self.participations.where([':todays_date > match_date \n AND :todays_date < exchange_date', \n :todays_date => Date.today])\n end",
"def property_conversations\n @property_conversations ||= sender.conversations_about(property)\n end",
"def read_messages\n @useConversations = Message.where(\"user_id = (?)\", current_user.id).pluck(:conversation_id)\n if @useConversations.count > 0\n @useConversations = @useConversations.uniq # Unique\n @useConversations = @useConversations.map(&:inspect).join(', ')\n #@updatemsg = Message.where(\"user_id != (?) and conversation_id IN (?)\", current_user.id, @useConversations).update_all(:mark_as_read => true)\n @updatemsg = Message.where(\"user_id != #{current_user.id} and conversation_id in (#{@useConversations})\").update_all(:mark_as_read => true)\n session[:mark_messages] = 0 # Mark as read messages\n end\n end",
"def saveConversations\n user = User.find(params[:id])\n conversation = Conversation.find_by_name(params[:conversation])\n\n userConversation = user.conversations.where(:name => conversation.name).first\n\n if userConversation.blank?\n user.conversations << conversation\n success = true\n else \n success = false\n end\n\n respond_to do |format|\n format.json {render :json => {:success => success}}\n end\n end",
"def index\n @conversations = Conversation.where(contype: \"OneToMany\", sender_id: current_member.id).order(name: :asc)\n end",
"def recipient_users\n User.active.where(id: recipient_user_ids).all\n end",
"def conversation\n @user = User.find(params[:id])\n @messages = Message.find(:all, :conditions => [\"((messages.user_id = #{current_user.id} and messages.receiver_id = #{params[:id]}) and messages.user_status != 'deleted') or ((messages.receiver_id = #{current_user.id} and messages.user_id = #{params[:id]}) and messages.receiver_status != 'deleted')\"], :order => \"created_at Desc\")\n for message in @messages\n if message.receiver_id == current_user.id\n message.update_attribute(:receiver_status, \"read\") if message.receiver_status == \"unread\"\n end\n end\n respond_to do |format|\n format.xml { render :xml => @messages }\n format.json { render :json => @messages }\n end\n end",
"def friend_candidates(for_channels)\n User.all.keep_if { |other|\n (for_channels == other.channel?) && # Select for channels or regular users\n User.public?(other.id) && # Exclude invisible users\n (other.channel? || (other.sign_in_count && (other.sign_in_count > 0))) && # Excluded unconfirmed invites\n (other.id != id) # Don't include this user\n }\n end",
"def timeline\n sent_friends = \"SELECT receiver_id FROM relationships\n WHERE requester_id = :user_id\n AND confirmed_friends = true\"\n received_friends = \"SELECT requester_id FROM relationships\n WHERE receiver_id = :user_id\n AND confirmed_friends = true\"\n Timeline.where(\"user_id IN (#{sent_friends}) OR \n user_id IN (#{received_friends} OR\n user_id = :user_id)\", user_id: id)\n end",
"def index\n\n @users_with_conversation = []\n @messages = Message.where(receiver_id: params[:user_id]).reverse_order\n @new_messages = @messages.where(unread: true)\n @messages.each do |message|\n unless @users_with_conversation.include?(message.sender)\n @users_with_conversation.push(message.sender)\n end\n end\n @messages = Message.all\n end",
"def chatting_with\n ChatMessage.participant(self).map do |chat|\n if chat.parent.id != self.id\n chat.parent\n else\n Parent.find(chat.recipient_fk)\n end\n end.uniq\n end",
"def current_user_chat_rooms\n is_group_chat = params[:is_group_chat].present? ? params[:is_group_chat] : FALSE_STR\n @chat_rooms = ChatRoom.joins(:chat_room_users).includes(\n chat_room_users: :user, messages: :user\n ).where(\n chat_rooms: { is_group_chat: is_group_chat },\n chat_room_users: { user_id: current_user.id }\n )\n end",
"def scheduled_emails\n @chat_history = EmailConversation.where(\"sender_id = #{current_user.id} AND sent_date is not null\")\n end",
"def index\n if current_user.seller?\n @conversations = current_user.seller.company.conversations\n else\n @conversations = current_user.conversations\n end\n end",
"def in_conversation? person = nil\n\t\treturn mode? :conversation if (person.nil?)\n\t\treturn @in_conversation if (person && person.is?(:person) && mode?(:conversation))\n\t\treturn nil\n\tend",
"def find_one_to_one_chat_room\n @chat_rooms.to_a.find do |chat_room|\n chat_room_users = chat_room.chat_room_users\n chat_room_users.length == 2 && chat_room_users.any? do |chat_room_user|\n chat_room_user.user_id == params[:user_id].to_i\n end\n end\n end",
"def get_conversation_data(opts = {})\n # opts['channel_id'] & opts['conversation_id']\n uri = \"/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}\"\n BotFramework::BotData.new api_get(uri)\n end",
"def friends\n current_id = self.id\n Actor.joins{received_contacts.inverse}.where{\n (received_contacts.inverse.blocked.eq false) &\n (received_contacts.blocked.eq false) &\n (received_contacts.sender_id.eq current_id)\n }\n end",
"def conversation_exist?(receiver_uid)\n !DatabaseConnection.query(\"SELECT * \n FROM \n (SELECT * FROM conversations \n WHERE\n u1_id = #{receiver_uid}\n OR u2_id = #{receiver_uid}) AS z\n WHERE\n u1_id = #{@uid}\n OR u2_id = #{@uid}\" \n ).num_tuples.zero?\n end",
"def find_pending\n notifications.where sent: false\n end",
"def accepted_invitations\n User.joins(:attended_events).where( invitations: { accepted: true, event_id: self.id } )\n end",
"def index\n @conversations = @current_user.conversations\n @not_viewed = 0\n @conversations.each do |c|\n @not_viewed += c.how_many_not_viewed(@current_user) unless c.how_many_not_viewed(@current_user) == nil\n end\n @current_user\n end",
"def index\n @messages = @conversation.messages.includes(:user).order('created_at ASC').page(1)\n\n conversation_user = ConversationUser.find_by(conversation: @conversation, user: current_user)\n @message = conversation_user.messages.build\n\n authorize @message\n @other = @conversation.users.find_by('users.id != ?', current_user.id)\n end",
"def active_tournaments\n admin_tournaments = Tournament.joins(:admins).where(tournament_admins: { user_id: self.id }).to_a\n player_tournaments = Tournament.joins(teams: :players).where(teams: { players: { user_id: self.id } }).to_a\n\n (admin_tournaments + player_tournaments).uniq\n end",
"def people(convo)\n @recipients = convo.conversation.users.where('user_id <> ?', current_user)\n end",
"def past_user_conversation(user_id)\n past_user_conversation = nil\n conversations.each do |conversation|\n unless conversation.user_conversations.find_by_user_id(user_id).nil?\n past_user_conversation = conversation.user_conversations.find_by_user_id(user_id)\n break\n end\n end\n return past_user_conversation\n end",
"def get_conversations(mailbox_id, page = 1, modified_since = nil)\n options = {\n query: {\n page: page,\n modifiedSince: modified_since,\n }\n }\n\n get(\"mailboxes/#{mailbox_id}/conversations\", options)\n end",
"def getConversations\n @conversations = Conversation.all.select(\"name\").map(&:name)\n\n respond_to do |format|\n format.json {render :json => {:conversations => @conversations}}\n end\n end",
"def events_with_presence(bool)\n current_user.participations.includes(:event).where(presence: bool).map { |p| p.event }\n end",
"def index\n @conversations = current_profile.conversations\n\n end",
"def get_conversation(id)\n get(\"conversations/#{id}\")\n end",
"def thread_messages\n #thread.messages + [thread]\n Message.where([\"id = ? or parent_id = ?\", thread_id, thread_id])\n end",
"def conversation\n message.conversation if message.is_a? Mailboxer::Message\n end",
"def conversation\n message.conversation if message.is_a? Mailboxer::Message\n end",
"def creator_conversation_ids\n self.creator ?\n self.creator.conversation_ids + self.creator.created_conversation_ids : []\n end",
"def getTopConversations\n eventConversations = []\n users = self.users.where(\"attendees.is_attending\" => true)\n users.each do |user|\n userConversations = user.conversations.pluck(:name)\n (eventConversations << userConversations).flatten! \n end\n\n conversationCounts = Hash.new 0\n eventConversations.each do |conversation|\n conversationCounts[conversation] += 1\n end\n\n topConversationsArr = conversationCounts.sort_by{ |k,v| v}.reverse[0..2]\n topConversations = Hash[topConversationsArr].keys\n end",
"def sent_messages\n @user = current_user\n\t # retrieve all sent messages by the current user\n @sent_messages = @user.sent_messages.sort_by{|m| m.created_at}.reverse\n @unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n end",
"def sent_friends\n Friendship.where(:sender_uid => self.uid, :accepted => true)\nend",
"def getContacts\n messages = [] \n \n if !self.received_messages.nil?\n messagesRecv = (self.received_messages.order(:updated_at)).reverse \n\t messagesRecv.each do |recv|\n\t user = User.find(recv.sender_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n if !self.send_messages.nil?\n messagesSend = (self.send_messages.order(:updated_at)).reverse \n\t messagesSend.each do |send|\n\t user = User.find(send.receiver_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n\t return messages\n end",
"def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end",
"def managed_users_sent_approvable_recognitions_set(query_scope)\n query_scope\n .where(::Recognition.arel_table[:sender_id].in(managed_users.pluck(:id)))\n .where(::Badge.arel_table[:requires_approval].eq(true))\n .where(::Badge.arel_table[:approver].eq(Role.manager.id))\n .where(::Badge.arel_table[:approval_strategy].eq(::Badge.approval_strategies[:any_manager]))\n end",
"def add_to_conversations\n session[:conversations] ||= []\n session[:conversations] << @conversation.id\n end",
"def get_conversation(id, embed_threads: false)\n if embed_threads\n get(\"conversations/#{id}?embed=threads\")\n else\n get(\"conversations/#{id}\")\n end\n end",
"def received_friends\n Friendship.where(:reciever_uid => self.uid, :accepted => true)\nend",
"def related_messages\n Message.related(self.id)\n end",
"def get_conversations_calls(opts = {})\n data, _status_code, _headers = get_conversations_calls_with_http_info(opts)\n return data\n end",
"def index\n\t\tputs(getAllFriendsConversation)\n\t\t@conversations = current_user.mailbox.conversations\n\t\t@current_user = current_user\n\tend",
"def get_all_channels\n user_id = current_user.id\n user_channels=Chatbox.uniq.where(:user_id => user_id).pluck(:channel)\n return user_channels \n end",
"def conversation_waiting_for_reply? conversation, by='Structure'\n if conversation.mailboxer_label_id == Mailboxer::Label::INFORMATION.id\n senders = conversation.messages.map(&:sender).compact.uniq\n if senders.length == 1 and !conversation.treated_by_phone\n return true\n end\n elsif conversation.mailboxer_label_id == Mailboxer::Label::REQUEST.id\n participation_request = conversation_participation_request(conversation)\n return (participation_request.present? and participation_request.pending? and participation_request.last_modified_by != by and !participation_request.past?)\n end\n\n return false\n end",
"def any_active_game\n games.where(\"status = 1\").any?\n end",
"def friendable_users\n User.all.where.not('id IN (?)', [id] + friends.ids +\n friend_requests_sent.pending.pluck(:receiver_id) + friend_requests_received.pending.pluck(:sender_id))\n end",
"def has_unread_messages?(user)\n latest_message = self.last_message\n if latest_message\n chat_participation = self.chat_participations.where(user_id: user.id).first\n chat_participation.try(:unread_message?, latest_message)\n end\n end",
"def conversation_params\n params[:conversation]\n end"
] | [
"0.7559071",
"0.75354826",
"0.708918",
"0.70735186",
"0.67406595",
"0.640352",
"0.6388556",
"0.6370114",
"0.6329861",
"0.62790936",
"0.62372273",
"0.62033486",
"0.6154459",
"0.6141713",
"0.61287546",
"0.61178565",
"0.60924554",
"0.6002418",
"0.6001807",
"0.5943966",
"0.59251016",
"0.5880285",
"0.5880285",
"0.58741134",
"0.58739656",
"0.58021724",
"0.58021724",
"0.57979906",
"0.5794503",
"0.5727957",
"0.5718553",
"0.57076937",
"0.5700856",
"0.569231",
"0.56527346",
"0.56410253",
"0.56259006",
"0.5613722",
"0.5612361",
"0.55997914",
"0.55989873",
"0.5572873",
"0.5570761",
"0.55477655",
"0.5532525",
"0.5503773",
"0.54947144",
"0.5481762",
"0.54763806",
"0.5463031",
"0.5462705",
"0.54596967",
"0.54477376",
"0.54343474",
"0.5421758",
"0.54193497",
"0.54137605",
"0.5412442",
"0.5406635",
"0.5357024",
"0.5355475",
"0.53535295",
"0.53389347",
"0.53285086",
"0.53247064",
"0.531521",
"0.53126204",
"0.53049886",
"0.5300719",
"0.5297742",
"0.5292066",
"0.52872646",
"0.52871996",
"0.5271414",
"0.5270619",
"0.5264248",
"0.5259584",
"0.52435404",
"0.52409124",
"0.5236847",
"0.5236847",
"0.52229905",
"0.5222873",
"0.52192587",
"0.52188367",
"0.5202157",
"0.52017534",
"0.5201193",
"0.518919",
"0.51755327",
"0.5169153",
"0.5162755",
"0.5155666",
"0.5144137",
"0.5132687",
"0.51296985",
"0.5126856",
"0.51180565",
"0.5118004",
"0.5113819"
] | 0.6255811 | 10 |
sets convo status to 'removed' | def remove_conv conv, user
if user.id == conv.user_id
return update_status(conv, user, 'status')
elsif user.id == conv.recipient_id
return update_status(conv, user, 'recipient_status')
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove!\n self.update_attribute(:status, REMOVED)\n end",
"def remove!\n self.update_attribute(:status, REMOVED)\n end",
"def removed; status[:removed]; end",
"def destroye\n self.update_attribute(:status,7)\n end",
"def remove\n if status == \"pending\"\n reject\n else\n destroy\n end\n end",
"def set_removed # :nodoc:\n @removed = true\n end",
"def cleared_status=(status)\r\n req = QBFC::Request.new(@sess, \"ClearedStatusMod\")\r\n req.txn_id = id\r\n status = QBFC_CONST::CsCleared if status === true\r\n status = QBFC_CONST::CsNotCleared if status === false\r\n req.cleared_status = status\r\n req.submit\r\n return status\r\n end",
"def removed; status[:removed] || []; end",
"def mark_as_removed!\n self.removed = true\n self.save\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def remove\r\n self.update(deleted: true)\r\n end",
"def destroy\n @cooperativa = Cooperativa.find(params[:id])\n @cooperativa.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_cooperativas_path }\n format.json { head :ok }\n end\n end",
"def clean; status[:normal]; end",
"def remove\n __flag__ :remove\n end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def destroy\n @client_status.destroy\n end",
"def destroy\n ActiveRecord::Base.transaction do\n @cuenca.status = Status.find(Status::VALUES[:deleted])\n @cuenca.save validate: false\n respond_to do |format|\n format.html { redirect_to cuencas_url, notice: 'La Cuenca se marco como borrada.' }\n format.json { head :no_content }\n end\n end\n end",
"def cancel\n self.status = 'Cancelled'\n self.save!\n end",
"def remove_old_stored_csvs\n end",
"def removed?\n (status == REMOVED)\n end",
"def removed?\n (status == REMOVED)\n end",
"def removed?\n (status == REMOVED)\n end",
"def removed?\n (status == REMOVED)\n end",
"def removed?\n (status == REMOVED)\n end",
"def cancel\n self.update_status :cancelled\n end",
"def remove!; end",
"def remove2(curation_concern, id)\n member = ActiveFedora::Base.find(id)\n curation_concern.ordered_members.delete(member)\n curation_concern.members.delete(member)\n end",
"def removed?\n status == STATUS_REMOVED\n end",
"def destroy\n @convo.destroy\n respond_to do |format|\n format.html { redirect_to convos_url, notice: 'Convo was successfully destroyed.' }\n end\n end",
"def destroy\n @client= Client.find(params[:id])\n @client.update_attribute(:is_active,false)\n @clients = Client.all\n flash[:notice]=\"Client supprimé avec succès!!!\"\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(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 revoke!\n self.used = true\n self.save\n end",
"def removed?\n\t\treturn self.status == 'R'\n\tend",
"def sample_csds_remove(facturama)\n puts \"===== Eliminar CSD asociado con un RFC- Inicio =====\"\n\n facturama.csds.remove(\"EKU9003173C9\")\n puts \"Se ha eliminado el CSD asociado al Rfc\"\n\n puts \"===== Eliminar CSD asociado con un RFC- Inicio =====\"\n end",
"def destroy\n @convo = Convo.find(params[:id])\n @convo.destroy\n\n respond_to do |format|\n format.html { redirect_to convos_url }\n format.json { head :no_content }\n end\n end",
"def cancel!\n self.update_attributes(status: CANCELLED)\n #self.line_items.update_attributes(status: LineItem::CANCELLED)\n end",
"def delete(vault_id)\n update(vault_id, false, { :status => 'C' })\n end",
"def destroy\n\t\tif Orden.por_cliente(@cliente).empty?\n \[email protected]\n redirect_to clientes_url, notice: 'El cliente se borró exitosamente.'\n else\n\t\t\[email protected](activo: false)\n\t\t\[email protected]_clientes.update_all(\"activo = false\")\n\t\t\tredirect_to clientes_url, notice: 'El cliente se ha desactivado.'\n end\n end",
"def clear_status(service)\n @status_mutex.synchronize { @statuses.delete(\"#{service}\") }\n end",
"def clear_status(service)\n @status_mutex.synchronize { @statuses.delete(\"#{service}\") }\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 destroy\n @comentario.estatus = Comentario::OCULTAR\n\n if @comentario.save\n render text: '1'\n else\n render text: '0'\n end\n end",
"def delete\n @channel_control.delete\n end",
"def remove(curation_concern, id)\n member = ActiveFedora::Base.find(id)\n curation_concern.ordered_members.delete(member)\n curation_concern.members.delete(member)\n end",
"def remove_from_twitter\n begin\n Twitocracy.master.status_destroy(self.up_tweetid) if self.up_tweetid \n Twitocracy.master.status_destroy(self.down_tweetid) if self.down_tweetid \n rescue Exception => e\n ap \"Proposal#remove_from_twitter #{e.inspect}\"\n end\n end",
"def cancelled!\n @cancelled = true\n end",
"def update_status conv, user, fld\n if conv.update_attribute(fld.to_sym, 'removed')\n conv.remove_posts(user)\n true\n else\n false\n end\n end",
"def destroy\n @congreso = Congreso.find(params[:id])\n if congreso_propio?(@congreso) or current_user.is_admin?\n @congreso.destroy\n respond_to do |format|\n format.html { redirect_to congresos_url }\n format.json { head :ok }\n end\n else\n flash[:notice] = \"Solo puedes eliminar tus propios congresos\"\n redirect_to congresos_url\n end\n\n \n end",
"def destroy\n debug('Removing clone')\n cmd = [command(:crm), '-w', 'resource', 'stop', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib], false)\n cmd = [command(:crm), 'configure', 'delete', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib])\n @property_hash.clear\n end",
"def delete(vault_id)\n\t update(vault_id, false, {:status => \"C\"})\n\t end",
"def destroy\n @clinica = Clinica.find(params[:id])\n @clinica.estatus = \"I\"\n @clinica.save \n respond_to do |format|\n format.html { redirect_to clinicas_url, notice: 'La Clínica ha sido eliminada exitosamente' }\n format.json { head :no_content }\n end\n \n end",
"def deleted!\n self.update_attribute(:status, DELETED)\n end",
"def destroy\n capitol_id = @capitol.id\n licenta_id = @capitol.licenta_id\n numar = @capitol.numar\n @capitol.destroy\n\n # actualizeaza numerele la restul capitolelor de dupa asta distrus\n @capitole = Capitol.where(\"licenta_id = ? and numar > ?\", \"#{licenta_id}\", \"#{numar}\")\n if @capitole.count > 0\n @capitole.each do |cap|\n cap.update_attributes(numar: cap.numar-1)\n end\n end\n\n # sterge si todo-urile capitolului aluia din baza de date\n Todo.where(capitol_id: capitol_id).delete_all\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :subscription,\n :event_subtype => :cancel,\n :user => self.user,\n :detail_i1 => self.id\n ) \n \n Rails::logger.debug \"Calling chargify to cancel subscription ID #{self.chargify_id}\" \n Sherlock::Chargify.new.cancel(self.chargify_id) \n \n Rails::logger.debug \"Adjusting my own status to 'canceled'\" \n \n self.status = 'canceled'\n self.save\n \n ev.finish\n \n InfusionsoftUtils.update_contact(self)\n end\n \n end",
"def sub_remove _value=0\n send_cmd(\"sub_remove #{_value}\")\n end",
"def destroy\n # TODO エラーハンドリングを共通化する\n if @current_team&.id != @concert.team.id\n render json: false, status: :unauthorized\n else\n @concert.destroy\n end\n end",
"def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_categorias_path }\n format.json { head :ok }\n end\n end",
"def remove_orcid\n remove_orcid_attributes( User.cid_from_email( current_user.email ) )\n # remove pending statuses\n GenericWork.where(\n orcid_status: GenericWork.pending_orcid_status,\n depositor: current_user.email\n ).each do |work|\n work.update(orcid_status: nil)\n end\n\n end",
"def destroy\n @course.update(status: [email protected])\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Curso '+(@course.status ? 'activado' : 'desactivado')+' satisfactoriamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subcategoria = Subcategoria.find(params[:id])\n @subcategoria.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_subcategorias_path }\n format.json { head :ok }\n end\n end",
"def clear_modification_status\r\n @modified = false\r\n end",
"def delete; update(:status => 'DELETED'); end",
"def logical_delete\n if is_main?\n resource.status = 'DELETED'\n resource.save\n else\n destroy\n end\n end",
"def clean; status[:normal] || []; end",
"def delete\n self.update_attribute(:deleted, true)\n self.update_attribute(:disabled, true)\n\n room_type = self.room_type\n channel = self.channel\n pool = PropertyChannel.find_by_property_id_and_channel_id(room_type.property.id, channel.id).pool\n\n unless pool.blank?\n # clear rates\n ChannelRate.where(:room_type_id => room_type.id, :pool_id => pool.id, :channel_id => channel.id).each do |rate|\n rate.set_zero\n end\n # clear cta\n ChannelCta.where(:room_type_id => room_type.id, :pool_id => pool.id, :channel_id => channel.id).each do |cta|\n cta.set_false\n end\n # clear ctd\n ChannelCtd.where(:room_type_id => room_type.id, :pool_id => pool.id, :channel_id => channel.id).each do |ctd|\n ctd.set_false\n end\n # clear min stay\n ChannelMinStay.where(:room_type_id => room_type.id, :pool_id => pool.id, :channel_id => channel.id).each do |min_stay|\n min_stay.set_zero\n end\n # clear stop sell\n ChannelStopSell.where(:room_type_id => room_type.id, :pool_id => pool.id, :channel_id => channel.id).each do |stop_sell|\n stop_sell.set_false\n end\n # clear all master rate channel setting\n RoomTypeMasterRateChannelMapping.where(:room_type_id => room_type.id, :channel_id => channel.id).each do |rtm|\n rtm.update_attribute(:deleted, true)\n end\n end\n end",
"def action_remove\n notifying_block do\n delete_config\n end\n end",
"def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n cliente = Cliente.find(params[:id])\n cliente.update_attribute(:cliente_active, false)\n redirect_to clientes_path\n end",
"def destroy\n @consumo.destroy\n respond_to do |format|\n format.html { redirect_to consumos_url, notice: 'Consumo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ActiveRecord::Base.transaction do\n @proyecto.status = Status.find(Status::VALUES[:deleted])\n @proyecto.save validate: false\n respond_to do |format|\n format.html { redirect_to proyectos_url, notice: 'Proyecto programa se marco como borrado.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @cp_change.destroy\n\n head :no_content\n end",
"def deactivate!\n update_attribute('contact_status__c','Inactive')\n end",
"def delete\n self.update(active: false)\n end",
"def delete\n self.update(active: false)\n end",
"def destroy\n @consumable.destroy\n respond_to do |format|\n format.html { redirect_to consumables_url, notice: 'Consumable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_posts usr\n @conv.posts.each do |post|\n if usr.id == post.user_id\n post.status = 'removed'\n elsif usr.id == post.recipient_id\n post.recipient_status = 'removed'\n end\n post.save\n end\n end",
"def destroy\n if current_user.has_role? :admin\n @concert.destroy\n respond_to do |format|\n format.html { redirect_to concerts_url, notice: 'Concert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @colo = Colo.find(params[:id])\n\n if @colo.assets.length > 0 or @colo.vlan_details.length > 0\n flash[:error] = \"#{@colo.name} has assets or vlans assigned, please remove association first.\" \n else \n @colo.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(colos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @plan_quirurgicos = PlanQuirurgico.find(params[:id])\n @plan_quirurgicos.estatus = \"I\"\n @plan_quirurgicos.save \n respond_to do |format|\n format.html { redirect_to plan_quirurgicos_url, notice: 'El Plan quirurgico fue eliminado exitosamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consumable.destroy\n respond_to do |format|\n format.html { redirect_to consumables_url, notice: \"Consumable was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_decision(custom, collection)\r\n clear\r\n custom_banner\r\n puts\r\n options = []\r\n options.push(\r\n # Comfirm the decision again!\r\n { name: 'Yes!!! I want to delete it so bad!!!!', value: lambda {\r\n conduct_deletion(custom, collection)\r\n } },\r\n # This option provide access to go back if user pull back\r\n { name: 'All right. I want to keep it there now', value: lambda {\r\n display_delete_collections\r\n } }\r\n )\r\n option = @prompt.select(\r\n 'The collection will be delete permanently!!! Think carefully before you act.'.colorize(:blue).colorize(background: :red), options, help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\\n\", show_help: :always\r\n )\r\n end",
"def destroy\n @consumos = ConsumoDirecto.all\n @relaciones = @consumos.find { |item| item[:obra_proyecto_id] == @obra_proyecto.id } \n if @relaciones.nil?\n @obra_proyecto.destroy\n flash[:notice] = 'La obra/proyecto fue eliminada exitosamente.'\n else\n flash[:notice] = 'La obra/proyecto tiene relaciones asociadas.No pudo ser eliminada' \n end \n respond_to do |format|\n format.html { redirect_to obras_proyectos_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n self.update_attribute(:status, DELETED)\n self.registration.update_attribute(:status, DELETED) if self.registration\n end",
"def destroy\n###### @company.destroy\n @company.active = false\n @company.save\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'company was successfully INACTIVATED.' }\n format.json { head :no_content }\n end\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 destroy\n if @csf.id == current_plan.selected_csf\n # Unset selected critical success factor\n current_plan.update_attribute(:selected_csf, nil)\n end\n @csf.destroy\n flash[:info] = \"Fator crítico de sucesso foi excluído\"\n redirect_to csfs_path\n end",
"def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n\n respond_to do |format|\n format.html { redirect_to consumos_url }\n format.json { head :no_content }\n end\n end",
"def chef_to_be_removed(chef_server_list)\n servers_up = cloud_server_list\n chef_server_list.delete_if do |name,server|\n puts \"Do not delete #{name}, it's up\" if servers_up[name]\n !! servers_up[name]\n end\nend",
"def destroy\n @rental = Rental.where(:license => @car.license, :status => 'Checked out')\n if [email protected]?\n redirect_to cars_url, notice: 'Car has been checked out thus can not be deleted until returned.'\n else\n @rental = Rental.where(:license => @car.license, :status => 'Reserved')\n @rental.each do |r|\n Rental.update(r.id,:status => \"Cancelled\")\n end\n @car.destroy\n respond_to do |format|\n format.html { redirect_to cars_url, notice: 'Car was successfully destroyed and it\\'s reservations were cancelled.' }\n format.json { head :no_content }\n end\n end\n end",
"def onRemoved(links)\n @set -= links\n end",
"def destroy\n @con_in.destroy\n respond_to do |format|\n format.html { redirect_to con_ins_url, notice: 'Con in was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_fileset\n\n fileset = get_the_fileset\n if fileset.nil? == false\n works = fileset.in_works\n work_id = works.empty? ? 'unknown' : works[0].id\n\n # audit the information\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{fileset.label}/#{fileset.title[0]} deleted\" )\n\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.destroy\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'Fileset not available' )\n end\n\n end",
"def revoke\n raise \"Implement me!\"\n end",
"def destroy\n run_callbacks :destroy do\n #the insurance billing record status need to be revertd back so it appears in the claims outstanding box\n #dont know if it was submitted or printed, so use error as a revert\n self.insurance_billing.revert_to_previous_status if !self.insurance_billing_id.blank?\n self.update_column(:deleted, true)\n end\n end"
] | [
"0.69407505",
"0.69407505",
"0.6678533",
"0.6245886",
"0.62038225",
"0.6047187",
"0.6032951",
"0.6011759",
"0.5924574",
"0.5850906",
"0.5850906",
"0.5850906",
"0.58394384",
"0.58113974",
"0.5778667",
"0.575794",
"0.57445323",
"0.57445323",
"0.57445323",
"0.57445323",
"0.56943935",
"0.5684593",
"0.567731",
"0.5650747",
"0.5641967",
"0.5641967",
"0.5641967",
"0.5641967",
"0.5641967",
"0.5636963",
"0.56053835",
"0.5592102",
"0.5566719",
"0.55662453",
"0.5552197",
"0.55516624",
"0.5536286",
"0.5528752",
"0.551961",
"0.5515144",
"0.55144125",
"0.54999566",
"0.5492615",
"0.5474689",
"0.5458974",
"0.5458974",
"0.54454887",
"0.5434556",
"0.54293776",
"0.54282063",
"0.54181623",
"0.54084253",
"0.54009837",
"0.53844076",
"0.53797096",
"0.5378511",
"0.5378214",
"0.5374109",
"0.53704417",
"0.53626657",
"0.53592455",
"0.53584796",
"0.53551805",
"0.53438157",
"0.5336576",
"0.5334359",
"0.53156143",
"0.53152806",
"0.53152204",
"0.53112435",
"0.52972096",
"0.5288879",
"0.5285766",
"0.52835375",
"0.52826554",
"0.527952",
"0.52696836",
"0.52576894",
"0.523928",
"0.523928",
"0.52378476",
"0.5231558",
"0.5224918",
"0.5220998",
"0.52204734",
"0.52185506",
"0.52159655",
"0.521488",
"0.5214787",
"0.5211841",
"0.5210054",
"0.5202641",
"0.5202568",
"0.5201594",
"0.5195365",
"0.5185571",
"0.51821536",
"0.5177956",
"0.51753217",
"0.51717126"
] | 0.6261511 | 3 |
update appropriate status fld | def update_status conv, user, fld
if conv.update_attribute(fld.to_sym, 'removed')
conv.remove_posts(user)
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_status(status)\n self.status = status\n self.save! validate: false\n end",
"def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end",
"def set_flds\n self.status = 'active' if status.blank?\n self.status = 'scheduled' if has_appt? && !is_completed?\n self.status = 'completed' if is_completed?\n end",
"def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend",
"def update\n @field_status = FieldStatus.find(params[:id])\n if @field_status.systematic\n render :js => %(show_warning('非法操作', '无法编辑系统属性'))\n return\n end\n @field_status.name = @field_status.name.strip\n respond_to do |format|\n if @field_status.update_attributes(params[:field_status])\n format.html { redirect_to @field_status, notice: '更新场地状态成功' }\n format.js { redirect_to @field_status, :remote => true }\n else\n format.html { render action: 'edit' }\n format.js { render action: 'edit' }\n end\n end\n end",
"def update_status\n \n case\n\n #If the file is in processing dont change the status\n when (self.attribute1 == \"Processing\" or self.attribute1 == \"Uploaded\")\n self.attribute1 = self.attribute1\n \n #When the file has all processed record \n when (self.no_of_processed_records !=0 and self.no_of_error_records == 0)\n self.attribute1 = \"Processed\" \n \n #When the file has only error records no processed record\n when (self.no_of_processed_records ==0 and self.no_of_error_records !=0)\n self.attribute1 = \"Error\" \n \n #When there are processed records and error records both in the file\n when (self.no_of_processed_records!=0 and self.no_of_error_records !=0)\n self.attribute1 = \"Processed with Error\" \n #When all the records are processed and no error and no deleted records\n when (self.no_of_records == self.no_of_processed_records and self.no_of_error_records == 0 and self.no_of_deleted_records == 0)\n self.attribute1 = \"Processed Successfully\"\n \n end\n\n end",
"def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end",
"def set_flds\n self.status = 'active' if self.status.blank?\n end",
"def update_status\n\t\tasset.update_attributes(:status => STATUS[\"Assigned\"])\n\tend",
"def update_status\n\t\tasset.update_attributes(:status => STATUS[\"Assigned\"])\n\tend",
"def status=(new_status)\n update_values([:status] => new_status)\n end",
"def set_StatusUpdate(value)\n set_input(\"StatusUpdate\", value)\n end",
"def status_update(_event)\n @submitted = false\n @filed = false\n end",
"def status=(status); end",
"def update!(**args)\n @new_status = args[:new_status] if args.key?(:new_status)\n end",
"def auto_update_status\n if self.criminal_date && self.child_abuse_date && self.fbi_date\n if self.status < 2\n self.status = 2\n end\n elsif self.status == 2\n self.status = 1\n end\n end",
"def update_status(new_stat)\n\n attrs = ActionController::Parameters.new({status: new_stat, req_to_del_at: nil})\n self.update_attributes(attrs.permit(Team::PERMIT_BASE))\n end",
"def force_update_status(status) #rails' behaviour when saving a attribute in a background thread is very weird and unpredictable..\n \t\tself.update_attribute(:status , status)\n \t\tself.update_attributes(:status => status)\n \t\tself.status = status\n \t\tself.save\n end",
"def upload_failed\n update_attributes(:status => STATUS[:failed])\n end",
"def comprado!\n \tupdate_column(:status, true)\n end",
"def status=(new_status)\n self.last_status = status\n\n self.setValue new_status, forKey: 'status'\n end",
"def set_status\n self.status = 1\n end",
"def set_status(status, status_message = '')\n return if status == Algorithm.statuses[self.status]\n self.update_attributes(status: status)\n self.update_attributes(status_message: status_message)\n self.update_attribute(:diva_id, nil) if self.status == 'review' || self.status == 'unpublished_changes'\n self.update_version if self.status == 'published'\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def change_status(status)\n #not implemented \n end",
"def change_status(object, status)\n object.update_attribute :status, status\n end",
"def update_status\n\t\t@medical_record_request.update_attributes!(:status => params[:status])\n\t\tredirect_to new_medical_record_request_path\n\trescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid \n\t\tflash.now[:error] = \"Medical Record Request Status Update failed\"\n\t\trender :action => 'edit'\n\tend",
"def update(input, field_width)\n # If [TYPE] is round, then Status' @round property will be set to [VALUE]\n # If [TYPE] is not round (i.e. field), then the parse_field method is called\n # with the word field and [VALUE], which is an array\n input.shift == 'round' ? @round = input[0] : parse_field(input[0], field_width)\n # This prints out the current Status object\n p self\n end",
"def update_status(status)\n @metric_status = status if STATUSES[status] > STATUSES[@metric_status]\n end",
"def update_status\n self.status = board.status\n end",
"def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end",
"def change_value field=\"status\", value=\"closed\", args\n #field = \"status\"\n #value = \"closed\"\n meth = \"validate_#{field}\".to_sym\n if respond_to? meth\n #bool = send(\"validate_#{field}\".to_sym, value)\n bool = send(meth, value)\n # try to find out values\n #vfield = \"@valid_#{field}\"\n #valid = eval(vfield).join(\",\")\n #die \"#{value} is not valid for #{field} (#{valid})\" unless bool\n return 1 unless bool\n end\n args.each do |id| \n db, row = validate_id id\n curr_status = row[field]\n # don't update if already closed\n if curr_status != value\n db.sql_update \"bugs\", id, field, value\n puts \"Updated #{id}\"\n rowid = db.sql_logs_insert id, field, \"[#{id}] updated [#{field}] with #{value}\"\n row[field] = value\n mail_issue \"[#{id}] updated [#{field}] with #{value}\", row\n else\n message \"#{id} already #{value}\"\n end\n _comment(db, id, @options[:comment]) if @options[:comment]\n _fix(db, id, @options[:fix]) if @options[:fix]\n end\n 0\n end",
"def updateStatus(event)\n parent = event.target.parentNode\n\n # update state from data attributes\n for i in 0...parent.attributes.length\n attr = parent.attributes[i]\n $data[attr.name[5..-1]] = attr.value if attr.name.start_with? 'data-'\n end\n\n # unindent action\n @status.gsub!(/\\n {14}/, \"\\n\")\n\n # set baseline to current value\n @baseline = @status\n\n # show dialog\n jQuery('#updateStatusForm').modal(:show)\n end",
"def update_status\n\t\t@blood_spot_request.update_attributes!(:status => params[:status])\n\t\tredirect_to new_blood_spot_request_path\n\trescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid \n\t\tflash.now[:error] = \"Blood Spot Request Status Update failed\"\n\t\trender :action => 'edit'\n\tend",
"def sdk_update_status(instance)\n if raw_power_state != instance.status\n update!(:raw_power_state => instance.status) if raw_power_state != instance.status\n $ibm_cloud_log.info(\"VM instance #{instance.id} state is #{raw_power_state}\")\n end\n end",
"def sdk_update_status(instance)\n if raw_power_state != instance.status\n update!(:raw_power_state => instance.status) if raw_power_state != instance.status\n $ibm_cloud_log.info(\"VM instance #{instance.id} state is #{raw_power_state}\")\n end\n end",
"def update_status\n return nil if !@on_status\n rows_count = Knj::Locales.number_out(@rows_count, 0)\n rows_count_total = Knj::Locales.number_out(@rows_count_total, 0)\n percent = (@rows_count.to_f / @rows_count_total.to_f) * 100\n percent_text = Knj::Locales.number_out(percent, 1)\n @on_status.call(:text => \"Dumping table: '#{@table_obj.name}' (#{rows_count}/#{rows_count_total} - #{percent_text}%).\")\n end",
"def set_status\n self.status = Status.find_by(code: \"OPEN\")\n end",
"def update_edit_kyc_row(status)\n @edit_kyc_request.status = status\n @edit_kyc_request.save!\n end",
"def editing_complete status=nil\n self.edit_mode = false\n self.status = status.to_s if status\n self.save\n end",
"def set_status\n if status.blank?\n if (consulted_legal) && (consulted_marketing)\n status = \"Pending Approval\"\n elsif (consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing Approval\"\n elsif (!consulted_legal) && (consulted_marketing)\n status = \"Awaiting Legal Approval\"\n elsif (!consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing & Legal Approval\"\n end\n end\n true # Needs to return true for the update to go through \n end",
"def update_status!(\n item = nil,\n file: true,\n data: true,\n ready: true,\n overwrite: true,\n **added\n )\n item ||= default_to_self\n file &&= overwrite || item[:file_status].nil?\n data &&= overwrite || item[:data_status].nil?\n ready &&= overwrite || item[:ready_status].nil?\n item[:file_status] = evaluate_file_status(item, **added) if file\n item[:data_status] = evaluate_data_status(item, **added) if data\n item[:ready_status] = evaluate_ready_status(item, **added) if ready\n # noinspection RubyMismatchedReturnType\n item\n end",
"def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end",
"def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end",
"def update_clinician_status\n binding.pry\n #(region.eql? \"India\") && (speciality.eql? \"dentist\")\n if region == \"India\" && speciality != \"dentist\"\n self.status = \"active\"\n end\n return nil\n end",
"def set_Status(value)\n set_input(\"Status\", value)\n end",
"def set_Status(value)\n set_input(\"Status\", value)\n end",
"def update_status\n return nil unless @on_status\n rows_count = Knj::Locales.number_out(@rows_count, 0)\n rows_count_total = Knj::Locales.number_out(@rows_count_total, 0)\n percent = (@rows_count.to_f / @rows_count_total.to_f) * 100\n percent_text = Knj::Locales.number_out(percent, 1)\n @on_status.call(text: \"Dumping table: '#{@table_obj.name}' (#{rows_count}/#{rows_count_total} - #{percent_text}%).\")\n end",
"def mark_as(status)\n self.status = status\n self.save\n end",
"def set_status(val)\n self.status = val\n self\n end",
"def update_job_status(status)\n @csv_report_job.status = status\n @csv_report_job.save!\n end",
"def lent_out\n\tupdate_attributes(status: 'Lent Out')\nend",
"def updateStatus id, status\n\t\[email protected] Hash['status' => status], ['id', id]\n\tend",
"def updateStatusRow(s)\n\t\ts=\"\" if s.nil?\n\t\[email protected](0,0,s); @statusRow.clrtoeol; @statusRow.refresh\n\tend",
"def setStatus(status)\r\n\t\t\t\t\t@status = status\r\n\t\t\t\tend",
"def set_status\n type = params[:type]\n if type == \"In Progress\"\n @service_request.status = \"In Progress\"\n elsif type == \"Completed\"\n @service_request.status = \"Completed\"\n end\n\n if @service_request.save\n flash.now[:sucess] = \"Status updated successfully\"\n redirect_to user_service_request_path(@service_request.user_id, @service_request)\n else\n flash.now[:danger] = \"Status was not updated\"\n redirect_to user_service_request_path(@service_request.user_id, @service_request)\n end\n\n end",
"def update_status\n find_detail\n #如果更改状态的时间比数据库中该设备最后更改的时间还早的话,说明日期有错误\n last_record=StatusChange.find_by_device_id(@device.id,:order=>\"status_change_time DESC\")\n\n if last_record.blank?\n max_date=Date.parse(\"1970-1-1\") \n pro_status = \"\"\n else \n max_date=last_record.status_change_time\n pro_status = last_record.status\n end\n\n if Date.parse(params[:status_change][:status_change_time])>max_date\n if params[:status_change][:status]==\"维修\" && pro_status!=\"故障\"\n flash[:notice] = '有故障的设备才能维修!'\n redirect_to :action=>:change_status\n else\n params[:device][:status] = params[:status_change][:status]\n @device.attributes = params[:device]\n\n @status_change = StatusChange.new(params[:status_change])\n @status_change.device_id = @device.id\n @status_change.service_provider = @device.service_provider\n @status_change.department = @device.department\n\n unless [@device, @status_change].map(&:valid?).include?(false)\n @device.update_attributes(params[:device])\n @status_change.save\n flash[:notice] = '新设备状态已经修改成功!'\n redirect_to :id=>@device, :action=>\"show_status_change\"\n else\n render :action => \"change_status\"\n end\n end\n else\n flash[:notice] = '日期错误!'\n redirect_to :action=>:change_status\n \n end\n end",
"def update_status\n case @part.status\n when 'Unstarted'\n @part.status = 'Started'\n @part.user = current_user\n @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype'\n @part.create_activity key: 'part.started', owner: current_user\n @part.start_rep_points\n when 'Started'\n @part.status = 'Finished'\n @part.create_activity key: 'part.finished', owner: current_user\n when 'Finished' \n @part.status = 'In Review'\n @part.create_activity key: 'part.in_review', owner: current_user\n when 'In Review'\n @part.status = 'Accepted'\n @part.accepted_rep_points\n @part.create_activity key: 'part.accepted', owner: current_user\n end\n @part.save\n redirect_to :back\n end",
"def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end",
"def update!(**args)\n @format = args[:format] if args.key?(:format)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update\n params[:kf_status][:status_type] = params[:status_type] unless params[:status_type].blank?\n params[:kf_status][:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n params[:kf_status][:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_status = Kf::Status.find(params[:id])\n\n respond_to do |format|\n if @kf_status.update_attributes(params[:kf_status])\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\", notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kf_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entry_status=(value)\n case value\n when \"有效的\", \"käytössä\", \"действующий\", \"válido\"\n value = \"valid\"\n when \"korvattu\", \"reemplazado\"\n value = \"superseded\"\n when \"информация отсутствует\" # \"information absent\"!?\n value = \"retired\"\n when %w(notValid valid superseded retired)\n # do nothing\n end\n @entry_status = value\n end",
"def update\n ticket = Ticket.find(params[:id])\n status = params[:status]\n\n if status and ticket.update_attributes(status: status)\n render json: {\"notice\"=>\"status updated successfully to '#{status}'\"}\n else\n render json: {\"alert\"=>\"status not updated. check params.\"}\n end\n end",
"def status=(value)\n write_attribute :status, value.to_i\n end",
"def set_status\n\t @id=params[:id]\n\t @state = State.find(@id)\n\t @status = @state.status\n if @status == true\n @state.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @state.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to states_path\n end",
"def update_query_status(total)\n @query_status.last_twid = @last_twid\n @query_status.last_run = Time.now.utc\n @query_status.last_result_count = total\n @query_status.save!\n end",
"def updateStatus\n\n storyURI = @details['Assets']['Asset']['href']\n\n statusXml = '<Asset>\n <Attribute name=\"Custom_JIRAIntStatus\" act=\"set\">' + @mapping.SendToJiraMap['Resolved in JIRA'] + '</Attribute>\n </Asset>'\n\n r_status = self.class.post(\"#{storyURI}\", :body => statusXml,\n :headers => {\"content_type\" => \"application/xml\"}, :verify => false)\n\n if r_status['Error']\n p r_status['Error']\n else\n @persist.updateDefectStatus(@story)\n return 1\n end\n return 0\n end",
"def update_status(new_status)\n raise ArgumentError.new\"Invalid Status\" unless new_status == :AVAILABLE || new_status == :UNAVAILABLE\n @status = new_status\n end",
"def update!(**args)\n @dlp_status = args[:dlp_status] if args.key?(:dlp_status)\n end",
"def set_status status\n self.update(pet_status: status)\n end",
"def updateStatus\n result = Hash.new\n result['status'] = true\n begin # try\n result['status'] = RegistCoursesHlp.updateStatus(params[:id],params[:status])\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n # byebug\n render json: result\n end\n end",
"def update\n ActiveRecord::Base.transaction do\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to @status, notice: 'El Estado se actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render :edit }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update_collaboration_status\n if collaboration.collaboration_items.count >= 30\n collaboration.status = 4\n elsif collaboration.collaboration_items.count >= 20\n collaboration.status = 3\n elsif collaboration.collaboration_items.count >= 10\n collaboration.status = 2\n elsif collaboration.collaboration_items.count >= 5\n collaboration.status = 1\n elsif collaboration.collaboration_items.count >= 0\n collaboration.status = 0\n end\n collaboration.save\n end",
"def update_status\n doc_id = params[:id]\n new_status = params[:new_status]\n doc = Typewright::Document.find_by_id(doc_id)\n old_status = doc.status\n doc.status = new_status\n if !doc.save\n render :text => doc.errors, :status => :error\n return\n end\n\n # need special behavior to handle documents that are complete\n # kick off new logic to grab corrected text, and send it to catalog for\n # re-indexing\n if new_status == 'complete'\n # grab corrected text\n fulltext = Typewright::Overview.retrieve_doc(doc.uri, \"text\")\n\n # get the solr object for this document\n solr = Catalog.factory_create(false)\n solr_document = solr.get_object(doc.uri)\n\n # update the important bits\n solr_document['text'] = fulltext\n solr_document['has_full_text'] = \"true\"\n json_data = ActiveSupport::JSON.encode( solr_document )\n\n # POST the corrected full text to the catalog so it will be\n # stored there and the results reproducable on the next reindex\n catalog_url = \"#{URI.parse(Setup.solr_url())}/corrections\"\n private_token = SITE_SPECIFIC['catalog']['private_token']\n\n begin\n resp = RestClient.post catalog_url, json_data, :'private_token' => private_token, :content_type => \"application/json\"\n Catalog.reset_cached_data()\n render :text => \"OK\", :status => :ok\n rescue RestClient::Exception => rest_error\n puts rest_error.response\n doc.status = old_status\n doc.save\n render :text => rest_error.response, :status => rest_error.http_code\n rescue Exception => e\n puts rest_error.response\n doc.status = old_status\n doc.save\n render :text => e, :status => :internal_server_error\n end\n else\n render :text => \"OK\", :status => :ok\n end\n end",
"def update_status() \n ContentProviderStatusItem.update(self)\n end",
"def check_progress\n self.increment_count\n begin\n self.send(\"check_progress_#{self.type}\")\n rescue\n self.update_attributes(:status =>'not yet available')\n end\n end",
"def update!(**args)\n @status_content = args[:status_content] if args.key?(:status_content)\n @status_file_name = args[:status_file_name] if args.key?(:status_file_name)\n end",
"def status_update(name, dice, saved=nil)\n end",
"def update_status\n update_params = {status: params[:status]}\n update_params[:password] = \"\" if params[:object] == \"User\"\n\n model = params[:object].constantize\n object = model.find(params[:status_id])\n if object.update_attributes(update_params)\n render json: {success:{msg: \"Updated #{params[:object]}\", id: object.id.to_s}}\n else \n render json: {failure:{msg: object.errors.full_messages.first}}\n end\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end",
"def status=(value)\n @status = value\n end"
] | [
"0.70309967",
"0.697569",
"0.6943432",
"0.68446016",
"0.6799303",
"0.67307174",
"0.67230606",
"0.6718294",
"0.6712188",
"0.6712188",
"0.6705528",
"0.669559",
"0.66875",
"0.6641387",
"0.66072446",
"0.660232",
"0.65956587",
"0.6559024",
"0.65514934",
"0.6538516",
"0.6531496",
"0.6515806",
"0.65092015",
"0.65070814",
"0.65070814",
"0.65070814",
"0.65070814",
"0.65070814",
"0.65070814",
"0.6457798",
"0.6446411",
"0.64412034",
"0.6410368",
"0.63890696",
"0.6376081",
"0.63702047",
"0.63680005",
"0.6367626",
"0.63266164",
"0.63222194",
"0.63222194",
"0.62925243",
"0.62785363",
"0.6264827",
"0.6263572",
"0.6253501",
"0.6253288",
"0.6236656",
"0.6235364",
"0.6230394",
"0.6224069",
"0.6224069",
"0.62234354",
"0.6217139",
"0.6205292",
"0.6201848",
"0.6198102",
"0.619674",
"0.61933523",
"0.61905617",
"0.61840683",
"0.6175112",
"0.6171955",
"0.6164822",
"0.61500955",
"0.6136042",
"0.6121698",
"0.6105197",
"0.6104467",
"0.60969913",
"0.60893697",
"0.60786176",
"0.6063631",
"0.6061562",
"0.6060445",
"0.6057788",
"0.60499334",
"0.6044423",
"0.6042319",
"0.60417855",
"0.60317034",
"0.6030806",
"0.6025913",
"0.6024522",
"0.5994781",
"0.599429",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151",
"0.5994151"
] | 0.0 | -1 |
sets all posts in a convo to 'removed' | def remove_posts usr
@conv.posts.each do |post|
if usr.id == post.user_id
post.status = 'removed'
elsif usr.id == post.recipient_id
post.recipient_status = 'removed'
end
post.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_posts usr\n ConversationProcessor.new(self).remove_posts usr\n end",
"def clear!\n @posts = nil\n end",
"def after_destroy(post)\n post = post.to_post\n Notification.where(:scope => 'mention',\n :source_ids => {'Post' => post.id}).each do |notification|\n notification.remove_source(post)\n notification.update_actors\n end\n end",
"def onRemoved(links)\n @set -= links\n end",
"def delete_tags\n tags = self.tags\n tags.each do |tag|\n tag.destroy if tag.posts.count == 1\n end\n end",
"def unpublished_posts\n @blog_posts = BlogPost.where(:deleted => '0').where(:publish => \"0\").order('created_at DESC')\n end",
"def delete post\n\t\t$DIRTY << :news\n\t\tpost = @children[post] if post.kind_of? Integer\n\t\traise ArgumentError, \"Post not found\" unless @children.include? post\n\n\t\tif @children[-1] == post and post.children.size == 0\n\t\t\[email protected] post\n\t\telse\n\t\t\tpost.title = \"<Deleted>\"\n\t\t\tpost.body = \"<Post deleted>\"\n\t\t\tpost.drill(true){|b| b.locked = true}\n\t\tend\n\n\t\tpost.sticky = false if post.sticky\n\tend",
"def destroy_cleanup\n\tadd_to_deleted(@micropost)\n end",
"def wipeout_unposted_works\n works.find(:all, :conditions => {:posted => false}).each do |w|\n w.destroy\n end\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end",
"def delete_pic\n self.posts.each do |post|\n post.pic.destroy\n end\n end",
"def cleanup_unposted_works\n works.find(:all, :conditions => ['works.posted = ? AND works.created_at < ?', false, 1.week.ago]).each do |w|\n w.destroy\n end\n end",
"def unfave!(post)\n fave = self.faves.find_by_post_id(post.id)\n fave.destroy!\n end",
"def unheart!(post)\n heart = self.hearts.find_by_post_id(post.id)\n heart.destroy!\n end",
"def destroy\n @blog_post.destroy\n end",
"def destroy\n destroy_q(@post, posts_url)\n end",
"def cms_setpost_trash cpid\n\t\tDB[:cms_post].filter(:cpid => cpid).update(:ctid => 2)\n\tend",
"def mark_as_removed!\n self.removed = true\n self.save\n end",
"def destroy\n @post.destroy\n end",
"def destroy\n @post.destroy\n end",
"def destroy\n @post.destroy\n end",
"def destroy\n @post.destroy\n end",
"def destroy\n @post.destroy\n\n end",
"def clear_cache\n $redis.del \"posts\"\n end",
"def decrement_posts_stats\n # first post don't count towards counters\n if self.topic.posts.length > 1\n self.topic.forum.update_attribute(:post_count, self.topic.forum.post_count - 1)\n self.topic.update_attribute(:replies, self.topic.replies - 1)\n self.user.update_attribute(:post_count, self.user.post_count - 1)\n end\n end",
"def destroy\n @post.destroy\n if @post.destroyed?\n @post.categories.clear\n @post.tags.clear\n @post.comments.clear\n redirect_to admin_posts_url, notice: 'Post was successfully destroyed.'\n else\n flash.now[:alert] = 'Post has not been destroyed.'\n redirect_to admin_posts_url\n end\n end",
"def prune\n @set.clear\n end",
"def destroy_all\n posts = current_user.posts\n\n posts.each do |post|\n post.destroy\n end\n\n redirect_to posts_url, :notice => \"Destroyed all Posts.\"\n end",
"def set_removed # :nodoc:\n @removed = true\n end",
"def remove_from_all_dil_collections\r\n self.collections.each do |collection|\r\n collection.members.remove_member_by_pid( self.pid )\r\n collection.save\r\n self.collections.delete(collection)\r\n end\r\n end",
"def unpublish!\n self.update_attributes(status: UNPUBLISHED, featured: false)\n end",
"def unpublish!\n self.update_attributes(status: UNPUBLISHED, featured: false)\n end",
"def unpublish!\n self.update_attributes(status: UNPUBLISHED, featured: false)\n end",
"def reposts\n Comment.where(:original_id => self.id).where(['id != ?', self.id])\n end",
"def destroy\n @post.destroy\n end",
"def remove_marked\n @objects.remove_marked\n end",
"def unpublish\n self.published = false\n end",
"def destroy\n @post.destroy\n success_post_destroy\n end",
"def remove_post(params)\n db = SQLite3::Database.new(\"db/database.db\")\n db.results_as_hash = true\n\n db.execute(\"DELETE FROM posts WHERE postId = ?\", params[\"post_id\"])\n end",
"def unshare\n self.slug = nil\n self.published_at = nil\n end",
"def unpublish_revisions\n #Unpublish us\n if self.submitted?\n self.deleted!\n save\n end\n if self.revisions.present?\n #Unpublish the revisions\n self.revisions.each do |event|\n if event.submitted?\n event.deleted!\n event.save\n end\n end\n end\n end",
"def update_status conv, user, fld\n if conv.update_attribute(fld.to_sym, 'removed')\n conv.remove_posts(user)\n true\n else\n false\n end\n end",
"def delete_post\n\t \n \tend",
"def destroy\n Site.delete_all \"sitename = 'lost+found'\" \n super\n end",
"def uncategorized\n @posts = Refinery::Blog::Post.uncategorized.page(params[:page])\n end",
"def destroy\n @post.profiles.clear\n @post.destroy\n respond_to do |format|\n format.html { redirect_to council_posts_path(@council) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loves = Love.where(post_id: @post.id)\n @loves.each do |love|\n love.destroy\n end \n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end",
"def remove\r\n self.update(deleted: true)\r\n end",
"def unset_all_tags\n @deployment.servers_no_reload.each do |s|\n # can't unset ALL tags, so we must set a bogus one\n s.tags = [{\"name\"=>\"removeme:now=1\"}]\n s.save\n end\n end",
"def remove!; end",
"def safe_destroy\n if self.is_root? && self.original_post?\n Comment.transaction do\n self.descendants.each{|c| c.destroy }\n end\n self.destroy\n else\n self.update_attribute('deleted', true)\n end\n end",
"def tags_to_remove=(value)\n @tags_to_remove = value\n end",
"def destroy\n blog = @post.blog\n @post.destroy\n redirect_to blog, notice: 'Post was successfully destroyed.'\n end",
"def cleanup\n self.objectives.destroy_all\n end",
"def destroy\n\t\[email protected]\n\t\tredirect_to category_posts_path(1) #posts forum index page cat 1\n\tend",
"def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n @post.save\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n make_rss\n end",
"def destroy\n @previous_content = @post.content \n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def after_destroy(post)\n expire_cache_for(post)\n end",
"def after_destroy(post)\n expire_cache_for(post)\n end",
"def unset_all_tags\n @servers.each do |s|\n # can't unset ALL tags, so we must set a bogus one\n s.tags = [{\"name\"=>\"removeme:now=1\"}]\n obj_behavior(s, :save)\n end\n end",
"def regenerate_nonexistent_post_counts!\n Tag.find_by_sql(<<~SQL.squish)\n UPDATE tags\n SET post_count = 0\n WHERE\n post_count != 0\n AND name NOT IN (\n SELECT DISTINCT tag\n FROM posts, unnest(string_to_array(tag_string, ' ')) AS tag\n GROUP BY tag\n )\n RETURNING tags.*\n SQL\n end",
"def unpush_post_through_topic(post, unpush_topic, single_user=nil)\n return unless post && unpush_topic\n\n neo4j_topic_ids = Neo4j.pulled_from_ids(unpush_topic.neo4j_id)\n topics = Topic.where(:_id => {\"$in\" => [unpush_topic.id] + neo4j_topic_ids.map{|t| t}}).to_a\n\n topics.each do |topic|\n # the potential users this post can be pushed to\n if single_user\n user_feed_users = [single_user]\n else\n user_feed_users = User.only(:id, :following_topics).where(:following_topics => topic.id)\n end\n\n user_feed_users.each do |u|\n\n item = FeedUserItem.where(:user_id => u.id, :post_id => post.id).first\n\n next unless item\n\n item.remove_reason('ft', topic)\n item.remove_reason('frt', topic)\n\n if item.reasons.length == 0\n item.delete\n post.pushed_users_count -= 1\n else\n item.save\n end\n\n end\n end\n\n post.save\n end",
"def clean_up\n Discussion.where(category_id: self.id).each do |d|\n Reply.where(discussion_id: d.id).destroy_all\n Revision.where(discussion_id: d.id).destroy_all\n d.destroy\n end\n end",
"def destroy\n can_manage_post\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n delete_unused_tags\n end",
"def cleanup\n Feed.processing.update_all(processing: false)\n FeedItem.processing.update_all(processing: false)\n end",
"def destroy\n # @post.delete_all_tags\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def reject_posts(post_ids)\n post_ids.each do |post|\n post_to_delete = Post.find(post)\n PostDestroyer.new(Discourse.system_user, post_to_delete).destroy\n end\n end",
"def clean_up_tags\n self.tags.each do |tag|\n if tag.todos.count == 1\n tag.destroy\n end\n end\n end",
"def destroy\n # Fetch the right post\n sentenced = Post.find(params[:id])\n\n # Save title for message and blog for redirect\n title = sentenced.title\n blog = sentenced.blog\n\n # Commit murder\n sentenced.destroy\n\n # Show message of successful murder\n flash[:info] = \"You successfully destroyed blog post: \" + title\n\n # Back to index\n redirect_to blog_path(blog)\n end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def unvote!(post)\n votes.find_by(post_id: post.id).destroy\n end",
"def cleardownvote\n @post = Post.find(params[:id])\n @post_count = Post.count\n @vote = Vote.where(user_id: session[:id], post_id: @post.id, score: -1)\n if @vote.exists?\n Vote.destroy(@vote.pluck(:id)[0])\n @post.update_attribute(:respect, @post.respect + 1) # Update post respect\n flash[:notice] = 'Vote cleared successfully'\n end\n redirect_to(action: 'index', topic_id: @topic.id)\n end",
"def destroy\n @post = @current_user.posts.find(params[:post])\n if @post then\n Feed.destroy_post(@post)\n @post.destroy\n end\n end",
"def unpublish_self\n if self.submitted?\n self.deleted!\n save\n end\n if self.revisions.present?\n self.revisions.each do |event|\n if event.submitted?\n event.deleted!\n event.save\n end\n end\n end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n destroy_hashtaggables(@comments.pluck('id'), 'PostComment')\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Wpis został usunięty.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tif @post.destroy\n\t\t\tflash[:notice] = \"It's gone\"\n\t\t\tredirect_to posts_path\n\t\telse\n\t\t\tflash[:alert] = \"Try Again!\"\n\t\tend\n\tend",
"def remove_photos\n self.photos.clear\n end",
"def retrieve_all_children\n self.to_be_removed = false\n self.save\n\n self.tags.each do |i|\n i.to_be_removed = false\n i.save\n end\n end",
"def remove_depricated\n self.articles.each do |a|\n unless ((a.created_at + 3.days) > Date.today) \n self.articles.delete(a)\n end\n end\n\tend",
"def destroy\n @fbpost.destroy\n head :no_content\n end",
"def set_post\n @post = Post.with_deleted.find(params[:id])\n end",
"def unpublish!\n self.update_attribute(:status, \"Unpublished\")\n end",
"def destroy\n @user_blog = UserBlog.find(params[:id])\n @post = @user_blog.posts.where(user_blog_id: @user_blog.id)\n @post.each do |post|\n @comment = post.comments.where(post_id: post.id)\n @comment.each do |comment|\n comment.destroy\n end\n post.destroy\n end\n @user_blog.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id], :include => :blog)\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_blog_posts_url(@post.blog)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post.destroy\n\n head :no_content\n end",
"def destroy\n find_post\n if @post.destroy\n redirect_to posts_path\n else\n end\n end",
"def after_post_update(post)\n if post = post.frozen? ? posts.last : post\n update_attributes! :last_updated_at => post.created_at, \n :last_post_id => post.id, \n :last_author => post.author\n else\n self.destroy\n end\n end",
"def remove\n\t\t#Clean up unused rtwork\n\t\tif Artwork.find_by_majorpost_uuid(params[:majorpost_uuid])\n\t\t\tResque.enqueue(Image::ArtworkCleanup, params[:majorpost_uuid])\n\t\tend\n\tend",
"def remove!\n self.update_attribute(:status, REMOVED)\n end",
"def remove!\n self.update_attribute(:status, REMOVED)\n end",
"def reset\n deleted.all.update marked_deleted: false\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def remove_share_visibilities_on_persons_posts\n ShareVisibility.for_contacts_of_a_person(person).destroy_all\n end"
] | [
"0.6978334",
"0.6913233",
"0.6187236",
"0.61253244",
"0.6107475",
"0.60547864",
"0.604865",
"0.6046654",
"0.60339445",
"0.6005888",
"0.6005888",
"0.6005888",
"0.6005485",
"0.5974702",
"0.5935466",
"0.59247625",
"0.59185445",
"0.59035033",
"0.58933",
"0.5884303",
"0.58808655",
"0.58808655",
"0.58808655",
"0.58808655",
"0.5874344",
"0.5864508",
"0.5853501",
"0.5848219",
"0.58390784",
"0.582004",
"0.5814444",
"0.57973003",
"0.5793887",
"0.5793887",
"0.5793887",
"0.5775698",
"0.57752806",
"0.5774713",
"0.5773949",
"0.57694316",
"0.5765466",
"0.57528955",
"0.5739471",
"0.5736605",
"0.5715171",
"0.5698247",
"0.5696439",
"0.56855464",
"0.5650224",
"0.5647478",
"0.5640528",
"0.56394106",
"0.5636651",
"0.5633668",
"0.56329656",
"0.56329",
"0.5607876",
"0.5606671",
"0.55905527",
"0.5587378",
"0.5587378",
"0.5579727",
"0.5579352",
"0.55770445",
"0.5576767",
"0.5562698",
"0.5561748",
"0.55606407",
"0.55494547",
"0.5547884",
"0.5545728",
"0.55436933",
"0.55436933",
"0.55436933",
"0.55436933",
"0.55403745",
"0.5539893",
"0.55395746",
"0.55359536",
"0.5535375",
"0.5531565",
"0.5528582",
"0.55142707",
"0.5496707",
"0.5494614",
"0.54809433",
"0.5479802",
"0.5478851",
"0.5461601",
"0.54561037",
"0.54549384",
"0.5444598",
"0.54338557",
"0.54331386",
"0.54331285",
"0.54331285",
"0.5430293",
"0.5417379",
"0.5417379",
"0.54163367"
] | 0.73982596 | 0 |
mark all posts in a conversation | def mark_all_posts usr
return false if usr.blank?
@conv.posts.each do |post|
post.mark_as_read! for: usr if post
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_all_posts usr\n ConversationProcessor.new(self).mark_all_posts usr\n end",
"def mark_all_readed\n doctor.notifications.update_all unreaded: false\n send_json doctor.notifications, true\n end",
"def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end",
"def mark(_ = nil)\n answers.each do |answer|\n answer.publish! if answer.submitted?\n end\n end",
"def mark_all_read\r\n @channel.mark_messages_read_for current_user\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel), notice: 'Nachrichten als gelesen markiert.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def mark(_ = nil)\n publish_answers\n end",
"def update_mentions\n post.update_mentions\n end",
"def after_numbered(post)\n return unless post.is_a?(Post)\n return unless post.topic\n return unless post.topic.status == 'publish'\n return unless post.floor and post.floor > 0\n send_mention(post)\n end",
"def mark_as_unread\n @client.post('/api/mod/conversations/unread', conversationIds: [get_attribute(:id)])\n end",
"def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end",
"def show\n @messages = @conversation.messages.sort_by(&:updated_at)\n @messages.each do |m|\n (m[:viewed] = true) && m.save if m.viewed == false && @current_user.id != m.author\n end\n end",
"def remove_posts usr\n @conv.posts.each do |post|\n if usr.id == post.user_id\n post.status = 'removed'\n elsif usr.id == post.recipient_id\n post.recipient_status = 'removed'\n end\n post.save\n end\n end",
"def set_to_read\n\t\t#We find all the messages in the current conversation\n\t\t@conversation_messages = PersonalMessage.where(conversation_id: @conversation).all\n\t\t@conversation_messages.each do |message|\n\t\t\t# We mark as read the messages recieved by the current user \n\t\t\tif message.user_id != current_user.id\n\t\t\t\tmessage.update(read: true) unless message.read != false\n\t\t\tend\n\t\tend\n\tend",
"def reset_unread_conversations_counter\n unread_count = conversations.unread.count\n if self.unread_conversations_count != unread_count\n self.class.where(:id => id).update_all(:unread_conversations_count => unread_count)\n end\n end",
"def update_read_statuses\n person_conversations.each do |p_c|\n if p_c.person_id == last_message.sender.id\n p_c.update_attribute(:last_sent_at, last_message.created_at)\n else\n p_c.update_attributes({ :is_read => 0, :last_received_at => last_message.created_at })\n end \n end\n end",
"def set_conversation\n @conversation = Conversation.where(featured: true).find(params[:id])\n end",
"def set_conversations\n if current_user == @listing.seller\n @conversations = @listing.conversations\n else\n @conversations = @listing.conversations.between(@listing.seller, current_user)\n if @conversations.empty? \n @conversations = create_conversation\n end\n end\n end",
"def enable_inbox_replies\n client.post('/api/sendreplies', id: read_attribute(:name), state: true)\n end",
"def mark_old_broadcasts\n BroadcastMessage.all.each do |broadcast|\n broadcast.users_viewed << self.id\n broadcast.save\n end\n end",
"def send_mention(post)\n post.mentioned.each do |mentioned_user|\n Notification.send_to mentioned_user, 'mention', post.topic, post.user, post\n end unless post.mentioned.blank?\n end",
"def mark_as_spam!\n update_attribute(:approved, true)\n Akismetor.submit_spam(akismet_attributes)\n end",
"def set_conversations\n @conversations = @conversations.send(@order) unless @conversations.blank?\n @conversations = @conversations.page(params[:page]).per(15)\n\n render :index\n end",
"def mark_as_spam!\n update_attribute(:approved, false)\n Akismetor.submit_spam(akismet_attributes)\n end",
"def set_members\n members_ids = params[:message][:recipient_ids].reject(&:empty?)\n members_ids.each do |members_id|\n @message = current_user.messages.create(:conversation_id => members_id , :body => params[:message][:body])\n\n #send notification\n reciver = User.find(members_id)\n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has send a message #{@message.topic} \", notificable: @message, :accept => false)\n end\n end\n end",
"def mark_as_read\n\t\tunread_messages = current_user.received_messages.where(read: false).order('id desc').limit(10)\n\t\tunread_messages.each do |m|\n\t\t\tm.update_attribute(:read, true)\n\t\t\tm.save\n\t\tend\n\t\tredirect_to request.referer\n\tend",
"def all_post\n end",
"def flag\n @conversation = @admin.mailbox.conversations.find(params[:id])\n @conversation.update_column :flagged, params[:flag]\n @conversation.update_column :flagged_at, Time.now\n @conversation.update_column :mailboxer_label_id, Mailboxer::Label::CONVERSATION\n @structure.delay.compute_response_rate\n respond_to do |format|\n format.html { redirect_to pro_structure_conversations_path(@structure), notice: \"Le message a été signalé\" }\n end\n end",
"def wall_post_members\n Member.related_to_notification(self)\n end",
"def mark_all_as_read(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n )\n\n # resource path\n path = path_replace(\"/v1/conversations/mark_all_as_read\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end",
"def perform\n ActiveRecord::Base.transaction do\n reply.update(deleted: true)\n reply.taggings.delete_all\n reply.mentionings.delete_all\n end\n end",
"def send_to_action_cable\n\t\t\tdata = {message: to_html,action:\"new_post\"}\n\t\t\tself.user.friend_ids.each do |friend_id|\n\t\t\t\t#\"posts_#{friend_id}\" hace el broacating a todos los amigos del usuarios\n\t\t\t\t#quien realiza la publicacion\n\t\t\t\tActionCable.server.broadcast \"posts_#{friend_id}\", data\n\t\t\tend\n\n\t\t\tself.user.user_ids.each do |friend_id|\n\t\t\t\tActionCable.server.broadcast \"posts_#{friend_id}\", data\n\t\t\tend\n\t\t\t\n\t\tend",
"def read_notifications\n # Update post notification\n post_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Post', @post.id)\n .first\n post_notification.update_attributes(read: true) unless post_notification.nil?\n\n # Update post's messages notifications\n @post.messages.each do |message|\n message_notification = @message.sender\n .notifications_unread\n .where(\"origin_type = ? AND origin_id = ?\", 'Message', message.id)\n .first\n message_notification.update_attributes(read: true) unless message_notification.nil?\n end\n end",
"def spam(*lines)\n @chats.each do |chat|\n post(chat, lines)\n end\n end",
"def feed_cats\n self.cats.each {|c| c.mood = \"happy\"}\n end",
"def index\n # follower 수를 기준으로 한 추천 사용자\n @suggested_friends_by_followers = User.all.sort{|a,b| b.followers.count <=> a.followers.count}.first(10)\n # 최근 책짹\n @recent_posts = Post.order(id: :desc).limit(10);\n # 가장 많은 좋아요를 받은 책짹\n @favorite_posts = Post.all.sort{|a,b| b.like_users.count <=> a.like_users.count}.first(10)\n\n #@posts = Post.where(user_id: current_user.followees.ids.push(current_user.id)).order(created_at: :desc) #원래 이거였음(followees 피드 저장)\n #@posts = Post.where(user_id: current_user.followees.ids.push(current_user.id)).or(Post.where(postable_type: \"Message\")) #Message 유형의 post 추가\n #@posts = Post.where(postable_type: \"Message\") #Message만 보기\n \n #@messages = Message.where(receiver_id: current_user.id) #일단 이렇게 하면 정상적으로 메시지를 찾기는 함.... 여기서 메시지의 ID를 얻어내야 하는가?\n #@posts = Post.where(postable_type: \"Message\", postable_id: @messages.ids)\n # 중요한 테스트를 해봐야 하는데 만일 Message 모델에 추가한 receiver_id와sender_id 관련 내용을 삭제한다면 올바른 @messages를 찾아낼 수 있는 것인가? => 이거 필요 없음.....\n\n @receive_messages = Message.where(receiver_id: current_user.id)\n #@posts = Post.where(user_id: current_user.followees.ids.push(current_user.id)).or(Post.where(postable_type: \"Message\", postable_id: @receive_messages.ids)).order(created_at: :desc) # 일단 성공/followees 피드에 user_id에 해당하는 post가 저장되니까... 문제 발생\n #@posts = Post.where(user_id: current_user.followees.ids.push(current_user.id)).where.not(postable_type: \"Message\") # messages는 출력하지 않아요...\n #@posts = Post.where(user_id: current_user.followees.ids.push(current_user.id)).where(postabled: @receive_messages) # AND 조건이기 때문에 내가 나한테 남긴 글만 보임(postable_type이 book인 post는 아예 안 보임) 그리고 이건 준우님이 가르쳐주신 Post.where(postable: @messages) object 자체를 조건으로 사용하기...\n @posts = Post.where(user_id: current_user.followees.ids.push(current_user.id)).where.not(postable_type: 'Message').or(Post.where(postable: @receive_messages)).order(created_at: :desc)\n\n end",
"def feed_cats\n self.cats.each{ |cat|\n cat.mood = \"happy\"\n }\n end",
"def index\n @page_title = \"Messages\"\n @message_threads = MessageThread.related_to(current_user)\n @message_thread = @message_threads.first\n if @message_thread\n @message_thread.mark_read!(current_user)\n end\n end",
"def feed_cats\n self.cats.each do |cat|\n cat.mood = \"happy\"\n end \n end",
"def sync_new_mail_count\n c = conversations.count(:conditions => [\"mails.mail_type = 'inbox' and mails.read = 0\"])\n self.class.update_all [\"new_mail_count = ?\", c], [\"id = ?\", id]\n end",
"def mark_as_read\n @client.post('/api/mod/conversations/read', conversationIds: [get_attribute(:id)])\n end",
"def sent\n @messages = Message.sent_by current_user\n end",
"def feed_cats\n self.cats.each do |cat|\n cat.mood = \"happy\"\n end\n end",
"def automatic_results_published_post(contestproblem)\n contest = contestproblem.contest\n sub = contest.subject\n mes = Message.create(:subject => sub, :user_id => 0, :content => helpers.get_new_correction_forum_message(contest, contestproblem))\n sub.last_comment_time = mes.created_at\n sub.last_comment_user_id = 0 # Automatic message\n sub.save\n \n sub.following_users.each do |u|\n UserMailer.new_followed_message(u.id, sub.id, -1).deliver\n end\n end",
"def show\n @conversation.mark_messages_as_read\n end",
"def set_post\n @post = FlaggedPost.find(params[:id])\n end",
"def set_conversations\n conversations = Conversation.where(\n \"user1_id = :current_user_id OR user2_id =:current_user_id\",\n current_user_id: current_user.id\n )\n\n @conversations = conversations.sort_by do |conversation|\n last_message = conversation.last_message\n\n if last_message\n last_message.created_at\n else\n Time.zone.now\n end\n end\n\n @conversations.reverse!\n end",
"def refresh_posts\n @user.find_posts do |posts|\n if posts[:response].success?\n posts[:conflicts].each do |conflict|\n conflict[:foreign].merge_if{ conflict[:local].nil? }\n end\n tableView.reloadData\n else\n puts \"error retreiving posts: #{response[:error_message]}\"\n end\n end\n end",
"def sent\n @messages = current_user.messages.order('created_at DESC').unarchived.paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @messages = @conversation.messages.order(created_at: :desc)\n @messages.unread(@conversation.partner(current_user)).update_all(read: true) # 既読処理\n @new_message = Message.new\n end",
"def feed_cats \n self.cats.each do |cat|\n cat.mood = \"happy\"\n end \n end",
"def update_responders\n return true unless self.original_post?\n children = self.descendants\n awesomes = self.awesomes\n # Save as array with comment user ids, then repost user ids, then awesome user ids\n self.responder_ids = [children.map{|c| c.user_id }, self.reposts.map{|c| c.user_id }, awesomes.map{|a| a.user_id }]\n self.responder_ids = [] if self.responder_ids.present? && self.responder_ids[0].blank? && self.responder_ids[1].blank? && self.responder_ids[2].blank?\n self.reply_count = children.size\n self.awesome_count = awesomes.size\n self.save\n end",
"def like_and_post_on_matching_feed( words_to_match, messages_array )\n regex = /#{words_to_match.map{|w|Regexp.escape(w)}.join('|')}/i\n \n messages = []\n \n posts = get_feed.each do |post|\n name = post[\"message\"]\n if regex === name\n message = \"#{messages_array.sample} #{post['from']['name']}\"\n messages << message\n add_comment_and_like_on_post( post[\"id\"], message )\n end\n end\n end",
"def work(raw_post)\r\n RecentPosts.push(raw_post)\r\n ack! # we need to let queue know that message was received\r\n end",
"def send!(to_array, subject)\n begin\n conversation = Conversation.new\n conversation.subject = subject\n \n conversation.messages << self\n \n self.save!\n conversation.save!\n \n senderconversation = Userconversation.new\n senderconversation.user = self.sender\n senderconversation.readed = true\n senderconversation.conversation = conversation\n senderconversation.hide = false\n senderconversation.save!\n \n to_array.each do |to|\n receiverconversation = Userconversation.new\n receiverconversation.user = to\n receiverconversation.readed = false\n receiverconversation.hide = false\n receiverconversation.conversation = conversation\n receiverconversation.save!\n end\n return true\n rescue\n return false\n end\n end",
"def mark_as_unread\n Notifyer::Notification.all.each do |n|\n n.update(is_read: false)\n end\n redirect_to :back\n end",
"def mark_all_user_notifications_notified(user)\n user.notifications.each do |n|\n n.notified = true\n n.save\n end\n end",
"def set_post_thread\n @post_thread = PostThread.viewable(current_account).find(params[:id])\n end",
"def mark_all_news_as_read\n where(:user_id => User.current_user_id).update_all(:read => 1)\n end",
"def add_post(post)\n @posts << post #pushes post into post array so that we can compare the author with that author\n post.author = self\nend",
"def add_to_conversations\n session[:conversations] ||= []\n session[:conversations] << @conversation.id\n end",
"def mark_unread_entries(feed_subscription)\n feed = feed_subscription.feed\n feed.entries.find_each do |entry|\n if !EntryState.exists? user_id: self.id, entry_id: entry.id\n entry_state = self.entry_states.create! entry_id: entry.id, read: false\n end\n end\n end",
"def sent\n @collection.select(&:sent?)\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 group_posts\n self.posts.docs.each {|post|\n @posts_by_language[post.language][post.url_no_language] = post\n }\n end",
"def add_to_post(post, all_comments)\n all_comments.each do |comment|\n post.add_comments(comment)\n end\nend",
"def sent\n @messages = current_user.sent_messages\n end",
"def set_posts\n @posts = Post.find(params[:id])\n end",
"def mutemessages\n self.has_message = false\n self.save\n end",
"def mark_all_as_read\n @notifications = Notification.unread.for_user(current_api_v1_user)\n @notifications.update_all(read_at: Time.now) unless @notifications.blank?\n @notifications = Notification.where(recipient_id: current_api_v1_user.id)\n \n render json: @notifications\n end",
"def index\n @post_replies = PostReply.all\n end",
"def turn_to_status_post\n fail_with! 'Post already is StatusPost' if @post.status?\n\n if @post.uploads.count.zero?\n @post.type = 'StatusPost'\n @post.title = nil\n @post.save or fail_with! @post.errors\n\n FeedEventsManager.new(user: user, target: @post).turn_to_status_event\n\n @post.elastic_index_document\n @post\n end\n end",
"def filter_posts_by_ids(post_ids)\n @posts = super(post_ids)\n if SiteSetting.private_replies_enabled && @topic.custom_fields.keys.include?('private_replies') && @topic.custom_fields['private_replies']\n if !@user\n @posts = @posts.where('posts.post_number = 1')\n end\n if @topic.user.id != @user.id && [email protected]? # Topic starter and admin can see it all\n replied_users = Post.where('topic_id = ? AND deleted_at IS NULL' ,@topic.id).pluck(:user_id)\n if not (replied_users.include?(@user.id))\n @posts = @posts.where('posts.post_number = 1')\n end\n end\n end\n @posts\n end",
"def index\n @messages = @conversation.messages\n @message = Message.new(user_id:current_user.id)\n @conversation.messages_for(current_user).unread.update_all(read: true)\n end",
"def feed_cats\n cats.each do |cat|\n cat.mood = \"happy\"\n end\n end",
"def set_postlike\n @likes = Like.where(post_id: params[:post_id])\n end",
"def remove_posts usr\n ConversationProcessor.new(self).remove_posts usr\n end",
"def posts=(value)\n @posts = value\n end",
"def posts=(value)\n @posts = value\n end",
"def save_person_conversations\n person_conversations.each { |p_c| p_c.save }\n end",
"def check_for_posts\n if self.posts.any?\n errors[:base] << \"cannot delete Topic tag when posts are using it!\"\n return false\n else\n return true\n end\n end",
"def mark!\n\t\t\t\t@marked = true\n\t\t\tend",
"def set_unread_message_count\n self.unread_messages = 1\n end",
"def set_reply_flag\n @reply_flag = ReplyFlag.find(params[:id])\n end",
"def reset_view_status\r\n members = conversation.conversation_members\r\n\r\n members = members.where.not(:user_id => user.id) unless user.nil?\r\n\r\n members.update_all :viewed => false\r\n end",
"def posts_feed\n\n init_posts_feed\n\n end",
"def conversation\n @user = User.find(params[:id])\n @messages = Message.find(:all, :conditions => [\"((messages.user_id = #{current_user.id} and messages.receiver_id = #{params[:id]}) and messages.user_status != 'deleted') or ((messages.receiver_id = #{current_user.id} and messages.user_id = #{params[:id]}) and messages.receiver_status != 'deleted')\"], :order => \"created_at Desc\")\n for message in @messages\n if message.receiver_id == current_user.id\n message.update_attribute(:receiver_status, \"read\") if message.receiver_status == \"unread\"\n end\n end\n respond_to do |format|\n format.xml { render :xml => @messages }\n format.json { render :json => @messages }\n end\n end",
"def new_post_notification(post)\n #author\n reciever = User.find_by_id post.user_id\n setup_email(reciever)\n @subject +=\"Новый пост в вашем сообществе\"\n body[:url] = RAILS_URL + \"posts/show/#{post.id}\"\n body[:post] = post\n end",
"def markbot()\n merge(markbot: 'true')\n end",
"def replies\n Post.where(\"topic_id = ?\", self.id).order(\"created_at asc\")\n #Post.find_all_by_topic_id(self.id).order(\"created_at desc\")\n end",
"def distribute_to_feed_postboxes\n self.feed.postboxes.each do |postbox|\n self.distribute_to(postbox)\n end\n end",
"def markMail(imap, folder)\n pp \"MARKED #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Seen])\n imap.expunge\nend",
"def mark_as_read\n @notifications = Notification.where(recipient: current_user).unread\n @notifications.update_all(read_at: Time.zone.now)\n render json: {success: true}\n end",
"def set_post_reply\n @post_reply = PostReply.find(params[:id])\n end",
"def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end",
"def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n end\n end",
"def set_readed!(date=DateTime.now)\n mensajes = Mensaje.find(:all, :conditions => [\"clave = ?\", self.clave])\n mensajes.each do |m|\n m.update_attributes!(:leido_at => date)\n end\n end",
"def send_notifications\n send_new_post_to(:sender) if self.sender.notify_on_comment_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_comment_received\n end",
"def generate_notifications\n notification = \"New Reply to '#{@post.content}'\"\n Notification.create(content: notification, \n user_id: @post.sender.id, \n user_type: @post.sender.class.name,\n origin_type: 'Message',\n origin_id: @message.id) unless @post.sender == @message.sender\n users = []\n @post.messages.each do |message|\n users << message.sender unless users.include?(message.sender) || @post.sender == message.sender\n end\n users.each do |user|\n Notification.create(content: notification,\n user_id: user.id,\n user_type: user.class.name,\n origin_type: 'Message',\n origin_id: @message.id) unless user == @message.sender\n end\n end",
"def set_thread_for_replies\n self.thread = self.commentable.thread if self.reply_comment?\n end",
"def add_post(post)\n @posts << post\n post.author = self\n @@post_count += 1\n end"
] | [
"0.8151513",
"0.6205402",
"0.6189774",
"0.58371794",
"0.56703055",
"0.56609356",
"0.55997",
"0.55727977",
"0.5549892",
"0.54906887",
"0.54813874",
"0.5453417",
"0.54390085",
"0.54188335",
"0.5398069",
"0.5370722",
"0.5357503",
"0.53451574",
"0.53398174",
"0.53383404",
"0.53074694",
"0.5306967",
"0.53016657",
"0.5282683",
"0.52692896",
"0.52469164",
"0.52418643",
"0.5235547",
"0.52286476",
"0.522823",
"0.5225097",
"0.5224274",
"0.5221048",
"0.5211617",
"0.5210162",
"0.5207484",
"0.5203656",
"0.51950026",
"0.51926255",
"0.5184723",
"0.5167078",
"0.51601917",
"0.5147203",
"0.5144888",
"0.51378715",
"0.5134601",
"0.5131707",
"0.51250124",
"0.5117916",
"0.5114818",
"0.50996876",
"0.5094819",
"0.50934666",
"0.50811046",
"0.5075825",
"0.5070933",
"0.5046639",
"0.50409275",
"0.5037737",
"0.50358546",
"0.5035452",
"0.50308436",
"0.5030307",
"0.5025911",
"0.5024835",
"0.5021965",
"0.5016241",
"0.5015383",
"0.5006792",
"0.5005131",
"0.50005925",
"0.49979588",
"0.49961033",
"0.49957615",
"0.4995544",
"0.49936178",
"0.49923527",
"0.49923527",
"0.4990771",
"0.49847162",
"0.49710143",
"0.4969812",
"0.49679634",
"0.49634588",
"0.49536774",
"0.49496216",
"0.4949491",
"0.4949191",
"0.49356443",
"0.4934513",
"0.49334106",
"0.4928074",
"0.49140558",
"0.4913712",
"0.49119377",
"0.4902828",
"0.48985884",
"0.4897547",
"0.48972937",
"0.48943505"
] | 0.69614565 | 1 |
This method sets up the user's abilities to view admin pages look at for more info | def initialize(user)
user ||= User.new # guest user will not be allowed in the admin section
alias_actions
if user.super_admin?
can :manage, :all
elsif user.admin? || user.contractor?
#can :manage, :all
#can :read, :all
#can :view_users, User do
# user.admin?
#end
#authorize! :view_users, @user
#can :create_users, User do
# user.super_admin?
#end
#authorize! :create_users, @user
#can :create_orders, User
if user.trial || user.unsubscribed
unless user.unsubscribed
can [:make], Product if user.products.count < 1
end
can [:read, :change], Product, contractor_id: user.id
else
can :manage, Product, contractor_id: user.id
end
can :manage, Order, contractor_id: user.id
can :manage, Shipment, order: {contractor_id: user.id}
can :manage, ImageGroup, product: {contractor_id: user.id}
can :manage, Property
can :manage, Invoice
if user.has_balance?
can :manage, Requests::Balance, user_id: user.id
can [:read, :make, :cancel], Requests::Transaction, balance_id: user.balance.id
can :read, Requests::Credit
can [:read, :make, :cancel], Requests::Withdraw
can [:read], Requests::Refund, transaksi: {balance_id: user.balance.id}
end
can :manage, :overview
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end",
"def info_for_edit_page\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n if @admins.empty?\n @mentors = [@admins]\n else\n employee = @user.client.employee\n if employee.present?\n @admins_cur = employee.employee_id\n @mentors_cur = @user.client.employee_id\n else\n @admins_cur = params[:administrator_id]\n @mentors_cur = 0\n end\n @mentors = User.mentors_list(@admins_cur, additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n @mentors_cur = @user.client.employee_id\n end\n end",
"def show\n\t\trequire_admin!\n\tend",
"def show\n set_administrator\n end",
"def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end",
"def show\n authorize! :read, @admin_system_admin\n end",
"def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end",
"def ensure_admin!\n authorize! :read, :admin_dashboard\n end",
"def ensure_admin!\n authorize! :read, :admin_dashboard\n end",
"def show\n is_admin?\n end",
"def show\n is_admin?\n end",
"def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end",
"def go_to_admin_page\n user_name.click\n admin_link.click\n end",
"def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end",
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def check_and_set_admin_access\n begin\n if params[:venue_name] == 'home'\n @venue = @actor\n @has_admin_access = @venue == @actor\n @has_link_access = @has_admin_access\n @is_homepage = true\n else\n @venue = Venue.where(:mention_name => params[:venue_name]).first\n @has_admin_access = @venue == @actor\n @is_public = true\n @has_link_access = false\n end\n rescue\n @venue = nil\n end\n unless @venue\n render :template =>\"bricks/page_missing\" and return\n end\n end",
"def require_admin\n unless env['warden'].user.advisor? || env['warden'].user.resident?\n flash.error = \"You are not authorized to access that page.\"\n redirect '/'\n end\n end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def show\n isadmin\n end",
"def admin_only\n deny_access(\"You must be signed in as an admin to access this page.\") unless signed_in_as_admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend",
"def show\n checkadmin\n end",
"def is_admin\n test_access :admin\n end",
"def admin\n\t\tcan :manage, :all\n\tend",
"def admin\n self.sitemap\n self.follow('dtime:dashboard:admin')\n self.get\n self\n end",
"def require_admin_permission\n redirect_to tables_path, notice: 'Necesita permisos de administrador para visualizar la configuracion' unless current_user_admin?\n end",
"def i_am_admin\n unless current_user.is_admin?\n redirect_to :root \n flash[:error] = \"You haven't the rights to access the required page.\"\n end\n end",
"def check_permissions\n unless current_user.is_admin?\n redirect_to index_path, alert: 'You do not have the permissions to visit the admin page'\n end\n end",
"def show\n\t\t\tputs current_user.is_admin?\n\tend",
"def admin_index\n return unless (user_is_allowed_to 'view', 'rets_properties') \n render :layout => 'caboose/admin' \n end",
"def activate\n RestrictedPage\n # admin.tabs.add \"Restricted Page\", \"/admin/restricted_page\", :after => \"Layouts\", :visibility => [:all]\n end",
"def index\n if current_user.admin_group?\n @admin_user = current_user\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), auth_assign_permits_path\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_user }\n end\n end\n end",
"def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end",
"def admin_in!\n access_denied! unless current_user.admin?\n end",
"def show\n # authorize Admin\n end",
"def facility_admin\n facility_controller_check\n unless current_user.role == \"site_admin\" || (@facility_role_access.present? && current_user.role == \"facility_admin\")\n flash[:error] = 'You are not authorized. Please request access from your manager'\n redirect_to root_url\n end\n end",
"def admin_access?\n admin?\n end",
"def info_for_forms\n #Info for page\n #Saving info if we are SA\n @is_super_admin = is_super?\n #Array of admins for SA\n @admins = User.admins_list(with_mentors: false) if @is_super_admin\n end",
"def show\n @user = current_user\n @admin = @user.admin\n unless @admin\n redirect_to :root, :alert => t(\"notice.access\")\n end\n end",
"def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end",
"def show_admin_menu_items?\n can?(:read, :admin_dashboard)\n end",
"def require_admin_privileges\n\t\tredirect_to root_path unless is_global_admin?\n\tend",
"def show\n authorize @admin\n end",
"def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end",
"def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end",
"def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend",
"def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end",
"def checkAdmin\n if !admin_signed_in?\n # if current user is not an admin then can't access the page like add teacher,department,college and new subject\n redirect_to root_path, notice: \"Only Admin Can Access This Page\"\n end\n end",
"def require_admin\n end",
"def admin\n @shell.admin\n end",
"def admin_user\n redirect_to(admin_page_url) if current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin\n #TODO\n end",
"def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end",
"def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to Warnings_url\n end\n end",
"def show\n admin_only do\n end\n end",
"def require_admin\n unless admin?\n flash[:notice] = \"Sorry, only administrators can do that.\"\n redirect_to :controller => 'typus', :action => 'dashboard'\n end\n end",
"def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end",
"def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end",
"def admin_user\n redirect_to(admin_page_url) if current_user.admin?\n end",
"def super_admin(user)\n can :manage, :all\n end",
"def ensure_admin_user\n redirect_to dashboard_index_path unless is_admin?\n end",
"def show_details\n effective_sysadmin(@user, @role_limit)\n end",
"def info_for_new_page\n # TODO FIX BUG WHEN SAVING FAILS LINKED MENTOR IS UNSET\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n @mentors =\n if @admins.empty?\n [@admins]\n else\n User.mentors_list(@admins.first[1], additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n end\n end",
"def check_admin\n\t\tif current_user && current_user.role == 2\n\t\telsif current_user && current_user.role != 2\n\t\t\tredirect_to buildings_url, notice: 'You are not authorized'\n\t\telse\n\t\t\tredirect_to buildings_url, notice: 'You are not logged in'\n\t\tend\n\tend",
"def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end",
"def admin_logic\n end",
"def must_be_admin!\n access_denied! unless current_admin?\n end",
"def admin_permission\n if session[:position].to_s == \"Secretary\" or\n session[:position].to_s == \"Treasurer\" or\n session[:position].to_s == \"Chairman\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n position: session[:position]\n return false\n end\n\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end",
"def admin_required\n current_user.is_admin? || access_denied\n end",
"def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end",
"def admin_nav\n items = {'Home' => admin_root_path, \n 'Users' => admin_users_path,\n 'Submissions' => admin_submissions_path}\n output_nav(items)\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
"def set_editability\n @editable = user_signed_in? && (current_user.member.role.name.eql? \"University Admin\") &&\n current_user.member.institution.id == @course.department.institution.id\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def admin\n end",
"def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def admin_access\n if current_user.access? :admin\n return true\n elsif current_user\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to nationalities_path\n else\n flash[:notice] = \"Du har ikke adgang til denne side\"\n redirect_to login_path\n end\n end",
"def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend",
"def check_permission\n unless current_user.is_admin == 1\n redirect_to \"/\", warning: \"You don't have permission to access that page.\"\n end\n end",
"def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_authorize\n \tunless User.find(session[:user_id]).user_type == \"admin\"\n \t\tsession[:original_uri] = nil\n\t\t flash[:warning] = \"You are not authorized to view this page!\"\n\t\t redirect_to(root_path)\n \tend\n end",
"def authorize_admin\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level == 2\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"access_denied\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end",
"def super_admin _\n puts \"superadmin\"\n can :manage, :all\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? || current_user.super_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_doctor.admin?\n end"
] | [
"0.7362424",
"0.71003675",
"0.7093616",
"0.70592356",
"0.7056795",
"0.7026277",
"0.700151",
"0.69992375",
"0.69992375",
"0.6967919",
"0.69633496",
"0.69437665",
"0.6916778",
"0.6903402",
"0.6896182",
"0.6881814",
"0.6854698",
"0.683619",
"0.68319356",
"0.6800599",
"0.6788348",
"0.6777957",
"0.6777957",
"0.6777957",
"0.67691606",
"0.67679054",
"0.67672455",
"0.67637277",
"0.676302",
"0.6757755",
"0.6757123",
"0.6754835",
"0.67514974",
"0.67473817",
"0.6747344",
"0.6736456",
"0.67129564",
"0.67048264",
"0.670356",
"0.66981584",
"0.66933733",
"0.6686073",
"0.6680892",
"0.66744",
"0.667225",
"0.667225",
"0.667225",
"0.6668585",
"0.6652259",
"0.6645884",
"0.66410595",
"0.6635944",
"0.66349953",
"0.6633911",
"0.663334",
"0.66129506",
"0.65962",
"0.659228",
"0.65911895",
"0.65911895",
"0.65851444",
"0.65846133",
"0.6580058",
"0.65765893",
"0.6559511",
"0.6555055",
"0.65520555",
"0.65457463",
"0.65447396",
"0.6542748",
"0.6540568",
"0.65393215",
"0.65392953",
"0.6539048",
"0.65345085",
"0.6533606",
"0.6521934",
"0.6516636",
"0.65134424",
"0.65108645",
"0.6508659",
"0.65062857",
"0.649949",
"0.64933264",
"0.64906573",
"0.64906573",
"0.64906573",
"0.64906573",
"0.64902407",
"0.64892584",
"0.64834267",
"0.64804137",
"0.6478686",
"0.64773965",
"0.6472629",
"0.6472629",
"0.6467353",
"0.64637035",
"0.646138",
"0.64613634",
"0.6459185"
] | 0.0 | -1 |
Initializes an instance url:: URL to a BigBlueButton server (e.g. salt:: Secret salt for this server version:: API version: 0.7 (valid for 0.7, 0.71 and 0.71a) | def initialize(url, salt, version='0.7', debug=false)
@supported_versions = ['0.7','0.8']
@url = url
@salt = salt
@debug = debug
if version.nil?
@version = get_api_version
else
@version = version
end
unless @supported_versions.include?(@version)
raise BigBlueButtonException.new("BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}")
end
puts "BigBlueButtonAPI: Using version #{@version}" if @debug
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(url, salt, version='0.7', debug=false)\n @supported_versions = ['0.7', '0.8']\n @url = url\n @salt = salt\n @debug = debug\n @timeout = 10 # default timeout for api requests\n @request_headers = {} # http headers sent in all requests\n\n @version = version || get_api_version\n unless @supported_versions.include?(@version)\n raise BigBlueButtonException.new(\"BigBlueButton error: Invalid API version #{version}. Supported versions: #{@supported_versions.join(', ')}\")\n end\n\n puts \"BigBlueButtonAPI: Using version #{@version}\" if @debug\n end",
"def initialize(url=\"\")\n @serverURL = url\n end",
"def initialize(server_url)\n uri = URI.parse(server_url)\n @host = uri.host\n @port = uri.port\n @username = uri.user\n @password = uri.password\n @use_ssl = (uri.scheme == \"https\")\n end",
"def initialize\n self.url = Yolo::Config::Settings.instance.deploy_url\n end",
"def initialize(url_or_port, api_key_or_file, api_version=nil)\n url_or_port = \"http://localhost:#{url_or_port}\" if url_or_port.is_a? Integer\n @uri = URI.parse(url_or_port)\n @api_key = api_key_or_file.is_a?(IO) ? api_key_or_file.read : api_key_or_file\n @api_version = api_version ? api_version.to_s : current_api_version.to_s\n @ssl_verify = OpenSSL::SSL::VERIFY_PEER\n end",
"def initialize(uri, api_checksum_salt, api_version)\n @api_checksum_salt = api_checksum_salt\n @api_version = api_version\n @uri = uri.start_with?('http') ? uri : 'https://' + uri\n end",
"def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end",
"def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end",
"def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:server], port || Puppet[:serverport])\n super(client, session, url)\n end",
"def initialize(url, options = {})\n # sets the URL to be shortened\n self.url = url\n # allows an instance-level override for the api key\n @api_key = options[:api_key]\n # allows an instance-level override for the timeout\n @timeout = options[:timeout]\n # allows an instance-level override for the proxy\n @proxy = URI(options[:proxy]) if options[:proxy]\n end",
"def initialize(base_url: BASE_URL, api_version: API_VERSION, api_key: API_KEY)\n @base_url = base_url\n @api_version = api_version\n @api_key = api_key\n end",
"def initialize(api_key, url='http://localhost:9001/api')\n @uri = URI.parse(url)\n raise ArgumentError, \"#{url} is not a valid url\" unless @uri.host and @uri.port\n @api_key = api_key\n connect!\n end",
"def initialize(api_url, app_name = DEFAULT_APP_NAME)\n @app_name = app_name\n @key = Digest::MD5.hexdigest(@app_name)\n @api_endpoint = \"http://#{api_url}/api\"\n end",
"def initialize(server, api_version, api_key)\n self.class.base_uri \"http://#{server}/api/#{api_version}\"\n self.class.headers 'Accept' => 'application/json', \"X-CCApiKey\" => api_key\n end",
"def init\n Biilabs.configuration do |config|\n config.host = SET_HOST_URL_HERE_HERE\n end\nend",
"def prepare\n @api = BigBlueButton::BigBlueButtonApi.new(URL, SECRET, VERSION.to_s, true)\n end",
"def initialize(instance, user: nil, password: nil, oauth_token: nil, client_id: nil, client_secret: nil, use_ssl: true)\n #instance example: https://dev99218.service-now.com\n instance_with_protocol = use_ssl ? \"https://#{instance}\" : \"http://#{instance}\"\n @instance = URI.parse(instance_with_protocol)\n @user = user\n @password = password\n if (client_id && client_secret && user && password)\n @oauth_token = get_token(client_id, client_secret)\n else\n @oauth_token = oauth_token\n end\n end",
"def initialize(url)\n self.url = url\n end",
"def initialize(base_url)\n @base_url = base_url\n end",
"def initialize(server_uri = nil, api_key = nil)\n config = Shacip::Client.configuration\n @server_uri = URI.parse(server_uri&.to_s || config.server_uri.to_s)\n @api_key = api_key || config.api_key\n @http = Net::HTTP.new(@server_uri.host, @server_uri.port)\n end",
"def initialize(url = 'https://api.tictail.com')\n @url = url\n end",
"def initialize(api_url:, api_key:, verbose: false)\n self.api_url = api_url.is_a?(Addressable::URI) ? api_url : Addressable::URI.parse(api_url)\n self.api_key = api_key\n self.verbose = verbose\n end",
"def initialize(api_url)\n\t\turi = URI(api_url)\n\t\tcall_api(uri)\n\tend",
"def initialize(url, secret = nil)\n self.url = URI.parse(url.to_s)\n self.secret = secret\n end",
"def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend",
"def initialize(url, &on_reconnect)\n @url = url\n @beanstalk = nil\n @on_reconnect = on_reconnect\n connect!\n end",
"def api\n if @api.nil?\n @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.salt,\n self.version.to_s, false)\n end\n @api\n end",
"def initialize(url)\n @url = url\n end",
"def init(url = 'localhost:3000', app = 'weapp')\n @url = url\n @app = app\n end",
"def initialize(url)\n @url = url\n end",
"def initialize(url)\n @url = url\n end",
"def initialize\n self.key = ''\n self.uuid = ''\n self.url = {\n development: 'http://localhost:3000'\n }\n self.env = :development\n end",
"def initialize(host = \"127.0.0.1\",port = 10025)\n self.class.base_uri \"http://#{host}:#{port}/\"\n end",
"def initialize(url, username, password, account_id)\n @url = url\n @username = username\n @password = password\n @account_id = account_id\n end",
"def initialize(key, version)\n # Sets API key and Version\n # Set api_key and check its correct format\n raise 'Version must be 1 or 2' unless %w[1 2].include?(version)\n\n warn('Warning: API key `1` is only for development') if key.to_s == '1'\n @version = version\n @key = key.to_s\n @api_url = API_ENDPOINT + \"/v#{@version}/#{@key}/\"\n end",
"def initialize(hst,p,url)\n self.host=hst\n self.port=p\n self.url =url\n puts \"#{self.class}: initialized on #{self.host}:#{self.port} url: #{self.url}\"\n end",
"def initialize\n self.cache_ttl = 60\n self.api_path = 'https://api-pl.easypack24.net/v4/'\n end",
"def initialize(username, password, host, port='8089', index='main',\n scheme='https')\n @username = username\n @password = password\n @splunk_url = URI::HTTP.new(\n scheme, nil, host, port, nil, nil, nil, nil, nil).to_s\n @index = index\n end",
"def initialize(url)\n @url = url\n freeze\n end",
"def initialize(name, ip, url_endpoint)\n @name = name\n @ip = ip\n @url = \"http://#{ip}/#{url_endpoint}\"\n @username = \"\"\n @password = \"\"\n end",
"def initialize(server, hs_admin, priv_key_path, pass_phrase = nil)\n @hs_admin = hs_admin\n @private_key_path = priv_key_path\n @pass_phrase = pass_phrase\n @base_url = 'https://' + server + '/api'\n @session_id = initialize_session\n end",
"def initialize(url)\n self.url = url\n self\n end",
"def initialize(url_config)\n super()\n @url_config = url_config\n end",
"def initialize(api_key, version = 'v1', base_url = 'http://api.digitalnz.org')\n @api_key = api_key\n @base_url = base_url\n @version = version\n \n if @base_url =~ /^(.*)\\/$/\n @base_url = $1\n end\n end",
"def initialize\n self.api_root = BASE_URL\n end",
"def initialize(server, api_version, username, password, logging = false)\n self.class.base_uri server\n self.class.send(:debug_output) if logging\n self.class.basic_auth username, password\n end",
"def server_url=(_arg0); end",
"def initialize\n @format = 'json'\n @scheme = 'https'\n @host = 'api.imagga.com:443'\n @base_path = '/v2'\n @user_agent = 'Swagger/Ruby/0.1.0/beta'\n @inject_format = false\n @force_ending_format = false\n @camelize_params = false\n # for API key/token authentication\n @api_key = '';\n @api_key_type = '';\n @api_key_name = '';\n @api_key_prefix = '';\n # for http basic authentication\n @username = ''\n @password = ''\n @user_agent = 'Swagger/Ruby/0.1.0/beta'\n end",
"def initialize(url, hdrs = nil)\n @logger = Neko.logger\n @init_uri = URI(url)\n raise ArgumentError, 'Invalid URL' unless @init_uri.class <= URI::HTTP\n @http = Net::HTTP.new(init_uri.host, init_uri.port)\n http.use_ssl = init_uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n @headers = hdrs\n end",
"def initialize(username, password, base_url)\n self.username = username\n self.password = password\n self.base_url = base_url\n end",
"def initialize(ip='192.168.120.249', base='abnet_db', port='2300')\n @ip = ip\n @base = base\n @port = port\n @url = @ip + ':' + @port + '/' + @base\n end",
"def initialize(public_key=nil, secret_key=nil, production=false)\n @public_key = public_key\n @secret_key = secret_key\n @production = production\n\n okra_sandbox_url = BASE_ENDPOINTS::OKRA_SANDBOX_URL\n okra_live_url = BASE_ENDPOINTS::OKRA_LIVE_URL\n\n #set okra url to sandbox or live if we are in production or development\n\n if production ==false\n @url = okra_sandbox_url\n else\n @url = okra_live_url\n end\n\n def base_url\n return url\n end\n\n #check if we set our public, secret keys to the environment variable\n\n if (public_key.nil?)\n @public_key = ENV['OKRA_PUBLIC_KEY']\n else\n @public_key = public_key\n end\n\n if (secret_key.nil?)\n @secret_key = ENV['OKRA_SECRET_KEY']\n else\n @secret_key = secret_key\n end\n\n warn \"Warning: To ensure your okra api keys are safe, It is best to always set your keys in the environment variable\"\n\n #raise this error if no public key is passed\n\n unless !@public_key.nil?\n\n raise OkraBadKeyError, \"No public key supplied and couldn't find any in environment variables. Make sure to set public key as an environment variable OKRA_PUBLIC_KEY\"\n end\n\n #raise this error if no secret key is passed\n\n unless !@secret_key.nil?\n\n raise OkraBadKeyError, \"No secret key supplied and couldn't find any in environment variables. Make sure to set secret key as an environment variable OKRA_SECRET_KEY\"\n end\n\n end",
"def initialize (url = nil, environment, root_directory)\n begin\n @pointconfig = YAML::load_file(\"#{root_directory}/config/config.breeze.yml\")[environment]\n rescue\n # should not occur except when running tests\n end\n if (url == nil)\n @url = @pointconfig[\"url\"]\n else\n @url = url\n end\n end",
"def initialize()\n print 'Base URL: ', @@base_url\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def base_url\n \"http#{configuration[:secure] ? 's' : ''}://#{configuration[:api_url]}/v#{configuration[:api_version]}\"\n end",
"def server\n uri = \"#{options[:use_ssl] ? \"https\" : \"http\"}://#{Blupee.config.api_server}\"\n end",
"def initialize(url, options = { })\n @url = url\n \n raise ArgumentError, \"Feedtosis::Client options must be in Hash form if provided\" unless options.is_a?(Hash)\n @options = options.reverse_merge(DEFAULTS)\n\n @backend = @options[:backend]\n \n unless @url.match(URI.regexp('http'))\n raise ArgumentError, \"Url #{@url} is not valid!\"\n end\n \n unless @backend.respond_to?(:[]) && @backend.respond_to?(:[]=)\n raise ArgumentError, \"Backend needs to be a key-value store\"\n end\n end",
"def server_url\n \"http://#{server_host}:#{server_port}\"\n end",
"def initialize(url_prefix = \"/borges\")\n @url_prefix = url_prefix\n @entry_points = {}\n end",
"def initialize(title: title, description: description, url: url = \"https://google.com\")\n @title = title\n @description = description\n @url = url\n secret_method\n end",
"def initialize\n @url = 'http://api.preachingcentral.com/'\n end",
"def initialize(title: title, description: description, url: url = \"google.com\")\n @title = title\n @description = description\n @url = url\n secret_method\n end",
"def initialize(title: title, description: description, url: url = \"google.com\")\n @title = title\n @description = description\n @url = url\n secret_method\n end",
"def initialize (api_key)\n\t\t@params = {\n\t\t\t\"key\" => api_key,\n\t\t\t\"wrapper\" => \"cleverbotrb\"\n\t\t}\n\t\t@endpoint = ENDPOINT\n\tend",
"def initialize(options = {})\n requires!(options, :login, :password)\n \n @options = {\n :strict_ssl => true,\n :crypt_type => 7\n }.update(options)\n \n @url = test? ? TEST_URL : LIVE_URL \n \n super \n end",
"def initialize(api_key, source, config = {})\n raise ArgumentError.new('Your need to specify your api key') unless api_key\n raise ArgumentError.new('You need to specify a source website') unless source\n\n\n defaults = {\n :api_version => API_VERSION\n }\n\n @config = defaults.merge(config).freeze\n @api_key = api_key\n @source = source\n @litmosURL = \"https://api.litmos.com/v#{@config[:api_version]}.svc/\"\n @devURL = \"http://apidev.litmos.com/v#{@config[:api_version]}.svc/\"\n end",
"def initialize server_url, login, password, params = {}\n @server_url = server_url\n unless @server_url.end_with? '/'\n @server_url << '/'\n end\n @login = login\n @password = password\n @limit = params[:limit]\n\n authenticate\n end",
"def initialize api_key=ENV['b2w_api_key'], api_url=\"http://api.born2win.local/v2/events\"\n @api_url = api_url\n @api_key = api_key\n end",
"def initialize()\n @url = \"http://not_real.com/customer_scoring\"\n end",
"def server_url\n url\n end",
"def initialize(server_host, server_port = nil, username = 'admin', password = 'admin', use_tls = false, version = API_CURRENT_VERSION)\n @version = version\n protocol = use_tls ? 'https' : 'http'\n server_port = use_tls ? 7183 : 7180 if server_port.nil?\n base_url = \"#{protocol}://#{server_host}:#{server_port}/api/v#{version}\"\n\n client = HttpClient.new(base_url, ApiException)\n client.set_basic_auth(username, password, API_AUTH_REALM)\n client.headers = { :'content-type' => 'application/json' }\n super(client)\n end",
"def base_url\n \"https://api.beezup.com/\"\n end",
"def initialize(server, major_version, minor_version)\n @server = server\n @major_version = major_version\n @minor_version = minor_version\n @transport_type = \"HTTP\"\n @port = 80\n @user = \"root\"\n @password = \"\"\n @style = \"LOGIN\"\n @timeout = 0\n @vfiler = \"\"\n @server_type = \"FILER\"\n @debug_style = \"\"\n @xml = \"\"\n @originator_id = \"\"\n @enable_server_cert_verification = false\n @enable_hostname_verification = false\n @cert_file = nil\n @key_file = nil\n @key_passwd = nil\n @ca_file = nil\n @url = FILER_URL\n @dtd = FILER_dtd\n\n # Following parameters are used for NMSDK/API Usage Tracking.\n # NOTE: DO NOT REMOVE/MODIFY THESE VARIABLES.\n @nmsdk_version = $NMSDK_VERSION\n @nmsdk_platform = $NMSDK_PLATFORM\n @nmsdk_language = \"Ruby\"\n @nmsdk_app = \"\"\n end",
"def initialize(server_url)\n #example http://192.168.2.97:8100\n @timeout = 10\n @duration=3\n @server_url = server_url\n # get /status\n agent = get(@server_url+'/status')\n\n fail 'WebDriver Agent running failed or server_url is wrong' if agent==nil\n fail 'WebDriver Agent running failed' if agent['status']!=0 || agent['sessionId']==0\n # set session\n @session = agent['sessionId']\n #example http://192.168.2.97:8100/session\n @session_url = @server_url+'/session/'+@session\n # Initialize log module\n @logger =AppClient::LoggerOut.logger\n @logger.info_log('AppClient::driver.init',\"connect WebDriverAgent succeed\\n\")\n\n $driver = self\n self # return newly created driver\n end",
"def initialize(endpoint)\n self.endpoint = URI(ROOT_URL + endpoint)\n end",
"def initialize url, callback_port = nil\n @target_url, @initial_path = (Connection.split_url url)\n #Gom::Remote.connection and (raise \"connection already open\")\n Gom::Remote.connection = self\n\n @subscriptions = []\n @callback_server = init_callback_server callback_port\n end",
"def initialize(url)\n raise ArgumentError \"url is invalid\" unless validate_url(url)\n @url = url\n @certificates = {}\n @certificates_expire_at = Time.now\n @monitor = Monitor.new\n @client = Firebase::Admin::Internal::HTTPClient.new\n end",
"def initialize(url, http_options={})\n unless url =~ VALID_URL\n raise ArgumentError, \"Invalid url \\\"#{url}\\\", it should be in format: (https|http)://<host>(:<port>)?/?\"\n end\n\n @url = url.match(VALID_URL)[1]\n @http_options = DEFAULT_OPTIONS.merge(http_options)\n end",
"def initialize (user_id, api_key, secret)\n @secret = secret\n @api_key = api_key\n @user = user_id\n @batch = nil\n\n self.protocol = 'https'\n self.host = 'sandbox.bunchball.net'\n self.accepts = 'json'\n end",
"def initialize(api_key:, url_prefix:)\n @api_key = api_key\n @url_prefix = url_prefix\n end",
"def initialize(options)\n @options = options\n @base_url = URI(ENVIRONMENTS.fetch(options[:environment]))\n end",
"def base_url\n URI::HTTPS.build(host: @server, port: @port, path: @api)\n end",
"def initialize\n raise NotImplementedError, 'need to implement #intialize and set @url'\n end",
"def initialize(args)\n require \"http2\"\n require \"json\"\n \n @http = Http2.new(\n :host => args[:host],\n :port => args[:port],\n :ssl => args[:ssl]\n )\n end",
"def initialize(params)\n\n fail 'missing API Base URL' if params[:api_base_url].nil?\n fail 'missing API Key' if params[:api_key].nil?\n fail 'missing API Secret' if params[:api_secret].nil?\n\n params[:api_base_url] = params[:api_base_url].gsub(/\\/$/, '') # remove trailing slash\n params[:api_spec] = false if params[:api_spec].nil?\n\n set_manifest(params)\n\n end",
"def url\n @url ||= \"http://#{host}:#{port}\"\n end",
"def initialize(driver_url, config)\n super(driver_url, config)\n\n uri = URI(driver_url)\n @connect_options = {\n provider: 'vsphere',\n host: uri.host,\n port: uri.port,\n use_ssl: uri.use_ssl,\n insecure: uri.insecure,\n path: uri.path\n }\n\n if driver_options\n @connect_options[:user] = driver_options[:user]\n @connect_options[:password] = driver_options[:password]\n end\n end",
"def initialize\n @app_name = \"FPS\"\n @http_method = \"GET\"\n @service_end_point = Rails.application.config.amazon_fps_endpoint\n @version = \"2008-09-17\"\n\n @access_key = Rails.application.config.aws_access_key\n @secret_key = Rails.application.config.aws_secret_key\n @params = get_default_parameters()\n end",
"def initialize(url, query_server_information=false, logger=NullLogger.new)\n url = url + \"/\" unless url[-1..-1] == \"/\"\n @url = url\n @logger = logger\n\n if query_server_information\n query_version\n query_repositories\n end\n\n logger.debug(\"Ruby-sesame initialized; connected to #{ url }\")\n end",
"def initialize\r\n\r\n @url = 'https://reqres.in/api/users/2'\r\n @url2 = 'https://reqres.in/api/users?page=2'\r\n end",
"def initialize(args={})\n PP.pp args\n @url = URI.parse ( args[\"url\"] || \"http://localhost:3000/connections\" )\n @conn = args[\"connection\"]\n @events = args[\"events\"] || []\n @credential = { :type=> args[\"credential\"][\"type\"],\n :cert => Base64.encode64( args[\"credential\"][\"cert\"]),\n :issuer => args[\"credential\"][\"issuer\"].map {|issuer| Base64.encode64( issuer) }\n }\n super @url.host, @url.port\n end",
"def initialize(web_service_url, username=nil, password=nil)\n @url = web_service_url\n @url.chop! if @url =~ /\\/$/ # Remove any trailing slash\n @username = username\n @password = password\n @client = Cherby::Client.new(@url)\n end",
"def initialize(url, user, password, company, logger = nil)\n @url = url\n @user = user\n @password = password\n @company = company\n @logger = logger\n end",
"def initialize\n @beanstalk_url = \"localhost\"\n @reserve_timeout = nil\n end",
"def initialize(address, port, token)\n throw \"bad vault address\" if nil==address\n throw \"bad vault port\" if nil==port\n throw \"bad vault token\" if nil==token\n @url = \"http://#{address}:#{port}/v1/\"\n @token = token\n @all_repos_path = 'secret/all_repos_path_storage_hash'\n @online = false\n end",
"def initialize(server, username: nil, password: nil)\n self.class.base_uri(URI.join(server, '/v1/').to_s)\n\n auth = if username && password\n Base64.encode64(\"#{username}:#{password}\")\n else\n ENV['KINTO_API_TOKEN']\n end\n\n self.class.headers('Authorization' => \"Basic #{auth}\")\n\n @server = KintoServer.new(client: self)\n end",
"def initialize(url_str)\n STDERR.puts \"Getting URL '#{url_str}'\"\n uri = URI.parse(url_str)\n unless VALID_SCHEMES.include?(uri.scheme)\n STDERR.puts \"URL protocol is not one of #{VALID_SCHEMES.join(',')}\"\n exit 1\n end\n if proxy = ENV['HTTP_PROXY']\n prx_uri = URI.parse(proxy)\n prx_host = prx_uri.host\n prx_port = prx_uri.port\n end\n\n h = Net::HTTP.new(uri.host, uri.port, prx_host, prx_port)\n h.set_debug_output($stderr) if $DEBUG\n h.use_ssl = uri.scheme == \"https\"\n h.verify_mode = OpenSSL::SSL::VERIFY_NONE # OpenSSL::SSL::VERIFY_PEER\n\n @body = ''\n begin\n @get_resp = h.get2(uri.request_uri, HTTP_GET_HEADER){|resp| @body += resp.body}\n rescue Exception => ex\n STDERR.puts \"Unable to get web page. Error: #{ex}\"\n exit 1\n end\n STDERR.puts \"#{@get_resp.class}\"\n\n end",
"def initialize(endpoint_url)\n @uri = URI(endpoint_url)\n end",
"def initialize\n\t\t@api_key = \"?api_key=\" + ENV['MDB_API']\n\t\t@def_config = \"http://image.tmdb.org/t/p/w154/\"\n\tend"
] | [
"0.7773854",
"0.75203896",
"0.7190561",
"0.6984908",
"0.6750601",
"0.67253166",
"0.67134416",
"0.67134416",
"0.67134416",
"0.66722953",
"0.6669814",
"0.66446024",
"0.66299945",
"0.6591506",
"0.6515754",
"0.649704",
"0.64923084",
"0.6490326",
"0.6474378",
"0.6450362",
"0.64403874",
"0.6439932",
"0.6411786",
"0.63969177",
"0.63892496",
"0.63870263",
"0.6378495",
"0.6375538",
"0.6374883",
"0.6373525",
"0.6341711",
"0.63372666",
"0.63359743",
"0.63331133",
"0.62889934",
"0.6279361",
"0.62745076",
"0.62707216",
"0.6268733",
"0.62672395",
"0.62639636",
"0.6260789",
"0.6231279",
"0.62311786",
"0.61896425",
"0.618801",
"0.618102",
"0.618076",
"0.6167918",
"0.6152064",
"0.6150384",
"0.6142979",
"0.6136192",
"0.6133234",
"0.61305606",
"0.61305606",
"0.6127305",
"0.6119681",
"0.61063623",
"0.609977",
"0.6096204",
"0.60825574",
"0.6079954",
"0.6079954",
"0.60794604",
"0.6077988",
"0.6074129",
"0.6073278",
"0.6072695",
"0.60705066",
"0.6067271",
"0.6054323",
"0.60537493",
"0.60275126",
"0.6020333",
"0.6015541",
"0.60145277",
"0.60028285",
"0.60011715",
"0.59981567",
"0.5994035",
"0.59924155",
"0.5984142",
"0.59827644",
"0.5967286",
"0.59655434",
"0.59570587",
"0.5957038",
"0.5954301",
"0.59490836",
"0.5949043",
"0.59480643",
"0.5945835",
"0.5944078",
"0.5944029",
"0.5942127",
"0.5939653",
"0.59395736",
"0.59392905",
"0.5936333"
] | 0.7768183 | 1 |
Returns the url used to join the meeting meeting_id:: Unique identifier for the meeting user_name:: Name of the user password:: Password for this meeting used to set the user as moderator or attendee user_id:: Unique identifier for this user web_voice_conf:: Custom voiceextension for users using VoIP | def join_meeting_url(meeting_id, user_name, password,
user_id = nil, web_voice_conf = nil)
params = { :meetingID => meeting_id, :password => password, :fullName => user_name,
:userID => user_id, :webVoiceConf => web_voice_conf }
get_url(:join, params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_meeting_url(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n get_url(:join, params)\n end",
"def join_meeting(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n send_api_request(:join, params)\n end",
"def join_url(username, role, key=nil, options={})\n server = BigbluebuttonRails.configuration.select_server.call(self, :join_meeting_url)\n\n pass = case role\n when :moderator\n self.moderator_api_password\n when :attendee\n self.attendee_api_password\n when :guest\n if BigbluebuttonRails.configuration.guest_support\n options = { guest: true }.merge(options)\n end\n self.attendee_api_password\n else\n map_key_to_internal_password(key)\n end\n\n r = server.api.join_meeting_url(self.meetingid, username, pass, options)\n r.strip! unless r.nil?\n r\n end",
"def join_meeting(meeting_id, user_name, password, user_id = nil, web_voice_conf = nil)\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name,\n :userID => user_id, :webVoiceConf => web_voice_conf }\n send_api_request(:join, params)\n end",
"def get_meeting_url(id, password)\n prepare\n @api.join_meeting_url(id, 'Guest', password)\n end",
"def join_path(room, name, options = {}, uid = nil)\n\n # Destroy otp current_session\n current_user.destroy_otp if current_user&.room_otp.present?\n session.delete(:otp_name)\n\n # Create the meeting, even if it's running\n start_session(room, options)\n\n # Determine the password to use when joining.\n password = options[:user_is_moderator] ? room.moderator_pw : room.attendee_pw\n\n # Generate the join URL.\n join_opts = {}\n join_opts[:userID] = uid if uid\n join_opts[:join_via_html5] = true\n\n bbb_server.join_meeting_url(room.bbb_id, name, password, join_opts)\n end",
"def update_url\n answer_meeting_registration_path(meeting_id: meeting.id)\n end",
"def get_authentication_url\n @wll.getConsentUrl(\"Contacts.Invite\")\n end",
"def craft_url(user=nil,session=nil,return_to=\"http://www.instructure.com\")\n logger.debug \"calling craft url in wiziq_conference\"\n user ||= self.user\n initiate_conference and touch or return nil\n if (user == self.user || self.grants_right?(user,session,:initiate))\n admin_join_url(user, return_to)\n else\n participant_join_url(user, return_to)\n end\n end",
"def embed_url\n params = {\n showChat: false,\n userName: Rack::Utils.escape(h.current_user.username)\n }\n\n \"#{url}?#{params.to_query}\"\n end",
"def meet_invitation(root_url, url, user, invitee, message, meet)\n @root_url, @url = root_url, url\n @user, @invitee, @message, @meet = user, invitee, message, meet\n mail(#:cc => user.email, \n :to => invitee.email,\n :subject => \"You've been added to a Kaya Meet\")\n end",
"def htlal_users_url\n if htlal_language_id\n \"http://how-to-learn-any-language.com/forum/languages.asp?language=#{htlal_language_id}\"\n end\n end",
"def youtube_url; \"https://youtube.com/user/#{youtube}\" end",
"def join_web_url\n return @join_web_url\n end",
"def join_web_url\n return @join_web_url\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def guest_link\n return guest_hearing_link if guest_hearing_link.present?\n\n \"#{VirtualHearing.base_url}?join=1&media=&escalate=1&\" \\\n \"conference=#{formatted_alias_or_alias_with_host}&\" \\\n \"pin=#{guest_pin}&role=guest\"\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def url\n \"#{@client.url}#{self.class.path}#{@user1.username};#{@user2.username}\"\n end",
"def set_meeting\n @meeting = User.find(params[:user_id]).meetings.find(params[:id])\n end",
"def send_join_my_video_email(from_user,to_user,video_id)\n @from_user = from_user\n @to_user = to_user\n @video = Video.find(video_id)\n @video_link = \"#{ENV['MOOVI_URL']}/www/#/app/join-video/#{video_id}/#{to_user.id}\"\n mail(:from => self.moovi_email, :to => @to_user.email, :subject => \"Join #{from_user.name} to create the best video for #{@video.receiver.name}\" )\n end",
"def user_url(user)\n \"http://last.fm/user/\" + user\n end",
"def invitee_string\n\t\n\tend",
"def get_invitation_link\n\t\tscope = self.scope\n\t\trace_id = self.race_id\n\t\t\n\t\tbase_url = InvitationEmailTarget.get_base_url(race_id, scope)\n\t\t\n\t\tbase_url += case self.scope\n\t\twhen (COMPETITION_SCOPE[:SITE])\n\t\t\t'competitions/' + self.id.to_s + '?code=' + self.invitation_code\n\t\twhen (COMPETITION_SCOPE[:CYCLINGTIPS])\n\t\t\t'?competition_id=' + self.id.to_s + '&code=' + self.invitation_code\n\t\tend\n\t\t\n\t\treturn base_url\n\tend",
"def user_ref\n @messaging['optin']['user_ref']\n end",
"def start_session(room, options = {})\n create_options = {\n record: options[:record].to_s,\n logoutURL: options[:meeting_logout_url] || '',\n moderatorPW: room.moderator_pw,\n attendeePW: room.attendee_pw,\n moderatorOnlyMessage: options[:moderator_message],\n muteOnStart: options[:mute_on_start].to_s || \"false\",\n breakoutRoomsEnabled: options[:breakoutRoomsEnabled],\n \"logo\": options[:customLogoUrl] || '',\n \"meta_#{META_LISTED}\": options[:recording_default_visibility].to_s || \"false\",\n \"meta_whistle-origin-version\": \"1.0\",\n \"meta_whistle-origin\": \"WhistleRoom\",\n \"meta_whistle-origin-server-name\": options[:host],\n \"meta_roomPassword\": room.attendee_pw,\n \"meta_inviteMsgPassword\": \"#{options[:moderator_message]}\",\n \"meta_meetingUrl\": options[:meeting_url],\n \"meta_auth-mandatory\": options[:auth_mandatory].to_s || \"false\",\n \"meta_auth-multi-factor\": options[:auth_multi_factor].to_s || \"false\",\n \"meta_auth-room-key\": room.access_code.present?,\n \"meta_room-key\": room.access_code.to_s,\n \"meta_auth-lobby\": options[:auth_lobby].to_s || \"false\",\n \"meta_auth-onetime\": options[:auth_one_time_invite_link].to_s || \"false\",\n \"meta_encrypt-transit\": \"true\",\n \"meta_encrypt-recording\": \"true\",\n \"meta_encrypt-content\": \"true\",\n \"meta_privacy-record-consent\": \"true\",\n \"meta_privacy-data-deletion\": \"true\",\n \"meta_owner\": options[:owner].to_s || \"false\",\n \"meta_email\": options[:owner_email].to_s || \"\",\n \"meta_webinar\": options[:listen_only].to_s || \"false\",\n \"meta_google-calendar-url\": options[:google_calendar_url] || '',\n \"meta_banner-message\": options[:banner_message] || ''\n }\n\n create_options[:guestPolicy] = \"ASK_MODERATOR\" if options[:require_moderator_approval]\n create_options[:maxParticipants] = options[:maxParticipants] if options[:maxParticipants]\n create_options[:lockSettingsDisableMic] = options[:listen_only]\n create_options[:listenOnlyMode] = options[:listen_only]\n create_options[:forceListenOnly] = options[:listen_only]\n create_options[:enableListenOnly] = options[:listen_only]\n create_options[:lockSettingsLockOnJoin] = true\n create_options[:record] = options[:record]\n\n # Send the create request.\n begin\n meeting = if room.presentation.attached?\n modules = BigBlueButton::BigBlueButtonModules.new\n url = rails_blob_url(room.presentation).gsub(\"&\", \"%26\")\n logger.info(\"Support: Room #{room.uid} starting using presentation: #{url}\")\n modules.add_presentation(:url, url)\n bbb_server.create_meeting(room.name, room.bbb_id, create_options, modules)\n else\n bbb_server.create_meeting(room.name, room.bbb_id, create_options)\n end\n\n unless meeting[:messageKey] == 'duplicateWarning'\n room.update_attributes(sessions: room.sessions + 1, last_session: DateTime.now)\n end\n rescue BigBlueButton::BigBlueButtonException => e\n puts \"BigBlueButton failed on create: #{e.key}: #{e.message}\"\n raise e\n end\n end",
"def show\n user = self.load_user(params)\n meeting = load_meeting(params)\n\n if user != nil && meeting != nil\n self.send_json(\n meeting.to_json(:include => {\n :participants => {:only => [:id, :name, :email]},\n :suggestions => {:include => [:votes]}\n })\n )\n else\n self.send_error 401\n end\n end",
"def url\n '/users/show/' + login\n end",
"def new_user_hash\n # source: https://github.com/tapster/omniauth-meetup\n {\n \"provider\"=>\"meetup\",\n \"uid\"=>12345,\n \"info\"=> {\n \"id\"=>12345,\n \"name\"=>\"elvis\",\n \"photo_url\"=>\"http://photos3.meetupstatic.com/photos/member_pic_111.jpeg\"\n },\n \"credentials\"=> {\n \"token\"=>\"abc123...\", # OAuth 2.0 access_token, which you may wish to store\n \"refresh_token\"=>\"bcd234...\", # This token can be used to refresh your access_token later\n \"expires_at\"=>1324720198, # when the access token expires (Meetup tokens expire in 1 hour)\n \"expires\"=>true\n },\n \"extra\"=> {\n \"raw_info\"=> {\n \"lon\"=>-90.027181,\n \"link\"=>\"http://www.meetup.com/members/111\",\n \"lang\"=>\"en_US\",\n \"photo\"=> {\n \"photo_link\"=> \"http://photos3.meetupstatic.com/photos/member_pic_111.jpeg\",\n \"highres_link\"=> \"http://photos1.meetupstatic.com/photos/member_pic_111_hires.jpeg\",\n \"thumb_link\"=> \"http://photos1.meetupstatic.com/photos/member_pic_111_thumb.jpeg\",\n \"photo_id\"=>111\n },\n \"city\"=>\"Memphis\",\n \"state\" => \"TN\",\n \"country\"=>\"us\",\n \"visited\"=>1325001005000,\n \"id\"=>12345,\n \"topics\"=>[],\n \"joined\"=>1147652858000,\n \"name\"=>\"elvis\",\n \"other_services\"=> {\"twitter\"=>{\"identifier\"=>\"@elvis\"}},\n \"lat\"=>35.046677\n }\n }\n }\n end",
"def invite_url(server: nil, permission_bits: nil)\n @client_id ||= bot_application.id\n\n server_id_str = server ? \"&guild_id=#{server.id}\" : ''\n permission_bits_str = permission_bits ? \"&permissions=#{permission_bits}\" : ''\n \"https://discord.com/oauth2/authorize?&client_id=#{@client_id}#{server_id_str}#{permission_bits_str}&scope=bot\"\n end",
"def connection relationship, confirm_relationship_url\n @patient = User.find(relationship.patient_id)\n @doctor = User.find(relationship.doctor_id)\n @confirmation_url = confirm_relationship_url.gsub(\"nt.\", \"nt/\")\n mail(to: \"#{@patient.first_name} #{@patient.last_name} <#{@patient.email}>\", subject:\"Invitation: Patient Notes\")\n end",
"def invite_url(server = nil)\n raise 'No application ID has been set during initialization! Add one as the `application_id` named parameter while creating your bot.' unless @application_id\n\n guild_id_str = server ? \"&guild_id=#{server.id}\" : ''\n \"https://discordapp.com/oauth2/authorize?&client_id=#{@application_id}#{guild_id_str}&scope=bot\"\n end",
"def host(inv, options = {}) \n link_to(inv.inviter.user_name, member_profile_url(:id => inv.inviter.user_name), :target => options[:target]) if inv.inviter\n end",
"def profile_url\n \"#{world.url}internal/fight.php?action=watchuser&act_user_id=#{user_id}\"\n end",
"def guest_url\n if guest_access_enabled?\n \"http://#{@campfire.subdomain}.campfirenow.com/#{guest_invite_code}\"\n else\n nil\n end\n end",
"def create_meeting(name, id)\n # create a meeting on the BBB server\n prepare\n options = {\n attendeePW: 'ap',\n moderatorPW: 'mp',\n welcome: \"Welcome to the #{name} meeting!\"\n }\n\n @api.create_meeting(name, id, options)\n @api.join_meeting_url(id, 'Guest', 'mp')\n end",
"def two_factor_otp_url\n \"otpauth://totp/%{app_id}?secret=%{secret}&issuer=%{app}\" % {\n :secret => current_user.unconfirmed_otp_secret,\n :app => \"Hammad\",\n :app_id => \"Ham\"\n }\n end",
"def generate_url\n api_key = WavecellOtpAndSms.configuration.api_key\n sub_account = WavecellOtpAndSms.configuration.sub_account\n details = [uid, code]\n parameters = {\n uid: uid,\n code: code\n }\n query_string = parameters.to_a.map { |x| \"#{x[0]}=#{x[1]}\" }.join(\"&\")\n url = \"https://api.wavecell.com/otp/v1/#{sub_account}/#{uid}?code=#{code}\"\n HTTParty.get(url.to_str,\n :body => parameters.to_json,\n :headers => {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{api_key}\"\n })\n end",
"def invite_url(html_url)\n # https://github.com/mike-north/micro-observable\n\n # https://github.com/mike-north/micro-observable/invitations\n invite_url = html_url + \"/invitations\"\n invite_url\n end",
"def on_behalf_of_user_id\n return @on_behalf_of_user_id\n end",
"def invite_to_conference(from, to, single_dir, room = nil)\n puts \"send invite from: #{from} to: #{to} for room: #{room}, will #{single_dir ? 'not dial' : 'dial'} in response\".red_on_yellow\n agent = User.find_by_slug(to)\n\n dial_user(from, agent, {room: room, action: 'conference', send_ping: true, skip_ping_check: true, single_dir: single_dir})\n end",
"def meetuser_params\n params.require(:meetuser).permit(:meeting_id, :user_id)\n end",
"def login_url\n DOMAINS[username_domain] || DOMAINS['hotmail.com']\n end",
"def invitation_url(type, employee)\n if type == :invite\n new_account_organization_invitation_path(current_account, current_organization, invitation: { employee_id: employee.id })\n else\n edit_account_organization_invitation_path(current_account, current_organization, employee.invitation)\n end\n end",
"def bookkeeper_invitation_url(access)\n \"#{::AppConfig.mail.host}/access/#{access}\"\n end",
"def set_meeting\n @meeting = current_user.meetings.find(params[:id] || params[:meeting_id])\n end",
"def set_meetuser\n @meetuser = Meetuser.find(params[:id])\n end",
"def user_id\n return link.split(\"/\")[2]\n end",
"def participant\n self_link.try(:participant)\n end",
"def join_appointment(appointment_id, user_id, travel_type=Meet4Xmas::Persistence::TravelType::ALL.first, location=Meet4Xmas::Persistence::Location.HPI.to_hash)\n @client.joinAppointment(appointment_id, user_id, travel_type, location)\n end",
"def notice_from_objective_auth\n\n @auth = User.find(params[:auth_id])\n user_mail = User.find(params[:user_id]).email\n @url = params[:url]\n mail(to: user_mail, subject:'承認されました。')\n \n end",
"def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end",
"def url_for_offering(offering, user, protocol, host, additional_params = {})\n grant = client.updated_grant_for(user, ReportTokenValidFor)\n if user.portal_teacher\n grant.teacher = user.portal_teacher\n grant.save!\n end\n url_options = {protocol: protocol, host: host}\n\n params = offering_report_params(offering, grant, user, url_options, additional_params)\n\n if offering.runnable.logging || offering.clazz.logging\n params[:logging] = 'true'\n end\n\n if allowed_for_students && user.portal_student\n params[:studentId] = user.id\n learner = Portal::Learner.where(offering_id: offering.id, student_id: user.portal_student.id).first\n if learner\n grant.learner = learner\n grant.save!\n end\n end\n\n add_query_params(url, params)\n end",
"def email_address_link user\n \"<a href=\\\"mailto:#{user.email}\\\">#{user.name} <#{user.email}></a>\"\n end",
"def link_gmail_note(user)\n @user = user\n @subject = \"Link Your Gmail to Bunch App\"\n mail(to: @user.email, subject: @subject)\n end",
"def set_id\n \"user:#{self['email']}\"\n end",
"def url() \n\t #'http://' << ENV['DOMAIN'] << \n\t '/' << self.author.username.to_s << '/' << self.name.to_s\n end",
"def get_user_uri\n \"/#{URI.encode ZohoReports.configuration.login_email}\"\n end",
"def send_invite(invite, password=nil)\n @invite = invite\n @event = @invite.event\n @password = password\n @email = @invite.invited_email\n @photographer = @event.photographer\n @subject = @invite.invite_subject\n link_slug = Link.create(event_id: @event.id)\n unique_key = Shortener::ShortenedUrl.generate(event_path(link_slug, invited: 'true')).unique_key\n @link = (ENV['END_CLIENT_URL'] || Rails.application.secrets[:env]['END_CLIENT_URL']) + '/' + unique_key\n mail(to: @email, subject: @subject )\n end",
"def create\n initiator = self.load_user(params)\n\n if initiator != nil\n new_meeting = Meeting.create\n new_meeting.initiator_id = initiator.id\n new_meeting.location = params[\"meeting\"][\"location\"]\n new_meeting.title = params[\"meeting\"][\"title\"]\n new_meeting.participants << initiator\n new_meeting.save!\n self.send_json(build_custom_meeting_json(meeting: new_meeting))\n else\n self.send_error 401\n end\n end",
"def voter_attestation_url(voter)\n leo_attestation_url(@voter, :protocol => 'https')\nend",
"def send_sign_up_link(username, referral_key)\n mail(to: username,\n subject: 'Sign up link for Referral Project',\n body: \"Here's the link to the sign up form: #{build_sign_up_link(referral_key)}\",\n content_type: 'text/html')\n end",
"def send_create(user=nil)\n self.meetingid = unique_meetingid() if self.meetingid.blank?\n self.moderator_api_password = internal_password() if self.moderator_api_password.blank?\n self.attendee_api_password = internal_password() if self.attendee_api_password.blank?\n self.save unless self.new_record?\n\n # Get the user options to use when creating the meeting\n user_opts = BigbluebuttonRails.configuration.get_create_options.call(self, user)\n user_opts = {} if user_opts.blank?\n\n server, response = internal_create_meeting(user, user_opts)\n unless response.nil?\n self.attendee_api_password = response[:attendeePW]\n self.moderator_api_password = response[:moderatorPW]\n self.voice_bridge = response[:voiceBridge] if response.has_key?(:voiceBridge)\n\n unless self.new_record?\n self.save\n\n # creates the meeting object since the create was successful\n BigbluebuttonMeeting.create_meeting_record_from_room(self, response, server, user, user_opts)\n\n # enqueue an update in the meeting with a small delay we assume to be\n # enough for the user to fully join the meeting\n Resque.enqueue(::BigbluebuttonMeetingUpdaterWorker, self.id, 10.seconds)\n end\n end\n\n response\n end",
"def join_web_url=(value)\n @join_web_url = value\n end",
"def join_web_url=(value)\n @join_web_url = value\n end",
"def room_data_url(room_id)\n \"https://#{valid_params[:subdomain]}.campfirenow.com/room/#{room_id}.json\"\nend",
"def set_meeting\n end",
"def user_path(user)\n \"/u/#{user.name}\"\n end",
"def get_meeting_session_name\n meeting_session ? meeting_session.get_full_name : '?'\n end",
"def get_meeting_name\n meeting ? meeting.get_full_name : '?'\n end",
"def create\n\t@meeting = Meeting.create(params[:meeting])\n \n print \"URL\", url_for(@meeting) + \"?key=\" + @meeting.uuid\n\tredirect_to url_for(@meeting) + \"?key=\" + @meeting.uuid\n end",
"def meeting_confirmation\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def meeting_id_param\n params[:meeting_id]\n end",
"def account_link\n UserMailer.account_link\n end",
"def meeting_params\n params.require(:meeting).permit(:meeting, :user_id, :mycontact_id, :name)\n end",
"def get_meeting_participaton(user_to_search)\n\t\tmeeting_participations.find_by(user_id: user_to_search.id)\n\tend",
"def application_meeting_metadata(meeting)\n {\n \"MeetingType\": \"PrivateRoom\",\n \"Room\": @room\n }\n end",
"def path\n \"/user/#{id}\"\n end",
"def meeting_resource_path(meeting_id, params = {})\n <%= @path_name_prefix %>meeting_path(<%= @path_args_prefix %>meeting_id, params)\n end",
"def meeting_params\n params.require(:meeting).permit(:name, :date, :s_time, :e_time, :room_id, :attending, user_ids: [])\n end",
"def youtube_profile\n @network = current_user.network ||= Network.new\n (@network.youtube.nil?) ? \"\" : @network.youtube\n end",
"def on_behalf_of_user_id=(value)\n @on_behalf_of_user_id = value\n end",
"def agenda_url(id)\n \"#{@baseurl}/agview.aspx?agviewdoctype=AGENDA&agviewmeetid=#{id}\"\n end",
"def url\n @client.url + self.class.path + @username\n end",
"def invite_people\n end",
"def attendee_resource_path(meeting_id, attendee_id, params = {})\n <%= @path_name_prefix %>meeting_attendee_path(<%= @path_args_prefix %>meeting_id, attendee_id, params)\n end",
"def meeting_resource_path(meeting_id, params = {})\n room_meeting_path(@room, meeting_id, params)\n end",
"def meeting_resource_path(meeting_id, params = {})\n room_meeting_path(@room, meeting_id, params)\n end",
"def set_users_meeting\n @users_meeting = UsersMeeting.find(params[:id])\n end",
"def chat_invite(user, ticket, message)\n # set up all variables to be used within the message\n @user = user\n @ticket = ticket\n @message = message\n @auth = Ticket.find(ticket).auth_client\n @sign_up_url = access_sign_up_url\n @ticket_url = ticket_url id: @ticket.id\n @chat_url = Rails.configuration.sync.root + '/chat/' + @ticket.id.to_s + '?email=' + @user.email + '&auth=' + @auth\n\n # send the email\n mail to: @user.email, subject: \"Response about ##{@ticket.id}: #{@ticket.subject}\"\n end",
"def welcome_new_webinar_participant(participant)\n @participant = participant\n mail(to: @participant.email, from: \"Eventos <[email protected]>\", subject: \"Kleer | #{@participant.event.event_type.name}\" )\n end",
"def meeting_resources_path(params = {})\n room_meetings_path(@room, params)\n end",
"def meeting_resources_path(params = {})\n room_meetings_path(@room, params)\n end",
"def url_for_offering(offering, user, protocol, host)\n grant = client.updated_grant_for(user, ReportTokenValidFor)\n if user.portal_teacher\n grant.teacher = user.portal_teacher\n grant.save!\n end\n routes = Rails.application.routes.url_helpers\n class_id = offering.clazz.id\n url_options = {protocol: protocol, host: host}\n add_query_params(url, {\n reportType: 'offering',\n offering: routes.api_v1_offering_url(offering.id, url_options),\n classOfferings: routes.api_v1_offerings_url(url_options.merge(class_id: class_id)),\n class: routes.api_v1_class_url(class_id, url_options),\n token: grant.access_token,\n username: user.login\n })\n end",
"def invite\n verifier = ActiveSupport::MessageVerifier.new(\"secret\")\n begin\n message = verifier.verify(::Base64.urlsafe_decode64(params[:token]))\n rescue ActiveSupport::MessageVerifier::InvalidSignature, ArgumentError\n logger.warn \"Invalid invite link: #{params[:token]}\"\n flash[:alert] = 'Invalid link'\n redirect_to new_registration_path and return\n end\n @user = User.find_by(id: message[:user_id])\n unless @user\n flash[:alert] = 'Invalid link'\n redirect_to new_registration_path and return\n end\n unless current_user.is_signed_in?\n session[:user_id] = @user.id\n flash[:notice] = \"Please select a username and password to complete your registration\"\n end\n end",
"def magic_link(session)\n @session = session\n\n authenticatable_resource_name =\n @session.authenticatable_type.underscore.pluralize\n @magic_link =\n send(authenticatable_resource_name).token_sign_in_url(session.token)\n\n email_field = @session.authenticatable.class.passwordless_email_field\n mail(\n to: @session.authenticatable.send(email_field),\n subject: 'Your magic link ✨'\n )\n end",
"def twitter_id(user_id)\n %Q|<a href=\"//twitter.com/#{user_id}\" link=\"_blank\">#{user_id}さん</a>|\nend",
"def invite_user(param)\n email_addresses.set param[:email]\n is_owner.set(true) if param[:owner] == 'true'\n unless nil_or_empty?(param[:apps])\n param[:apps].each_with_index do |item, index|\n app_drop_down.select item\n role_drop_down.select param[:roles][index] if param[:roles]\n site_drop_down.select param[:sites][index] if param[:sites]\n add_new_app.click\n end\n end\n invite_button.click\n end",
"def club_member_post_url(a,b,args={});user_post_url(a,b,args);end",
"def join\n @invite_code = params[:invite_code]\n end"
] | [
"0.8092655",
"0.7162452",
"0.713902",
"0.7123276",
"0.700276",
"0.6416468",
"0.5919399",
"0.5888902",
"0.5880316",
"0.5797665",
"0.57330704",
"0.5627439",
"0.54624236",
"0.5445873",
"0.5445873",
"0.5440448",
"0.5386621",
"0.53849703",
"0.5333603",
"0.5322903",
"0.531965",
"0.531545",
"0.52822727",
"0.5255568",
"0.5237582",
"0.5220786",
"0.52163714",
"0.5209025",
"0.51964444",
"0.5150385",
"0.5101664",
"0.5091659",
"0.50876683",
"0.50838214",
"0.5063511",
"0.50583214",
"0.50552803",
"0.5047435",
"0.50423735",
"0.5036206",
"0.50326335",
"0.50231415",
"0.5019948",
"0.50194293",
"0.50094545",
"0.49924338",
"0.4983246",
"0.49801818",
"0.49800882",
"0.49745417",
"0.49722806",
"0.49708366",
"0.49689704",
"0.4966851",
"0.49573332",
"0.49548128",
"0.49489862",
"0.49298516",
"0.49222654",
"0.49217",
"0.49143982",
"0.49140367",
"0.4901303",
"0.48974586",
"0.48974586",
"0.48893043",
"0.48840022",
"0.4879441",
"0.48740765",
"0.48736107",
"0.48730236",
"0.486816",
"0.48651052",
"0.48538464",
"0.48381498",
"0.4834621",
"0.48287365",
"0.48238555",
"0.4821575",
"0.48180234",
"0.48144504",
"0.48134866",
"0.48056963",
"0.48048413",
"0.48027664",
"0.47864455",
"0.47862625",
"0.47862625",
"0.47858512",
"0.47813845",
"0.47799104",
"0.47793132",
"0.47793132",
"0.47777197",
"0.47739333",
"0.47720772",
"0.47704136",
"0.47692767",
"0.47649837",
"0.47649392"
] | 0.80475104 | 1 |
Returns true or false as to whether meeting is open. A meeting is only open after at least one participant has joined. meeting_id:: Unique identifier for the meeting | def is_meeting_running?(meeting_id)
hash = send_api_request(:isMeetingRunning, { :meetingID => meeting_id } )
hash[:running].downcase == "true"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meeting_running?(id)\n prepare\n @api.is_meeting_running?(id)\n end",
"def is_meeting_running?(meeting_id)\n hash = send_api_request(:isMeetingRunning, { :meetingID => meeting_id } )\n BigBlueButtonFormatter.new(hash).to_boolean(:running)\n end",
"def open?\n\t\t@time = Time.now.to_formatted_s(:time)\n\t\t#Recupere le numero du jour actuel\n\t\tday = Time.now\n\t\tday = day.strftime(\"%w\")\n\t#Recupere l'operating_hour du jour actuel\n\t\t@open = self.operating_hours.find_by(day: day)\n\t\[email protected](close_soon: false)\n\n\t\t@open_time = @open[:open].to_formatted_s(:time)\n\t\t@close_time = @open[:close].to_formatted_s(:time)\n\n\n\t\tif @open_time < @close_time\n\t\t\tif @time >= @open_time && @time <= @close_time\n\t\t\t\tif @time >= @open[:close] - 60*30\n\t\t\t\t\[email protected](close_soon: true)\n\t\t\t\tend\n\t\t\treturn true\n\t\t\telse\n\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\tif @time <= @open_time && @time >= @close_time\n\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\tif @time >= @open[:close] - 60*45\n\t\t\t\t\t\[email protected](close_soon: true)\n\t\t\t\t\tend\n\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\tend",
"def appointment?\n !open && !close\n end",
"def appointment?\n !open && !close\n end",
"def open?\n event_status_id == 1\n end",
"def find_open_meetings( check_date = Date.today() )\n @meetings_found = true\n\n # If no seasons_ids check out\n if !@seasons_found\n find_manageable_seasons()\n end\n\n @meetings_ids = Meeting.\n where( are_results_acquired: false ).\n where( season_id: @seasons_ids ).\n where(['meetings.header_date >= ? and (meetings.entry_deadline is null or meetings.entry_deadline >= ?)', check_date, check_date] ).\n select( :id ).\n map{ |m| m.id }\n end",
"def check_close_data_presence(meeting)\n return if meeting.closed_at.present? || !minutes_data?(meeting)\n\n meeting.closed_at = Time.current\nend",
"def is_open?\n @open\n end",
"def open?\n open = false\n\n # if any door is open, consider the entrance open\n self.doors.each do |door|\n if door.open?\n open = true\n end\n end\n\n open\n end",
"def open?\n state == :open\n end",
"def open?\n @opened\n end",
"def open_entry?\n opened_at <= DateTime.now.to_date && closed_at >= DateTime.now.to_date\n end",
"def open?\n open_date < Time.now && !past_deadline? rescue nil\n end",
"def check_closing_visibility(meeting)\n return unless meeting.minutes_visible.nil?\n return if minutes_data?(meeting) || meeting.closed_at.blank?\n\n meeting.minutes_visible = true\nend",
"def is_meeting_response\n return @is_meeting_response\n end",
"def open?\n return accepted_proposal_id == nil\n end",
"def is_open?()\n return !@closed\n end",
"def is_open?\n\t\treturn !!@open\n\tend",
"def not_yet_open?\n opened_at > DateTime.now\n end",
"def opening?\n !(open? || closed?)\n end",
"def open?\n @state == :open\n end",
"def current_meeting?\n Meeting.where(committee: self).and(Meeting.where(end_time: nil)).exists?\n end",
"def is_meeting_request\n return @is_meeting_request\n end",
"def is_open?\n return state == :open\n end",
"def open_at_this_time?\n now = timenow\n time_inside?(now, start_time.utc, end_time.utc)\n end",
"def open?\n @handshake&.finished? && !@closed\n end",
"def open?\n @open || true\n end",
"def open?\n registration_open_time < DateTime.now rescue false\n end",
"def closed?\n # the conference has been created the virtual hearing was deleted\n conference_id.present? && conference_deleted?\n end",
"def open_event\n @event = Event.find(params[:id])\n\n if [email protected]_open\n flash[:danger] = \"We're sorry, but this event is not open for requests.\"\n redirect_to events_url\n end\n end",
"def can_participate?\n open? and !max_participants_reached?\n end",
"def open?\n @open\n end",
"def open?\n @session && @session.started?\n end",
"def locked_open?\n lock == :open\n end",
"def open?\n return false if close_today?\n today = self.time_tables.find_by(day_of_week: Time.now.wday)\n (today.opened_at...today.closed_at).include?(Time.now.hour)\nend",
"def is_open?\n return self.status == \"open\"\n end",
"def open?\n return @opened\n end",
"def isBusy(meeting_start, meeting_end, start_time, end_time)\n if start_time > meeting_start && end_time < meeting_end\n return true\n end \n return false\nend",
"def opened?\n @opened\n end",
"def open?\n @open\n end",
"def open?\n @open\n end",
"def opened?\n @session > -1 ? true : false\n end",
"def open?\n (start_date..end_date).cover?(Date.current)\n end",
"def available?(meeting_start, meeting_end)\n # if for any meeting schedule for the room, start/end is between them, return false\n meetings.each do |meeting|\n return false if meeting_start.between?(meeting.meeting_start, meeting.meeting_end)\n return false if meeting_end.between?(meeting.meeting_start, meeting.meeting_end)\n end\n\n # if there are no schedule conflicts, return true\n true\n end",
"def room_running?(bbb_id)\n bbb_server.is_meeting_running?(bbb_id)\n end",
"def is_closed\n if ((self.closed) && self.closed > 0 && self.closed < Time.now.to_i)\n return true\n else\n return false\n end\n end",
"def open?\n state == \"open\"\n end",
"def is_open?\n bookings.completed.empty?\n end",
"def open?\n return closetime && closetime > DateTime.now\n end",
"def open?\n !closed?\n end",
"def should_send_opening_reminder\n time_now = Time.zone.now\n return false if start_at && start_at_was && start_at < time_now && start_at_was < time_now\n\n true\n end",
"def opened?\n !closed?\n end",
"def closed?\n !closed_at.blank?\n end",
"def closed?\n closed_on.present?\n end",
"def open?\n @open\n end",
"def open?\n (AVAILABLE == status) and in_redemption_period?\n end",
"def open?\n !(closed?)\n end",
"def team_registration_open?\n d = @data_object\n today = Date.today\n d.aff_team_reg_start.to_date <= today && d.aff_team_reg_end.to_date >= today\n end",
"def challenge_open?\n self.state == \"open\"\n end",
"def open?\n @ban_until > Time.now\n end",
"def open?\n @ban_until > Time.now\n end",
"def closed?\n (contact && contact.closed?) && (event && event.closed?)\n end",
"def open?\n is_open\n end",
"def open?\n @dialog ? true : false\n end",
"def open?(station_from, station_to)\n station_from.common_line_codes(station_to).any? do |line_code|\n station_from.open?(@time, line_code) &&\n station_to.open?(@time, line_code)\n end\n end",
"def registration_open?\n today = Date.current\n if self.registration_start_date.blank? || self.registration_end_date.blank?\n false\n end\n\n (registration_start_date..registration_end_date).cover?(today)\n end",
"def alive?\n state == :open\n end",
"def overlaps_with?(other_meeting) \n if day == other_meeting.day\n if (other_meeting.start_time < end_time) && (other_meeting.end_time > start_time)\n return true\n end\n end\n return false\n end",
"def has_awaiting_picked_meeting?\n !completed? && self.notifications.last.is_a?(::Users::Notifications::TradePickedMeeting)\n end",
"def open?\n status == \"open\"\n end",
"def closed?\n minutes_open = (Time.zone.now - self.created_at)/60.0\n time_limit = workout_offering.time_limit_for(user)\n\n !time_limit.nil? && minutes_open >= time_limit\n end",
"def closed?\n minutes_open = (Time.zone.now - self.created_at)/60.0\n time_limit = workout_offering.time_limit_for(user)\n\n !time_limit.nil? && minutes_open >= time_limit\n end",
"def isLocked\n room = Room.find_by_id params[:id]\n\n if room.nil?\n respond_with locked: true\n else\n if room.lock_owner_user_id.nil? || room.room_lock_start.nil? || room.lock_owner_user_id == session[:uid]\n respond_with locked: false\n else\n respond_with locked: true\n end\n end\n end",
"def isSendToRoom?\n @room_id != nil\n end",
"def open\n return start_date <= Time.now.to_date && end_date >= Time.now.to_date\n end",
"def bidding_open?\n return self.auction_end.blank? || self.auction_end.future?\n end",
"def is_meeting_response=(value)\n @is_meeting_response = value\n end",
"def opens\n if open_status == true || unlocked_status == false\n raise ArgumentError.new(\"You cannot open a door that is already open or locked!\")\n else\n door_hash[:open_status] = true\n end\n end",
"def open?(time = nil)\n time = Time.new if time.nil?\n time = time.in_time_zone(self.time_zone)\n day_index = time.wday\n return unless open_on_day? day_index\n hours = hours_on_day day_index\n (time > hours[0]) && (time < hours[1])\n end",
"def verify_meeting\n set_meeting_from_id\n unless ( @meeting )\n flash[:error] = I18n.t(:invalid_action_request) + ' - ' + I18n.t('meeting.errors.missing_meeting_id')\n redirect_to( meetings_current_path() ) and return\n end\n\n # Find preselected team and swimmer if user logged in and associated to a swimmer\n # and the swimmer or team partecipated to the meeting\n set_swimmer_from_current_user\n if @swimmer\n team = @swimmer.teams.joins(:badges).where(['badges.season_id = ?', @meeting.season_id]).first\n\n if @meeting.meeting_individual_results.where(['meeting_individual_results.swimmer_id = ?', @swimmer.id]).exists? ||\n @meeting.meeting_entries.where(['meeting_entries.swimmer_id = ?', @swimmer.id]).exists?\n @team = team\n else\n if team && (@meeting.meeting_individual_results.where(['meeting_individual_results.team_id = ?', team.id]).exists? ||\n @meeting.meeting_entries.where(['meeting_entries.team_id = ?', team.id]).exists?)\n # The team of the swimmer associated with the user parteciapte to the meeting\n @team = team\n end\n end\n end\n end",
"def locked_closed?\n lock == :closed\n end",
"def isOpen\r\n\t\t\t\t\treturn @isOpen\r\n\t\t\t\tend",
"def open_door\n if !self.open? && !self.locked?\n @opened = true\n elsif self.open?\n raise TypeError.new(\"This door is already opened. It cannot be opened again.\")\n elsif self.locked?\n raise TypeError.new(\"This door is locked. It cannot be opened.\")\n else\n return \"this door can't be opened and we don't know why!!!!!!!!!!!!\"\n end\n end",
"def closed?\n defined?(@closed) && @closed\n end",
"def open?\n type == 'open'\n end",
"def registration_open?\n today = Date.current\n if registration_dates_given?\n (registration_start_date..registration_end_date).cover?(today)\n else\n false\n end\n end",
"def open?\n !closed?\n end",
"def open?\n !closed?\n end",
"def cfp_open?\n today = Date.current\n cfp = self.call_for_papers\n if !cfp.nil? && (cfp.start_date.. cfp.end_date).cover?(today)\n return true\n end\n\n return false\n end",
"def cfp_open?\n today = Date.current\n cfp = self.call_for_papers\n if !cfp.nil? && (cfp.start_date.. cfp.end_date).cover?(today)\n return true\n end\n\n return false\n end",
"def can_open?\n\t\treturn true\n\tend",
"def open?\n return Time.now.hour >= 18 && Time.now.hour <= 22\n end",
"def open?\n scheduled? or conditional?\n end",
"def open?\n return\n (Time.now.hour >= 9 && Time.now.hour <= 12) ||\n super\n end",
"def create\n @meeting = Meeting.new(meeting_params)\n\n new_start_date = @meeting.start_date.to_date\n new_end_time = @meeting.end_time.to_date\n # p \"new_start_date = #{new_start_date}\"\n # p \"new_end_time = #{new_end_time}\"\n\n flag = false\n @meetings = Meeting.all\n @meetings.each do |meeting|\n # p \"meetings : #{meeting.id}\"\n\n startdate = (meeting.start_date).to_date\n enddate = (meeting.end_time).to_date\n # p \"startdate = #{startdate}\"\n # p \"enddate = #{enddate}\"\n range_date = (startdate..enddate).to_a\n\n unless range_date.include?(\"#{new_start_date}\") || range_date.include?(\"#{new_end_time}\")\n p \"YES - #{new_start_date}\"\n flag = true\n end\n\n\n # p \"range_date = #{range_date}\"\n # range_date.each do |day|\n # day_date = day.to_date\n # p \"day : #{day.to_date}\"\n #\n # range_date2.each do |day2|\n # day_date2 = day2.to_date\n # p \"day2 : #{day2.to_date}\"\n # if day_date2 == day_date\n # p \"Período de data já cadastrada\"\n # flag = true\n # end\n # end\n #\n # end\n\n\n end\n\n if flag\n respond_to do |format|\n format.js\n end\n # redirect_to request.referrer\n else\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to @meeting, notice: 'Meeting was successfully created.' }\n format.json { render :show, status: :created, location: @meeting }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def idle?\n conversation_state.idle?\n end",
"def active?\n @subject&.open?\n end",
"def is_meeting_request=(value)\n @is_meeting_request = value\n end",
"def fetch_is_running?\n server = BigbluebuttonRails.configuration.select_server.call(self, :is_meeting_running)\n server.api.is_meeting_running?(self.meetingid)\n end"
] | [
"0.6380261",
"0.62248003",
"0.6221971",
"0.6039648",
"0.6039648",
"0.59506863",
"0.590294",
"0.57762027",
"0.57440346",
"0.572106",
"0.5709472",
"0.5704064",
"0.5704059",
"0.57009107",
"0.5669436",
"0.5643488",
"0.5627048",
"0.5624854",
"0.55969566",
"0.5593739",
"0.55860245",
"0.5576971",
"0.55761963",
"0.55659354",
"0.5554448",
"0.553411",
"0.5532574",
"0.551463",
"0.5495333",
"0.54896206",
"0.5473399",
"0.54628664",
"0.5458406",
"0.54580903",
"0.5433671",
"0.54309565",
"0.5426299",
"0.5412014",
"0.53842777",
"0.53800535",
"0.53784144",
"0.53784144",
"0.5375016",
"0.53372663",
"0.53349864",
"0.5330302",
"0.53267586",
"0.53027356",
"0.5296807",
"0.5293969",
"0.52708715",
"0.5257822",
"0.5245172",
"0.5245019",
"0.52423936",
"0.52361685",
"0.52291787",
"0.5212367",
"0.5211136",
"0.5177386",
"0.51542974",
"0.51542974",
"0.51440334",
"0.5117558",
"0.51135993",
"0.51128966",
"0.5111227",
"0.5102997",
"0.5101459",
"0.50898015",
"0.50837296",
"0.507896",
"0.507896",
"0.5070316",
"0.50601125",
"0.5053864",
"0.5043753",
"0.5041427",
"0.5040175",
"0.5040128",
"0.5033068",
"0.5020415",
"0.50156295",
"0.5008523",
"0.5001708",
"0.4990597",
"0.49904275",
"0.49874002",
"0.49874002",
"0.49824944",
"0.49824944",
"0.49793252",
"0.49741557",
"0.49723792",
"0.49554148",
"0.495334",
"0.49531317",
"0.49498025",
"0.4938588",
"0.493385"
] | 0.6326372 | 1 |
Warning: As of this version of the gem, this call does not work (instead of returning XML response, it should join the meeting). Joins a user into the meeting using an API call, instead of directing the user's browser to moderator_url or attendee_url (note: this will still be required however to actually use bbb). Returns the URL a user can use to enter this meeting. meeting_id:: Unique identifier for the meeting user_name:: Name of the user password:: Moderator or attendee password for this meeting user_id:: Unique identifier for this user web_voice_conf:: Custom voiceextension for users using VoIP | def join_meeting(meeting_id, user_name, password, user_id = nil, web_voice_conf = nil)
params = { :meetingID => meeting_id, :password => password, :fullName => user_name,
:userID => user_id, :webVoiceConf => web_voice_conf }
send_api_request(:join, params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_meeting_url(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n get_url(:join, params)\n end",
"def join_meeting_url(meeting_id, user_name, password,\n user_id = nil, web_voice_conf = nil)\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name,\n :userID => user_id, :webVoiceConf => web_voice_conf }\n get_url(:join, params)\n end",
"def join_meeting(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n send_api_request(:join, params)\n end",
"def join_url(username, role, key=nil, options={})\n server = BigbluebuttonRails.configuration.select_server.call(self, :join_meeting_url)\n\n pass = case role\n when :moderator\n self.moderator_api_password\n when :attendee\n self.attendee_api_password\n when :guest\n if BigbluebuttonRails.configuration.guest_support\n options = { guest: true }.merge(options)\n end\n self.attendee_api_password\n else\n map_key_to_internal_password(key)\n end\n\n r = server.api.join_meeting_url(self.meetingid, username, pass, options)\n r.strip! unless r.nil?\n r\n end",
"def get_meeting_url(id, password)\n prepare\n @api.join_meeting_url(id, 'Guest', password)\n end",
"def meet_invitation(root_url, url, user, invitee, message, meet)\n @root_url, @url = root_url, url\n @user, @invitee, @message, @meet = user, invitee, message, meet\n mail(#:cc => user.email, \n :to => invitee.email,\n :subject => \"You've been added to a Kaya Meet\")\n end",
"def list_meeting_attendee(meeting_id=nil)\n operation_name=\"List Attendee\"\n @id = meeting_id unless meeting_id.nil?\n xml_value= xml_meetings(@configuration, operation_name,@id)\n \n res = Net::HTTP.start(@configuration[:host]){ |http|\n http.post(\"/WBXService/XMLService\",xml_value)\n }\n xml_data = res.body\n meeting_data = Hash.new\n attend = Attendee.new\n meeting_data= attend.parse_xml(res.body)\n puts res.body\n return meeting_data\n end",
"def create_meeting(name, id)\n # create a meeting on the BBB server\n prepare\n options = {\n attendeePW: 'ap',\n moderatorPW: 'mp',\n welcome: \"Welcome to the #{name} meeting!\"\n }\n\n @api.create_meeting(name, id, options)\n @api.join_meeting_url(id, 'Guest', 'mp')\n end",
"def set_meeting\n @meeting = User.find(params[:user_id]).meetings.find(params[:id])\n end",
"def show\n user = self.load_user(params)\n meeting = load_meeting(params)\n\n if user != nil && meeting != nil\n self.send_json(\n meeting.to_json(:include => {\n :participants => {:only => [:id, :name, :email]},\n :suggestions => {:include => [:votes]}\n })\n )\n else\n self.send_error 401\n end\n end",
"def fetch_meeting_info\n begin\n server = BigbluebuttonRails.configuration.select_server.call(self, :get_meeting_info)\n response = server.api.get_meeting_info(self.meetingid, self.moderator_api_password)\n\n @participant_count = response[:participantCount]\n @moderator_count = response[:moderatorCount]\n @has_been_forcibly_ended = response[:hasBeenForciblyEnded]\n @end_time = response[:endTime]\n @current_attendees = []\n if response[:attendees].present?\n response[:attendees].each do |att|\n attendee = BigbluebuttonAttendee.new\n attendee.from_hash(att)\n @current_attendees << attendee\n end\n end\n\n # a 'shortcut' to update meetings since we have all information we need\n # if we got here, it means the meeting is still in the server, so it's not ended\n update_current_meeting_record(response, true)\n\n rescue BigBlueButton::BigBlueButtonException => e\n # note: we could catch only the 'notFound' error, but there are complications, so\n # it's better to end the meeting prematurely and open it again if needed than to\n # not end it at all (e.g. in case the server stops responding)\n Rails.logger.info \"BigbluebuttonRoom: detected that a meeting ended in the room #{self.meetingid} after the error #{e.inspect}\"\n\n finish_meetings\n end\n\n response\n end",
"def send_create(user=nil)\n self.meetingid = unique_meetingid() if self.meetingid.blank?\n self.moderator_api_password = internal_password() if self.moderator_api_password.blank?\n self.attendee_api_password = internal_password() if self.attendee_api_password.blank?\n self.save unless self.new_record?\n\n # Get the user options to use when creating the meeting\n user_opts = BigbluebuttonRails.configuration.get_create_options.call(self, user)\n user_opts = {} if user_opts.blank?\n\n server, response = internal_create_meeting(user, user_opts)\n unless response.nil?\n self.attendee_api_password = response[:attendeePW]\n self.moderator_api_password = response[:moderatorPW]\n self.voice_bridge = response[:voiceBridge] if response.has_key?(:voiceBridge)\n\n unless self.new_record?\n self.save\n\n # creates the meeting object since the create was successful\n BigbluebuttonMeeting.create_meeting_record_from_room(self, response, server, user, user_opts)\n\n # enqueue an update in the meeting with a small delay we assume to be\n # enough for the user to fully join the meeting\n Resque.enqueue(::BigbluebuttonMeetingUpdaterWorker, self.id, 10.seconds)\n end\n end\n\n response\n end",
"def join_path(room, name, options = {}, uid = nil)\n\n # Destroy otp current_session\n current_user.destroy_otp if current_user&.room_otp.present?\n session.delete(:otp_name)\n\n # Create the meeting, even if it's running\n start_session(room, options)\n\n # Determine the password to use when joining.\n password = options[:user_is_moderator] ? room.moderator_pw : room.attendee_pw\n\n # Generate the join URL.\n join_opts = {}\n join_opts[:userID] = uid if uid\n join_opts[:join_via_html5] = true\n\n bbb_server.join_meeting_url(room.bbb_id, name, password, join_opts)\n end",
"def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if developer?\n #take care of meeting participants\n param_users = (params[:users].map {|i| i.to_i} rescue []).to_set\n meeting_users = (@meeting.meeting_participants.map {|mp| mp.user.id}).to_set\n (param_users - meeting_users).each {|uid| MeetingParticipant.create(:user => User.find(uid), :meeting => @meeting)}\n (meeting_users - param_users).each {|uid| MeetingParticipant.find(:first, :conditions => [\"meeting_id = ? and user_id = ?\", @meeting.id, uid]).destroy rescue nil}\n\n if @meeting.update_attributes(params[:meeting])\n flash[:notice] = 'Meeting was successfully updated.'\n format.html { redirect_to(iteration_stories_url(@meeting.iteration)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meeting.errors, :status => :unprocessable_entity }\n end\n else\n format.xml { render :xml => XML_ERRORS[:not_authorized] }\n end\n end\n end",
"def get_meetings\n prepare\n @api.get_meetings\n end",
"def set_meeting\n @meeting = current_user.meetings.find(params[:id] || params[:meeting_id])\n end",
"def emit_meeting(cur_mtg_dir, svn_mtg_dir, dt, num_members, quorum_need, num_proxies, attend_irc)\n _div id: \"meeting-#{dt.year}\"\n _whimsy_panel(\"All Meeting Details for #{dt.strftime(DTFORMAT)}\", style: 'panel-info') do\n if Time.now > dt\n _p do\n _ 'At the time of this past meeting, we had:'\n _ul do\n _li \"#{num_members} eligible voting Members,\"\n _li \"#{quorum_need} needed for quorum (one third),\"\n _li \"#{num_proxies} proxy assignments available for the meeting,\"\n _li \"And hoped that at least #{attend_irc} would attend the start of meeting.\"\n end\n attendees_file = File.join(cur_mtg_dir, 'attend')\n if File.exist?(attendees_file)\n attendees = File.readlines(attendees_file)\n _ \"By the end of the meeting, we had a total of #{attendees.count} Members participating (either via attending IRC, sending a proxy, or voting via email)\"\n else\n _p.alert.alert_danger do\n _span \"Unable to calculate participating members (\"\n _code \"attend\"\n _span \"file does not yet exist for meeting)\"\n end\n end\n end\n _p \"These are historical links to the past meeting's record.\"\n else\n _p \"Live links to the upcoming meeting records/ballots/how-tos are below.\"\n end\n _ul do\n ASF::MeetingUtil::MEETING_FILES.each do |f, desc|\n _li do\n emit_link(svn_mtg_dir, f, desc)\n end\n end\n end\n end\nend",
"def create\n initiator = self.load_user(params)\n\n if initiator != nil\n new_meeting = Meeting.create\n new_meeting.initiator_id = initiator.id\n new_meeting.location = params[\"meeting\"][\"location\"]\n new_meeting.title = params[\"meeting\"][\"title\"]\n new_meeting.participants << initiator\n new_meeting.save!\n self.send_json(build_custom_meeting_json(meeting: new_meeting))\n else\n self.send_error 401\n end\n end",
"def create\n @meeting = Meeting.new(params[:meeting])\n @iteration = Iteration.find(params[:meeting][:iteration_id])\n respond_to do |format|\n if developer?\n if @meeting.save\n flash[:notice] = 'Meeting was successfully created.'\n format.html do \n \n params[:users].each do |uid|\n user = User.find(uid)\n MeetingParticipant.create(:user => user, :meeting => @meeting)\n end if params.key? :users\n \n redirect_to(iteration_stories_url(@iteration))\n end\n format.xml { render :xml => @meeting, :status => :created, :location => @meeting }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @meeting.errors, :status => :unprocessable_entity }\n end\n else\n format.xml { render :xml => XML_ERRORS[:not_authorized] }\n end\n end\n end",
"def join\n @event = Event.find(params[:event_id])\n if (params[:type] == \"invite\")\n @uids = params[:uids]\n @uid_array = []\n @uid_array = @uids.split(\",\")\n\n @motlee_users = []\n @non_motlee_users = []\n\n @uid_array.each do |uid|\n motlee_user = User.where(:uid => uid).first\n\n if motlee_user.nil?\n token = params[:access_token]\n event_id = params[:event_id]\n Resque.enqueue(ProcessNewUserInvite, token, event_id, uid) \n else\n # User is already a part of Motlee\n # Add user to array of Motlee users\n @motlee_users << uid\n \n # Now we check to see if the user has already been added to the event\n @attendee = Attendee.where(\"user_id = ? AND event_id = ?\", motlee_user.id, params[:event_id]).first\n if @attendee.nil?\n # If user has not been added, create new Attendee object\n @attendee = Attendee.create(:user_id => motlee_user.id, :event_id => params[:event_id], :rsvp_status => 1)\n if (motlee_user.id != current_user.id)\n Resque.enqueue(AddEventNotification, motlee_user.id, params[:event_id], current_user.id)\n end\n end\n end\n end \n else\n @attendee = Attendee.create(:user_id => current_user.id, :event_id => @event.id, :rsvp_status => 1)\n end\n # Render a response so the devices are happy\n @event.update_attributes(:updated_at => Time.now)\n render :json => @event.as_json({:methods => [:owner, :attendee_count], \n :include => {:photos => {:include => {:comments => {}, :likes => {}}}, \n :people_attending => {:only => [:id, :uid, :name, :sign_in_count]}}})\n end",
"def send_email\n\n # Set subject for email\n title = \"\" + @meeting.name\n case action_name\n when 'create'\n title = \"[\" + t('views.meetings.new.title') + \"] \" + @meeting.name\n when 'update'\n title = \"[\" + t('views.meetings.edit.title') + \"] \" + @meeting.name\n when 'cancel'\n title = \"[\" + t('views.meetings.show.button.cancel') + \"] \" + @meeting.name\n else\n #nothing to do\n end\n\n # Set content for email\n content = %([#{t('activerecord.attributes.meeting.id')}]\\n#{@meeting.id}\\n) +'<br>'+\n %([#{t('activerecord.attributes.meeting.dates')}]\\n) << @meeting.dates.to_s << ' ' << @meeting.start_time.strftime('%l:%M %p') +'<br>'+\n %([#{t('activerecord.attributes.meeting.venue')}]\\n#{@meeting.venue}\\n) +'<br>'+\n %([#{t('activerecord.attributes.meeting.message')}]\\n#{@meeting.message}\\n) +'<br>'\n\n # Get email of users who join to meeting\n @meeting.participants.each do |participant|\n @participant_email = participant.user.mailaddress\n if !@participant_email.nil?\n Notifier.send_email_notifications(@participant_email, title, content ).deliver\n end\n end\n @meeting.observers.each do |observers|\n @observers_email = observers.user.mailaddress\n if !@observers_email.nil?\n Notifier.send_email_notifications(@observers_email, title, content ).deliver\n end\n end\n\n end",
"def craft_url(user=nil,session=nil,return_to=\"http://www.instructure.com\")\n logger.debug \"calling craft url in wiziq_conference\"\n user ||= self.user\n initiate_conference and touch or return nil\n if (user == self.user || self.grants_right?(user,session,:initiate))\n admin_join_url(user, return_to)\n else\n participant_join_url(user, return_to)\n end\n end",
"def show\n @meeting = Meeting.find(params[:id])\n @user = User.find_by_watiam(session[:cas_user])\n\n @allattendees = Attendee.where(:meeting_id => @meeting.id).all\n @allattendees.find(:sort => 'weight')\n @allusers = []\n \n \n #creates array of users that are attending the meeting\n @allattendees.each do |attendee|\n @userall = User.find(:first, :conditions => {:id => attendee.user_id})\n @allusers << @userall\n end\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meeting }\n end\n end",
"def update_url\n answer_meeting_registration_path(meeting_id: meeting.id)\n end",
"def set_meeting\n end",
"def join_appointment(appointment_id, user_id, travel_type=Meet4Xmas::Persistence::TravelType::ALL.first, location=Meet4Xmas::Persistence::Location.HPI.to_hash)\n @client.joinAppointment(appointment_id, user_id, travel_type, location)\n end",
"def show\n @users_meetings = UsersMeeting.where(meeting_id_id: @meeting.id)\n end",
"def meeting_accepted(meeting)\n setup_email\n @recipients = meeting.host.email\n @subject += \"Cita aceptada\"\n @body = {:meeting => meeting}\n end",
"def create\n\t@meeting = Meeting.create(params[:meeting])\n \n print \"URL\", url_for(@meeting) + \"?key=\" + @meeting.uuid\n\tredirect_to url_for(@meeting) + \"?key=\" + @meeting.uuid\n end",
"def create\n @meeting = Meeting.new(params[:meeting])\n @user = User.find_by_watiam(session[:cas_user])\n @meeting.user_id = @user.id\n @all = User.all\n\n respond_to do |format|\n if @meeting.save\n \n AgendaReminder.reminder_email(@user, @meeting).deliver\n \n if params[:all?] == true\n @all.each do |id|\n @a = Attendee.new\n @d = Discussion.new\n @a.meeting_id = @meeting.id\n @a.user_id = id\n @d.meeting_id = @meeting.id\n @d.user_id = id\n @a.weight = @a.user_id\n @a.save\n @d.save\n end\n else \n params[:user_ids].each do |id|\n @a = Attendee.new\n @d = Discussion.new\n @a.meeting_id = @meeting.id\n @a.user_id = id\n @d.meeting_id = @meeting.id\n @d.user_id = id\n @a.weight = @a.user_id\n @a.save\n @d.save\n end\n end\n \n format.html { redirect_to @meeting, notice: 'Meeting was successfully created.' }\n format.json { render json: @meeting, status: :created, location: @meeting }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_meeting_participaton(user_to_search)\n\t\tmeeting_participations.find_by(user_id: user_to_search.id)\n\tend",
"def add_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n comment = params[\"comment\"].nil? ? \"\" : params[\"comment\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n unless meeting.participants.exists?(participant_id)\n new_participant = User.find(participant_id)\n meeting.participants << new_participant\n # add default vote for the new added participant to each suggestion\n meeting.suggestions.each do |suggestion|\n suggestion.votes << Vote.new(:voter => new_participant, :decision => \"?\")\n end\n\n NotificationService.send_meeting_invitation(user, new_participant, meeting, comment)\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end",
"def meeting\n meeting = nil\n session = nil\n program = meeting_program ? meeting_program.meeting : data_import_meeting_program\n if program.respond_to?(:meeting_session) && program.meeting_session\n session = program.meeting_session\n elsif program.respond_to?(:data_import_meeting_session) && program.data_import_meeting_session\n session = program.data_import_meeting_session\n end\n if session.respond_to?(:meeting) && session.meeting\n meeting = session.meeting\n elsif session.respond_to?(:data_import_meeting) && session.data_import_meeting\n meeting = session.data_import_meeting\n end\n meeting\n end",
"def show\n @meeting = Meeting.find(params[:id])\n if @meeting\n @attendee = @meeting.attendee_with_user(current_user) || Attendee.new\n @attendees = @meeting.attendees.find_all_by_rsvp(\"Yes\")\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meeting }\n end\n end",
"def get_friends_list\n # Append user string \n data_string = twitter\n\n # Append friend strings\n Invite.find( :all, :conditions => { :host_user => id } ).each do |invite|\n \n if( invite.accepted && invite.active )\n #friend = invite.users[0]\n friend = User.find( invite.target_user )\n data_string = data_string + \"|\" + friend.twitter\n end\n \n end \n \n return data_string\nend",
"def show\n #head :status => 405\n #return\n \n @participant = Participant.find(params[:id])\n \n # debugging\n #@meeting = Meeting.find(@participant.meeting_id)\n #send_invitation\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @participant }\n end\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_users_meeting\n @users_meeting = UsersMeeting.find(params[:id])\n end",
"def find_meeting\n @meeting = @parent_node.content\n end",
"def get_meeting_info(id)\n prepare\n @api.get_meeting_info(id, nil)\n end",
"def create\n @meeting = Meeting.new(create_params)\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to @meeting, notice: 'Meeting was successfully created.' }\n format.json { render :show, status: :created, location: @meeting }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n add_user_meeting_relation\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def set_meeting\n @meeting = Meeting.find(params[:id])\n end",
"def fetch_meetings\n response = self.api.get_meetings\n\n # updates the information in the rooms that are currently in BBB\n @meetings = []\n response[:meetings].each do |attr|\n room = BigbluebuttonRoom.find_by_server_id_and_meetingid(self.id, attr[:meetingID])\n if room.nil?\n room = BigbluebuttonRoom.new(:server => self, :meetingid => attr[:meetingID],\n :name => attr[:meetingID], :attendee_password => attr[:attendeePW],\n :moderator_password => attr[:moderatorPW], :external => true,\n :randomize_meetingid => false, :private => true)\n else\n room.update_attributes(:attendee_password => attr[:attendeePW],\n :moderator_password => attr[:moderatorPW])\n end\n room.running = attr[:running]\n\n @meetings << room\n end\n end",
"def end_meeting(id)\n prepare\n mod_pw = get_meeting_info(id).dig(:moderatorPW).to_s\n @api.end_meeting(id, mod_pw)\n end",
"def create\n @rooms = Room.all\n @users = User.all\n @meeting = Meeting.new(meeting_params)\n @meeting.users << current_user\n \n respond_to do |format|\n if @meeting.save\n EventMailer.with(meeting: @meeting, users: @meeting.users.map {|u| u}).new_meeting_email.deliver_now\n format.html { redirect_to @meeting, notice: 'Meeting was successfully created.' }\n format.json { render :show, status: :created, location: @meeting }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @meeting.update(meeting_params)\n @meeting.users << current_user\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invite_to_conference(from, to, single_dir, room = nil)\n puts \"send invite from: #{from} to: #{to} for room: #{room}, will #{single_dir ? 'not dial' : 'dial'} in response\".red_on_yellow\n agent = User.find_by_slug(to)\n\n dial_user(from, agent, {room: room, action: 'conference', send_ping: true, skip_ping_check: true, single_dir: single_dir})\n end",
"def show\n @meet_up_comment = MeetUpComment.in_conference(current_conference).\n find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def send_end\n server = BigbluebuttonRails.configuration.select_server.call(self, :end)\n response = server.api.end_meeting(self.meetingid, self.moderator_api_password)\n\n # enqueue an update in the meeting to end it faster\n Resque.enqueue(::BigbluebuttonMeetingUpdaterWorker, self.id)\n\n response\n end",
"def create\n @meeting = Meeting.new(params[:meeting])\n @meeting.attendeePW = rand(36**20).to_s(36)\n @meeting.moderatorPW = rand(36**20).to_s(36)\n @meeting.user_id = session[:user_id]\n #puts session[:user_id].inspect\n @meeting.name = Subject.find(@meeting.subject).title + Time.now.strftime('_%y%m%d%h%m')\n if @meeting.tutor.rate == 0\n @meeting.paid = true\n end\n @meeting.status = 0\n respond_to do |format|\n if @meeting.save\n ta = TutorAvailability.find(@meeting.tutor_availability_id)\n ta.taken = 1\n ta.save\n format.html { redirect_to @meeting, notice: 'Meeting was successfully created.' }\n format.json { render json: @meeting, status: :created, location: @meeting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_meeting\n @meeting_room = MeetingRoom.find(params[:id])\n end",
"def embed_url\n params = {\n showChat: false,\n userName: Rack::Utils.escape(h.current_user.username)\n }\n\n \"#{url}?#{params.to_query}\"\n end",
"def join\n @room = OnlineMeetingRoom.find_by_id(params[:id])\n role = @room.user_role(current_user)\n unless role == :denied\n join_internal(current_user.full_name, role, :join)\n else\n flash[:notice] = \"#{t('access_denied')}\"\n redirect_to :index and return\n end\n end",
"def get_invite_message(bitch_message=nil)\n name = get(\"name\").split(\" \").first # Get the first name\n id = get(\"id\")\n messages = get(\"messages\")\n bitch_message = bitch_message || messages[(rand(messages.length-1))][\"abuse\"]\n return \"#{name} says... #{bitch_message}!!\\nIs that cool with you? B*tch back!\\nInstall Yo! B*tch app from http://#{CONFIG.get(:domain)}/i/#{id}/#{name}\"\n end",
"def get_meeting_name\n meeting ? meeting.get_full_name : '?'\n end",
"def create\n @meeting = Meeting.new(meeting_params)\n @meeting.user_id = current_user.id\n\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to user_meetings_path, notice: 'Meeting was successfully created.' }\n format.json { render :show, status: :created, location: @meeting }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def applicant_invite\n require 'date' # For DateTime.new\n \n # Create Date time value\n date = params[:applicant].values\n meeting_time = DateTime.new(date[0].to_i, date[1].to_i, date[2].to_i, date[3].to_i, date[4].to_i, 0)\n \n @applicant = Applicant.find_by(id: params[:id])\n recruiter = @applicant.recruiter\n \n # Save meeting time\n params = ActionController::Parameters.new({\n applicant: {\n meeting: meeting_time\n }\n })\n @applicant.update(applicant_params(params))\n \n \n # Send emails\n UserMailer.with(applicant: @applicant, recruiter: recruiter, meeting_time: meeting_time).applicant_meeting_email.deliver_now\n UserMailer.with(applicant: @applicant, recruiter: recruiter, meeting_time: meeting_time).recruiter_meeting_email.deliver_now\n \n # Make calendar invitations.\n redirect_to new_interview_url(@applicant.id)\n\n #redirect_to \"/applicants/#{@applicant[:id]}\"\n end",
"def update\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n if user != nil and meeting != nil\n title = params[\"meeting\"][\"title\"]\n if title != nil\n meeting.title = title\n end\n result = meeting.save!\n if result\n self.send_ok\n else\n self.send_error 422\n end\n else\n self.send_error 401\n end\n end",
"def invite_people\n end",
"def show\n @model = Meeting.find(params[:id])\n @meeting = Meeting.find(params[:id], :include => :organizator)\n# @organizator = User.find(@meeting.organizator)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meeting }\n format.json { render :json => @meeting }\n end\n end",
"def invite_a_friend_to_track(user, email, the_body, the_subject) \n recipients email\n #bcc \"[email protected]\"\n from user.first_name + \" via habitforge <[email protected]>\"\n subject the_subject \n body the_body\n content_type \"text/html\"\n end",
"def agenda_url(id)\n \"#{@baseurl}/agview.aspx?agviewdoctype=AGENDA&agviewmeetid=#{id}\"\n end",
"def invite\n \n end",
"def set_meeting\n @meeting = Meeting.find(params[:meeting_id])\n end",
"def get_authentication_url\n @wll.getConsentUrl(\"Contacts.Invite\")\n end",
"def new\n @meetup = Meetup.new\n @recipient = User.find_by_id(params[:recipient_id])\n \n @recipient_meetups = []\n @recipient.upcoming_meetups.each do |m|\n @recipient_meetups.push({:title=> @recipient.name, :start=> m.date.strftime('%m-%d-%Y %H:%M:%S'), :end=> (m.date + 1.hour).strftime('%m-%d-%Y %H:%M:%S'), :allDay=> false})\n end\n \n @my_meetups = []\n current_user.upcoming_meetups.each do |m|\n @my_meetups.push({:title=> current_user.name, :start=> m.date.strftime('%m-%d-%Y %H:%M:%S'), :end=> (m.date + 1.hour).strftime('%m-%d-%Y %H:%M:%S'), :allDay=> false})\n end\n\n gon.recipient = @recipient\n gon.me = current_user\n gon.recipient_meetups = @recipient_meetups\n gon.my_meetups = @my_meetups\n \n @current_user = current_user\n @prev_meetup_id = params[:prev_meetup_id]\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def meet\n # Envia pedido de que quer conhecer o animal. \n # Isto mandaria uma proposta para o dono do shelter.\n\n # TODO: É preciso criar uma tabela associativa para saber quem já mandou proposta para o animal.\n # Assim evitaria mandar proposta múltiplas vezes.\n if params[:user_id]\n # friendly_user = User.find(params[:user_id])\n friendly_user = current_user\n AnimalMailer.meet_up_proposal(@animal, friendly_user).deliver\n end\n end",
"def create_meeting(name, folder_id, url_path)\n puts \"ACS create meeting with name '#{name}', folder_id '#{folder_id.to_s}' and url_path '#{url_path}'\"\n\n res = query(\"sco-update\", \n \"type\" => \"meeting\", \n \"name\" => name, \n \"folder-id\" => folder_id, \n \"url-path\" => url_path)\n\n puts \"ACS: meeting created\"\n return res.body\n end",
"def invite_facebook_friends\n end",
"def create\n dateFormats = ['%m/%d/%Y %I:%M %p %Z', '%Y-%m-%dT%H:%M %Z']\n # 2016-05-10T10:10 or 05/21/2015 10:07 pm\n # 2016-10-18T00:24\n dateStr = meeting_params[:date] + \" \" + Time.zone.now.strftime('%Z')\n logger.info(\"dateStr: \" + dateStr)\n parsedDate = nil\n\n dateFormats.each do |format|\n parsedDate ||= DateTime.strptime(dateStr, format) rescue nil\n end\n\n if parsedDate.nil?\n logger.error(\"No date found for input date: \" + dateStr)\n raise ActiveRecord::RecordNotFound()\n end\n\n @meeting = Meeting.new({\n meeting_type: MeetingType.find(meeting_params[:meeting_type]),\n met: parsedDate,\n school_id: @_current_school.id,\n comment: meeting_params[:comment]\n })\n\n memberIds = meeting_params[:students].split(\",\")\n assistIds = meeting_params[:assistants].split(\",\")\n student_role = Role.student_role\n instructor_role = Role.teacher_role\n assistant_role = Role.assistant_role\n\n # Create an array of tuples, role to member to then add.\n students = Member.find(memberIds)\n assistants = Member.find(assistIds)\n instructor = Member.find(meeting_params[:instructor])\n\n mmembs = students.collect {|mem| [student_role, mem]} + assistants.collect {|mem| [assistant_role, mem]} + [instructor].collect {|mem| [instructor_role, mem]}\n\n mmembs.each do |mmem|\n puts mmem.inspect\n role, member = mmem\n mm = MeetingMember.new({\n meeting: @meeting,\n member: member,\n belt: member.belt,\n role: role,\n })\n\n mm.save\n end\n\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to meetings_path(), notice: 'Meeting was successfully created.' }\n format.json { render :show, status: :created, location: @meeting }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def meeting_params\n params.require(:meeting).permit(:name, :date, :s_time, :e_time, :room_id, :attending, user_ids: [])\n end",
"def set_meetuser\n @meetuser = Meetuser.find(params[:id])\n end",
"def url_after_invite(invite)\n invite.invitable\n end",
"def get_invitation_link\n\t\tscope = self.scope\n\t\trace_id = self.race_id\n\t\t\n\t\tbase_url = InvitationEmailTarget.get_base_url(race_id, scope)\n\t\t\n\t\tbase_url += case self.scope\n\t\twhen (COMPETITION_SCOPE[:SITE])\n\t\t\t'competitions/' + self.id.to_s + '?code=' + self.invitation_code\n\t\twhen (COMPETITION_SCOPE[:CYCLINGTIPS])\n\t\t\t'?competition_id=' + self.id.to_s + '&code=' + self.invitation_code\n\t\tend\n\t\t\n\t\treturn base_url\n\tend",
"def meetuser_params\n params.require(:meetuser).permit(:meeting_id, :user_id)\n end"
] | [
"0.71058464",
"0.70569307",
"0.7056182",
"0.6351036",
"0.6325934",
"0.61878186",
"0.61102873",
"0.58758646",
"0.5833925",
"0.581703",
"0.5768154",
"0.57501143",
"0.57223004",
"0.56345004",
"0.55315965",
"0.55248547",
"0.5518703",
"0.5513635",
"0.5485416",
"0.54838276",
"0.5458421",
"0.54117465",
"0.54039186",
"0.5394274",
"0.53490514",
"0.5269003",
"0.52575904",
"0.5241107",
"0.5224337",
"0.5220469",
"0.5214231",
"0.52105784",
"0.5199441",
"0.519173",
"0.5158468",
"0.5145995",
"0.51434654",
"0.51434654",
"0.51434654",
"0.51434654",
"0.51434654",
"0.5140627",
"0.51375663",
"0.5126864",
"0.5121447",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51207787",
"0.51181257",
"0.51110005",
"0.5103801",
"0.51025236",
"0.51022947",
"0.5091251",
"0.50805396",
"0.50749254",
"0.50706625",
"0.506194",
"0.5049581",
"0.5041935",
"0.5040595",
"0.50396276",
"0.5034709",
"0.50299096",
"0.5023875",
"0.49859726",
"0.49820516",
"0.49669254",
"0.49645337",
"0.495306",
"0.49477667",
"0.49369398",
"0.4933002",
"0.49256083",
"0.49186286",
"0.49182847",
"0.49130163",
"0.49045023",
"0.49031848",
"0.48956916",
"0.48940128"
] | 0.7053277 | 3 |
Returns the API version (as string) of the associated server. This actually returns the version returned by the BBB server, and not the version set by the user in the initialization of this object. | def get_api_version
response = send_api_request(:index)
if response[:returncode]
response[:version].to_s
else
""
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_version\n @api_version ||= begin\n pool = self.pool.get_all[0]\n host = self.pool.get_master(pool)\n major = self.host.get_API_version_major(host)\n minor = self.host.get_API_version_minor(host)\n \"#{major}.#{minor}\"\n end\n end",
"def get_server_version\n server_info[:server_version]\n end",
"def api_version\n self.class.get('/api')['api_ver']\n end",
"def api_version\n request('getAPIVersion')\n end",
"def get_api_version\n _make_request(:types)['version'].to_s\n end",
"def get_api_version\n response = send_api_request(:index)\n response[:returncode] ? response[:version].to_s : \"\"\n end",
"def server_version\n ServerVersion.new(server_info[\"version\"])\n end",
"def server_version\n request(auth: false, expects: 200)['version']\n rescue => ex\n error { \"Server version exception\" }\n error { ex }\n nil\n end",
"def api_version\n Gandi.call('version.info')['api_version']\n end",
"def version\n response = get('/getVersion', {}, false)\n ApiVersion.new(response.body['version'], response.body['builddate'])\n end",
"def version\n api_execute('/version', :get).body\n end",
"def api_version\n @version\n end",
"def server_version\n status['value']['build']['version']\n end",
"def version\n @version ||= exec('SHOW server_version')[0]['server_version'].split[0]\n end",
"def current_api_version\n JSON.parse(get('/api').to_s)['currentVersion'] rescue 1\n end",
"def version\n ret = @client.call('Bugzilla.version')\n handle_faults(ret)\n ret['version']\n end",
"def api_version\n self.class.api_version\n end",
"def api_version\n @api_version || :latest\n end",
"def to_s\n self.api_version\n end",
"def get_version\n request('getVersion')\n end",
"def get_api_version()\n return API_VERSION\n end",
"def version\n raise InvalidRequestException unless defined?(API_VERSION)\n API_VERSION\n end",
"def formatted_version\n self.api_version.presence || DEFAULT_API_VERSION\n end",
"def server_version\n call! :server_version\n end",
"def API_version(options={})\n return \"#{@major}.#{@minor}\"\n end",
"def api_version\n @api_version || \"2011-02-01\"\n end",
"def server_version\n server_info.present? ? @server_info[:parseServerVersion] : nil\n end",
"def version\n self.class.get(\"/get/version\")\n end",
"def get_version\n prepare\n @api.get_api_version\n end",
"def server_version\n check_connection\n @protocol.server_version\n end",
"def api_version\n self.class.superclass.name.to_s.split('::').second.sub('V', '').to_i\n end",
"def server_api_version=(v)\n $server_api_version = v || Pedant::Config.server_api_version\n end",
"def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end",
"def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end",
"def api_version\n @api_version ||= \"v4.2\"\n end",
"def server_version\n db.server_version(@opts[:server])\n end",
"def best_request_version\n klass = get_class_for(:max_server_version)\n klass.minimum_api_version.to_s\n end",
"def version\n fetch('vehicle.version')\n end",
"def appliance_api_version\n options = { 'Content-Type' => :none, 'X-API-Version' => :none, 'auth' => :none }\n response = rest_api(:get, '/rest/version', options)\n version = response_handler(response)['currentVersion']\n raise ConnectionError, \"Couldn't get API version\" unless version\n version = version.to_i if version.class != Integer\n version\n rescue ConnectionError\n @logger.warn \"Failed to get OneView max api version. Using default (#{OneviewSDK::DEFAULT_API_VERSION})\"\n OneviewSDK::DEFAULT_API_VERSION\n end",
"def get_version()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('system', 'getVersion', 'string', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def server_version(server=nil)\n @server_version ||= (synchronize(server){|conn| conn.info[:id]})\n end",
"def server_version(_server=nil)\n @server_version ||= super()\n end",
"def server_version; end",
"def get_api_version()\n return :v201502\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end",
"def get_api_version_string(api_version)\n \"?api-version=#{api_version}\"\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version\n return @version\n end",
"def version; env['api.version'] end",
"def server_version(server=nil)\n return @server_version if @server_version\n ds = dataset\n ds = ds.server(server) if server\n @server_version = swallow_database_error{ds.with_sql(\"SELECT CAST(current_setting('server_version_num') AS integer) AS v\").single_value} || 0\n end",
"def get_api_version\n :v201502\n end",
"def apiversion\n @attributes.fetch('apiversion', nil)\n end",
"def version\n endpoint.config.version\n end",
"def version\n @version\n end",
"def api_version\n 'v2'\n end",
"def version_number\n @version\n end",
"def api_version; config[:api_version]; end",
"def client_version\n ClientVersion\n end",
"def version\n self[:version]\n end",
"def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end",
"def version\n v = KJess::Request::Version.new\n r = send_recv( v )\n return r.version if Response::Version === r\n raise KJess::Error, \"Unexpected Response from VERSION command\"\n end",
"def version\n [@major_version, @minor_version].join('.')\n end",
"def http_version\n \"%d.%d\" % [self[:http_major], self[:http_minor]]\n end",
"def ver\n @values['ver']\n end",
"def version\n @version_helper.to_s\n end",
"def version\n @version_helper.to_s\n end",
"def version\n values = {}\n ring.servers.each do |server|\n values[server.name.to_s] = server.alive? ? server.request(:version) : nil\n end\n values\n end",
"def version_number\n return @version_number\n end",
"def to_s\n @version\n end",
"def to_s\n @version\n end",
"def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend",
"def version\n VERSION\n end",
"def version\n return call('Bugzilla.version')\n end",
"def version\n return last_version if versionable?\n version_number\n end",
"def version\n attributes.fetch(:version)\n end",
"def version\n attributes.fetch(:version)\n end",
"def version\n attributes.fetch(:version)\n end",
"def version\n attributes.fetch(:version)\n end",
"def version\n attributes.fetch(:version)\n end",
"def app_version\n return @app_version\n end",
"def app_version\n return @app_version\n end",
"def version\n @attributes[:version]\n end",
"def version\n @attributes[:version]\n end",
"def version\n (version_from_class.to_f / 10).to_s\n end",
"def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend",
"def version\n send_command(:getinfo, 'version')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n reply\n end",
"def to_s\n @version\n end"
] | [
"0.8020638",
"0.7922533",
"0.7849166",
"0.78220415",
"0.7770864",
"0.77261287",
"0.76650965",
"0.7625699",
"0.7594201",
"0.755313",
"0.75075597",
"0.7504527",
"0.74810535",
"0.74678487",
"0.7390593",
"0.7367479",
"0.7310886",
"0.7304962",
"0.7296324",
"0.72943884",
"0.72848076",
"0.72842586",
"0.7260403",
"0.7252459",
"0.72515124",
"0.723324",
"0.7223845",
"0.7219806",
"0.70317227",
"0.7007757",
"0.6985601",
"0.69621706",
"0.69517",
"0.69517",
"0.6936976",
"0.6933541",
"0.6931214",
"0.6922464",
"0.68976694",
"0.6880865",
"0.68495715",
"0.68412644",
"0.68080276",
"0.6747881",
"0.67434436",
"0.67434436",
"0.67434436",
"0.67434436",
"0.67434436",
"0.67434436",
"0.67434436",
"0.67351246",
"0.673017",
"0.673017",
"0.673017",
"0.673017",
"0.673017",
"0.673017",
"0.673017",
"0.673017",
"0.673017",
"0.6716298",
"0.6705613",
"0.6702509",
"0.66402805",
"0.66367245",
"0.66152316",
"0.66109246",
"0.6609685",
"0.6604946",
"0.6602457",
"0.6596144",
"0.65918297",
"0.65788174",
"0.6563876",
"0.65610164",
"0.6550987",
"0.6550081",
"0.6550081",
"0.65391815",
"0.65297234",
"0.65241975",
"0.65241975",
"0.65231323",
"0.6517092",
"0.6490934",
"0.64860004",
"0.64857584",
"0.64857584",
"0.64857584",
"0.64857584",
"0.64857584",
"0.6473594",
"0.6473594",
"0.6464657",
"0.6464657",
"0.64634764",
"0.64628434",
"0.64473724",
"0.6427636"
] | 0.7735128 | 5 |
Make a simple request to the server to test the connection | def test_connection
response = send_api_request(:index)
response[:returncode]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_connection\n args = get_connection_args(\"#{endpoint}/auth\")\n args[:raw_response] = true\n RestClient::Request.execute(args)\n end",
"def make_http_request\n Net::HTTP.get_response('localhost', '/ping', 3000).body\nend",
"def talk_to_server(host, port, request)\n socket = TCPSocket.open(host, port)\n socket.print(request)\n response = socket.read\n socket.close\n\n response\nend",
"def test_can_get_ping\n get '/ping'\n assert last_response.ok?\n assert_equal 'PONG', last_response.body\n end",
"def attempt_connection\n conn = Puppet.runtime[:http]\n\n response = conn.get(test_uri, headers: test_headers, options: options)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (#{test_uri}): [#{response.code}] #{response.reason}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (#{test_uri}): #{e.message}\"\n return false\n end",
"def test\n base_url = url_for(path: '')\n logger.debug \"Testing the #{fqdn} fora\"\n client.url = base_url.to_s\n begin\n # this is network library code; it MUST be rescued\n client.perform\n if client.response_code >= 300\n logger.error \"HTTP code not as expected! (#{client.response_code})\"\n end\n rescue => e\n # log the problem and move on\n logger.fatal \"#{e.class}: #{e.message} (#{e.backtrace[0]})\"\n end\n logger.info client.status.to_s\n logger.debug client.header_str.to_s\n # REVIEW: this netcode might need to be rescued\n driver.get base_url.to_s\n logger.info \"#{driver.title} (#{base_url})\"\n logger.debug \"Cookies:\\n\" + cookies.map { |cookie| \"\\t#{cookie[:name]} => #{cookie[:value]}\" }.join(\"\\n\")\n end",
"def ping\n response, body = send_request :get, '', :binary\n true\n end",
"def send_request(request = \"\", host = \"127.0.0.1\", port = 40600)\n begin\n @server.connect(host, port)\n @server.send(request, 0)\n response, address = @server.recvfrom(1024*1024)\n rescue Exception => e\n response = e.message\n end\n puts response\n end",
"def test\n Srchio::Response.new(self.class.get(\"/test\"))\n end",
"def test_get\n req = c.get(0, \"/ping\", &blk)\n\n assert_sent req.tag, :verb => V::GET, :path => \"/ping\"\n assert_recv reply(req.tag, :cas => 123, :value => \"pong\")\n end",
"def attempt_connection\n conn = Puppet::Network::HttpPool.http_instance(http_server, http_port, use_ssl, verify_peer)\n\n response = conn.get(test_path, test_headers)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): #{e.message}\"\n return false\n end",
"def connect\n\t\tsocket = TCPSocket.open(@host, @port) # Connect to server\n\t\tsocket.print(@request) # Send request\n\t\tresponse = socket.read # Read complete response\n\t\t\n\t\tputs \"------------------------------------\"\n\t\tputs \"Request to server: #{@request}\"\n\t\tputs \"------------------------------------\"\n\t\tputs \"Response is:\"\n\t\tputs \"\"\n\t\tputs response\n\tend",
"def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end",
"def server_ready?\n begin\n url = URI.parse(TEST_URI)\n req = Net::HTTP.new(url.host, url.port)\n res = req.request_head(\"/\")\n res.code == \"200\"\n rescue Errno::ECONNREFUSED\n false\n end\nend",
"def connect(options={})\n query = query_string(options)\n request = generate_request(query)\n begin\n response = Net::HTTP.get_response(request)\n Response.new response\n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, SocketError,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts \"Failed to connect: #{e}\"\n end\n end",
"def ping\n get('')\n end",
"def ping\n url = URI.parse(\"http://localhost:#{@port_number}/selenium-server/driver/?cmd=testComplete&sessionId=smoketest\")\n request = Net::HTTP::Get.new(url.path)\n Net::HTTP.start(url.host, url.port) {|http|\n http.read_timeout=5\n http.request(request)\n }\n end",
"def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend",
"def connect\n @connection = Net::HTTP.new(@params[:server], @params[:port])\n @connection.use_ssl = true if @params[:scheme] == 'https'\n @connection.start\n end",
"def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end",
"def serverup?(ip, port)\n http = Net::HTTP.start(ip, port, {open_timeout:3, read_timeout:3})\n response = http.send_request('GET', '/')\n JSON.parse(response.body)\nrescue Timeout::Error, SocketError, Errno::ECONNREFUSED\n nil\nend",
"def test_connection\n end",
"def connect\n http = Net::HTTP.new @host, @port\n # http.set_debug_output($stdout)\n http.use_ssl = @ssl\n http.start\n http\n end",
"def test_connection\n synchronize{|conn|}\n true\n end",
"def test_request\n get \"/example/route\"\n assert last_response.ok?\n body = last_response.body\n assert body[\"Hello\"]\n end",
"def test_connection\n call :test_connection\n end",
"def request(*args, &blk)\n (@client ||= connect).request(*args, &blk)\n end",
"def test_racket_key\n server_run app: ->(env) { [200, {'Racket' => 'Bouncy'}, []] }\n data = send_http_and_read \"GET / HTTP/1.0\\r\\n\\r\\n\"\n\n assert_match(/HTTP\\/1.0 200 OK\\r\\nRacket: Bouncy\\r\\nContent-Length: 0\\r\\n\\r\\n/, data)\n end",
"def request(method)\n setup_client\n respond_with @client.request(method, @request.url, nil, @request.body, @request.headers, &@request.on_body)\n rescue OpenSSL::SSL::SSLError\n raise SSLError\n rescue Errno::ECONNREFUSED # connection refused\n $!.extend ConnectionError\n raise\n end",
"def connect!\n @connection = Net::HTTP.new(@server, 80)\n if @ssl\n @connection.use_ssl = true\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n @connection.start\n end",
"def send_request(url, req)\n begin\n Net::HTTP.start(url.host, url.port, :read_timeout => 180) {|http| http.request(req)}\n rescue Errno::ECONNREFUSED, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts e.to_s\n nil\n end\n end",
"def test_connectivity\n data = {'cart_type' => 'standalone'}\n\n response = fetch_url_json(\"/broker/cartlist\", data)\n assert_equal 200, response.code.to_i, error_for(:no_connectivity, $libra_server)\n end",
"def send_request(url)\n verify_credentials!\n\n api_response = nil\n\n complete_url = Applitrack.api_base + url\n uri = URI(complete_url)\n\n Net::HTTP.start(uri.host, uri.port,\n use_ssl: uri.scheme == 'https') do |http|\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(Applitrack.username, Applitrack.password)\n\n api_response = http.request(request)\n if api_response.code != \"200\"\n raise api_error(api_response)\n end\n end\n\n api_response\n end",
"def test_success\n assert_equal('kaboodle', make_request.handle)\n end",
"def test_connection\n error = nil\n @basic_query_params = {\n :fields => {},\n :start_at => 0,\n :max_results => 1000000000\n }\n begin\n response = @access_client.get('/secure/Dashboard.jspa')\n\n if response.code == '502'\n error = 'Something going wrong in JIRA server side. Please, try later.'\n elsif response.code == '403'\n error = 'Please, check your access rights to JIRA.'\n end\n rescue JIRA::HTTPError\n error = 'Please check your credentials or right URL address for Jira'\n end\n check_for_correct_jira_project(error)\n end",
"def attempt_connection\n # All that we care about is that we are able to connect successfully via\n # https, so here we're simpling hitting a somewhat arbitrary low-impact URL\n # on the scalemgmt server.\n http = Net::HTTP.new(scalemgmt_server, scalemgmt_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(test_path, test_headers)\n request.basic_auth(api_user, api_password)\n\n response = http.request(request)\n unless response.is_a?(Net::HTTPSuccess)\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n true\n rescue Exception => e # rubocop:disable Lint/RescueException\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): #{e.message}\"\n false\n end",
"def login\n response = get \"server\"\n response.code == 200\n end",
"def login\n response = get \"server\"\n response.code == 200\n end",
"def send_request; end",
"def test\n @worker = Worker.find(params[:id])\n\n $clientSession = nil\n\n # Connect to Worker and authenticate\n begin\n $clientSession = TCPSocket.new(@worker.wrk_host, @worker.wrk_port.to_i)\n rescue Exception => e\n respond_to do |format|\n format.html { redirect_to @worker, alert: 'Cannot connect to agent: ' + @worker.wrk_name.chomp }\n format.json { head :no_content }\n end\n else\n $clientSession.puts @worker.wrk_auth_token\n workerResponse = $clientSession.gets\n \n if workerResponse.include? \"UNAUTHORIZED\"\n respond_to do |format|\n format.html { redirect_to @worker, alert: 'Not authorized to access agent: ' + @worker.wrk_name.chomp }\n format.json { head :no_content }\n end\n else\n $clientSession.puts '.os'\n workerResponse = $clientSession.gets\n respond_to do |format|\n format.html { redirect_to @worker, notice: workerResponse }\n format.json { head :no_content }\n end\n end\n end\n end",
"def dsi_send(request)\n socket = TCPSocket.new(URL, test? ? TEST_PORT : LIVE_PORT )\n\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n ssl_socket = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)\n ssl_socket.sync_close = true\n ssl_socket.connect\n \n ssl_socket.puts(request)\n ssl_socket.flush\n \n response = \"\"\n \n while line = ssl_socket.gets\n response << line unless line.include? \"endofdata\"\n end\n \n ssl_socket.close\n return response\n end",
"def connect!\n @connection = Net::HTTP.new(@url.host, @url.port)\n if @ssl\n @connection.use_ssl = true\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n @connection.start\n end",
"def api_connect(server, endpoint)\n url= \"http://#{server}:4569/#{endpoint}\"\n #puts url\n begin \n response = open(url).read\n rescue Errno::ECONNREFUSED\n return :unreachabe\n rescue Errno::ENETUNREACH\n return :unreachabe\n rescue Errno::ETIMEDOUT\n return :unreachabe\n rescue Errno::EHOSTUNREACH\n return :unreachable\n end\n \n return response\nend",
"def make_request_and_respond(request, client)\n socket = TCPSocket.open(request.host, request.port)\n\n socket.print(request.request_string)\n response = \"\"\n \n while next_kilobyte = socket.read(1000) do\n unless next_kilobyte.nil?\n response << next_kilobyte\n client.print(next_kilobyte)\n end\n end\n socket.close()\n return response\nend",
"def attempt_connection\n begin\n response = Net::HTTP.get_response(uri)\n unless response.code == \"200\"\n Puppet.notice \"HTTP request (#{uri}) failed: (#{response.code} #{response.body})\"\n return false\n end\n return true\n rescue Errno::ECONNREFUSED => e\n Puppet.notice \"Unable to establish HTTP connection to '#{uri}'; #{e}\"\n return false\n end\n end",
"def test_ssl_basic\n client = create_client(@connect_info, :connect => false, :ssl => true)\n assert client.connect\n end",
"def start\n call :get, @endpoint\n end",
"def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end",
"def run\n begin\n timeout(config[:timeout]) do\n http = Net::HTTP.new(config[:host], config[:port])\n req = Net::HTTP::Get.new('/pools/nodes/')\n req.basic_auth config[:user], config[:password]\n res = http.request(req)\n case res.code\n when /^2/\n ok \"Can get node status\"\n else\n critical res.code\n end\n end\n rescue Timeout::Error\n critical \"Connection timed out\"\n rescue => e\n critical \"Connection error: #{e.message}\"\n end\n end",
"def connect!\n request! :connect\n end",
"def say_hello(options)\n via_option = options[:via] ? \"_via_#{options[:via].to_s.downcase}\" : \"\"\n with_option = options[:with] ? \"_with_#{options[:with].to_s.downcase}\" : \"\"\n\n Net::HTTP.start(\"localhost\", 3000) do |http|\n http.request_post(\"/sync_hello/execute#{via_option}#{with_option}\",\n \"sleep=0.5\")\n end\n end",
"def run\n return if halted?\n\n http = request.em\n http.callback {\n Benchy.logger.info \"#{name}\\t| #{request.method.upcase} #{request.url} - HTTP #{http.response_header.status}\"\n run\n }\n http.errback {\n Benchy.logger.error \"#{name}\\t| Connection error!\"\n halt # TODO - Make this fail the ping and try again, not halt\n }\n end",
"def http\n HTTP .headers(accept: \"application/json\")\n # .via(\"127.0.0.1\", 8888)\n end",
"def send_request(url, data)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.port == 443\n http.use_ssl\t= true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n response = http.post(uri.path, data)\n response.code == '200' ? response.body : response.error!\n end",
"def test_app\n get '/'\n assert last_response.ok?\n assert_equal 200, last_response.status\n end",
"def url_test\n response = HTTParty.get('http://www.baidu.com')\n res = Rack::Response.new\n res.write response.body\n res.finish\n end",
"def test(*args)\n client.ping\n\n { success: true, result: 'Checked API endpoint' }\n rescue Gitlab::PrometheusError => err\n { success: false, result: err }\n end",
"def execute\n uri = request_uri\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n retries = Europeana.max_retries\n \n begin\n response = http.request(request)\n rescue Timeout::Error, Errno::ECONNREFUSED, EOFError\n retries -= 1\n raise unless retries > 0\n sleep Europeana.retry_delay\n retry\n end\n \n json = JSON.parse(response.body)\n raise Errors::RequestError, json['error'] unless json['success']\n json\n rescue JSON::ParserError\n raise Errors::ResponseError\n end",
"def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFile at #{@host}\")\n end\n end",
"def http_request(url, options = {})\n\t\t\treq = Net::HTTP::Get.new(url)\n\t\t\treq[\"user-agent\"] = \"Mozilla/5.0 Gecko/20070219 Firefox/2.0.0.2\" # ensure returns XML\n\t\t\treq[\"cookie\"] = \"cookieMenu=all; cookieLangId=\" + options[:lang] + \"; cookies=true;\"\n\t\t\t\n\t\t\treq[\"cookie\"] += options[:cookie] if options[:cookie]\n\t\t\t\n\t\t\turi = URI.parse(url)\n\t\t\t\n\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\n\t\t\tif (options[:secure])\n\t\t\t\tputs \"Secure authentication\" if options[:debug]\n\n\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\t\thttp.use_ssl = true\n\t\t\tend\n\t\t \n\t\t\t\n\t\t\tbegin\n\t\t\t http.start do\n\t\t\t res = http.request req\n\t\t\t\t\t# response = res.body\n\t\t\t\t\t\n\t\t\t\t\ttries = 0\n\t\t\t\t\tresponse = case res\n\t\t\t\t\t\twhen Net::HTTPSuccess, Net::HTTPRedirection\n\t\t\t\t\t\t\tres.body\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttries += 1\n\t\t\t\t\t\t\tif tries > @@max_connection_tries\n\t\t\t\t\t\t\t\traise Wowr::Exceptions::NetworkTimeout.new('Timed out')\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tretry\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t end\n\t\t\trescue \n\t\t\t\traise Wowr::Exceptions::ServerDoesNotExist.new('Specified server at ' + url + ' does not exist.');\n\t\t\tend\n\t\tend",
"def test_application_running\n get '/v1/main'\n assert last_response.ok?\n assert last_response.body.include?('Hello world')\n end",
"def test_connection\n\n $anterior = 1\n $siguiente = 2\n\n $server = params[:server]\n $port = params[:port]\n $username = params[:username]\n $password = params[:password]\n\n @data = {\n username: $username,\n server: $server,\n port: $port\n }\n\n begin\n\n load 'script/mailman_server.rb'\n render json: { errors: {data: @data, status: 200, message: \"conexión exitosa\"} }\n\n rescue\n\n render json: { errors: {data: @data, status: 500, message: \"Error! valida las credenciales de acceso o revisa la configuración de tu cuenta\"} }\n\n end\n\n end",
"def receive_test\n setup_http\n\n http_get(\"#{BASE_URL}\")\n\n { ok: true, message: \"OAuth token is valid\" }\n rescue => ex\n { ok: false, message: ex.message }\n end",
"def send_request\n \t\taz = @args[:authorization] and az = \"Authorization: #{az}\\r\\n\"\n body = @args.delete(:body)\n headers = @args.delete(:headers)\n body.strip! if body\n content_type = @args[:content_type]\n \t\tr = [\n \t\t \t\"#{@args[:verb]} #{@args[:uri]} HTTP/#{@args[:version] || \"1.1\"}\\r\\n\",\n \t\t\t\"Host: #{@args[:host_header] || \"_\"}\\r\\n\",\n \t\t\taz || \"\",\n \t\t\t\"Content-Length: #{body.nil? ? 0 : body.size}\\r\\n\",\n \t\t\t\"Date: #{Time.now.httpdate}\\r\\n\",\n \t\t\tcontent_type.nil? ? \"\" : \"Content-Type: #{content_type}\\r\\n\"\n \t] + \n (headers.nil? ? [] : headers.keys.map{|key| \"#{key}: #{headers[key]}\\r\\n\"}) +\n [\"\\r\\n\", body]\n \n \t\[email protected]_data(r.join)\n \tend",
"def test_https_external\n uri = URI(EXTERNAL_HTTPS)\n res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |https|\n https.head('/').code\n end\n assert_equal(\"200\", res)\n end",
"def send_request(req); end",
"def scsb_test_conn\n conn = Faraday.new(url: SCSB_TEST_URL) do |faraday|\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n end\n conn\nend",
"def get\n check_response( @httpcli.get(@endpoint) )\n end",
"def test_firedrill\n set_env 'FIREDRILL', 'true'\n authorize 'user', 'password'\n capture_io do\n get '/status'\n end\n last_response.body.must_equal 'red'\n end",
"def ssl_connect()\n $log.debug(\"Initiating SSL Connect Test\")\n disable_validations\n s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }\n s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)\n s.sync_close = true\n\n @socket = BufferedIO.new(s)\n @socket.read_timeout = @read_timeout\n @socket.debug_output = @debug_output\n\n if proxy?\n @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion)\n @socket.writeline \"Host: #{@address}:#{@port}\"\n @socket.writeline ''\n HTTPResponse.read_new(@socket).value\n end\n\n begin\n s.connect\n return ResultContainer.new(true, nil)\n rescue OpenSSL::SSL::SSLError => ex\n return ResultContainer.new(false, ex)\n rescue => ex2\n return ResultContainer.new(false, ex2)\n end\n end",
"def send_request(url, data=nil)\n begin\n puts \"BigBlueButtonAPI: URL request = #{url}\" if @debug\n url_parsed = URI.parse(url)\n http = Net::HTTP.new(url_parsed.host, url_parsed.port)\n http.open_timeout = @timeout\n http.read_timeout = @timeout\n if data.nil?\n response = http.get(url_parsed.request_uri, @request_headers)\n else\n puts \"BigBlueButtonAPI: Sending as a POST request with data.size = #{data.size}\" if @debug\n opts = { 'Content-Type' => 'text/xml' }.merge @request_headers\n response = http.post(url_parsed.request_uri, data, opts)\n end\n puts \"BigBlueButtonAPI: URL response = #{response.body}\" if @debug\n\n rescue TimeoutError => error\n raise BigBlueButtonException.new(\"Timeout error. Your server is probably down: \\\"#{@url}\\\". Error: #{error}\")\n\n rescue Exception => error\n raise BigBlueButtonException.new(\"Connection error. Your URL is probably incorrect: \\\"#{@url}\\\". Error: #{error}\")\n end\n\n response\n end",
"def send_request(uri, params, user, password)\n request = Net::HTTP::Get.new(uri)\n request.basic_auth(user, password)\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n params.each_pair do |key, val|\n request[key] = val\n end\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n return JSON.parse(response.body)\nend",
"def request (addrs)\n\t\turi = URI.parse(addrs) rescue addrs\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\tif addrs.index('https').nil? == false # it is an secure connection\n\t\t\thttp.use_ssl = true\n\t\tend\n#\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE # read into this\n\t\treq = Net::HTTP::Get.new(uri.request_uri)\n\t\tbegin\n\t\t\tresponse = Timeout::timeout(TIMEOUT) {\n\t\t\t\thttp.request(req)\n\t\t\t}\n\t\trescue Timeout::Error => exc\n\t\t\t@requestErrMsg = \"ERROR: #{exc.message}\"\n\t\t\tputs \"#{@requestErrMsg}\"\n\t\t\t-1\n\n\t\trescue Errno::ETIMEDOUT => exc\n\t\t\t@requestErrMsg = \"ERROR: #{exc.message}\"\n\t\t\tputs \"#{@requestErrMsg}\"\n\t\t\t-2\n\n\t\trescue Errno::ECONNREFUSED => exc\n\t\t\t@requestErrMsg = \"ERROR: #{exc.message}\"\n\t\t\tputs \"#{@requestErrMsg}\"\n\t\t\t-3\n\n\t\telse\n\t\t\t# puts \"Response is...\"\n\t\t\t# puts response.code.to_i\n\t\t\tresponse\n\t\tend\n\tend",
"def call(request)\n test request\n end",
"def send_request(method, url)\n @response = client.run_request(method, url, @body, headers) do |req|\n req.params = params\n end\n end",
"def zero_out\r\n my_port = 8083\r\n room_map_message = \"/zeroout\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"ok\"] != \"everything is cool and good\"\r\n raise\"rooms not updated\"\r\n end\r\nend",
"def ping\n client.ping\n end",
"def test_connection(ip,port)\n\t\tbegin\n\t\t\tsock = Rex::Socket::Tcp.create(\n\t\t\t\t'PeerHost' => ip,\n\t\t\t\t'PeerPort' => port,\n\t\t\t\t'Timeout' => 1\n\t\t\t\t)\n\t\trescue Rex::ConnectionError\n\t\t\treturn :down\n\t\tend\n\t\tsock.close\n\t\treturn :up\n\tend",
"def checkCxn(conn)\n res = conn.request(:method=>:get,:path=>\"/wapi/v1.0/network\")\n if(res.status != 200)\n raise res.body\n end\nend",
"def test_key_containing_status\n server_run app: ->(env) { [200, {'Teapot-Status' => 'Boiling'}, []] }\n data = send_http_and_read \"GET / HTTP/1.0\\r\\n\\r\\n\"\n\n assert_match(/HTTP\\/1.0 200 OK\\r\\nTeapot-Status: Boiling\\r\\nContent-Length: 0\\r\\n\\r\\n/, data)\n end",
"def run_request(method, url, body, headers); end",
"def start(params = {})\n resp = connection.post do |req|\n req.url path\n req.params = params\n end\n return true if resp.success?\n\n raise_exception_based_on_response!(resp)\n end",
"def test_connectivity\n\t\t# Allow real requests.\n\t\tWebMock.allow_net_connect!\n\n\t\t# Initialize a new VLille service and load its status.\n\t\tvl = VLille.new\n\t\tvl.load()\n\n\t\t# Ensure there's something in the result.\n\t\tassert_not_nil vl.center_lat\n\t\tassert_not_nil vl.center_lng\n\t\tassert_not_nil vl.zoom_level\n\t\tassert vl.stations.size > 0\n\n\t\t# Load a station to check for emptiness.\n\t\tstation = vl.stations[0]\n\t\tassert_not_nil station.id\n\t\tassert_not_nil station.name\n\t\tassert_not_nil station.lat\n\t\tassert_not_nil station.lng\n\t\tassert_nil station.address\n\t\tassert_nil station.status\n\t\tassert_nil station.bikes\n\t\tassert_nil station.attachs\n\t\tassert_nil station.payment\n\t\tassert_nil station.last_update\n\n\t\t# Load the station and test we have some data now.\n\t\tstation.load\n\t\tassert_not_nil station.address\n\t\tassert_not_nil station.status\n\t\tassert_not_nil station.bikes\n\t\tassert_not_nil station.attachs\n\t\tassert_not_nil station.payment\n\t\tassert_not_nil station.last_update\n\n\t\t# Disallow real requests.\n\t\tWebMock.disable_net_connect!\n\tend",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def send!\n request = Net::HTTP::Post.new(uri.path, headers)\n request.body = @body\n request.content_type = @@content_type\n response = Net::HTTP.start(uri.host, uri.port) do |http|\n http.request(request)\n end\n ok?(response)\n end",
"def verify\n @request = Net::HTTP::Get.new(@uri.path)\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.code.to_i == 200\n\n rescue Errno::ETIMEDOUT, Exception\n false\n end",
"def get_response_from(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = http.open_timeout = SimpliTest.config[:settings][\"HTTP_TIMEOUT\"] || 3\n request = Net::HTTP::Get.new(uri.request_uri)\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n http.request(request)\n end",
"def send_request(method, options={})\n begin\n # We need to persist the method.\n @method = method\n\n @host, @port =\n @normalized_uri.host, @normalized_uri.inferred_port\n if @connections[[@host, @port]]\n if options[:log]\n options[:log].write(\n \"* Using open connection to #{@host} port #{@port}\\n\")\n end\n @socket = @connections[[@host, @port]]\n if @socket.closed?\n if options[:log]\n options[:log].write(\n \"* Socket was closed. Reopening.\\n\")\n end\n @socket = PushBackIO.new(TCPSocket.new(@host, @port), options)\n @connections[[@host, @port]] = @socket\n end\n else\n if options[:log]\n options[:log].write(\n \"* About to connect to #{@host} port #{@port}\\n\")\n end\n @socket = PushBackIO.new(TCPSocket.new(@host, @port), options)\n @connections[[@host, @port]] = @socket\n if options[:log]\n options[:log].write(\n \"* Connected to #{@host} port #{@port}\\n\")\n end\n end\n\n output = StringIO.new\n write_head(method, output, options)\n body = options[:body] || \"\"\n\n if options[:log]\n options[:log].write((output.string + body).gsub(/^/, \"> \"))\n end\n\n @socket.write(output.string + body)\n @socket.flush\n\n return read_response(options)\n rescue Object\n raise $!\n ensure\n if !options[:connections]\n for pair, connection in @connections\n if options[:log]\n options[:log].write(\n \"* Closing connection to #{pair[0]} port #{pair[1]}\\n\")\n end\n connection.close if connection\n @connections.delete(pair)\n end\n else\n if options[:log]\n options[:log].write(\n \"* No connections closed. \" +\n \"Connections must be closed manually.\\n\"\n )\n end\n end\n end\n end",
"def get_response(uri, req)\n Net::HTTP.start(uri.hostname, uri.port){|http| http.request(req) }\nend",
"def connect_to_unit\n puts \"Connecting to '#{@host}...\"\n begin\n tcp_client = TCPSocket.new @host, @port\n @ssl_client = OpenSSL::SSL::SSLSocket.new tcp_client, @context\n @ssl_client.connect\n rescue Exception => e\n puts \"Could not connect to '#{@host}: #{e}\"\n end\n end",
"def request( xml )\n # open_connection\n\n # @logged_in = true if login\n\n begin\n @response = send_request( xml )\n ensure\n if @logged_in && !old_server\n @logged_in = false if logout\n end\n end\n\n return @response\n end",
"def send_request\n setup_connection\n send_request_with_lazy_pirate unless error?\n end",
"def test!\n @connection = Connection.new 14000\n @bitcoin = BlockrIo.new true\n end",
"def server?\n response = Net::HTTP.get_response(URI.parse('http://localhost:9533/'))\n raise unless response.class == Net::HTTPOK\nrescue\n skip 'Local server not detected'\nend",
"def http( *args )\n p http_get( *args )\n end",
"def test(exception: false, &blk)\n params = { exception: exception }\n if block_given?\n websocket.subscribe :test, params: params, &blk\n else\n http.get :test, params: params, raw_body: true\n end\n end",
"def request(method, path, params, headers = {})\n url = \"https://#{@host}/api/#{@version}#{path}\"\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n assign_verify_mode(http)\n request = create_request(method, uri, params, headers)\n\n res = http.request(request) if request\n parse_body(res)\n rescue SocketError => e\n raise ConnectionError, e.message\n end",
"def report_connectivity(controller, port, connectivity_map)\n me = `hostname`.chomp\n req = Net::HTTP::Post.new(\"/#{me}\", initheader = {'Content-Type'=>'application/json'})\n req.body = connectivity_map.to_json\n response = Net::HTTP.start(controller, port) do |http|\n http.request(req)\n end\n response.code == '200'\nend"
] | [
"0.7246728",
"0.6996201",
"0.6960943",
"0.69358444",
"0.6804451",
"0.67962855",
"0.6730802",
"0.6646011",
"0.6623835",
"0.660756",
"0.65600026",
"0.6557589",
"0.6467756",
"0.643878",
"0.64028424",
"0.6393356",
"0.6374452",
"0.6329454",
"0.6299891",
"0.62986606",
"0.62953645",
"0.6291279",
"0.6265853",
"0.6260751",
"0.6253393",
"0.62393326",
"0.62387437",
"0.6230733",
"0.62305015",
"0.6211616",
"0.62100875",
"0.6202862",
"0.6189656",
"0.6159757",
"0.6157199",
"0.61563385",
"0.61317754",
"0.61317754",
"0.61297864",
"0.61186457",
"0.6087534",
"0.60390675",
"0.6034669",
"0.6033227",
"0.6017312",
"0.6014342",
"0.60073125",
"0.60011095",
"0.60009813",
"0.5994437",
"0.5993124",
"0.5971767",
"0.596506",
"0.5957861",
"0.59414834",
"0.5938526",
"0.59335494",
"0.5926732",
"0.5926443",
"0.5922344",
"0.59220207",
"0.59218967",
"0.59141785",
"0.5894529",
"0.58925384",
"0.588944",
"0.58798385",
"0.5869213",
"0.5858648",
"0.5853557",
"0.5846435",
"0.58463484",
"0.58455324",
"0.5843121",
"0.58415025",
"0.58221924",
"0.5814664",
"0.57967293",
"0.5796491",
"0.5791272",
"0.5788699",
"0.5779928",
"0.5779758",
"0.57789785",
"0.57789785",
"0.5776711",
"0.57724816",
"0.5769768",
"0.576912",
"0.57581216",
"0.57570827",
"0.5756786",
"0.57559556",
"0.5754517",
"0.57398814",
"0.57383406",
"0.5737611",
"0.5734013",
"0.57264733"
] | 0.7188415 | 1 |
API's are equal if all the following attributes are equal | def ==(other)
r = true
[:url, :supported_versions, :salt, :version, :debug].each do |param|
r = r && self.send(param) == other.send(param)
end
r
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def same_attributes?(spec)\n @@attributes.all? {|name, default| self.send(name) == spec.send(name) }\n end",
"def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\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 changed_api_attributes\n ret = {}\n self.api_attributes.each do |name, value|\n if @json[name] != value\n ret[name] = value\n end\n end\n ret\n end",
"def json_should_eql(actual, expected)\n same = json_cmp(actual, expected)\n actual.should.== expected unless same \nend",
"def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"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 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 equality_fields\n [:id, :dealership, :expires, :next]\n end",
"def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end",
"def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end",
"def ==(other)\n id == other.id && url == other.url\n end",
"def ==(other)\n other.present? && self.attributes == other.attributes\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 ==(other)\n timestamp.to_f == other.timestamp.to_f &&\n [:uuid, :duration, :response, :path, :request, :params].all? { |k| send(k) == other.send(k) }\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 ==(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 self.class == other.class &&\n attributes[\"_id\"] == other.attributes[\"_id\"]\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 ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end",
"def equality_fields\n [:status, :plan]\n end",
"def same?(other)\n all_signature_parameter_names ==\n other.all_signature_parameter_names\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n access_token_url == o.access_token_url &&\n audience == o.audience &&\n client_id == o.client_id &&\n client_secret == o.client_secret &&\n resource == o.resource &&\n scope == o.scope &&\n token_api_authentication == o.token_api_authentication &&\n type == o.type\n end",
"def comparable\n reload! if api_response.nil?\n\n api_resource.except(\n :id,\n :web_url,\n :project_id,\n :source_project_id,\n :target_project_id,\n :merge_status,\n # these can differ depending on user fetching mr\n :user,\n :subscribed,\n :first_contribution\n ).merge({ references: api_resource[:references].except(:full) })\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n api_percentage == o.api_percentage &&\n api_usage == o.api_usage &&\n apm_fargate_percentage == o.apm_fargate_percentage &&\n apm_fargate_usage == o.apm_fargate_usage &&\n apm_host_percentage == o.apm_host_percentage &&\n apm_host_usage == o.apm_host_usage &&\n apm_usm_percentage == o.apm_usm_percentage &&\n apm_usm_usage == o.apm_usm_usage &&\n appsec_fargate_percentage == o.appsec_fargate_percentage &&\n appsec_fargate_usage == o.appsec_fargate_usage &&\n appsec_percentage == o.appsec_percentage &&\n appsec_usage == o.appsec_usage &&\n browser_percentage == o.browser_percentage &&\n browser_usage == o.browser_usage &&\n ci_visibility_itr_percentage == o.ci_visibility_itr_percentage &&\n ci_visibility_itr_usage == o.ci_visibility_itr_usage &&\n container_excl_agent_percentage == o.container_excl_agent_percentage &&\n container_excl_agent_usage == o.container_excl_agent_usage &&\n container_percentage == o.container_percentage &&\n container_usage == o.container_usage &&\n cspm_containers_percentage == o.cspm_containers_percentage &&\n cspm_containers_usage == o.cspm_containers_usage &&\n cspm_hosts_percentage == o.cspm_hosts_percentage &&\n cspm_hosts_usage == o.cspm_hosts_usage &&\n custom_ingested_timeseries_percentage == o.custom_ingested_timeseries_percentage &&\n custom_ingested_timeseries_usage == o.custom_ingested_timeseries_usage &&\n custom_timeseries_percentage == o.custom_timeseries_percentage &&\n custom_timeseries_usage == o.custom_timeseries_usage &&\n cws_containers_percentage == o.cws_containers_percentage &&\n cws_containers_usage == o.cws_containers_usage &&\n cws_hosts_percentage == o.cws_hosts_percentage &&\n cws_hosts_usage == o.cws_hosts_usage &&\n dbm_hosts_percentage == o.dbm_hosts_percentage &&\n dbm_hosts_usage == o.dbm_hosts_usage &&\n dbm_queries_percentage == o.dbm_queries_percentage &&\n dbm_queries_usage == o.dbm_queries_usage &&\n estimated_indexed_logs_percentage == o.estimated_indexed_logs_percentage &&\n estimated_indexed_logs_usage == o.estimated_indexed_logs_usage &&\n estimated_indexed_spans_percentage == o.estimated_indexed_spans_percentage &&\n estimated_indexed_spans_usage == o.estimated_indexed_spans_usage &&\n estimated_ingested_logs_percentage == o.estimated_ingested_logs_percentage &&\n estimated_ingested_logs_usage == o.estimated_ingested_logs_usage &&\n estimated_ingested_spans_percentage == o.estimated_ingested_spans_percentage &&\n estimated_ingested_spans_usage == o.estimated_ingested_spans_usage &&\n estimated_rum_sessions_percentage == o.estimated_rum_sessions_percentage &&\n estimated_rum_sessions_usage == o.estimated_rum_sessions_usage &&\n fargate_percentage == o.fargate_percentage &&\n fargate_usage == o.fargate_usage &&\n functions_percentage == o.functions_percentage &&\n functions_usage == o.functions_usage &&\n infra_host_percentage == o.infra_host_percentage &&\n infra_host_usage == o.infra_host_usage &&\n invocations_percentage == o.invocations_percentage &&\n invocations_usage == o.invocations_usage &&\n npm_host_percentage == o.npm_host_percentage &&\n npm_host_usage == o.npm_host_usage &&\n obs_pipeline_bytes_percentage == o.obs_pipeline_bytes_percentage &&\n obs_pipeline_bytes_usage == o.obs_pipeline_bytes_usage &&\n profiled_container_percentage == o.profiled_container_percentage &&\n profiled_container_usage == o.profiled_container_usage &&\n profiled_fargate_percentage == o.profiled_fargate_percentage &&\n profiled_fargate_usage == o.profiled_fargate_usage &&\n profiled_host_percentage == o.profiled_host_percentage &&\n profiled_host_usage == o.profiled_host_usage &&\n sds_scanned_bytes_percentage == o.sds_scanned_bytes_percentage &&\n sds_scanned_bytes_usage == o.sds_scanned_bytes_usage &&\n snmp_percentage == o.snmp_percentage &&\n snmp_usage == o.snmp_usage &&\n universal_service_monitoring_percentage == o.universal_service_monitoring_percentage &&\n universal_service_monitoring_usage == o.universal_service_monitoring_usage &&\n vuln_management_hosts_percentage == o.vuln_management_hosts_percentage &&\n vuln_management_hosts_usage == o.vuln_management_hosts_usage\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n access == o.access &&\n admin_url == o.admin_url &&\n always_display_in_console == o.always_display_in_console &&\n attributes == o.attributes &&\n authentication_flow_binding_overrides == o.authentication_flow_binding_overrides &&\n authorization_services_enabled == o.authorization_services_enabled &&\n authorization_settings == o.authorization_settings &&\n base_url == o.base_url &&\n bearer_only == o.bearer_only &&\n client_authenticator_type == o.client_authenticator_type &&\n client_id == o.client_id &&\n consent_required == o.consent_required &&\n default_client_scopes == o.default_client_scopes &&\n default_roles == o.default_roles &&\n description == o.description &&\n direct_access_grants_enabled == o.direct_access_grants_enabled &&\n enabled == o.enabled &&\n frontchannel_logout == o.frontchannel_logout &&\n full_scope_allowed == o.full_scope_allowed &&\n id == o.id &&\n implicit_flow_enabled == o.implicit_flow_enabled &&\n name == o.name &&\n node_re_registration_timeout == o.node_re_registration_timeout &&\n not_before == o.not_before &&\n optional_client_scopes == o.optional_client_scopes &&\n origin == o.origin &&\n protocol == o.protocol &&\n protocol_mappers == o.protocol_mappers &&\n public_client == o.public_client &&\n redirect_uris == o.redirect_uris &&\n registered_nodes == o.registered_nodes &&\n registration_access_token == o.registration_access_token &&\n root_url == o.root_url &&\n secret == o.secret &&\n service_accounts_enabled == o.service_accounts_enabled &&\n standard_flow_enabled == o.standard_flow_enabled &&\n surrogate_auth_required == o.surrogate_auth_required &&\n web_origins == o.web_origins\n end",
"def bt_same_value?(other)\n bt_value_attributes == other.bt_value_attributes\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n api_percentage == o.api_percentage &&\n api_usage == o.api_usage &&\n apm_fargate_percentage == o.apm_fargate_percentage &&\n apm_fargate_usage == o.apm_fargate_usage &&\n apm_host_percentage == o.apm_host_percentage &&\n apm_host_usage == o.apm_host_usage &&\n appsec_fargate_percentage == o.appsec_fargate_percentage &&\n appsec_fargate_usage == o.appsec_fargate_usage &&\n appsec_percentage == o.appsec_percentage &&\n appsec_usage == o.appsec_usage &&\n browser_percentage == o.browser_percentage &&\n browser_usage == o.browser_usage &&\n container_percentage == o.container_percentage &&\n container_usage == o.container_usage &&\n cspm_container_percentage == o.cspm_container_percentage &&\n cspm_container_usage == o.cspm_container_usage &&\n cspm_host_percentage == o.cspm_host_percentage &&\n cspm_host_usage == o.cspm_host_usage &&\n custom_timeseries_percentage == o.custom_timeseries_percentage &&\n custom_timeseries_usage == o.custom_timeseries_usage &&\n cws_container_percentage == o.cws_container_percentage &&\n cws_container_usage == o.cws_container_usage &&\n cws_host_percentage == o.cws_host_percentage &&\n cws_host_usage == o.cws_host_usage &&\n dbm_hosts_percentage == o.dbm_hosts_percentage &&\n dbm_hosts_usage == o.dbm_hosts_usage &&\n dbm_queries_percentage == o.dbm_queries_percentage &&\n dbm_queries_usage == o.dbm_queries_usage &&\n estimated_indexed_logs_percentage == o.estimated_indexed_logs_percentage &&\n estimated_indexed_logs_usage == o.estimated_indexed_logs_usage &&\n estimated_indexed_spans_percentage == o.estimated_indexed_spans_percentage &&\n estimated_indexed_spans_usage == o.estimated_indexed_spans_usage &&\n estimated_ingested_logs_percentage == o.estimated_ingested_logs_percentage &&\n estimated_ingested_logs_usage == o.estimated_ingested_logs_usage &&\n estimated_ingested_spans_percentage == o.estimated_ingested_spans_percentage &&\n estimated_ingested_spans_usage == o.estimated_ingested_spans_usage &&\n estimated_rum_sessions_percentage == o.estimated_rum_sessions_percentage &&\n estimated_rum_sessions_usage == o.estimated_rum_sessions_usage &&\n infra_host_percentage == o.infra_host_percentage &&\n infra_host_usage == o.infra_host_usage &&\n lambda_functions_percentage == o.lambda_functions_percentage &&\n lambda_functions_usage == o.lambda_functions_usage &&\n lambda_invocations_percentage == o.lambda_invocations_percentage &&\n lambda_invocations_usage == o.lambda_invocations_usage &&\n npm_host_percentage == o.npm_host_percentage &&\n npm_host_usage == o.npm_host_usage &&\n profiled_container_percentage == o.profiled_container_percentage &&\n profiled_container_usage == o.profiled_container_usage &&\n profiled_hosts_percentage == o.profiled_hosts_percentage &&\n profiled_hosts_usage == o.profiled_hosts_usage &&\n snmp_percentage == o.snmp_percentage &&\n snmp_usage == o.snmp_usage\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 ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n edge_requests == o.edge_requests &&\n edge_resp_header_bytes == o.edge_resp_header_bytes &&\n edge_resp_body_bytes == o.edge_resp_body_bytes &&\n status_1xx == o.status_1xx &&\n status_2xx == o.status_2xx &&\n status_3xx == o.status_3xx &&\n status_4xx == o.status_4xx &&\n status_5xx == o.status_5xx &&\n status_200 == o.status_200 &&\n status_204 == o.status_204 &&\n status_206 == o.status_206 &&\n status_301 == o.status_301 &&\n status_302 == o.status_302 &&\n status_304 == o.status_304 &&\n status_400 == o.status_400 &&\n status_401 == o.status_401 &&\n status_403 == o.status_403 &&\n status_404 == o.status_404 &&\n status_416 == o.status_416 &&\n status_429 == o.status_429 &&\n status_500 == o.status_500 &&\n status_501 == o.status_501 &&\n status_502 == o.status_502 &&\n status_503 == o.status_503 &&\n status_504 == o.status_504 &&\n status_505 == o.status_505 &&\n requests == o.requests &&\n resp_header_bytes == o.resp_header_bytes &&\n resp_body_bytes == o.resp_body_bytes &&\n bereq_header_bytes == o.bereq_header_bytes &&\n bereq_body_bytes == o.bereq_body_bytes &&\n edge_hit_requests == o.edge_hit_requests &&\n edge_miss_requests == o.edge_miss_requests &&\n origin_fetches == o.origin_fetches &&\n origin_fetch_resp_header_bytes == o.origin_fetch_resp_header_bytes &&\n origin_fetch_resp_body_bytes == o.origin_fetch_resp_body_bytes &&\n bandwidth == o.bandwidth &&\n edge_hit_ratio == o.edge_hit_ratio &&\n origin_offload == o.origin_offload &&\n origin_status_200 == o.origin_status_200 &&\n origin_status_204 == o.origin_status_204 &&\n origin_status_206 == o.origin_status_206 &&\n origin_status_301 == o.origin_status_301 &&\n origin_status_302 == o.origin_status_302 &&\n origin_status_304 == o.origin_status_304 &&\n origin_status_400 == o.origin_status_400 &&\n origin_status_401 == o.origin_status_401 &&\n origin_status_403 == o.origin_status_403 &&\n origin_status_404 == o.origin_status_404 &&\n origin_status_416 == o.origin_status_416 &&\n origin_status_429 == o.origin_status_429 &&\n origin_status_500 == o.origin_status_500 &&\n origin_status_501 == o.origin_status_501 &&\n origin_status_502 == o.origin_status_502 &&\n origin_status_503 == o.origin_status_503 &&\n origin_status_504 == o.origin_status_504 &&\n origin_status_505 == o.origin_status_505 &&\n origin_status_1xx == o.origin_status_1xx &&\n origin_status_2xx == o.origin_status_2xx &&\n origin_status_3xx == o.origin_status_3xx &&\n origin_status_4xx == o.origin_status_4xx &&\n origin_status_5xx == o.origin_status_5xx\n end",
"def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end",
"def assert_ways_are_equal(a, b)\n assert_not_nil a, \"first way is not allowed to be nil\"\n assert_not_nil b, \"second way #{a.id} is not allowed to be nil\"\n assert_equal a.id, b.id, \"way IDs\"\n assert_equal a.changeset_id, b.changeset_id, \"changeset ID on way #{a.id}\"\n assert_equal a.visible, b.visible, \"visible on way #{a.id}, #{a.visible.inspect} != #{b.visible.inspect}\"\n assert_equal a.version, b.version, \"version on way #{a.id}\"\n assert_equal a.tags, b.tags, \"tags on way #{a.id}\"\n assert_equal a.nds, b.nds, \"node references on way #{a.id}\"\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n allow_insecure_certificates == o.allow_insecure_certificates &&\n basic_auth == o.basic_auth &&\n body == o.body &&\n body_type == o.body_type &&\n cookies == o.cookies &&\n device_ids == o.device_ids &&\n follow_redirects == o.follow_redirects &&\n headers == o.headers &&\n locations == o.locations &&\n metadata == o.metadata &&\n public_id == o.public_id &&\n _retry == o._retry &&\n start_url == o.start_url &&\n variables == o.variables\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n client_id == o.client_id &&\n secret == o.secret &&\n client_name == o.client_name &&\n language == o.language &&\n country_codes == o.country_codes &&\n user == o.user &&\n products == o.products &&\n additional_consented_products == o.additional_consented_products &&\n required_if_supported_products == o.required_if_supported_products &&\n webhook == o.webhook &&\n access_token == o.access_token &&\n link_customization_name == o.link_customization_name &&\n redirect_uri == o.redirect_uri &&\n android_package_name == o.android_package_name &&\n institution_data == o.institution_data &&\n account_filters == o.account_filters &&\n eu_config == o.eu_config &&\n institution_id == o.institution_id &&\n payment_initiation == o.payment_initiation &&\n deposit_switch == o.deposit_switch &&\n employment == o.employment &&\n income_verification == o.income_verification &&\n base_report == o.base_report &&\n consumer_report_permissible_purpose == o.consumer_report_permissible_purpose &&\n auth == o.auth &&\n transfer == o.transfer &&\n update == o.update &&\n identity_verification == o.identity_verification &&\n statements == o.statements &&\n user_token == o.user_token &&\n investments == o.investments &&\n investments_auth == o.investments_auth &&\n hosted_link == o.hosted_link\n end",
"def ==(other)\n %i[authority client_id token_response].all? do |field|\n (other.respond_to? field) && (send(field) == other.send(field))\n end\n end",
"def identicalish_resources?(first, second)\n skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ]\n checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars\n non_matching_ivars = checked_ivars.reject do |iv|\n if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] )\n # :nothing action on either side of the comparison always matches\n true\n else\n first.instance_variable_get(iv) == second.instance_variable_get(iv)\n end\n end\n Chef::Log.debug(\"ivars which did not match with the prior resource: #{non_matching_ivars}\")\n non_matching_ivars.empty?\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 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 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 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 assert_ways_are_equal(a, b)\n assert_not_nil a, \"first way is not allowed to be nil\"\n assert_not_nil b, \"second way #{a.id} is not allowed to be nil\"\n assert_equal a.id, b.id, \"way IDs\"\n assert_equal a.changeset_id, b.changeset_id, \"changeset ID on way #{a.id}\"\n assert_equal a.visible, b.visible, \"visible on way #{a.id}, #{a.visible.inspect} != #{b.visible.inspect}\"\n assert_equal a.version, b.version, \"version on way #{a.id}\"\n assert_equal a.tags, b.tags, \"tags on way #{a.id}\"\n assert_equal a.nds, b.nds, \"node references on way #{a.id}\"\n 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 resource_configurations_equal?(narrower, wider, exact=false)\n return false if wider[:name] != narrower[:name]\n if exact\n return false if wider[:params] != narrower[:params]\n else\n narrower[:params].each do |key, value|\n return false if wider[:params][key] != value\n end\n end\n true\n end",
"def == other\n return false if outputs.count != other.outputs.count\n return false if outputs.any? do |output|\n other.outputs.none? do |other_output|\n output['name'] == other_output['name'] and\n output['res'] == other_output['res']\n end\n end\n return true\n end",
"def ==(other)\n self.title == other.title &&\n self.date == other.date &&\n self.result_type == other.result_type &&\n self.url == other.url\n end",
"def identicalish_resources?(first, second)\n skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time, :@declared_type ]\n checked_ivars = ( first.instance_variables | second.instance_variables ) - skipped_ivars\n non_matching_ivars = checked_ivars.reject do |iv|\n if iv == :@action && ( [first.instance_variable_get(iv)].flatten == [:nothing] || [second.instance_variable_get(iv)].flatten == [:nothing] )\n # :nothing action on either side of the comparison always matches\n true\n else\n first.instance_variable_get(iv) == second.instance_variable_get(iv)\n end\n end\n Chef::Log.debug(\"ivars which did not match with the prior resource: #{non_matching_ivars}\")\n non_matching_ivars.empty?\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n access_token == o.access_token &&\n data == o.data &&\n expires_in == o.expires_in &&\n refresh_token == o.refresh_token &&\n token_type == o.token_type &&\n scope == o.scope\n end",
"def eql?(other)\n self.class == other.class &&\n self.base_url == other.base_url &&\n fuzzy_hash_eql?(self.options, other.options)\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 other.is_a?(self.class) &&\n other.attribute == attribute &&\n other.validation == validation &&\n other.expected == expected &&\n other.actual == actual\n end",
"def test_legacy_codes_unique\n spods = Person.find(:all, :limit => 2)\n person1 = spods[0]\n person2 = spods[1]\n \n new_leg_code = \"AAAA\"\n assert person1.legacy4d_identity_code !=person2.legacy4d_identity_code\n person1.legacy4d_identity_code = new_leg_code\n person2.legacy4d_identity_code = new_leg_code\n assert !person1.save\n assert !person2.save\n \n end",
"def update_same_fields? model, method\n intersection = fields_from_model(model).map(&:to_s) & fields_from_model_method(model, method).map(&:to_s)\n intersection.present?\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 ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n custom_headers == o.custom_headers &&\n encode_as == o.encode_as &&\n name == o.name &&\n payload == o.payload &&\n url == o.url\n end",
"def ==(other)\n [:id, :type, :name, :votes, :duration, :rating, :release_date, :genres, :plot, :under_development].all? do |m|\n other.respond_to?(m) && self.public_send(m) == other.public_send(m)\n end\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 discrepancy?(local, remote)\n local.status != remote['status'] ||\n local.ad_description != remote['description']\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n class_id == o.class_id &&\n object_type == o.object_type &&\n api_version == o.api_version &&\n app_partition_number == o.app_partition_number &&\n connection_id == o.connection_id &&\n connection_reason == o.connection_reason &&\n connection_status == o.connection_status &&\n connection_status_last_change_time == o.connection_status_last_change_time &&\n connector_version == o.connector_version &&\n device_external_ip_address == o.device_external_ip_address &&\n proxy_app == o.proxy_app\n end",
"def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_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 is_equal?(a)\n @amount == a.amount && @code == a.code\n end",
"def assert_equal_responses uri1, uri2, options={}\n resp1 = Kronk.request(uri1, options).stringify\n resp2 = Kronk.request(uri2, options).stringify\n\n assert_equal resp1, resp2\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n name == o.name &&\n placement == o.placement &&\n response_condition == o.response_condition &&\n format == o.format &&\n format_version == o.format_version &&\n region == o.region &&\n token == o.token &&\n created_at == o.created_at &&\n deleted_at == o.deleted_at &&\n updated_at == o.updated_at &&\n service_id == o.service_id &&\n version == o.version\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n __meta == o.__meta &&\n created_at == o.created_at &&\n updated_at == o.updated_at &&\n customer == o.customer &&\n reusable == o.reusable &&\n status == o.status &&\n token == o.token\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n client_id == o.client_id &&\n secret == o.secret &&\n company_name == o.company_name &&\n is_diligence_attested == o.is_diligence_attested &&\n products == o.products &&\n create_link_customization == o.create_link_customization &&\n logo == o.logo &&\n legal_entity_name == o.legal_entity_name &&\n website == o.website &&\n application_name == o.application_name &&\n technical_contact == o.technical_contact &&\n billing_contact == o.billing_contact &&\n customer_support_info == o.customer_support_info &&\n address == o.address &&\n is_bank_addendum_completed == o.is_bank_addendum_completed &&\n assets_under_management == o.assets_under_management &&\n redirect_uris == o.redirect_uris\n end",
"def eql?(other)\n self.class === other and @version == other._version\n end",
"def eql?(other)\n self.class === other and @version == other._version\n end",
"def eql?(other)\n self.class === other and @version == other.version\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 test_compare_user_w_same_country\n get '/v1/compare_country?data1=eyJOYW1lIjogIkVkdWFyZG8iLCAiQ291bnRyeSI6ICJCcmF6aWwiIH0%3D&data2=eyJOYW1lIjogIkVkdWFyZG8iLCAiQ291bnRyeSI6ICJCcmF6aWwiIH0%3D'\n assert last_response.ok?\n assert last_response.body.include?('The users live in the same country')\n end",
"def eql?(other)\n other.is_a?(Resource::Token) && type == other.type && id == other.id\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n click_rate_formatted == o.click_rate_formatted &&\n created_dts == o.created_dts &&\n deleted == o.deleted &&\n email_campaign_uuid == o.email_campaign_uuid &&\n email_communication_sequence_uuid == o.email_communication_sequence_uuid &&\n end_once_customer_purchases == o.end_once_customer_purchases &&\n end_once_customer_purchases_anywhere == o.end_once_customer_purchases_anywhere &&\n esp_campaign_folder_uuid == o.esp_campaign_folder_uuid &&\n esp_domain_user == o.esp_domain_user &&\n esp_domain_uuid == o.esp_domain_uuid &&\n esp_friendly_name == o.esp_friendly_name &&\n library_item_oid == o.library_item_oid &&\n memberships == o.memberships &&\n merchant_id == o.merchant_id &&\n name == o.name &&\n open_rate_formatted == o.open_rate_formatted &&\n prevent_sending_due_to_spam == o.prevent_sending_due_to_spam &&\n revenue_formatted == o.revenue_formatted &&\n revenue_per_customer_formatted == o.revenue_per_customer_formatted &&\n scheduled_dts == o.scheduled_dts &&\n screenshot_large_full_url == o.screenshot_large_full_url &&\n sms_esp_twilio_uuid == o.sms_esp_twilio_uuid &&\n sms_phone_number == o.sms_phone_number &&\n status == o.status &&\n status_dts == o.status_dts &&\n storefront_oid == o.storefront_oid\n end",
"def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend",
"def eql? other\n self.class === other and @version == other.version\n end",
"def object_equal(obj1, obj2)\n vars1 = obj1.instance_variables\n vars2 = obj2.instance_variables\n return false unless vars1.length == vars2.length\n # if they don't have exactly the same instance_variables names then return false\n return false unless vars1.map(&:to_s).sort.to_s == vars2.map(&:to_s).sort.to_s\n\n equal = true\n some(vars1, proc { |v|\n val1 = obj1.instance_variable_get(v)\n val2 = obj2.instance_variable_get(v)\n if val1 != val2\n equal = false\n true\n else\n false\n end\n })\n equal\nend",
"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 ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n created == o.created &&\n modified == o.modified &&\n company_name == o.company_name &&\n domain_name == o.domain_name &&\n state == o.state &&\n billing_email == o.billing_email &&\n plan_name == o.plan_name &&\n plan_expires == o.plan_expires &&\n application_limit == o.application_limit &&\n user_limit == o.user_limit &&\n campaign_limit == o.campaign_limit &&\n api_limit == o.api_limit &&\n application_count == o.application_count &&\n user_count == o.user_count &&\n campaigns_active_count == o.campaigns_active_count &&\n campaigns_inactive_count == o.campaigns_inactive_count &&\n attributes == o.attributes\n end",
"def eql?(object)\n self.class.equal?(object.class) && attributes == object.attributes\n end",
"def eql?(*) end",
"def test_eql_returns_true_if_the_specified_object_is_a_post_with_the_same_value\n attributes = {'title' => 'Item 1 title', 'link' => 'http://example.com/blog_posts/1', 'description' => 'Item 1 description'}\n\n post = FacebookWall::Post.new create_feed_entry(attributes)\n another_post = FacebookWall::Post.new create_feed_entry(attributes)\n\n assert post.eql?(another_post)\n\n almost_a_feed_entry = \"<item>\\n <title>Item 1 title</title>\\n <link>http://example.com/blog_posts/1</link>\\n <description>Item 1 description</description>\\n</item>\"\n post = FacebookWall::Post.new create_feed_entry(attributes)\n \n assert_equal almost_a_feed_entry, post.feed_entry.to_s\n assert ! post.eql?(almost_a_feed_entry)\n \n not_a_post = 123\n post = FacebookWall::Post.new create_feed_entry(attributes)\n \n assert ! post.eql?(not_a_post)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n affiliate_rate == o.affiliate_rate &&\n campaign_id == o.campaign_id &&\n category == o.category &&\n client_review == o.client_review &&\n create_date == o.create_date &&\n currency_code == o.currency_code &&\n description == o.description &&\n document_id == o.document_id &&\n fee_amount == o.fee_amount &&\n fee_type == o.fee_type &&\n financial_rate == o.financial_rate &&\n financial_rate_term == o.financial_rate_term &&\n financial_rate_term_unit == o.financial_rate_term_unit &&\n financial_rate_type == o.financial_rate_type &&\n id == o.id &&\n image == o.image &&\n institution_name == o.institution_name &&\n is_active == o.is_active &&\n metadata == o.metadata &&\n minimum_contribution == o.minimum_contribution &&\n minimum_contribution_term == o.minimum_contribution_term &&\n minimum_contribution_term_unit == o.minimum_contribution_term_unit &&\n name == o.name &&\n node_map == o.node_map &&\n offer_link == o.offer_link &&\n offer_term == o.offer_term &&\n offer_term_unit == o.offer_term_unit &&\n prerequisite == o.prerequisite &&\n prerequisite_type == o.prerequisite_type &&\n rating == o.rating &&\n secondary_id == o.secondary_id &&\n subcategory == o.subcategory &&\n update_date == o.update_date\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 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 same; end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n type == o.type &&\n page_access_token == o.page_access_token &&\n app_id == o.app_id &&\n app_secret == o.app_secret &&\n account_sid == o.account_sid &&\n auth_token == o.auth_token &&\n phone_number_sid == o.phone_number_sid &&\n token == o.token &&\n channel_access_token == o.channel_access_token &&\n encoding_aes_key == o.encoding_aes_key &&\n from_address == o.from_address &&\n certificate == o.certificate &&\n password == o.password &&\n auto_update_badge == o.auto_update_badge &&\n server_key == o.server_key &&\n sender_id == o.sender_id &&\n consumer_key == o.consumer_key &&\n consumer_secret == o.consumer_secret &&\n access_token_key == o.access_token_key &&\n access_token_secret == o.access_token_secret\n end",
"def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n action == o.action &&\n api_version == o.api_version &&\n deprecated_count == o.deprecated_count &&\n deprecated_first_timestamp == o.deprecated_first_timestamp &&\n deprecated_last_timestamp == o.deprecated_last_timestamp &&\n deprecated_source == o.deprecated_source &&\n event_time == o.event_time &&\n kind == o.kind &&\n metadata == o.metadata &&\n note == o.note &&\n reason == o.reason &&\n regarding == o.regarding &&\n related == o.related &&\n reporting_controller == o.reporting_controller &&\n reporting_instance == o.reporting_instance &&\n series == o.series &&\n type == o.type\n end",
"def ==(other)\n if self.class.attribute_names.include?('id')\n if other.is_a?(::Numeric)\n id == other\n elsif other.class == self.class\n id == other.id\n else\n false\n end\n else\n self.inspect == other.inspect\n end\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 ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n account_id == o.account_id &&\n campaign_id == o.campaign_id &&\n csp_id == o.csp_id &&\n reseller_id == o.reseller_id &&\n status == o.status &&\n create_date == o.create_date &&\n auto_renewal == o.auto_renewal &&\n billed_date == o.billed_date &&\n brand_id == o.brand_id &&\n usecase == o.usecase &&\n sub_usecases == o.sub_usecases &&\n description == o.description &&\n embedded_link == o.embedded_link &&\n embedded_phone == o.embedded_phone &&\n affiliate_marketing == o.affiliate_marketing &&\n number_pool == o.number_pool &&\n age_gated == o.age_gated &&\n direct_lending == o.direct_lending &&\n subscriber_optin == o.subscriber_optin &&\n subscriber_optout == o.subscriber_optout &&\n subscriber_help == o.subscriber_help &&\n sample1 == o.sample1 &&\n sample2 == o.sample2 &&\n sample3 == o.sample3 &&\n sample4 == o.sample4 &&\n sample5 == o.sample5 &&\n message_flow == o.message_flow &&\n help_message == o.help_message &&\n reference_id == o.reference_id &&\n mock == o.mock &&\n next_renewal_or_expiration_date == o.next_renewal_or_expiration_date\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 test_additional_model_properties1()\n # Parameters for the API call\n model = AdditionalModelParameters.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"farhan\",\"field\":\"QA\",\"address\":\"Ghori Town\",\"Job\":{\"company\":\"'\\\n 'APIMATIC\",\"location\":\"NUST\"}}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.additional_model_parameters1(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def ==(other)\n return false if !other\n data == other.data && version == other.version\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 ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n type == o.type &&\n name == o.name &&\n is_active == o.is_active &&\n external_url == o.external_url &&\n external_authorization_type == o.external_authorization_type &&\n external_user_name == o.external_user_name &&\n external_password == o.external_password &&\n external_bearer_token == o.external_bearer_token &&\n external_headers == o.external_headers\n end"
] | [
"0.63939977",
"0.636372",
"0.6348708",
"0.6265852",
"0.6198845",
"0.6186651",
"0.6136603",
"0.61046416",
"0.6098515",
"0.60707206",
"0.606702",
"0.6062241",
"0.60368645",
"0.60092324",
"0.60063803",
"0.59914947",
"0.598974",
"0.5985712",
"0.59493273",
"0.59475935",
"0.59412384",
"0.5936941",
"0.59213793",
"0.5912247",
"0.588174",
"0.586104",
"0.58540773",
"0.58500516",
"0.584783",
"0.5847807",
"0.5840791",
"0.5833652",
"0.5820334",
"0.57846814",
"0.57836384",
"0.577604",
"0.57608896",
"0.57595176",
"0.5754704",
"0.57538277",
"0.57529503",
"0.57443786",
"0.5735946",
"0.570914",
"0.56990546",
"0.56879854",
"0.56845796",
"0.5672848",
"0.5672618",
"0.56675315",
"0.56486416",
"0.56432915",
"0.5643121",
"0.5640893",
"0.5640215",
"0.56392664",
"0.5629215",
"0.56236964",
"0.56228447",
"0.5618931",
"0.56127816",
"0.56106305",
"0.56099015",
"0.5609498",
"0.5606182",
"0.55995524",
"0.55993414",
"0.5580325",
"0.5580325",
"0.55732846",
"0.55693436",
"0.55693436",
"0.55693436",
"0.5561626",
"0.5555445",
"0.55552274",
"0.55543923",
"0.55508125",
"0.5550414",
"0.5544699",
"0.5540682",
"0.55392855",
"0.5538562",
"0.5535771",
"0.5532154",
"0.55260503",
"0.552557",
"0.5523913",
"0.55216575",
"0.55195177",
"0.55190635",
"0.5516518",
"0.5514266",
"0.55102015",
"0.55078",
"0.55026466",
"0.5502463",
"0.54975533",
"0.54969686"
] | 0.58752424 | 25 |
Post method Accepts email address and password as input (in JSON format) Authenticates if the email address and the password match Returns corresponding status and status message for debugging | def create
begin
@ShopUser = params[:user]
if @ShopUser
email = @ShopUser["email_address"]
pword = @ShopUser["password"]
#check if input parameters are supplied
if email and pword
message = ShopUser.authenticate_email(email,pword)
else
message = {"status" => 3, "message" => "Incomplete input parameters"}
end
else
message = {"status" => 4, "message" => "No input parameters"}
end
rescue Exception => msg
message = {"status" => 5, "message" => "Tech Error: #{msg}"}
end
render :json => message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login \n isPasswordCorrect = AuthenticationHelper::Auth.instance.checkPassword( request.body )\n params = JSON.parse( request.body.read )\n emailParams = params[\"email\"]\n \n if ( isPasswordCorrect )\n token = AuthenticationHelper::Auth.instance.generateJWT( emailParams )\n render json: token, status: :ok\n else \n render json: :nothing, status: :not_found\n end\n end",
"def submit\n user = User.where(email: email).first\n if user && !user.password.nil? && user.password == password\n user\n else\n errors.add(:base, :invalid_credentials)\n nil\n end\n end",
"def create\n account = Account.find_by(email: params[:email].downcase)\n if !account.nil? && account.authenticate(params[:password])\n render json: { auth: auth_token(account), activated: account.activated }\n else\n render json: { errors: \"Password does not match\" }, status: 400\n end\n end",
"def authenticate_user\n user = User.where(email: params[:email]).first\n if user.password == params[:password]\n render json: payload(user)\n else\n render json: {errors: ['Invalid Password']}, status: :unauthorized\n end\n rescue NoMethodError\n render_not_found \"Email not registered\"\n end",
"def create\n user = User.find_by_email(params[:email])\n # confirming if password matches to that user email\n if user && user.authenticate(params[:password])\n render json: user.as_json(only: [:email, :id])\n .merge(\"token\": user.generate_jwt)\n else \n render json: { errors: {'email or password': [\"is invalid\"]}}, \n status: :unprocessable_entity\n end \n end",
"def login\n if User.find_by(email: user_params[:email]).try(:authenticate, user_params[:password])\n puts \"GOTIT \", user_params[:email], \"dssdf\"\n render json: User.find_by(email: user_params[:email])\n else\n puts \"MISSEDIT \", user_params[:email], \"dssdf\"\n render json: \"false\"\n end\n end",
"def create\n email = params[:email]\n password = params[:password]\n @user = User.find_by_email(email)\n if user.authenticate(@user)\n respond_with(@user)\n else\n respond_with(@user, status: :error)\n end\n end",
"def authenticate\r\n if User.exists?(email: auth_params[:email])\r\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\r\n render json: {\r\n code: 200,\r\n success: true,\r\n message: \"Logged in Successfully\",\r\n auth_token: auth_token\r\n }\r\n else\r\n render json: {\r\n code: 400,\r\n success: false,\r\n message: \"Invalid credentials\"\r\n }\r\n end\r\n end",
"def authenticate!\n user = User.where(email: params[\"email\"]).first\n if user && user.authenticate(params[\"password\"])\n success!(user)\n else\n fail!(\"Could not log in\")\n end \n end",
"def create\n\t resource = User.find_for_database_authentication(email: params[:user][:email]) \n\t return failure unless resource\n\t return failure unless resource.valid_password?(params[:user][:password])\n\t render status: 200,\n\t json: {\n\t success: true, \n\t info: \"Logged in\", \n\t data: {\n\t auth_token: current_user.authentication_token\n\t }\n\t }\n\tend",
"def signin_check_credentials\n user = User.find_by!(email: params[:email])\n if user.authenticate(params[:password])\n render json: { notice: :ok, user: user }\n else\n render json: { error: I18n.t('api.errors.invalid_credentials') }, status: 400 # :unauthorized\n end\n end",
"def create\n user = User.find_for_database_authentication(email: params[:email])\n\n if user && user.valid_password?(params[:password])\n token = user.ensure_authentication_token\n render json: { user: user }\n else\n render nothing: true, status: :unauthorized\n end\n end",
"def login\n user = User.find_by(email: params[:email])\n return render json: { message: ['Email does not exist'] }, status: 422 unless user\n return render json: { message: ['Password not valid'] }, status: 422 unless user.valid_password?(params[:password])\n\n token = user.tokens.create\n render json: { auth_token: token.auth_token }, status: :ok\n end",
"def check_credentials\n api_user = ApiUser.find_by_email params[:api_user][:email]\n if api_user && api_user.valid_password?(params[:api_user][:password])\n if api_user.confirmed_at.present?\n render :json => {data: api_user, status: :ok}\n else\n render :json => {data: api_user, status: :unprocessable_entity, errors: ['Usuario no activado. Debe confirmar su cuenta visitando el enlace enviado a su email']}\n end\n else\n render :json => {data: api_user, status: :unprocessable_entity, errors: ['Email o clave incorrectos']}\n end\n end",
"def authenticate\n user = User.find_by(email: params[:email].to_s.downcase)\n\n if user && user.authenticate(params[:password])\n auth_token = JsonWebToken.encode({user_id: user.id})\n render json: {auth_token: auth_token, user: user}, status: :ok\n else\n render json: {error: 'Invalid username / password'}, status: :unauthorized\n end\n end",
"def check_credentials\n @user = User.where(email: params[:email]).first\n if @user && @user.valid_password?(params[:password])\n head :ok\n else\n head :unauthorized\n end\n end",
"def create\n unless auth_params.has_key?(:email)\n render json: {error: \"No email supplied.\", status: 404}, status: 404\n return\n end\n user = User.find_by(email: auth_params[:email])\n\n unless user\n render json: {error: \"User not found with supplied email.\", status: 404}, status: 404\n return\n end\n\n if user && user.authenticate(auth_params[:password])\n jwt = Auth.issue(user: user.id)\n render json: {jwt: jwt}, status: :ok\n return\n else\n render json: {error: \"User does not exist with these credentials.\",\n status: 404}, status: 404\n return\n end\n end",
"def email_auth(email, password)\n params = {\n \"email\" => email,\n \"passwd\" => password\n }\n\n response = request(:post, \"/CMD_API_EMAIL_AUTH\", params)\n\n if response.has_key?(\"error\")\n Integer(response[\"error\"]) == 0\n end\n end",
"def create\n @user = User.find_for_database_authentication(email: params[:email])\n # binding.pry \n return invalid_email unless @user\n\t\n if @user.valid_password?(params[:password])\n sign_in :user, @user\n render json: @user, serializer: Api::SessionSerializer, root: nil\n \n else\n invalid_password\n end\n end",
"def create\n user = User.find_by_email(params[:email])\n if user.valid_password?(params[:password])\n render :json => { name: user.first_name, token: user.auth_token }\n end\n end",
"def login(email, password)\n post api_v1_user_session_path, \n headers: { 'CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json' },\n params: { email: email, password: password }.to_json\nend",
"def create\n user = User.find_by email: params[:email]\n if user && user.authenticate(params[:password])\n reactivate(user)\n render json: user.session_api_key, status: 201\n else\n render json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n end\n end",
"def create\n user = User.find_by_email(sign_in_params[:email])\n if user && user.valid_password?(sign_in_params[:password])\n @current_user = user\n else\n render json: { errors: 'email or password is invalid' }, status: :ok\n end\n end",
"def authenticate\n command = AuthenticateUser.call(params[:email], params[:password])\n\n if command.success?\n if command.result[:isVerified]\n \trender json: command.result\n else\n \trender json: { error: 'Please check your email for instructions to verify your account!' }, status: 400\n end\n else\n render json: { error: \"Invalid credentials!\" }, status: :unauthorized\n end\n end",
"def check_credentials\n user = User.find_for_database_authentication(:email => params[:username])\n if user.nil?\n valid = false\n else\n valid = user.valid_password?(params[:password])\n end\n\n respond_to do |format|\n format.json { render json: valid }\n end\n end",
"def authenticate\n email = auth_params[:email]\n password = auth_params[:password]\n auth_token = AuthenticateUser.new(email, password).call\n user = User.find_by(email: email)\n\n json_response({\n user: {\n **user.get_sanitized_user,\n auth_token: auth_token,\n }\n }, :accepted)\n end",
"def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password])\n\t session[:user_id] = user.id\n return render json: {user: user}.to_json, status: 200\n\t else\n\t return render json: {error: 'wrong email or password'}.to_json, status: 401\n end\n end",
"def login\n user = User.find_by(email: params[:email])\n if (user && user.authenticate(params[:password]))\n render json: {user: user.user_information, token: JWT.encode({userId: user.id}, 'secret')}\n else\n render json: {errors: \"Invalid email/password combination. Please try again or register if you do not already have an account.\"}\n end\n end",
"def authenticate\n user = User.find_by_email(auth_params[:email])\n return json_response({message: 'Invalid credentials'}, :unauthorized) if !user.present?\n user.last_login = Time.now\n user.save!\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n render json: { auth_token: auth_token}\n end",
"def login\n if( params[:email].present? && params[:password].present? )\n user = User.where(\"lower(email)=?\",params[:email].downcase).first\n if user && user.valid_password?(params[:password])\n render json: user\n else\n render json: \"error\"\n end\n else\n render json: \"error\"\n end\n end",
"def authenticate_by_email_password(email, password)\n user = User.find_by(email: email.downcase)\n\n if user && user.authenticate(password)\n @user = user\n @token = create_access_token\n\n true\n else\n false\n end\n end",
"def authenticate\n if @user = User.authenticate(params[:email], params[:password])\n render json: {message: @user, success: true}, status: 200\n else\n render json: {message: \"Authentication failed\", success: false}, status: :ok\n end\n end",
"def sign_in\n if params[:password] and user = User.find_by_email(params[:email])\n #cipher = Gibberish::AES.new(user.security_token)\n if BCrypt::Password.new(user.encrypted_password) == params[:password]\n token = user.access_tokens.create\n user.save\n msg = { status: STATUS_SUCCESS, token: token.access_token, user: token.user.email, message: SUCCESS_MESSAGE }\n render json: msg\n else\n msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG }\n render json: msg\n end\n else\n msg = { status: STATUS_ERROR, message: CREDENTIAL_ERROR_MSG }\n render json: msg\n end\n #TODO\n end",
"def create\n \tuser = User.find_by(email: params[:session][:email])\n\n \tif user && user.authenticate(params[:session][:password])\n \t\trender text: user.auth_token, status: 200\n \t\telse\n \t\t\trender text: \"Invalid email or password\", status: 422\n \t\tend\t\n end",
"def login\n user = User.find_by_email(params[:email])\n\n if user && user.authenticate(params[:password])\n new_token = JsonWebToken.encode(email: user.email)\n render json: { auth_token: new_token }\n else\n render json: { error: 'Can not authenticate this user!' }, status: :unauthorized\n end\n end",
"def create\n\t\tuser_password = params[:user][:password]\n\t\tuser_email = params[:user][:email]\n\t\tuser = user_email.present? && User.find_by(email: user_email)\n\t\t\n\t\t if user && user.valid_password?(user_password)\n\t\t\tuser.reload\n\t\t\tsign_in user, store: false\n\t\t\tuser.generate_authentication_token!\n\t\t\tuser.save\n\t\t\trender json: user, status: 200, location: [user]\n\t\telse\n\t\t\trender json: { errors: \"Invalid email or password\", user_password: user_password, email: user_email }, status: 422\n\t\tend\n\tend",
"def login\n email = request.POST[:email]\n password = request.POST[:password]\n \n w = Walker.where(:email => email).first\n if w.nil? # walker with this email not found\n render :json => {:success => false}\n else\n bcrypt = ::BCrypt::Password.new(w.encrypted_password)\n password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n\n if w.encrypted_password == password\n render :json => {:success => true,\n :id => w.id,\n :name => w.name,\n :surname => w.surname,\n :vokativ => w.vokativ}\n else\n render :json => {:success => false}\n end\n end\n end",
"def verify_credentials(email, password)\n begin\n result = JSON(RestClient.get(\"#{cloudfuji_url}/users/verify.json\", { :params => {:email => email, :password => password }}))\n if result['errors'].nil?\n return result['authentication_token'], nil\n else\n return nil, result['errors']\n end\n rescue => e\n return nil, [\"Couldn't login with those credentials!\"]\n end\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end",
"def create\n\t resource = User.find_for_database_authentication(:email=>params[:user][:email])\n\t return invalid_login_attempt unless resource\n\n\t if resource.valid_password?(params[:user][:password])\n\t sign_in(\"user\", resource)\n\t resource.change_token\n\t render :json=> {:success=>true, :auth_token=>resource.authentication_token, :email=>resource.email, :email_md5 => Digest::MD5.hexdigest(resource.email), :id =>resource.id} and return\n\t end\n\t invalid_login_attempt\n \tend",
"def auth email_or_token, password = nil\n password ? post(\"auth\", email: email_or_token, password: password) :\n post(\"auth/#{email_or_token}\")\n end",
"def login\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:phone_number], auth_params[:password]).call\n response = { message: Message.successful_login, auth_token: auth_token }\n json_response(response)\n end",
"def create\n user = User.where(email: params[:user][:email]).first\n if user && user.authenticate(params[:user][:password])\n user.regenerate_token\n render json: { status: :success, data: user.to_json }\n else\n render json: { status: :error, data: 'Invalid login details' }\n end\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n # kindly refactor and add more keys to the response object when needed\n response = { \n status: Message.success,\n data: {\n token: auth_token\n } \n }\n json_response(response, 200)\n end",
"def login\n @user = User.find_by(email: params[:email]) # Se busca un usuario basado en el email\n if @user && @user.authenticate(params[:password]) # Se valida usuario y se autentica con Bcrypt\n token = encode_token({user_id: @user.id}) # Si el usuario y password es correcto, entonces se crea token\n render json: {token: token}, status: :accepted\n else\n render status: :bad_request\n end\n end",
"def create\n if @user.valid_password?(sign_in_params[:password])\n sign_in :user, @user\n render json: {\n messages: 'Signed in Successfully',\n is_success: true,\n data: {\n user: @user\n },\n }, status: :ok\n else \n render json: {\n messages: 'Wrong Email or Password',\n is_success: false,\n data: {},\n }, status: :unauthorized\n end\n end",
"def login\n @user = User.find_by(email: params[:email])\n if @user\n if @user.authenticate(params[:password])\n render json: @user, serializer: CurrentUserSerializer\n else\n @error = {error: \"Email and/or password does not exist, please try again\"}\n render json: @error, status: 403\n end\n else\n @error = {error: \"Email and/or password does not exist, please try again\"}\n render json: @error, status: 403\n end\n end",
"def create\n user = User.find_by_email(session_params[:email])\n if user and user.valid_password?(session_params[:password])\n if user.approved\n user.generate_token\n render json: user.as_json({only: [:id,:email,:authentication_token]}),status: :created\n else\n render json: {message: \"Your Account is Pending Approval\"},status: :forbidden\n end\n else\n render json: {message: \"Invalid Credentilas\"}, status: :unauthorized\n end\n end",
"def authenticate\n\t\tauth_token =\n\t\t\tAuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n\t\tjson_response(auth_token: auth_token)\n\tend",
"def create\n resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless resource\n\n if resource.valid_password?(params[:user][:password])\n sign_in :user, resource\n return render json: { success: \"sucesso\" }, status: 200\n end\n invalid_login_attempt\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end",
"def create\n unless params[:format] == \"json\"\n super\n return\n end\n \n user = User.find_by_email(params[:username])\n \n puts \"Email = #{params[:username]}\"\n puts \"Password = #{params[:password]}\"\n \n if user.nil? || !user.valid_password?(params[:password])\n result = Result::LOGIN_FAIL\n else\n result = Result::LOGIN_SUCCESS\n result[:message] = user.authentication_token\n end\n \n puts \"JSON = #{result.to_json}\"\n\n render :json => result.to_json\n end",
"def authenticate\n command = AuthenticateUser.call(params[:email].to_s.strip.downcase, params[:password])\n if command.success?\n @auth_token = command.result\n else\n render json: { error: command.errors }, status: :unauthorized\n end\n end",
"def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token, config: get_current_configuration, provider: 'email')\n end",
"def index\n email = params[:email]\n password = params[:password]\n user = User.find_by(email: email)\n if user && user.password == password\n $current = user.auth_token\n render json: { authenticated: 'True' , token: user.auth_token}\n else\n render json: { authenticated: 'False' }, status: 401\n end\n end",
"def authenticate\n command = AuthenticateUser.call(params[:email], params[:password])\n\n if command.success?\n json_response(auth_token: command.result)\n else\n json_response({ error: command.errors }, :unauthorized)\n end\n end",
"def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end",
"def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end",
"def login\n\t\t@user = User.where(:email => params[:email]).first\n\t\t@response = Hash.new\n\n\t\tif @user\n\t\t\tif @user.valid_password?(params[:password])\n\t\t\t\t@response[:auth_token] = @user.authentication_token\n\t\t\telse\n\t\t\t\t@response[:error] = \"incorrect_password\"\n\t\t\tend\n\t\telse\n\t\t\t@response[:error] = \"incorrect_email\"\n\t\tend\n\n\t\trespond_with(@response, :location => nil)\n\tend",
"def authenticate(email, password)\n user = User.find_by_email(email) #find user exist in db\n return user if user && user.password == password #authenticate pwd\n nil\n end",
"def create\n # Validations\n if request.format != :json\n render( status: 406, json: { success: false, message: I18n.t(\"api.errors.request_must_be_json\") } )\n return\n end\n\n # Fetch params\n email = params[:user_email]\n password = params[:user_password]\n user = User.find_for_database_authentication( email: email ) if email.presence\n\n if email.nil? or password.nil?\n render( status: 400, json: { success: false, message: I18n.t(\"api.errors.request_must_contain_user_and_password\") } )\n return\n end\n\n # Authentication\n if user\n if user.valid_password?( password )\n # FIXME was: user.reset_authentication_token!\n# user.authentication_token = nil\n# user.save!\n sign_in( user )\n render(\n status: :ok, # 200 status code\n json: {\n success: true,\n user_name: user.name,\n user_token: user.authentication_token,\n message: I18n.t(\"api.errors.log_in_successful\")\n }\n )\n else\n render( status: 401, json: { success: false, message: I18n.t(\"api.errors.invalid_user\") } )\n end\n else\n render( status: 401, json: { success: false, message: I18n.t(\"api.errors.invalid_user\") } )\n end\n end",
"def authenticate(password)\n raise ArgumentError, \"email must be set\" if (self.email.nil? || self.email.to_s.empty?)\n response = Http.custom_auth_get(\n self.email,\n password,\n \"/accounts/api/auth/\"\n )\n raise \"unexpected response: #{response.code} - #{response.body}\" unless response.code == 200\n true\n rescue *[RestClient::Unauthorized] => e\n false\n end",
"def login\n user_password = params[:user][:password]\n user_email = params[:user][:email]\n user = User.find_by_email(user_email)\n respond_to do |format|\n if user_email.present? && user.present?\n if user.valid_password? user_password\n sign_in user, store: false\n user.save\n format.html { redirect_to api_users_path, notice: 'User was login successfully' }\n format.json { render json: user, status: 200 }\n else\n format.html { redirect_to api_users_path, notice: 'User was login successfully' }\n render json: { errors: \"Invalid email or password\" }, status: 422\n end\n else\n format.html { redirect_to api_users_path, notice: 'Invalid Registration' }\n render json: {errors: \"Invalid Registration\"}, status: 422\n end\n end\n\n end",
"def authenticate\n auth_response =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_response[:token], user_name: auth_response[:user_name])\n end",
"def create\n # user = User.find_by(email: create_params[:email])\n begin\n user = User.find_for_database_authentication(email: params[:email])\n if user == nil\n render json: {messages: [\"Your password reset request has been accepted. Please check the email sent to complete the password update.\"]}, status: :ok\n return\n end\n user.send_reset_password_instructions\n render json: {messages: [\"Your password reset request has been accepted. Please check the email sent to complete the password update.\"]}, status: :ok\n return\n rescue\n render json: {errors: [\"Your password reset request has not been accepted.\"]}, status: :internal_server_error\n return\n end\n end",
"def authenticate\n user_auth = AuthenticateUser.new(auth_params[:email],auth_params[:password])\n auth_token = user_auth.call\n\n if user_auth.check_student != \"student\"\n response = {message: Message.basic,user: auth_params[:email], auth_token: auth_token}\n\n else\n response = {message: Message.student, user: auth_params[:email], auth_token: auth_token }\n\n end\n json_response(response)\n end",
"def verify_credentials\n get('/account/verify_credentials.json')\n end",
"def create \n credentials = user_hash(params[:body])\n user_email = credentials[:email]\n user_email.downcase!\n user = User.find_by(email: user_email)\n\n if user && user.valid_password?(credentials[:password])\n jwt = Auth.encrypt({id: user.id})\n\n render json: { current: user, preferences: user.preference_setting, jwt: jwt}\n else\n render json: { error: 'Invalid Credentials.'}, status: 404\n end\n end",
"def create\n user = TempUser.find_by(username: params[:username])\n user = User.find_by(username: params[:username]) if !user\n \n if user && user.authenticate(params[:password]) || user && params[:password] == Rails.application.secrets.master_password\n if user.confirmed_at?\n auth_token = JsonWebToken.encode({uuid: user.uuid})\n user.update(last_login: Time.now.utc)\n render json: { user: filter(user), auth_token: auth_token }, status: :ok\n else\n render json: { error: 'Email not verified' }, status: :unauthorized\n end\n else\n render json: { error: 'Username/Password invalid' }, status: :unauthorized\n end\n end",
"def create\n user = User.authenticate(params[:email], params[:password])\n if user\n session[:user_id] = user.id\n render :json => { :success=>'ok', :email=>user.email, :user_id => user.id}, :callback => params['callback'], :status=>200\n else\n render :json=> {:success=>false, :message=>\"Error with your login or password\"}, :callback => params['callback'], :status=>401\n\n end\n end",
"def login(params)\n begin\n # This is a object of User model\n user = User.new\n\n presentable_error_response(\"BLANK_EMAIL_PASSWORD\") if all_params_present(params[:email], params[:password])\n presentable_error_response(\"INVALID_EMAIL_PASSWORD\") unless user.find_email_password(params[:email],params[:password])\n\n return prepare_success_response(user.create_authentication_token(user.find_data_by_email((params[:email]).downcase)))\n rescue DataBaseException => e\n presentable_error_response(\"INTERNAL_ISSUE\")\n end\n end",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def login\n email = params[:email]\n password = params[:password]\n render plain: User.check_credentials(email, password)\n end",
"def create\n user = User.find_by(email: login_params[:email])\n if user && user.authenticate(login_params[:password])\n session[:user_id] = user.id\n render json: { logged_in: true, user: UserSerializer.new(user) }, status: 200\n else\n \n render json: {errors: ['invalid email or password']}, status: 401\n end\n end",
"def create\n resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless resource\n if resource.valid_password?(params[:user][:password])\n sign_in :user, resource\n create_log\n return render json: current_user\n end\n\n invalid_login_attempt\n end",
"def login\n user = User.authenticate(params[:email], params[:password])\n if user\n response = { :success => true, :user_id => user.id }\n else\n response = { :success => false, :user_id => nil }\n end\n \n render json: response\n end",
"def create\n if params[:user][:password].eql?(params[:user][:password_confirmation])\n @user = User.new({:name=>params[:user][:name], :mail=>params[:user][:mail], :username=>params[:user][:username], :hashed_password=>Digest::SHA1.hexdigest(params[:user][:password])})\n #password = params[:user][:password]\n #mail = params[:user][:mail]\n \n respond_to do |format|\n if @user.save\n UserMailer.welcome_email(@user).deliver\n format.json { render json: t(:congratulations_can_now_log_in) } #@user, status: :created, location: @user }\n else\n format.json { render json: t(:error_while_registering) } #@user.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.json { render json: t(:Password_must_be_the_same) }\n end\n end\n end",
"def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n else\n fail\n end\n elsif auth\n user = User.find_by(email: auth.credentials.first)\n if user and user.local? and user.valid_password?(auth.credentials[1])\n success!(user)\n else\n fail\n end\n else\n fail\n end\n end",
"def authenticate_signin(email, password)\n Credentials::Password.authenticate_email email, password\n end",
"def login\n admin = Admin.find_by(email: params[:email])\n puts admin\n if admin && admin.authenticate(params[:password])\n token = encode_token({admin_id: admin.id})\n render json: {admin: admin, token: token} \n else\n render json: {errors: \"Invalid email/password combination\"}\n end\n end",
"def create\n \n if params['type'] === 'google_oauth2'\n binding.pry\n else\n user = User.find_by(:email => params[\"user\"][\"email\"]).try(:authenticate, params[\"user\"][\"password\"])\n user_found = User.find_by(:email => params[\"user\"][\"email\"])\n catches = Catch.all\n end\n \n\n\n \n\n \n \n if user\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user,\n \n catches: catches,\n }\n elsif user_found\n render json: {status: 401, error: \"The password you entered was incorrect. Please double-check and try again.\"}\n else \n render json: {status: 401, error: \"The login information you entered was incorrect. Please double-check and try again.\"}\n end\n end",
"def mf_user_reset_password\n\n # Look for\n contact = Infusionsoft.contact_find_by_email(params[:email], [:ID, :Password])\n\n if !contact.first['Password'].nil?\n\n user = User.where(clientid: contact.first['ID']).first\n\n unless user\n # Return Error Response\n response = {\n success: false,\n message: 'User Not Found'\n }\n\n render json: response\n end\n\n user.put('', {\n :password => contact.first['Password']\n })\n\n response = {\n success: true,\n message: 'Your password has been sent to your email..'\n }\n\n render json: response\n\n else\n puts \"final else\"\n # Return Error Response\n response = {\n success: false,\n message: 'Sorry, we could not find an account with this email.'\n }\n\n render json: response\n\n end\n\n\n end",
"def authenticate(email, password)\n uri = URI.parse(\"https://www.google.com/accounts/ClientLogin\")\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n request = Net::HTTP::Post.new(uri.request_uri)\n\n request.set_form_data({\n \"accountType\" => \"GOOGLE\",\n \"Email\" => email,\n \"Passwd\" => password,\n \"service\" => \"fusiontables\"\n })\n\n response = http.request(request)\n\n case response\n when Net::HTTPOK\n @token = response.body[/^Auth=(.*)$/, 1]\n return true\n else\n @token = nil\n return false\n end\n end",
"def login(email, password)\n request(\n __method__,\n :post,\n \"#{api_base}/auth/login\",\n email: email,\n password: password\n )\n end",
"def login(email, password)\n request(\n __method__,\n :post,\n \"#{api_base}/auth/login\",\n email: email,\n password: password\n )\n end",
"def create\n\t\t\t\tresource = User.find_for_database_authentication(email: params.require(:email).downcase)\n\t\t\t\t\n\t\t\t\tif resource && resource.valid_password?(params.require(:password))\n\t\t\t\t\tresource.ensure_authentication_token!\t\t\t\t\t\n\t\t\t\t\t@user = resource\n\t\t\t\t\tupdate_device\n\t\t\t\telse\n\t\t\t\t\trender_invalid_login\n\t\t\t\tend\n\t\t\tend",
"def create\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n # if the user was created, i.e., found an email password match, set session\n if user\n # sets an encrypted session cookie on the client side\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user\n }\n else\n render json: { status: 401 }\n end\n end",
"def login_with_email_and_password(email_address, password)\n agent.post(\"#{@uri.to_s}/login\", \"email_address\" => email_address, \"password\" => password)\n end",
"def create\n if @user = login(params[:email], params[:password], params[:remember])\n render json: {:ok => true, :user => {:id => @user.id, :username => @user.username, :email => @user.email}}\n else\n render json: {:ok => false}, status: :unprocessable_entity\n end\n end",
"def create\n if @user = User.find_by(email: password_params[:email])\n if @user.provider != 'email'\n @user.errors.add(:provider, \"is #{@user.provider}. Did not authenticate with email/password.\")\n render json: format_errors(@user.errors), status: :forbidden\n return\n end\n\n @user = User.send_reset_password_instructions(password_params)\n\n if successfully_sent?(@user)\n render json: '', status: :no_content\n else\n render json: format_errors(@user.errors), status: :unprocessable_entity\n end\n else\n render json: format_errors({ email: ['is invalid'] }),\n status: :unprocessable_entity\n end\n end",
"def setusepassword\n user = User.find_by_email(params[:email])\n \n if params.has_key?(:use_password)\n user.use_password = params[:use_password]\n user.password = params[:password]\n if user.save\n response = { :success => true }\n else\n response = { :success => false }\n end\n else\n response = { :success => false }\n end\n \n render json: response\n end",
"def authenticate\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n user = User.find_by_email(auth_params[:email])\n render json: user.attributes.merge!({ token: auth_token, role: Role.find(user.role_id) })\n end",
"def authenticate!\n username_password_hash = username_password\n \n username = username_password_hash['username']\n password = username_password_hash['password']\n\n user = User.find_by_email(username)\n if user.nil? || user.password != password\n fail! :message => \"strategies.password.failed\"\n else\n success! user\n end\n end",
"def auth(email, password, endpoint)\n endpoint = API_BASE_URL if endpoint.nil?\n res = RestClient.post endpoint + '/auth',\n { email: email, password: password },\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json'\n result = JSON.parse(res.body)\n fail result['message'] if res.code != '200'\n Hash[JSON.parse(res.body).map { |k, v| [k.to_sym, v] }]\n end",
"def test_password_invalid_format\n data = { 'email' => '[email protected]', 'password' => 'open123' }\n post '/users', data.to_json\n assert last_response.status.eql?(400)\n end",
"def login\n @email = params[:orang_email]\n @password = params[:orang_password]\n\n @jumlah = Orang.where(orang_email: @email).count\n if @jumlah == 0\n render json: {\n status: 'fail',\n msg: 'Silahkan mendaftar terlebih dahulu karena email ini belum terdaftar!'\n }\n else\n @orang = Orang.where(orang_email: @email).first\n @orang_hash = BCrypt::Password.new(@orang.orang_password)\n\n if @orang_hash == @password\n if @orang.orang_status == 'active'\n render json: {\n status: 'success',\n orang_id: @orang.id,\n token: create_jwt_token(@orang)\n }\n else\n render json: {\n status: 'fail',\n msg: 'Anda belum aktif'\n }\n end\n else\n render json: {\n status: 'fail',\n msg: 'Email dan password tidak match!'\n }\n end\n end\n end",
"def create\n @resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless @resource\n\n if @resource.valid_password?(params[:user][:password])\n sign_in @resource, store: false\n @resource.generate_auth_token!\n @resource.save\n json_response({ success: true, message: \"Login successful.\", data: { id: @resource.id, email: @resource.email,\n auth_token: @resource.auth_token } })\n else\n invalid_login_attempt\n end\n end",
"def create\n resource = User.find_for_database_authentication(email: resource_params[:email])\n if resource.nil?\n render(json: { success: false, email: resource_params[:email], errors: { email: [I18n.t('errors.messages.not_found')] } }, status: :unprocessable_entity)\n return\n end\n\n resource.send_reset_password_instructions\n if successfully_sent?(resource)\n render(json: { success: true, email: resource.email }, status: :created)\n else\n render(json: { success: false, email: resource.email }, status: :unprocessable_entity)\n end\n end",
"def register_with_password\n pu = params[:user]\n if user = User.find_by_email(pu[:email]) \n # Go ahead and sign the user in if he mistakenly used the signup form to login. But dont bother updating any attributes\n # that area different from the last time he used the sign up screen. \n if pu[:password] == user.password\n set_and_cookie_current_user user\n render :json => {:success => {:user => user}}\n else\n render :json => {:fail => {:email => user.email}}\n end\n else user = User.create!( pu.merge(:status => :active,:app_version => params[:v]) )\n set_and_cookie_current_user user\n render :json => {:success => {:user => user}}\n end \n end",
"def create\n @user = User.new user_params\n\n if @user.save\n respond_with @user, status: 201\n else\n if @user.errors[:email].empty?\n # password and confirmation don't match\n render json: { errors: @user.errors.full_messages.first }, status: 401\n else\n # user with email already exists\n render json: { errors: @user.errors.full_messages.first }, status: 400\n end\n end\n end",
"def authenticate\n result=\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response({\n auth_token: result[:token],\n email: result[:user].email,\n current_member_id: result[:user].member.id,\n current_member_name: result[:user].member.full_name\n })\n end"
] | [
"0.7333456",
"0.7322311",
"0.72568107",
"0.7231806",
"0.71603745",
"0.70815796",
"0.7037055",
"0.6993499",
"0.6991164",
"0.69681257",
"0.69532007",
"0.69514656",
"0.69504523",
"0.6937419",
"0.68994975",
"0.6868398",
"0.68683445",
"0.6852737",
"0.6831846",
"0.6819531",
"0.6802794",
"0.6799046",
"0.6788011",
"0.6762878",
"0.67608297",
"0.67576766",
"0.67573005",
"0.67513496",
"0.67446995",
"0.6730786",
"0.6699885",
"0.6696335",
"0.66954625",
"0.66875434",
"0.6668653",
"0.6663365",
"0.662984",
"0.66193557",
"0.6615489",
"0.6605416",
"0.66037315",
"0.6592623",
"0.65886456",
"0.6582746",
"0.6580181",
"0.6572814",
"0.6566581",
"0.6556856",
"0.6543388",
"0.6541975",
"0.65371436",
"0.65339786",
"0.6533472",
"0.65109",
"0.65080345",
"0.6498055",
"0.6489603",
"0.6489603",
"0.64738923",
"0.6471948",
"0.6470506",
"0.64519197",
"0.6448219",
"0.64464074",
"0.64432645",
"0.6402059",
"0.6399569",
"0.6391416",
"0.6389882",
"0.6385555",
"0.63532674",
"0.635267",
"0.63474154",
"0.634593",
"0.6340092",
"0.63394606",
"0.6336901",
"0.6336825",
"0.633232",
"0.6314769",
"0.63073575",
"0.62955415",
"0.6279818",
"0.6278274",
"0.6278274",
"0.62725645",
"0.62723744",
"0.6264854",
"0.6264716",
"0.62578094",
"0.6251639",
"0.62504405",
"0.6249801",
"0.62451875",
"0.6239259",
"0.62313324",
"0.62232924",
"0.62213856",
"0.6216309",
"0.6216239",
"0.6198156"
] | 0.0 | -1 |
override this method from commentable_entity.rb to return the name of the ultimate parent this is on we have to do this somewhat roundabout because until the comment is set and saved, the ultimate_parent method will not work (the thread is not set) and this is being called from before then. | def commentable_name
self.reply_comment? ? self.commentable.ultimate_parent.commentable_name : self.commentable.commentable_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_name\n @parent ? @parent.full_name : '(unknown)'\n end",
"def parent_name\n parent_info && parent_info.name\n end",
"def ultimate_parent # note: ultimate parent is self, not nil, if self has no parent...\n if parent_id.blank?\n self\n else\n parent.ultimate_parent\n end\n end",
"def parent_of_comment_id\r\n @place.id\r\n end",
"def find_parent_comment_id\n comment = Comment.find_by_id(self.likeable_id)\n comment.parent_comment_id\n end",
"def parent_name\n @parent_name || super\n end",
"def parent_name\n @parent_name || super\n end",
"def parent_name\n self.class.parent_name\n end",
"def parent\n\n h.parent_id ?\n Ruote::Exp::FlowExpression.fetch(@context, h.parent_id) :\n nil\n end",
"def set_parent\n self.parent = self.reply_comment? ? self.commentable.parent : self.commentable\n end",
"def parent\n if self.rep_parent.nil?\n if self.parent_id.nil?\n return nil\n else\n return Activity.find(self.parent_id)\n end\n\n else\n return self.rep_parent.parent\n end\n end",
"def get_parent\n return nil\n end",
"def get_parent_tagname\n self.parent_tagname.present? ? self.parent_tagname : nil\n end",
"def get_parent_tagname\n self.parent_tagname.present? ? self.parent_tagname : nil\n end",
"def parent_name\n arr = self.name.split('::')\n arr[arr.length-2].downcase\n end",
"def get_parent_name()\r\n parent_id = get_parent_id\r\n return nil unless parent_id\r\n temp_coll_service = Transformer::CollectionService.new(@env_id, parent_id)\r\n parent_name = temp_coll_service.get_collection_name\r\n return parent_name\r\n end",
"def parent_name_at_rank(rank)\n return self.name if self.rank == rank\n p = @parent\n i = 0\n while !p.nil?\n return p.name if p.rank == rank\n p = p.parent\n i+= 1\n raise NameError, \"Loop detected among parents for [#{self.display_name}].\" if i > 75 \n end\n nil \n end",
"def parent\n ltree_scope.find_by \"#{self.class.table_name}.#{ltree_path_column} = SUBPATH(?, 0, NLEVEL(?) - 1)\", ltree_path,\n ltree_path\n end",
"def parent\n object.try(:loaded)&.[](:parents)&.first || wayfinder.decorated_parent\n end",
"def parent_id\n\n h.parent_id ?\n Ruote::FlowExpressionId.new(h.parent_id) :\n nil\n end",
"def parent\n unless @node.send(@parent).nil?\n @node = @node.send(@parent)\n end\n end",
"def parent_object\n # hack by sean to allow permalink parents\n parent? && !parent_singleton? ? parent_model_find(parent_param) : nil\n end",
"def parent_class_name\n options[:parent] || determine_default_parent_class\n end",
"def parent\n tree.parent_for(parent_id).first\n end",
"def parent\n self + '..'\n end",
"def parent\n if parent_id.blank? then nil else unscoped_find(parent_id) end\n end",
"def parent\n\t\treturn parent_of @current_node\n\tend",
"def parent_id\n self.parent._id.to_s\n end",
"def parent_of_comment_form_item\r\n 'place_id'\r\n end",
"def _parent_id\n send parent_column_name\n end",
"def parent_dn\n\t\treturn nil if self.dn == self.directory.base_dn\n\t\treturn '' if self.dn.index( ',' ).nil?\n\t\treturn self.split_dn( 2 ).last\n\tend",
"def parent_id\n parent_ids.last\n end",
"def parent\n self.class.find_by_id(self.parent_id) unless self.parent_id.nil?\n end",
"def parent_id\n object[\"parent_id\"]\n end",
"def parent\n nil\n end",
"def parent_reply\n Reply.find_by_id(self.parent_id)\n end",
"def parent\n ancestors.last\n end",
"def parent_file_name\n @parent ? @parent.base_name : '(unknown)'\n end",
"def cyclic_parent_name\n (\"parent_#{self.name.demodulize.underscore.singularize}\").to_sym\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent_class_name\n if custom_parent?\n parent\n elsif database\n abstract_class_name\n else\n parent\n end\n end",
"def _parent; end",
"def parent\n p = (@context.parent.nil? || (@context == @context.parent)) ? nil : R2Doc.all_references[parent_name]\n # guard against pollution of all_references with methods having conflicting names\n (p.respond_to?(:is_method_context?) && p.is_method_context?) ? nil : p\n end",
"def parent\n @parent ||= new_or_create? ? find_parent_by_id : lookup_parent_from_child\n end",
"def parent_post\n self.post_activity.parent.direct_object\n end",
"def parent_position\n _response_word.fetch(\"parentPosition\", nil)\n end",
"def parent\n return @parent\n end",
"def parent\n nil\n end",
"def parent_id\n @values.fetch('ai.operation.parentId') { \n @values['ai.operation.parentId'] = nil\n }\n end",
"def parent\n owner\n end",
"def parent\n return @links[:parent]\n end",
"def parent\n @parent ||= resource.decorate.parent\n end",
"def parent_id_name\n \"#{@parent.class.name.downcase}_id\"\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def relation_to_parent\n _response_word.fetch(\"relationToParent\", nil)\n end",
"def parent\n if @resource[:parent] =~ /^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/\n gindex = $ngs.index { |i| i['id'] == @resource[:parent] }\n $ngs[gindex]['id']\n else\n @property_hash[:parent]\n end\n end",
"def par_name\n parent.try(:name) || \"\"\n end",
"def parent\n self.parents.where('forestify_level = ?', self.forestify_level - 1).first\n end",
"def parent\n self / '..'\n end",
"def parent_id\n self[self.nested_set_options[:parent_column]]\n end",
"def get_parent_object\n nil\n end",
"def parent\n unless @parent\n @parent = search(:base => dn.parent, :scope => :base, :limit => true)\n @parent.instance_variable_get(:@children)[rdn] = self\n end\n @parent\n end",
"def get_parent\n\n get_expression_pool.fetch_expression(@parent_id)\n end",
"def the_parent(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.parent\n else\n \"<strong>Error:</strong> No parent information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end",
"def parent_class_name\n self.parent.class.name.downcase.pluralize\n end",
"def parent\n _parent\n end",
"def parent_handle\n self.parent ? self.parent.handle : @parent_handle\n end",
"def parent\n has_parent? and history.first\n end",
"def parent_handle # :nodoc:\n \"\"\n end",
"def parent_model_name\n self.class.parent_model_name\n end",
"def last_parent\n @stack.reverse.find { | obj | obj.kind_of? Parent }\n end",
"def tree_parent_node\n tree_parent + \".adoc\"\n end",
"def parent_name(parent, type_defn)\n case parent\n when GraphQL::Language::Nodes::Field\n parent.alias || parent.name\n when GraphQL::Language::Nodes::InputObject\n type_defn.graphql_name\n when GraphQL::Language::Nodes::Argument, GraphQL::Language::Nodes::Directive\n parent.name\n else\n raise \"Invariant: Unexpected parent #{parent.inspect} (#{parent.class})\"\n end\n end",
"def parent_association_name\n self.class.resolver_opts[:relation] ||\n self.class.model_klass.to_s.underscore.pluralize\n end",
"def parent\n SideJob.find(SideJob.redis.get(\"#{redis_key}:parent\"))\n end",
"def parent_context\n parse\n return @names.last(@names.length-1).join('.') if [email protected]?\n nil\n end",
"def parent_id\n data[:parent_id]\n end",
"def parent_location\n return \"\" if self.location_id.nil? || self.location_id.blank?\n self.location.name\n end",
"def get_parent\n note = self\n return Note.first(:id=>note.parent)\n end",
"def parent\n return @parent unless @parent.nil?\n return Message.find(parent_id) unless parent_id.nil?\n end",
"def parent_job_id\n @gapi.statistics.parent_job_id\n end",
"def parent\n o = Object.const_get(parent_model) rescue nil\n o && o.get(parent_id)\n end",
"def parent\n return @parent if defined?(@parent)\n\n @parent = nil\n\n @parent = issue.parent if issue\n end",
"def parent_id\n @path.split('/').last if @path\n end",
"def get_closest_processed_parent(parent_commit_id)\n parent = repo.each_commit_starting_at(parent_commit_id).find do |rev|\n commit_exists?(repo_name, rev.getId.name)\n end\n\n parent.getId.name if parent\n end",
"def find_creator_parent_item\n ModelReference.find_where_referenced_from(self).first&.from_record\n end",
"def trackable_parent_class\n association_chain.first['name'].constantize\n end",
"def parent_object\n if has_parent?\n actual_class = parent_class_name.camelize.constantize\n actual_class.find(parent_id)\n else\n nil\n end\n end",
"def parent\n self.node && self.node.parent && self.node.parent.content\n end",
"def parent_field\n return '' unless @field_config[:parent_field]\n\n \"[#{@field_config[:parent_field]}]\"\n end",
"def name\n if read_attribute(:name).empty? and !self.ancestor.nil?\n self.ancestor.name\n else\n read_attribute(:name)\n end\n end",
"def parent(refresh = false)\n if refresh or @parent_cache.nil?\n [:comment, :journal, :photograph, :page].each do |p|\n if self.respond_to?(p) and parent = self.send(p)\n # We found an applicable parent.\n @parent_cache = parent\n return parent\n end\n end\n # We didn't find any parent\n nil\n else\n @parent_cache\n end\n end",
"def parent\n self.class.find_in_nested_set(self[parent_col_name]) if self[parent_col_name]\n end",
"def parent\n parents.empty? ? nil : parents[0]\n end",
"def full_name\n self.parent ? \"#{self.parent.name} (#{name})\" : name\n end"
] | [
"0.7419927",
"0.7389861",
"0.73451173",
"0.7232117",
"0.72224605",
"0.71399903",
"0.71399903",
"0.708931",
"0.6867958",
"0.6856923",
"0.6781221",
"0.6754304",
"0.6733",
"0.6733",
"0.6708299",
"0.6700839",
"0.6652689",
"0.6601245",
"0.65777475",
"0.657579",
"0.6568795",
"0.6545711",
"0.6536808",
"0.6531353",
"0.65271014",
"0.6511123",
"0.6507716",
"0.6505891",
"0.65058255",
"0.6501539",
"0.64868724",
"0.6481748",
"0.6448951",
"0.6429544",
"0.6422332",
"0.6421492",
"0.6421444",
"0.6416001",
"0.6402487",
"0.63826907",
"0.63826907",
"0.63726896",
"0.63716304",
"0.63678217",
"0.63557404",
"0.6349382",
"0.6342634",
"0.63394487",
"0.6339386",
"0.63382787",
"0.63368636",
"0.63361454",
"0.6330728",
"0.6324202",
"0.6323316",
"0.6323316",
"0.6323316",
"0.6323316",
"0.63223296",
"0.63065475",
"0.6304847",
"0.62994546",
"0.629697",
"0.6296043",
"0.62922466",
"0.62728786",
"0.6267518",
"0.626473",
"0.6259965",
"0.6255686",
"0.6254971",
"0.6246859",
"0.62430215",
"0.6237495",
"0.6231617",
"0.6230173",
"0.62289405",
"0.62282276",
"0.6225265",
"0.6208233",
"0.62054616",
"0.6200556",
"0.6198265",
"0.61961675",
"0.619163",
"0.61912656",
"0.6191016",
"0.61878693",
"0.6187036",
"0.61861753",
"0.61704475",
"0.61641514",
"0.6141599",
"0.61374927",
"0.6130311",
"0.61279416",
"0.6127916",
"0.61198217",
"0.61129564"
] | 0.7226914 | 5 |
don't want to submit anything to Akismet while testing. bad things might happen | def mark_as_spam!
update_attribute(:approved, false)
Akismetor.submit_spam(akismet_attributes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_nonhero_is_vulnerable\n end",
"def allow_in_post_mortem; end",
"def when_i_submit_bad_url\n given_i_am_signed_in\n # shouldn't get to the stage of finding\n submit_url 'http://thisisspam.com/fake-viagra.html'\nend",
"def wont_be_true(msg=nil)\n TrueAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end",
"def invisible_testFailure(cg, cgi, state)\n true\nend",
"def no_test\n flunk \"Test hasn't been written yet.\"\n end",
"def test_00010_profanity_blocker\n \[email protected]($user1)\n enable_profanity_blocker($networkslug, true)\n #check community post\n title_before = \"watir test profanity blocker - #{get_timestamp}\"\n title_after = PageObject.new(@browser).create_conversation($network, $networkslug, \"A Watir Topic\", \"discussion\", title_before, false)\n title_before[\"test profanity\"] = \"**** *********\"\n assert title_before == title_after\n # comment_root_post\n # reply_to_comment\n # #check hybris post\n # create_post_from_hybris\n enable_profanity_blocker($networkslug, false)\n title2_before = \"watir test profanity blocker - #{get_timestamp}\"\n title2_after = PageObject.new(@browser).create_conversation($network, $networkslug, \"A Watir Topic\", \"question\", title2_before, false)\n assert title2_before == title2_after\n end",
"def ignore; end",
"def testNoAction\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal(nil, $Variables[:DummySenderCalls])\n end\n end",
"def test_nothing\n end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def ignore_request(_team, _user)\n # stub\n end",
"def ignore!\n @should_ignore = true\n end",
"def todo\n flunk \"test not written\"\n end",
"def testing\n # ...\n end",
"def wont_be_false(msg=nil)\n FalseAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end",
"def is_spam? \n # You'll need to get your own Akismet API key from www.akismet.com\n \n #return false;\n \n @akismet = Akismet.new('key', 'webpage') \n \n return nil unless @akismet.verifyAPIKey\n \n return self.spam!(:exempt => true) if @akismet.commentCheck(\n self.author_ip, # remote IP\n self.user_agent, # user agent\n self.referrer, # http referer\n self.page.url, # permalink\n 'comment', # comment type\n self.author, # author name\n self.author_email, # author email\n self.author_url, # author url\n self.content, # comment text\n {}) # other\n end",
"def skip_actions; end",
"def __dummy_test__\n end",
"def test04_EmptyGTDTiLD\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_event)\n\t\t\tsleep 2\n\t\t\tif $post_now.exists?\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PEV04T04: FAILED! Unable to locate Post button.\"\n\t\t\tend\n\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PEV04T04: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend",
"def test_ut_t5_sef_con_019\n assert ContextNotifier.send_email_waiting_but_no_analyzing\n # manually test by checking the mail.\n end",
"def handle_post_mortem; end",
"def test02_EmptyGTLDePopTiPublish\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_event)\n\t\t\tsleep 2\n\t\t\tif $post_event_time_start_field.exists?\n \t\t\t\t$post_event_time_start_field.click\n \t\t\t\t$post_event_select_time.select(\"8:00 AM\")\n \t\t\t\tpostPublishLater\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\t\tsleep 2\n\t\t\telse puts \"PPL05T02: FAILED! User able to Post.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PPL05T02: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend",
"def semact?; false; end",
"def before_run; end",
"def ignore_test_requests\n event_id = params[:event_id]\n response_id = params.dig(:form_response, :token)\n\n # If we don't have this information, don't do anything\n # the rest of the controller will handle the error\n return unless event_id.present? && response_id.present?\n\n # This is just a heuristic, but real form responses seem to have completely different tokens\n # and test webhook requests have tokens that start off the same as the event ID\n head :no_content if event_id[0..5] == response_id[0..5]\n end",
"def wont_be_empty(msg=nil)\n EmptyAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end",
"def test_nothing\n end",
"def test04_EmptyGTDTiLDPublish\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_event)\n\t\t\tsleep 2\n\t\t\tif $post_now.exists?\n\t\t\t\tpostPublishLater\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PPL04T04: FAILED! Unable to locate Post button.\"\n\t\t\tend\n\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PPL04T04: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend",
"def miss_reason; end",
"def never?; end",
"def useless\n @useful = false\n end",
"def graffiti_test\n end",
"def handle_unverified_request\n unless action_name == \"fire_object_search\" || action_name == \"fire_populate_drop_down\" \n super\n end\n end",
"def distracted?\n false\n end",
"def ygg_attacker() ; return nil ; end",
"def testNoAction\n executeTest('DummyUser', {})\n end",
"def before\n end",
"def use_agent?; end",
"def submit_spam(args)\n call_akismet('submit-spam', args)\n end",
"def sandbox?; end",
"def sandbox?; end",
"def ignores; end",
"def allow_in_post_mortem=(_arg0); end",
"def w3c_tests # :nologin:\n render(layout: false)\n end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def precheck\n end",
"def test_hack\n assert(true)\n end",
"def test02_EmptyGDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_now.exists?\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PEV03T02: FAILED! User unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PEV03T02: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\t\n\t\tend",
"def before() nil ; end",
"def verify\n end",
"def sharded?; false; end",
"def test_cannot_see_donee_wish_if_is_not_donee\n nonshared_wish=create_nonshared_wish\n \n get :show, {user_id: @current_user.id, id: nonshared_wish.id}\n\n assert_response :not_found\n end",
"def silence_deprecations; end",
"def hijacked; end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def test_accept_community\n assert public_trap_passes? \"public\"\n assert public_trap_passes? [\"test\", \"public\"]\n assert public_trap_passes? nil\n end",
"def pending?; end",
"def failsafe_action\n super\n end",
"def test_the_application_can_not_create_an_item_without_a_description\n #Implement the test\n #Controller action is already written.\n end",
"def noSecret()\r\n puts \"I won’t tell you our secret\"\r\n end",
"def testing!(msg=\"Expected to be in testing env, but was not.\")\n raise LT::Critical.new(msg) if !self.testing?\n end",
"def test04_EmptyGTDTiLPopDePublish\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_event)\n\t\t\tsleep 2\n\t\t\tif $post_event_location.exists?\n \t\t\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n\t\t\t\tpostPublishLater\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\t\tsleep 2\n\t\t\telse puts \"PPL05T04: FAILED! User able to Post.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PPL05T04: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend",
"def before; end",
"def needed_if_relevant?\n false\n end",
"def needed_if_relevant?\n false\n end",
"def mechanic_quest; end",
"def i_dont_see(what)\n assert !i_see?(what), __last_because + \" (actually see #{what})\"\n end",
"def test_nothing; end",
"def bots_not_allowed\n render_403('page') if visitor_is_bot?\n end",
"def uncovered\n return true\n end",
"def no_request?\n if self.submission\n return false\n else\n return true\n end\n end",
"def ignore_me\nend",
"def unofficial_submit\n \n feedback_str = request.body.read\n\n @course = Course.where(:id => params[:course_id]).first\n @assessment = Assessment.where(:id => params[:id]).first\n @user = User.where(:email => params[:user]).first\n\n if !@course then\n puts \"ERROR: invalid course\"\n exit\n end\n\n if !@user then\n puts \"ERROR: invalid username (#{user}) for class #{course.id}\"\n exit\n end\n\n if !@assessment then\n puts \"ERROR: Invalid Assessment (#{assessment}) for course #{course.id}\"\n exit\n end\n\n if [email protected]_unofficial then\n puts \"ERROR: This assessment does not allow Unofficial Submissions\"\n exit\n end\n\n @result = params[:result]\n\n if !@result then\n puts \"ERROR: No result!\"\n exit\n end\n\n # Everything looks OK, so append the autoresult to the log.txt file for this lab\n @logger = Logger.new(\"#{Rails.root}/courses/#{@course.name}/#{@assessment.name}/log.txt\")\n @logger.add(Logger::INFO) { \"#{@user.email},0,#{@result}\" }\n\n # Load up the lab.rb file\n modName = @assessment.name + (@course.name).gsub(/[^A-Za-z0-9]/,\"\")\n require(\"#{Rails.root}/assessmentConfig/#{@course.name}-#{@assessment.name}.rb\")\n eval(\"extend #{modName.camelcase}\")\n\n begin\n # Call the parseAutoresult function defined in the lab.rb file. If\n # the list of scores it returns is empty, then we the lab developer is\n # asking us not to create an unofficial submission in the\n # database. Simply return a successful status string to the client and\n # exit.\n scores = parseAutoresult(@result,false)\n\n if scores.keys.length == 0 then \n render :nothing => true and return\n end\n\n # Try to find an existing unofficial submission (always version 0). \n submission = @assessment.submissions.where(:version=>0,:user_id=>@user.id).first\n if !submission then\n submission = @assessment.submissions.new(:version=>0,\n :autoresult=>@result,\n :user_id=>@user.id,\n :submitted_by_id=>0)\n submission.save!()\n else\n #update this one\n submission.autoresult= @result\n submission.created_at = Time.now()\n submission.save!()\n end\n\n\n # Update the scores in the db's unofficial submission using the list\n # returned by the parseAutoresult function\n for key in scores.keys do\n problem = @assessment.problems.where(:name => key).first\n score = submission.scores.where(:problem_id => problem.id).first\n if !score then \n score = submission.scores.new(:problem_id=>problem.id)\n end\n score.score = scores[key]\n score.released = true\n score.grader_id= 0\n score.save!()\n end\n rescue Exception => e\n print e\n end\n\n\n render :nothing => true and return\n\n end",
"def test_nothing\n return true\n end",
"def disallow_teaching_staff_force_submit_assessment_submissions\n cannot :force_submit_assessment_submission, Course::Assessment\n end",
"def ibu; end",
"def before() ; end",
"def weber; end",
"def not_final\n @resp[:expectUserResponse] = true\n end",
"def soy_edificable\n return false\n end",
"def soy_edificable\n return false\n end",
"def spam?(env)\n\t\t\tparams = { blog: 'http://sivers.org/',\n\t\t\t\tuser_ip: env['REMOTE_ADDR'],\n\t\t\t\tuser_agent: env['HTTP_USER_AGENT'],\n\t\t\t\treferrer: env['HTTP_REFERER'],\n\t\t\t\tcomment_type: 'comment',\n\t\t\t\tcomment_author: env['rack.request.form_hash']['name'],\n\t\t\t\tcomment_author_email: env['rack.request.form_hash']['email'],\n\t\t\t\tcomment_content: env['rack.request.form_hash']['comment'] }\n\t\t\tparams.each {|k,v| params[k] = URI.encode_www_form_component(v)}\n\t\t\tkey = Sivers.config['akismet']\n\t\t\turi = URI(\"http://#{key}.rest.akismet.com/1.1/comment-check\")\n\t\t\t'true' == Net::HTTP.post_form(uri, params).body\n\t\tend",
"def example_pending; end",
"def verify\n # nothing to do here, so just return\n end",
"def missed?; end",
"def test03_EmptyGTDTiDePopLPublish\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_event)\n\t\t\tsleep 2\n\t\t\tif $post_event_location.exists?\n\t\t\t\t$post_event_location.set(\"Location #{random}\")\n\t\t\t\tpostPublishLater\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\t\tsleep 2\n\t\t\telse puts \"PPL05T03: FAILED! User able to Post.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PPL05T03: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend",
"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 reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end",
"def unanswered_with_my_tags\n request('unanswered/my-tags').auth_required!\n end",
"def test_push_nothing\n json = {:ref => 'refs/heads/master', :forced => false, :commits => [], :repository => {:name => 'web'}}.to_json\n post '/events', json\n assert_equal 422, last_response.status\n end",
"def testMissingUser\n setupTest do |iTasksFileName, iTicketsFileName|\n executeProcess(\n [\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ],\n :Error => WEACE::MissingVariableError\n )\n end\n end",
"def test_unit_not_dead\n end"
] | [
"0.62719405",
"0.60163856",
"0.5991905",
"0.59910226",
"0.59844375",
"0.5874197",
"0.5856557",
"0.57921964",
"0.5757335",
"0.5717968",
"0.56985873",
"0.56777436",
"0.5674995",
"0.56681556",
"0.56669265",
"0.56545115",
"0.5628268",
"0.56231636",
"0.5616189",
"0.5615758",
"0.5603625",
"0.56003994",
"0.55777854",
"0.5574566",
"0.5573784",
"0.55704206",
"0.55626196",
"0.5560012",
"0.5557637",
"0.5554557",
"0.55492294",
"0.5534903",
"0.5531539",
"0.55104977",
"0.55049866",
"0.5499603",
"0.5496547",
"0.54887205",
"0.54886705",
"0.5481926",
"0.54811037",
"0.54811037",
"0.5473711",
"0.5467921",
"0.54583013",
"0.54535806",
"0.54535806",
"0.545318",
"0.54522866",
"0.5451543",
"0.54451877",
"0.54414016",
"0.54378533",
"0.5426304",
"0.5418248",
"0.54156834",
"0.5415084",
"0.5415084",
"0.5415084",
"0.5415084",
"0.5415084",
"0.5415084",
"0.5415084",
"0.5414741",
"0.5414204",
"0.5413964",
"0.5409116",
"0.5406501",
"0.54064",
"0.54055196",
"0.5405071",
"0.5404668",
"0.54036343",
"0.5398454",
"0.5398393",
"0.5397649",
"0.539507",
"0.539428",
"0.5393072",
"0.5384952",
"0.538488",
"0.5381899",
"0.5378638",
"0.5375565",
"0.53737867",
"0.5369965",
"0.53675896",
"0.5365425",
"0.5365425",
"0.5360781",
"0.53534526",
"0.53287244",
"0.5327827",
"0.53265107",
"0.53248256",
"0.53248084",
"0.5323745",
"0.5313562",
"0.5310824",
"0.5303479"
] | 0.5305555 | 99 |
this solution is very slow!! (takes a number of hours to run to completion) | def is_abundant?(n)
factors(n).reduce(0, :+) > n
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_kpi_from_key_counter(all_fomula,s1_ip,time_counter_hash,source_file,logger)\n\ncell_size=3\n\ntime_counter_hash.each do |start_time,one_time_counter|\n\n counter_hash=one_time_counter\n #logger.debug \"kpi calculation for start time=#{start_time}\"\n all_cell_hash=Hash.new\n\n all_fomula.each do |fomula|\n #puts fomula.name\n #logger.debug \"start calculate fomula #{fomula.name}\"\n\n fomula_hash=Hash.new\n\n #获取原始公式并替换处理\n new_fomula=fomula.fomula_exp1.gsub(/sum|avg|\\[|\\]/,\"\")\n #获取一个公示里面所有的counter,并存放在数组中\n counter_array=fomula.fomula_exp1.scan(/M\\d+C\\d+/)\n\n counter_array.each do |counter|\n fomula_hash[counter]=counter_hash[counter]\n end\n\n #logger.debug \"fomula hash=#{fomula_hash}\"\n\n# we need convert fomulu to map to the array we calculated above\n cell_fomula_array=[]\n\n 0.upto(cell_size-1).each do |i|\n\n new_fomula_2=String.new(new_fomula)\n formated_fomula=\"\"\n counter_array.uniq.each do |counter|\n\n if fomula.formularid==\"LTE_5218c\" || fomula.formularid==\"LTE_5023d\" || fomula.formularid==\"LTE_5017a\" || fomula.formularid==\"LTE_5017a\" || fomula.formularid==\"LTE_5035a\" || fomula.formularid==\"LTE_5082a\" \\\n || fomula.formularid==\"LTE_5114a\" || fomula.formularid==\"LTE_5035a\" ||fomula.formularid==\"LTE_5048b\" || fomula.formularid==\"LTE_5082a\" || fomula.formularid==\"LTE_5114a\" || fomula.formularid==\"LTE_5043a\" \\\n || fomula.formularid==\"LTE_5058b\" || fomula.formularid==\"LTE_5119c\" ||fomula.formularid==\"LTE_5025d\"\n formated_fomula= new_fomula_2.gsub!(\"#{counter}\",\"fomula_hash\\[\\\"#{counter}\\\"\\]\\[#{i}\\].to_f\")\n\n else\n formated_fomula= new_fomula_2.gsub!(\"#{counter}\",\"fomula_hash\\[\\\"#{counter}\\\"\\]\\[#{i}\\]\")\n end\n \n end #end of each counter sacn\n #save converted fomulr\n cell_fomula_array << formated_fomula\n\n #logger.debug \"formated_fomula=#{formated_fomula}\"\n end\n\n#logger.debug cell_fomula_array\n\n #对于每一个cell的公式\n cell_fomula_array.each_index do |index|\n all_cell_hash[\"#{start_time}_cell#{index}\"] ||={}\n # logger.debug \"calculation formuala=#{cell_fomula_array[index]}\"\n\n merged_hash=all_cell_hash[\"#{start_time}_cell#{index}\"]\n\n merged_hash[\"start_time\"]=start_time\n merged_hash[\"source_file\"]=source_file\n merged_hash[\"s1_ip\"]=s1_ip\n merged_hash[\"kpi_hash\"]||={} #KPI is empty\n merged_hash[\"scopelevel\"]=\"cell-#{index+1}\"\n\n begin\n #logger.debug cell_fomula_array\n kpi_result=eval(cell_fomula_array[index].to_s)\n logger.debug \"kpi_result=#{kpi_result}\"\n if kpi_result.kind_of?(Float)\n kpi_result=kpi_result.round(2).to_s+\"%\"\n end\n\n\n # logger.debug \"kpi result=#{kpi_result}\"\n merged_hash[\"kpi_hash\"]=merged_hash[\"kpi_hash\"].merge({fomula.name.to_s=>kpi_result})\n \n rescue Exception => ex\n # puts ex\n logger.debug ex.class\n\n \t#logger.debug \"merged_hash=#{merged_hash}\"\n \t#merged_hash[\"kpi_hash\"]||=Hash.new #KPI is empty\n \t#\traise unless merged_hash[\"kpi_hash\"].kind_of?(Hash)\n merged_hash[\"kpi_hash\"]=merged_hash[\"kpi_hash\"].merge({fomula.name.to_s=>\"#{ex.class}\"})\n end #end of rescue\n\n \n \n all_cell_hash[\"#{start_time}_cell#{index}\"]=merged_hash\n # puts merged_hash\n end # end of 3 cell calculation \n #logger.debug all_cell_hash\n\t\n end #end of all fomula\n\nall_cell_hash.each do |key,value|\n #logger.debug \"start_time =#{key},value hash size=#{value[\"kpi_hash\"].size}\"\n value[\"kpi_hash\"]=value[\"kpi_hash\"].to_s\n kpi=Kpi.where(:s1_ip=>s1_ip,:start_time=>value[\"start_time\"],:scopelevel=>value[\"scopelevel\"]).first\n \n if kpi.nil?\n Kpi.create(value) \n # else\n # kpi.update_attributes(value) \n end\n\nend\n\nend \n\n\n\nend",
"def NL43_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTTGGTCCCAAAAAAGACAAGAGATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTTCAAGTTAGTACCAGTTGAACCAGAGCAAGTAGAAGAGGCCAAATAAGGAGAGAAGAACAGCTTGTTACACCCTATGAGCCAGCATGGGATGGAGGACCCGGAGGGAGAAGTATTAGTGTGGAAGTTTGACAGCCTCCTAGCATTTCGTCACATGGCCCGAGAGCTGCATCCGGAGTACTACAAAGACTGCTGACATCGAGCTTTCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGTGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTACATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTCAAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACTTGAAAGCGAAAGTAAAGCCAGAGGAGATCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCGGTATTAAGCGGGGGAGAATTAGATAAATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAACAATATAAACTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTTTTAGAGACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAATAGCAGTCCTCTATTGTGTGCATCAAAGGATAGATGTAAAAGACACCAAGGAAGCCTTAGATAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAGGCACAGCAAGCAGCAGCTGACACAGGAAACAACAGCCAGGTCAGCCAAAATTACCCTATAGTGCAGAACCTCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTAATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAATACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGATTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACACATAATCCACCTATCCCAGTAGGAGAAATCTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGATTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAAGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGGAGCGACACTAGAAGAAATGATGACAGCATGTCAGGGAGTGGGGGGACCCGGCCATAAAGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATCCAGCTACCATAATGATACAGAAAGGCAATTTTAGGAACCAAAGAAAGACTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACATAGCCAAAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCCACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTTTGGGGAAGAGACAACAACTCCCTCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAGCTTCCCTCAGATCACTCTTTGGCAGCGACCCCTCGTCACAATAAAGATAGGGGGGCAATTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAATTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGCGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGCTGCACTTTAAATTTTCCCATTAGTCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAAATGGAAAAGGAAGGAAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGATTTCTGGGAAGTTCAATTAGGAATACCACATCCTGCAGGGTTAAAACAGAAAAAATCAGTAACAGTACTGGATGTGGGCGATGCATATTTTTCAGTTCCCTTAGATAAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAGTGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTCATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAACTGAGACAACATCTGTTGAGGTGGGGATTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAGGACAGCTGGACTGTCAATGACATACAGAAATTAGTGGGAAAATTGAATTGGGCAAGTCAGATTTATGCAGGGATTAAAGTAAGGCAATTATGTAAACTTCTTAGGGGAACCAAAGCACTAACAGAAGTAGTACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGGGAGATTCTAAAAGAACCGGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAAGGGTGCCCACACTAATGATGTGAAACAATTAACAGAGGCAGTACAAAAAATAGCCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAATTACCCATACAAAAGGAAACATGGGAAGCATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTCAATACCCCTCCCTTAGTGAAGTTATGGTACCAGTTAGAGAAAGAACCCATAATAGGAGCAGAAACTTTCTATGTAGATGGGGCAGCCAATAGGGAAACTAAATTAGGAAAAGCAGGATATGTAACTGACAGAGGAAGACAAAAAGTTGTCCCCCTAACGGACACAACAAATCAGAAGACTGAGTTACAAGCAATTCATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTGACAGACTCACAATATGCATTGGGAATCATTCAAGCACAACCAGATAAGAGTGAATCAGAGTTAGTCAGTCAAATAATAGAGCAGTTAATAAAAAAGGAAAAAGTCTACCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATGGGTTGGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGAAGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTACCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGGGAAGCCATGCATGGACAAGTAGACTGTAGCCCAGGAATATGGCAGCTAGATTGTACACATTTAGAAGGAAAAGTTATCTTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTAATTCCAGCAGAGACAGGGCAAGAAACAGCATACTTCCTCTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAGTACATACAGACAATGGCAGCAATTTCACCAGTACTACAGTTAAGGCCGCCTGTTGGTGGGCGGGGATCAAGCAGGAATTTGGCATTCCCTACAATCCCCAAAGTCAAGGAGTAATAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAGATCCAGTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATCAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAACACATGGAAAAGATTAGTAAAACACCATATGTATATTTCAAGGAAAGCTAAGGACTGGTTTTATAGACATCACTATGAAAGTACTAATCCAAAAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAAATTAGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGACCTAGCAGACCAACTAATTCATCTGCACTATTTTGATTGTTTTTCAGAATCTGCTATAAGAAATACCATATTAGGACGTATAGTTAGTCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAGTACTTGGCACTAGCAGCATTAATAAAACCAAAACAGATAAAGCCACCTTTGCCTAGTGTTAGGAAACTGACAGAGGACAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCATACAATGAATGGACACTAGAGCTTTTAGAGGAACTTAAGAGTGAAGCTGTTAGACATTTTCCTAGGATATGGCTCCATAACTTAGGACAACATATCTATGAAACTTACGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATGACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAATGCAACCTATAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAGTATCAGCACTTGTGGAGATGGGGGTGGAAATGGGGCACCATGCTCCTTGGGATATTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGATAAGGTGCAGAAAGAATATGCATTCTTTTATAAACTTGATATAGTACCAATAGATAATACCAGCTATAGGTTGATAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATCAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGATGTAGTAATTAGATCTGCCAATTTCACAGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGTATCCGTATCCAGAGGGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATGCCACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACACTCCCATGCAGAATAAAACAATTTATAAACATGTGGCAGGAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACTGGGCTGCTATTAACAAGAGATGGTGGTAATAACAACAATGGGTCCGAGATCTTCAGACCTGGAGGAGGCGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCTGCACGTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGATATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAACAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATAACATGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAATCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTAGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAACTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTATTACAAGCAGCTTATAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTGCTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATGGGGTGGGAGCAGTATCTCGAGACCTAGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTAACAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAAGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTGGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGGTAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCTGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATGCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCACCCAGGAGGTAGAGGTTGCAGTGAGCCAAGATCGCGCCACTGCATTCCAGCCTGGGCAAGAAAACAAGACTGTCTAAAATAATAATAATAAGTTAAGGGTATTAAATATATTTATACATGGAGGTCATAAAAATATATATATTTGGGCTGGGCGCAGTGGCTCACACCTGCGCCCGGCCCTTTGGGAGGCCGAGGCAGGTGGATCACCTGAGTTTGGGAGTTCCAGACCAGCCTGACCAACATGGAGAAACCCCTTCTCTGTGTATTTTTAGTAGATTTTATTTTATGTGTATTTTATTCACAGGTATTTCTGGAAAACTGAAACTGTTTTTCCTCTACTCTGATACCACAAGAATCATCAGCACAGAGGAAGACTTCTGTGATCAAATGTGGTGGGAGAGGGAGGTTTTCACCAGCACATGAGCAGTCAGTTCTGCCGCAGACTCGGCGGGTGTCCTTCGGTTCAGTTCCAACACCGCCTGCCTGGAGAGAGGTCAGACCACAGGGTGAGGGCTCAGTCCCCAAGACATAAACACCCAAGACATAAACACCCAACAGGTCCACCCCGCCTGCTGCCCAGGCAGAGCCGATTCACCAAGACGGGAATTAGGATAGAGAAAGAGTAAGTCACACAGAGCCGGCTGTGCGGGAGAACGGAGTTCTATTATGACTCAAATCAGTCTCCCCAAGCATTCGGGGATCAGAGTTTTTAAGGATAACTTAGTGTGTAGGGGGCCAGTGAGTTGGAGATGAAAGCGTAGGGAGTCGAAGGTGTCCTTTTGCGCCGAGTCAGTTCCTGGGTGGGGGCCACAAGATCGGATGAGCCAGTTTATCAATCCGGGGGTGCCAGCTGATCCATGGAGTGCAGGGTCTGCAAAATATCTCAAGCACTGATTGATCTTAGGTTTTACAATAGTGATGTTACCCCAGGAACAATTTGGGGAAGGTCAGAATCTTGTAGCCTGTAGCTGCATGACTCCTAAACCATAATTTCTTTTTTGTTTTTTTTTTTTTATTTTTGAGACAGGGTCTCACTCTGTCACCTAGGCTGGAGTGCAGTGGTGCAATCACAGCTCACTGCAGCCTCAACGTCGTAAGCTCAAGCGATCCTCCCACCTCAGCCTGCCTGGTAGCTGAGACTACAAGCGACGCCCCAGTTAATTTTTGTATTTTTGGTAGAGGCAGCGTTTTGCCGTGTGGCCCTGGCTGGTCTCGAACTCCTGGGCTCAAGTGATCCAGCCTCAGCCTCCCAAAGTGCTGGGACAACCGGGCCCAGTCACTGCACCTGGCCCTAAACCATAATTTCTAATCTTTTGGCTAATTTGTTAGTCCTACAAAGGCAGTCTAGTCCCCAGCAAAAAGGGGGTTTGTTTCGGGAAAGGGCTGTTACTGTCTTTGTTTCAAACTATAAACTAAGTTCCTCCTAAACTTAGTTCGGCCTACACCCAGGAATGAACAAGGAGAGCTTGGAGGTTAGAAGCACGATGGAATTGGTTAGGTCAGATCTCTTTCACTGTCTGAGTTATAATTTTGCAATGGTGGTTCAAAGACTGCCCGCTTCTGACACCAGTCGCTGCATTAATGAATCGGCCAACGCGCGGGGAGAGGCGGTTTGCGTATTGGGCGCTCTTCCGCTTCCTCGCTCACTGACTCGCTGCGCTCGGTCGTTCGGCTGCGGCGAGCGGTATCAGCTCACTCAAAGGCGGTAATACGGTTATCCACAGAATCAGGGGATAACGCAGGAAAGAACATGTGAGCAAAAGGCCAGCAAAAGGCCAGGAACCGTAAAAAGGCCGCGTTGCTGGCGTTTTTCCATAGGCTCCGCCCCCCTGACGAGCATCACAAAAATCGACGCTCAAGTCAGAGGTGGCGAAACCCGACAGGACTATAAAGATACCAGGCGTTTCCCCCTGGAAGCTCCCTCGTGCGCTCTCCTGTTCCGACCCTGCCGCTTACCGGATACCTGTCCGCCTTTCTCCCTTCGGGAAGCGTGGCGCTTTCTCATAGCTCACGCTGTAGGTATCTCAGTTCGGTGTAGGTCGTTCGCTCCAAGCTGGGCTGTGTGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCGTCTTGAGTCCAACCCGGTAAGACACGACTTATCGCCACTGGCAGCAGCCACTGGTAACAGGATTAGCAGAGCGAGGTATGTAGGCGGTGCTACAGAGTTCTTGAAGTGGTGGCCTAACTACGGCTACACTAGAAGGACAGTATTTGGTATCTGCGCTCTGCTGAAGCCAGTTACCTTCGGAAAAAGAGTTGGTAGCTCTTGATCCGGCAAACAAACCACCGCTGGTAGCGGTGGTTTTTTTGTTTGCAAGCAGCAGATTACGCGCAGAAAAAAAGGATCTCAAGAAGATCCTTTGATCTTTTCTACGGGGTCTGACGCTCAGTGGAACGAAAACTCACGTTAAGGGATTTTGGTCATGAGATTATCAAAAAGGATCTTCACCTAGATCCTTTTAAATTAAAAATGAAGTTTTAAATCAATCTAAAGTATATATGAGTAAACTTGGTCTGACAGTTACCAATGCTTAATCAGTGAGGCACCTATCTCAGCGATCTGTCTATTTCGTTCATCCATAGTTGCCTGACTCCCCGTCGTGTAGATAACTACGATACGGGAGGGCTTACCATCTGGCCCCAGTGCTGCAATGATACCGCGAGACCCACGCTCACCGGCTCCAGATTTATCAGCAATAAACCAGCCAGCCGGAAGGGCCGAGCGCAGAAGTGGTCCTGCAACTTTATCCGCCTCCATCCAGTCTATTAATTGTTGCCGGGAAGCTAGAGTAAGTAGTTCGCCAGTTAATAGTTTGCGCAACGTTGTTGCCATTGCTACAGGCATCGTGGTGTCACGCTCGTCGTTTGGTATGGCTTCATTCAGCTCCGGTTCCCAACGATCAAGGCGAGTTACATGATCCCCCATGTTGTGCAAAAAAGCGGTTAGCTCCTTCGGTCCTCCGATCGTTGTCAGAAGTAAGTTGGCCGCAGTGTTATCACTCATGGTTATGGCAGCACTGCATAATTCTCTTACTGTCATGCCATCCGTAAGATGCTTTTCTGTGACTGGTGAGTACTCAACCAAGTCATTCTGAGAATAGTGTATGCGGCGACCGAGTTGCTCTTGCCCGGCGTCAATACGGGATAATACCGCGCCACATAGCAGAACTTTAAAAGTGCTCATCATTGGAAAACGTTCTTCGGGGCGAAAACTCTCAAGGATCTTACCGCTGTTGAGATCCAGTTCGATGTAACCCACTCGTGCACCCAACTGATCTTCAGCATCTTTTACTTTCACCAGCGTTTCTGGGTGAGCAAAAACAGGAAGGCAAAATGCCGCAAAAAAGGGAATAAGGGCGACACGGAAATGTTGAATACTCATACTCTTCCTTTTTCAATATTATTGAAGCATTTATCAGGGTTATTGTCTCATGAGCGGATACATATTTGAATGTATTTAGAAAAATAAACAAATAGGGGTTCCGCGCACATTTCCCCGAAAAGTGCCACCTGACGTCTAAGAAACCATTATTATCATGACATTAACCTATAAAAATAGGCGTATCACGAGGCCCTTTCGTCTCGCGCGTTTCGGTGATGACGGTGAAAACCTCTGACACATGCAGCTCCCGGAGACGGTCACAGCTTGTCTGTAAGCGGATGCCGGGAGCAGACAAGCCCGTCAGGGCGCGTCAGCGGGTGTTGGCGGGTGTCGGGGCTGGCTTAACTATGCGGCATCAGAGCAGATTGTACTGAGAGTGCACCATATGCGGTGTGAAATACCGCACAGATGCGTAAGGAGAAAATACCGCATCAGGCGCCATTCGCCATTCAGGCTGCGCAACTGTTGGGAAGGGCGATCGGTGCGGGCCTCTTCGCTATTACGCCAGGGGAGGCAGAGATTGCAGTAAGCTGAGATCGCAGCACTGCACTCCAGCCTGGGCGACAGAGTAAGACTCTGTCTCAAAAATAAAATAAATAAATCAATCAGATATTCCAATCTTTTCCTTTATTTATTTATTTATTTTCTATTTTGGAAACACAGTCCTTCCTTATTCCAGAATTACACATATATTCTATTTTTCTTTATATGCTCCAGTTTTTTTTAGACCTTCACCTGAAATGTGTGTATACAAAATCTAGGCCAGTCCAGCAGAGCCTAAAGGTAAAAAATAAAATAATAAAAAATAAATAAAATCTAGCTCACTCCTTCACATCAAAATGGAGATACAGCTGTTAGCATTAAATACCAAATAACCCATCTTGTCCTCAATAATTTTAAGCGCCTCTCTCCACCACATCTAACTCCTGTCAAAGGCATGTGCCCCTTCCGGGCGCTCTGCTGTGCTGCCAACCAACTGGCATGTGGACTCTGCAGGGTCCCTAACTGCCAAGCCCCACAGTGTGCCCTGAGGCTGCCCCTTCCTTCTAGCGGCTGCCCCCACTCGGCTTTGCTTTCCCTAGTTTCAGTTACTTGCGTTCAGCCAAGGTCTGAAACTAGGTGCGCACAGAGCGGTAAGACTGCGAGAGAAAGAGACCAGCTTTACAGGGGGTTTATCACAGTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACATTGCACCCTGACAGTCGTCAGCCTCACAGGGGGTTTATCACAGTGCACCCTTACAATCATTCCATTTGATTCACAATTTTTTTAGTCTCTACTGTGCCTAACTTGTAAGTTAAATTTGATCAGAGGTGTGTTCCCAGAGGGGAAAACAGTATATACAGGGTTCAGTACTATCGCATTTCAGGCCTCCACCTGGGTCTTGGAATGTGTCCCCCGAGGGGTGATGACTACCTCAGTTGGATCTCCACAGGTCACAGTGACACAAGATAACCAAGACACCTCCCAAGGCTACCACAATGGGCCGCCCTCCACGTGCACATGGCCGGAGGAACTGCCATGTCGGAGGTGCAAGCACACCTGCGCATCAGAGTCCTTGGTGTGGAGGGAGGGACCAGCGCAGCTTCCAGCCATCCACCTGATGAACAGAACCTAGGGAAAGCCCCAGTTCTACTTACACCAGGAAAGGC\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/temp\"\n temp_aln = temp_dir + \"/temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n l1 = 0 if l1 < 0\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\nrescue\n return [0,0,0,0,\"N\",\"N\"]\nend",
"def find_small_set_of_string_in_large_string( large_string, small_string_set)\n \n #create and array of size L,\n small_string_size = small_string_set[0].size\n window_array = []\n \n (0..small_string_size-1).each do |index|\n window_array[index] = {}\n end\n \n #build dthe window array as we look a all the small string in a set\n small_string_set.each do |str|\n (0..str.size - 1).each do |index|\n if !window_array[index].has_key? str[index] \n #create new hash\n window_array[index][str[index]]={}\n end\n window_array[index][str[index]][str] = str\n end\n end\n\n all_found = []\n (0..large_string.size - small_string_size).each do |window_start|\n found_set = []\n first_set = true\n qualified_length = 0\n\n (window_start..window_start + small_string_size -1 ).each do |index|\n \n #puts \"String start at index #{window_start} '#{\"\"<<large_string[window_start]}'\"\n \n if window_array[ index - window_start ].has_key? large_string[index ]\n if first_set \n window_array[ index - window_start ][large_string[index]].each do |key, val|\n found_set.push(key)\n end\n first_set = false\n else\n window_array[ index - window_start ][large_string[index]].each do |key, val|\n if !found_set.include? key\n found_set.delete(key)\n end\n end\n end\n qualified_length += 1 if !found_set.empty? #suvire from the delete, increase the qualified lenghth\n elsif first_set == false and found_set.empty?\n #puts \"stop examing 1\"\n break\n else\n #puts \"stop examing 2 -- #{window_start.to_s} #{index.to_s}\"\n break\n end\n end #end of exampling each slow of the window\n #only print and save qualify string\n #p qualified_length , window_array.size\n if qualified_length == window_array.size\n all_found = all_found | found_set\n \n #puts \"Found:\" + found_set.join(\",\")\n end\n \n end\n #p window_array\n return all_found\nend",
"def slow_build_pattern_prefix_function(pattern)\n prefix_fnc_array = []\n prefix_fnc_array[0] = -1\n prefix_fnc_array[1] = 0\n padded_pattern = \" \" + pattern # padded so that index 1 will point to the start of the pattern\n \n (2..pattern.size ).each do |q|\n k = 0\n (1..q-1).each do |index|\n #puts \"#{q} #{index} #{padded_pattern[1..index]} #{padded_pattern[ q - index + 1 .. q]} \"\n if padded_pattern[1..index] == padded_pattern[ q - index + 1 .. q] \n k = index \n end\n end\n prefix_fnc_array[q] = k\n \n end\n\n return prefix_fnc_array\nend",
"def private; end",
"def find_hash(possible_words, known_anagram, known_md5s, start, n = 3)\n cpus = Parallel.processor_count\n puts \"Total number of iteration: #{possible_words.length**n}\"\n puts \"You got #{cpus} cores\"\n\n hash_table = get_hash_table(known_anagram)\n known_hash = get_hash(known_anagram, hash_table)\n\n Parallel.map(possible_words, in_processes: cpus) do |w1|\n possible_words.each do |w2|\n possible_words.each do |w3|\n # Print every ten million iteration\n phrase = \"#{w1} #{w2} #{w3}\"\n\n # Allow only equal size phrases\n next unless phrase.length == known_anagram.length\n\n # Allow only equal hash phrases\n hash = get_hash(phrase, hash_table)\n next unless hash == known_hash\n\n # All only equal md5 phrases\n md5 = Digest::MD5.hexdigest phrase\n next unless known_md5s.include?(md5)\n\n puts \"#{phrase} #{md5} (#{Time.now - start}s)\"\n end\n end\n end\nend",
"def generate_comprehensive\n\n end",
"def check_duplication (n=10)\n\n # get the first n hits\n less_hits = @hits[0..[n-1,@hits.length].min]\n averages = []\n\n less_hits.each do |hit|\n # indexing in blast starts from 1\n start_match_interval = hit.hsp_list.each.map{|x| x.hit_from}.min - 1\n end_match_interval = hit.hsp_list.map{|x| x.hit_to}.max - 1\n \n #puts \"#{hit.xml_length} #{start_match_interval} #{end_match_interval}\" \n\n coverage = Array.new(hit.xml_length,0)\n hit.hsp_list.each do |hsp|\n aux = []\n # for each hsp\n # iterate through the alignment and count the matching residues\n [*(0 .. hsp.align_len-1)].each do |i|\n residue_hit = hsp.hit_alignment[i]\n residue_query = hsp.query_alignment[i]\n if residue_hit != ' ' and residue_hit != '+' and residue_hit != '-'\n if residue_hit == residue_query \n idx = i + (hsp.hit_from-1) - hsp.hit_alignment[0..i].scan(/-/).length \n aux.push(idx)\n #puts \"#{idx} #{i} #{hsp.hit_alignment[0..i].scan(/-/).length}\"\n # indexing in blast starts from 1\n coverage[idx] += 1\n end\n end\n end\n end\n overlap = coverage.reject{|x| x==0}\n averages.push(overlap.inject(:+)/(overlap.length + 0.0))\n end\n \n # if all hsps match only one time\n if averages.reject{|x| x==1} == []\n return [\"NO\",1]\n end\n\n R.eval(\"library(preprocessCore)\")\n\n #make the wilcox-test and get the p-value\n R.eval(\"coverageDistrib = c#{averages.to_s.gsub('[','(').gsub(']',')')}\")\n R. eval(\"pval = wilcox.test(coverageDistrib - 1)$p.value\")\n pval = R.pull \"pval\"\n\n if pval < 0.01\n status = \"YES\"\n else\n status = \"NO\"\n end\n return [status, pval]\n end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def find_params(fonts)\n 1.upto(9) do |d|\n 2.times do\n 1.upto(999) do |u|\n 1.upto(999) do |v|\n if fonts.all? {|f| solve_identity(u, v, f + d) }\n table = fonts.map do |f|\n solve_identity(u, v, f + d).reverse\n end.transpose.flatten.map {|c| c.chr }.join\n return u, v, d, table\n end\n end\n end\n d = -d\n end\n end\n puts \"Not found.\"\n exit\nend",
"def schubert; end",
"def suivre; end",
"def stderrs; end",
"def sequence_locator(seq=\"\",temp_dir=File.dirname($0))\n hxb2_ref = \"TGGAAGGGCTAATTCACTCCCAACGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTAGCAGAACTACACACCAGGGCCAGGGATCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGAGAAGTTAGAAGAAGCCAACAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGAATGGATGACCCGGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACATGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATCCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCAGTGGCGCCCGAACAGGGACCTGAAAGCGAAAGGGAAACCAGAGGAGCTCTCTCGACGCAGGACTCGGCTTGCTGAAGCGCGCACGGCAAGAGGCGAGGGGCGGCGACTGGTGAGTACGCCAAAAATTTTGACTAGCGGAGGCTAGAAGGAGAGAGATGGGTGCGAGAGCGTCAGTATTAAGCGGGGGAGAATTAGATCGATGGGAAAAAATTCGGTTAAGGCCAGGGGGAAAGAAAAAATATAAATTAAAACATATAGTATGGGCAAGCAGGGAGCTAGAACGATTCGCAGTTAATCCTGGCCTGTTAGAAACATCAGAAGGCTGTAGACAAATACTGGGACAGCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAGATCATTATATAATACAGTAGCAACCCTCTATTGTGTGCATCAAAGGATAGAGATAAAAGACACCAAGGAAGCTTTAGACAAGATAGAGGAAGAGCAAAACAAAAGTAAGAAAAAAGCACAGCAAGCAGCAGCTGACACAGGACACAGCAATCAGGTCAGCCAAAATTACCCTATAGTGCAGAACATCCAGGGGCAAATGGTACATCAGGCCATATCACCTAGAACTTTAAATGCATGGGTAAAAGTAGTAGAAGAGAAGGCTTTCAGCCCAGAAGTGATACCCATGTTTTCAGCATTATCAGAAGGAGCCACCCCACAAGATTTAAACACCATGCTAAACACAGTGGGGGGACATCAAGCAGCCATGCAAATGTTAAAAGAGACCATCAATGAGGAAGCTGCAGAATGGGATAGAGTGCATCCAGTGCATGCAGGGCCTATTGCACCAGGCCAGATGAGAGAACCAAGGGGAAGTGACATAGCAGGAACTACTAGTACCCTTCAGGAACAAATAGGATGGATGACAAATAATCCACCTATCCCAGTAGGAGAAATTTATAAAAGATGGATAATCCTGGGATTAAATAAAATAGTAAGAATGTATAGCCCTACCAGCATTCTGGACATAAGACAAGGACCAAAGGAACCCTTTAGAGACTATGTAGACCGGTTCTATAAAACTCTAAGAGCCGAGCAAGCTTCACAGGAGGTAAAAAATTGGATGACAGAAACCTTGTTGGTCCAAAATGCGAACCCAGATTGTAAGACTATTTTAAAAGCATTGGGACCAGCGGCTACACTAGAAGAAATGATGACAGCATGTCAGGGAGTAGGAGGACCCGGCCATAAGGCAAGAGTTTTGGCTGAAGCAATGAGCCAAGTAACAAATTCAGCTACCATAATGATGCAGAGAGGCAATTTTAGGAACCAAAGAAAGATTGTTAAGTGTTTCAATTGTGGCAAAGAAGGGCACACAGCCAGAAATTGCAGGGCCCCTAGGAAAAAGGGCTGTTGGAAATGTGGAAAGGAAGGACACCAAATGAAAGATTGTACTGAGAGACAGGCTAATTTTTTAGGGAAGATCTGGCCTTCCTACAAGGGAAGGCCAGGGAATTTTCTTCAGAGCAGACCAGAGCCAACAGCCCCACCAGAAGAGAGCTTCAGGTCTGGGGTAGAGACAACAACTCCCCCTCAGAAGCAGGAGCCGATAGACAAGGAACTGTATCCTTTAACTTCCCTCAGGTCACTCTTTGGCAACGACCCCTCGTCACAATAAAGATAGGGGGGCAACTAAAGGAAGCTCTATTAGATACAGGAGCAGATGATACAGTATTAGAAGAAATGAGTTTGCCAGGAAGATGGAAACCAAAAATGATAGGGGGAATTGGAGGTTTTATCAAAGTAAGACAGTATGATCAGATACTCATAGAAATCTGTGGACATAAAGCTATAGGTACAGTATTAGTAGGACCTACACCTGTCAACATAATTGGAAGAAATCTGTTGACTCAGATTGGTTGCACTTTAAATTTTCCCATTAGCCCTATTGAGACTGTACCAGTAAAATTAAAGCCAGGAATGGATGGCCCAAAAGTTAAACAATGGCCATTGACAGAAGAAAAAATAAAAGCATTAGTAGAAATTTGTACAGAGATGGAAAAGGAAGGGAAAATTTCAAAAATTGGGCCTGAAAATCCATACAATACTCCAGTATTTGCCATAAAGAAAAAAGACAGTACTAAATGGAGAAAATTAGTAGATTTCAGAGAACTTAATAAGAGAACTCAAGACTTCTGGGAAGTTCAATTAGGAATACCACATCCCGCAGGGTTAAAAAAGAAAAAATCAGTAACAGTACTGGATGTGGGTGATGCATATTTTTCAGTTCCCTTAGATGAAGACTTCAGGAAGTATACTGCATTTACCATACCTAGTATAAACAATGAGACACCAGGGATTAGATATCAGTACAATGTGCTTCCACAGGGATGGAAAGGATCACCAGCAATATTCCAAAGTAGCATGACAAAAATCTTAGAGCCTTTTAGAAAACAAAATCCAGACATAGTTATCTATCAATACATGGATGATTTGTATGTAGGATCTGACTTAGAAATAGGGCAGCATAGAACAAAAATAGAGGAGCTGAGACAACATCTGTTGAGGTGGGGACTTACCACACCAGACAAAAAACATCAGAAAGAACCTCCATTCCTTTGGATGGGTTATGAACTCCATCCTGATAAATGGACAGTACAGCCTATAGTGCTGCCAGAAAAAGACAGCTGGACTGTCAATGACATACAGAAGTTAGTGGGGAAATTGAATTGGGCAAGTCAGATTTACCCAGGGATTAAAGTAAGGCAATTATGTAAACTCCTTAGAGGAACCAAAGCACTAACAGAAGTAATACCACTAACAGAAGAAGCAGAGCTAGAACTGGCAGAAAACAGAGAGATTCTAAAAGAACCAGTACATGGAGTGTATTATGACCCATCAAAAGACTTAATAGCAGAAATACAGAAGCAGGGGCAAGGCCAATGGACATATCAAATTTATCAAGAGCCATTTAAAAATCTGAAAACAGGAAAATATGCAAGAATGAGGGGTGCCCACACTAATGATGTAAAACAATTAACAGAGGCAGTGCAAAAAATAACCACAGAAAGCATAGTAATATGGGGAAAGACTCCTAAATTTAAACTGCCCATACAAAAGGAAACATGGGAAACATGGTGGACAGAGTATTGGCAAGCCACCTGGATTCCTGAGTGGGAGTTTGTTAATACCCCTCCCTTAGTGAAATTATGGTACCAGTTAGAGAAAGAACCCATAGTAGGAGCAGAAACCTTCTATGTAGATGGGGCAGCTAACAGGGAGACTAAATTAGGAAAAGCAGGATATGTTACTAATAGAGGAAGACAAAAAGTTGTCACCCTAACTGACACAACAAATCAGAAGACTGAGTTACAAGCAATTTATCTAGCTTTGCAGGATTCGGGATTAGAAGTAAACATAGTAACAGACTCACAATATGCATTAGGAATCATTCAAGCACAACCAGATCAAAGTGAATCAGAGTTAGTCAATCAAATAATAGAGCAGTTAATAAAAAAGGAAAAGGTCTATCTGGCATGGGTACCAGCACACAAAGGAATTGGAGGAAATGAACAAGTAGATAAATTAGTCAGTGCTGGAATCAGGAAAGTACTATTTTTAGATGGAATAGATAAGGCCCAAGATGAACATGAGAAATATCACAGTAATTGGAGAGCAATGGCTAGTGATTTTAACCTGCCACCTGTAGTAGCAAAAGAAATAGTAGCCAGCTGTGATAAATGTCAGCTAAAAGGAGAAGCCATGCATGGACAAGTAGACTGTAGTCCAGGAATATGGCAACTAGATTGTACACATTTAGAAGGAAAAGTTATCCTGGTAGCAGTTCATGTAGCCAGTGGATATATAGAAGCAGAAGTTATTCCAGCAGAAACAGGGCAGGAAACAGCATATTTTCTTTTAAAATTAGCAGGAAGATGGCCAGTAAAAACAATACATACTGACAATGGCAGCAATTTCACCGGTGCTACGGTTAGGGCCGCCTGTTGGTGGGCGGGAATCAAGCAGGAATTTGGAATTCCCTACAATCCCCAAAGTCAAGGAGTAGTAGAATCTATGAATAAAGAATTAAAGAAAATTATAGGACAGGTAAGAGATCAGGCTGAACATCTTAAGACAGCAGTACAAATGGCAGTATTCATCCACAATTTTAAAAGAAAAGGGGGGATTGGGGGGTACAGTGCAGGGGAAAGAATAGTAGACATAATAGCAACAGACATACAAACTAAAGAATTACAAAAACAAATTACAAAAATTCAAAATTTTCGGGTTTATTACAGGGACAGCAGAAATCCACTTTGGAAAGGACCAGCAAAGCTCCTCTGGAAAGGTGAAGGGGCAGTAGTAATACAAGATAATAGTGACATAAAAGTAGTGCCAAGAAGAAAAGCAAAGATCATTAGGGATTATGGAAAACAGATGGCAGGTGATGATTGTGTGGCAAGTAGACAGGATGAGGATTAGAACATGGAAAAGTTTAGTAAAACACCATATGTATGTTTCAGGGAAAGCTAGGGGATGGTTTTATAGACATCACTATGAAAGCCCTCATCCAAGAATAAGTTCAGAAGTACACATCCCACTAGGGGATGCTAGATTGGTAATAACAACATATTGGGGTCTGCATACAGGAGAAAGAGACTGGCATTTGGGTCAGGGAGTCTCCATAGAATGGAGGAAAAAGAGATATAGCACACAAGTAGACCCTGAACTAGCAGACCAACTAATTCATCTGTATTACTTTGACTGTTTTTCAGACTCTGCTATAAGAAAGGCCTTATTAGGACACATAGTTAGCCCTAGGTGTGAATATCAAGCAGGACATAACAAGGTAGGATCTCTACAATACTTGGCACTAGCAGCATTAATAACACCAAAAAAGATAAAGCCACCTTTGCCTAGTGTTACGAAACTGACAGAGGATAGATGGAACAAGCCCCAGAAGACCAAGGGCCACAGAGGGAGCCACACAATGAATGGACACTAGAGCTTTTAGAGGAGCTTAAGAATGAAGCTGTTAGACATTTTCCTAGGATTTGGCTCCATGGCTTAGGGCAACATATCTATGAAACTTATGGGGATACTTGGGCAGGAGTGGAAGCCATAATAAGAATTCTGCAACAACTGCTGTTTATCCATTTTCAGAATTGGGTGTCGACATAGCAGAATAGGCGTTACTCGACAGAGGAGAGCAAGAAATGGAGCCAGTAGATCCTAGACTAGAGCCCTGGAAGCATCCAGGAAGTCAGCCTAAAACTGCTTGTACCAATTGCTATTGTAAAAAGTGTTGCTTTCATTGCCAAGTTTGTTTCATAACAAAAGCCTTAGGCATCTCCTATGGCAGGAAGAAGCGGAGACAGCGACGAAGAGCTCATCAGAACAGTCAGACTCATCAAGCTTCTCTATCAAAGCAGTAAGTAGTACATGTAACGCAACCTATACCAATAGTAGCAATAGTAGCATTAGTAGTAGCAATAATAATAGCAATAGTTGTGTGGTCCATAGTAATCATAGAATATAGGAAAATATTAAGACAAAGAAAAATAGACAGGTTAATTGATAGACTAATAGAAAGAGCAGAAGACAGTGGCAATGAGAGTGAAGGAGAAATATCAGCACTTGTGGAGATGGGGGTGGAGATGGGGCACCATGCTCCTTGGGATGTTGATGATCTGTAGTGCTACAGAAAAATTGTGGGTCACAGTCTATTATGGGGTACCTGTGTGGAAGGAAGCAACCACCACTCTATTTTGTGCATCAGATGCTAAAGCATATGATACAGAGGTACATAATGTTTGGGCCACACATGCCTGTGTACCCACAGACCCCAACCCACAAGAAGTAGTATTGGTAAATGTGACAGAAAATTTTAACATGTGGAAAAATGACATGGTAGAACAGATGCATGAGGATATAATCAGTTTATGGGATCAAAGCCTAAAGCCATGTGTAAAATTAACCCCACTCTGTGTTAGTTTAAAGTGCACTGATTTGAAGAATGATACTAATACCAATAGTAGTAGCGGGAGAATGATAATGGAGAAAGGAGAGATAAAAAACTGCTCTTTCAATATCAGCACAAGCATAAGAGGTAAGGTGCAGAAAGAATATGCATTTTTTTATAAACTTGATATAATACCAATAGATAATGATACTACCAGCTATAAGTTGACAAGTTGTAACACCTCAGTCATTACACAGGCCTGTCCAAAGGTATCCTTTGAGCCAATTCCCATACATTATTGTGCCCCGGCTGGTTTTGCGATTCTAAAATGTAATAATAAGACGTTCAATGGAACAGGACCATGTACAAATGTCAGCACAGTACAATGTACACATGGAATTAGGCCAGTAGTATCAACTCAACTGCTGTTAAATGGCAGTCTAGCAGAAGAAGAGGTAGTAATTAGATCTGTCAATTTCACGGACAATGCTAAAACCATAATAGTACAGCTGAACACATCTGTAGAAATTAATTGTACAAGACCCAACAACAATACAAGAAAAAGAATCCGTATCCAGAGAGGACCAGGGAGAGCATTTGTTACAATAGGAAAAATAGGAAATATGAGACAAGCACATTGTAACATTAGTAGAGCAAAATGGAATAACACTTTAAAACAGATAGCTAGCAAATTAAGAGAACAATTTGGAAATAATAAAACAATAATCTTTAAGCAATCCTCAGGAGGGGACCCAGAAATTGTAACGCACAGTTTTAATTGTGGAGGGGAATTTTTCTACTGTAATTCAACACAACTGTTTAATAGTACTTGGTTTAATAGTACTTGGAGTACTGAAGGGTCAAATAACACTGAAGGAAGTGACACAATCACCCTCCCATGCAGAATAAAACAAATTATAAACATGTGGCAGAAAGTAGGAAAAGCAATGTATGCCCCTCCCATCAGTGGACAAATTAGATGTTCATCAAATATTACAGGGCTGCTATTAACAAGAGATGGTGGTAATAGCAACAATGAGTCCGAGATCTTCAGACCTGGAGGAGGAGATATGAGGGACAATTGGAGAAGTGAATTATATAAATATAAAGTAGTAAAAATTGAACCATTAGGAGTAGCACCCACCAAGGCAAAGAGAAGAGTGGTGCAGAGAGAAAAAAGAGCAGTGGGAATAGGAGCTTTGTTCCTTGGGTTCTTGGGAGCAGCAGGAAGCACTATGGGCGCAGCCTCAATGACGCTGACGGTACAGGCCAGACAATTATTGTCTGGTATAGTGCAGCAGCAGAACAATTTGCTGAGGGCTATTGAGGCGCAACAGCATCTGTTGCAACTCACAGTCTGGGGCATCAAGCAGCTCCAGGCAAGAATCCTGGCTGTGGAAAGATACCTAAAGGATCAACAGCTCCTGGGGATTTGGGGTTGCTCTGGAAAACTCATTTGCACCACTGCTGTGCCTTGGAATGCTAGTTGGAGTAATAAATCTCTGGAACAGATTTGGAATCACACGACCTGGATGGAGTGGGACAGAGAAATTAACAATTACACAAGCTTAATACACTCCTTAATTGAAGAATCGCAAAACCAGCAAGAAAAGAATGAACAAGAATTATTGGAATTAGATAAATGGGCAAGTTTGTGGAATTGGTTTAACATAACAAATTGGCTGTGGTATATAAAATTATTCATAATGATAGTAGGAGGCTTGGTAGGTTTAAGAATAGTTTTTGCTGTACTTTCTATAGTGAATAGAGTTAGGCAGGGATATTCACCATTATCGTTTCAGACCCACCTCCCAACCCCGAGGGGACCCGACAGGCCCGAAGGAATAGAAGAAGAAGGTGGAGAGAGAGACAGAGACAGATCCATTCGATTAGTGAACGGATCCTTGGCACTTATCTGGGACGATCTGCGGAGCCTGTGCCTCTTCAGCTACCACCGCTTGAGAGACTTACTCTTGATTGTAACGAGGATTGTGGAACTTCTGGGACGCAGGGGGTGGGAAGCCCTCAAATATTGGTGGAATCTCCTACAGTATTGGAGTCAGGAACTAAAGAATAGTGCTGTTAGCTTGCTCAATGCCACAGCCATAGCAGTAGCTGAGGGGACAGATAGGGTTATAGAAGTAGTACAAGGAGCTTGTAGAGCTATTCGCCACATACCTAGAAGAATAAGACAGGGCTTGGAAAGGATTTTGCTATAAGATGGGTGGCAAGTGGTCAAAAAGTAGTGTGATTGGATGGCCTACTGTAAGGGAAAGAATGAGACGAGCTGAGCCAGCAGCAGATAGGGTGGGAGCAGCATCTCGAGACCTGGAAAAACATGGAGCAATCACAAGTAGCAATACAGCAGCTACCAATGCTGCTTGTGCCTGGCTAGAAGCACAAGAGGAGGAGGAGGTGGGTTTTCCAGTCACACCTCAGGTACCTTTAAGACCAATGACTTACAAGGCAGCTGTAGATCTTAGCCACTTTTTAAAAGAAAAGGGGGGACTGGAAGGGCTAATTCACTCCCAAAGAAGACAAGATATCCTTGATCTGTGGATCTACCACACACAAGGCTACTTCCCTGATTAGCAGAACTACACACCAGGGCCAGGGGTCAGATATCCACTGACCTTTGGATGGTGCTACAAGCTAGTACCAGTTGAGCCAGATAAGATAGAAGAGGCCAATAAAGGAGAGAACACCAGCTTGTTACACCCTGTGAGCCTGCATGGGATGGATGACCCGGAGAGAGAAGTGTTAGAGTGGAGGTTTGACAGCCGCCTAGCATTTCATCACGTGGCCCGAGAGCTGCATCCGGAGTACTTCAAGAACTGCTGACATCGAGCTTGCTACAAGGGACTTTCCGCTGGGGACTTTCCAGGGAGGCGTGGCCTGGGCGGGACTGGGGAGTGGCGAGCCCTCAGATCCTGCATATAAGCAGCTGCTTTTTGCCTGTACTGGGTCTCTCTGGTTAGACCAGATCTGAGCCTGGGAGCTCTCTGGCTAACTAGGGAACCCACTGCTTAAGCCTCAATAAAGCTTGCCTTGAGTGCTTCAAGTAGTGTGTGCCCGTCTGTTGTGTGACTCTGGTAACTAGAGATCCCTCAGACCCTTTTAGTCAGTGTGGAAAATCTCTAGCA\"\n hxb2_l = hxb2_ref.size\n head = \"\"\n 8.times {head << (65 + rand(25)).chr}\n temp_file = temp_dir + \"/\" + head + \"_temp\"\n temp_aln = temp_dir + \"/\" + head + \"_temp_aln\"\n\n l1 = 0\n l2 = 0\n name = \">test\"\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts hxb2_ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n\n begin\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n if ref_size > 1.3*(seq.size)\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n max_seq = aln_test2.scan(/[ACGT]+/).max_by(&:length)\n aln_test2 =~ /#{max_seq}/\n before_aln_seq = $`\n before_aln = $`.size\n post_aln_seq = $'\n post_aln = $'.size\n before_aln_seq_size = before_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b1 = (1.3 * before_aln_seq_size).to_i\n post_aln_seq_size = post_aln_seq.scan(/[ACGT]+/).join(\"\").size\n b2 = (1.3 * post_aln_seq_size).to_i\n if (before_aln > seq.size) and (post_aln <= seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1)]\n l1 = l1 + (before_aln - b1)\n elsif (post_aln > seq.size) and (before_aln <= seq.size)\n ref = ref[before_aln..(ref_size - post_aln - 1 + b2)]\n l2 = l2 + post_aln - b2\n elsif (post_aln > seq.size) and (before_aln > seq.size)\n ref = ref[(before_aln - b1)..(ref_size - post_aln - 1 + b2)]\n l1 = l1 + (before_aln - b1)\n l2 = l2 + (post_aln - b2)\n end\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test2 = $2\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n ref_size = ref.size\n end\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n\n if g1 == g2 and (s1 + g1 + s2) == ref.size\n if s1 > s2 and g2 > 2*s2\n ref = ref[0..(-g2-1)]\n repeat = 1\n l2 = l2 + g2\n elsif s1 < s2 and g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n else\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n\n while repeat == 1\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n aln_test =~ /^(\\-*)(\\w.*\\w)(\\-*)$/\n gap_begin = $1.size\n gap_end = $3.size\n aln_test = $2\n aln_test =~ /^(\\w+)(\\-*)\\w/\n s1 = $1.size\n g1 = $2.size\n aln_test =~ /\\w(\\-*)(\\w+)$/\n s2 = $2.size\n g2 = $1.size\n ref = aln_seq[\">ref\"]\n ref = ref[gap_begin..(-gap_end-1)]\n l1 = l1 + gap_begin\n l2 = l2 + gap_end\n repeat = 0\n if g1 > 2*s1\n ref = ref[g1..-1]\n repeat = 1\n l1 = l1 + g1\n end\n if g2 > 2*s2\n ref = ref[0..(-g2 - 1)]\n repeat = 1\n l2 = l2 + g2\n end\n end\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n #refine alignment\n\n if ref =~ /^(\\-+)/\n l1 = l1 - $1.size\n elsif ref =~ /(\\-+)$/\n l2 = l2 + $1.size\n end\n\n if (hxb2_l - l2 - 1) >= l1\n ref = hxb2_ref[l1..(hxb2_l - l2 - 1)]\n temp_in = File.open(temp_file,\"w\")\n temp_in.puts \">ref\"\n temp_in.puts ref\n temp_in.puts name\n temp_in.puts seq\n temp_in.close\n print `muscle -in #{temp_file} -out #{temp_aln} -quiet`\n aln_seq = fasta_to_hash(temp_aln)\n aln_test = aln_seq[name]\n ref = aln_seq[\">ref\"]\n\n ref_size = ref.size\n sim_count = 0\n (0..(ref_size-1)).each do |n|\n ref_base = ref[n]\n test_base = aln_test[n]\n sim_count += 1 if ref_base == test_base\n end\n similarity = (sim_count/ref_size.to_f*100).round(1)\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n loc_p1 = l1 + 1\n loc_p2 = hxb2_l - l2\n if seq.size != (loc_p2 - loc_p1 + 1)\n indel = true\n elsif aln_test.include?(\"-\")\n indel = true\n else\n indel = false\n end\n return [loc_p1,loc_p2,similarity,indel,aln_test,ref]\n else\n return [0,0,0,0,0,0,0]\n end\n rescue\n print `rm -f #{temp_file}`\n print `rm -f #{temp_aln}`\n return [0,0,0,0,0,0,0]\n end\nend",
"def probers; end",
"def genome(liszt)\n=begin\n[samopen] SAM header is present: 2 sequences\n7621912 reads; of these:\n 4009241 (52.60%) were paired; of these:\n 1983557 (49.47%) aligned concordantly 0 times\n 1818685 (45.36%) aligned concordantly exactly 1 time\n 206999 (5.16%) aligned concordantly >1 times\n ----\n 1983557 pairs aligned concordantly 0 times; of these:\n 409503 (20.64%) aligned discordantly 1 time\n ----\n 1574054 pairs aligned 0 times concordantly or discordantly; of these:\n 3148108 mates make up the pairs; of these:\n 1009275 (32.06%) aligned 0 times\n 35392 (1.12%) aligned exactly 1 time\n 2103441 (66.82%) aligned >1 times\n 3612671 (47.40%) were unpaired; of these:\n 498719 (13.80%) aligned 0 times\n 2246121 (62.17%) aligned exactly 1 time\n 867831 (24.02%) aligned >1 times\n=end\n #puts(liszt);exit\n dict={}; liszt.shift\n dict[\"total\"]=liszt.shift.split[0]; #liszt.shift\n dict[\"paired\"]=liszt.shift.split[0]; liszt.shift #conc 0\n dict[\"conc_once\"]=liszt.shift.split[0]\n dict[\"conc_mult\"]=liszt.shift.split[0]\n liszt.shift(2); dict[\"disc_once\"]=\"\"; dict[\"disc_mult\"]=\"\"\n line=liszt.shift\n line.include?(\">1 times\") ? dict[\"disc_mult\"]=line.split[0] : dict[\"disc_once\"]=line.split[0]\n liszt.shift\n dict[\"unaligned_pairs\"]=liszt.shift.split[0]\n liszt.shift\n dict[\"unmates\"]=liszt.shift.split[0] #unaligned mates\n dict[\"mate_once\"]=liszt.shift.split[0]\n dict[\"mate_mult\"]=liszt.shift.split[0]\n dict[\"unpaired\"]=liszt.shift.split[0]\n dict[\"unpair_unaligned\"]=liszt.shift.split[0]\n dict[\"unpair_once\"]=liszt.shift.split[0]\n dict[\"unpair_mult\"]=liszt.shift.split[0]\n dict\nend",
"def 500_files(input)\n # naive solution is to flatten and sort\n\n \nend",
"def remove_duplicates_full (temp_geo)\n geo_full_final=Array.new\n indexes=Array.new\n i=1 \n while temp_geo[i]\n j=i-1\n \tuntil j==0\n \t if temp_geo[i][:long]==temp_geo[j][:long] && temp_geo[i][:lat]==temp_geo[j][:lat]\n \t\t unless indexes.include? i\n \t\t indexes.push(i) \n \t \t end\n \t \tbreak\n \t else\n \t j-=1\n \t end \n \tend \n \t i+=1\n end\n\t p \"loading uniq data\"\n\t i=0\n\t while indexes[i]\n \t\t unless indexes.include?(i)\n\t\t\t geo_full_final.push(temp_geo[i])\t\t\n \t\t end\t\n \t i+=1\n\t end\ngeo_full_final\nend",
"def sdrm_int(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[66] = ['T',['A','I','K']]\n # sdrm[68] = ['L',['V']] not included any more\n sdrm[74] = ['L',['M']]\n sdrm[92] = ['E',['Q']]\n sdrm[95] = ['Q',['K']]\n sdrm[97] = ['T',['A']]\n sdrm[121] = ['F',['Y']]\n sdrm[140] = ['G',['A','S','C']]\n sdrm[143] = [\"Y\",[\"C\",\"H\",\"R\"]]\n sdrm[147] = ['S',['G']]\n sdrm[148] = ['Q',['H','K','R']]\n sdrm[155] = ['N',['S','H']]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n\n end\n end\n return out_hash\nend",
"def euler66\n max = 0\n val = 0\n min = 0 \n set = Set.new\n vec = [] \n (2..1000).each do |r|\n num = 1\n \n set.clear()\n vec.clear() \n\n sr = Math.sqrt(r)\n min = val = sr.floor\n\n next if min*min==r\n\n print \"#{r}: \" if $debug\n\n num = ( r - val*val ) / num\n \n #print \"(#{num})\"\n\n tval = 0 \n tmin = -min\n while ( ( sr - tmin ) / num ) > 1\n tval += 1\n tmin += num\n #print \"#{tmin} #{( ( sr - tmin ) / num )}\"\n end\n min = tmin \n val = tval\n\n print \"(#{tval}_#{min}_#{num})\" if $debug\n set.add(\"#{tval}_#{min}_#{num}\")\n vec.push(tval)\n\n # This section get from Euler64\n freq = 1\n while true\n num = ( r - min*min ) / num\n \n tval = 0 \n tmin = -min\n while ( ( sr - tmin ) / num ) > 1\n tval += 1\n tmin += num\n end\n min = tmin \n val = tval\n\n str = \"#{tval}_#{min}_#{num}\"\n break if set.include?(str) \n print \" (#{str})\" if $debug\n set.add(str)\n vec.push(tval)\n freq += 1\n end\n print \" # #{freq}\" if $debug\n\n num = 1\n if vec.size==1\n den = vec.last\n lnum = 2 \n vec.reverse.drop(lnum).each do |v|\n tval = den\n den = v*den + num \n num = tval \n end\n num = sr.floor * den + num \n else \n n = vec.size\n vec_ = vec + vec # One frequent section is not enough\n\n # variable backup\n tden = den \n tnum = num\n\n # We need to continue trying ... \n (n..2*n).each do |nn|\n tvec = vec_[0..nn-1]\n den = tvec.reverse.drop(1).last\n tvec.reverse.drop(2).each do |v|\n tval = den\n den = v*den + num \n num = tval \n end\n num = sr.floor * den + num\n \n break if (num*num-den*den*r)==1 # Check if this fraction is any \n den = tden \n num = tnum\n end \n end\n \n puts \" => #{num} #{den} \" if $debug\n\n if max < num \n $ans = r\n max = num\n end\n end\nend",
"def transform; end",
"def villian; end",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end",
"def translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend",
"def gettrys(tcoords)\n # Indexa coordenadas de las lineas con menor incognitas\n p \"hmiss............\"\n p tcoords[:hmiss]\n hlower_c = lowerabsent(tcoords[:hmiss]) # [{:hindex=>x, :coords=> [[]]\n vlower_c = lowerabsent(tcoords[:vmiss],\"v\") # [{:vindex=>x, :coords=>[[]]\n slower_c = lowerabsent(tcoords[:smiss],\"s\") # [{:sindex=>x, :coords=>[[]]\n\n # combierte las coordenadas en numeros -> contiene menor incognitas\n hlower_n = hlower_c.collect {|line| missto_n(line[:hindex])} # [{:hindex=>0, :numbers=>[3, 4]}, x]\n vlower_n = vlower_c.collect {|line| missto_n(line[:vindex],tcoords[:vwhole], \"v\")} # [{:vindex=>0, :numbers=>[3, 4]}, x]\n #slower_n = slower_c.collect {|line| missto_n(line[:sindex], tcoords[:swhole], \"s\")} # [{:sindex=>2, :numbers=>[4, 6, 8]}, x]\n p \"****** H vs V *******\"\n p hlower_c.length < vlower_c.length ? \"h < v\" : \"h > v\"\n # cantidad de incognitas decide si se usa h o v\n p lower_c = hlower_c.length < vlower_c.length ? hlower_c : vlower_c\n lower_n = lower_c[0].keys[0][0] == \"h\" ? hlower_n : vlower_n\n # le pone cuadro a cada coord y separa coordenadas, una por linea\n hvindex_sindex_coords = locatecoord_onsquere(lower_c, tcoords[:swhole])\n sqr_n = hvindex_sindex_coords.collect {|item| missto_n(item[:sindex], tcoords[:swhole],\"s\")}\n # buscar que sqr tiene menos coincidencias\n hvindex_sindex_coords.collect { |main|\n main[:sqr_options] = sqr_n.collect {|numbers| numbers[:numbers] if main[:sindex] == numbers[:sindex] }.compact.flatten\n main[:options] = lower_n.collect {|numbers| numbers[:numbers] if main[main.keys[0]] == numbers[numbers.keys[0]] }.compact.flatten\n main[:reduce] = main[:options] - ([1,2,3,4,5,6,7,8,9] - main[:sqr_options])\n\n }\n # numbers[:numbers] if main[main.keys[0]] == numbers[numbers.keys[0]]\n result = hvindex_sindex_coords.group_by {|g| g[:reduce].length}\n\n p \"*******start Result\"\n reduce_index = result.collect {|x,y| x }.min\n result[reduce_index].map {|e| p e} # inspect\n result[reduce_index].map do |item|\n\n case item.keys[0][0]\n when \"h\"\n if item[:reduce].length == 1\n x = item[:coord][0]\n y = item[:coord][1]\n @tbls[:notformated][x][y] = item[:reduce][0]\n @tbls[:formated][x][y] = formato(@tbls[:notformated][x][y].to_s,:red, :yellow)\n elsif item[:reduce].length > 1\n # Pregunta en linea vertical\n end\n when \"v\"\n p \"################## - caso vertical pendiente - ###################\"; exit\n end\n\n end\n\n end",
"def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend",
"def sdrm_nrti(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[41] = ['M',['L']]\n sdrm[65] = ['K',['R']]\n sdrm[67] = ['D',['N','G','E']]\n sdrm[69] = ['T',['D']]\n sdrm[70] = ['K',['R','E']]\n sdrm[74] = ['L',['V','I']]\n sdrm[75] = ['V',['M','T','A','S']]\n sdrm[77] = ['F',['L']]\n sdrm[115] = ['Y',['F']]\n sdrm[116] = ['F',['Y']]\n sdrm[151] = ['Q',['M']]\n sdrm[184] = ['M',['V','I']]\n sdrm[210] = ['L',['W']]\n sdrm[215] = [\"T\",[\"Y\",\"F\",\"I\",\"C\",\"D\",\"V\",\"E\",\"S\"]]\n sdrm[219] = [\"K\",[\"Q\",\"E\",\"N\",\"R\"]]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n\n end\n end\n return out_hash\nend",
"def doing_raw_file_to_verified_unique_researches # adjustable line length filter\n consumer = Fiber.new do |producer, queue|\n a = File.read(\"../../Documents/20111224-research.txt\")\n\t new = a.to_textual\n#TODO finishe\t \n @megadata = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n @megadata_unique = @megadata.uniq\n f = open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n #IO.foreach(\"./tmp/database_doings/doing_uniques/uniques_todo.txt\") do |line|\n queue = \"\"\n puts queue\n @megadata_unique.each do |line|\n sequence_text = line.to_textual.de_comma\n if sequence_text.length < 50 # adjustable\n puts \"line ignored due to length\"\n elsif Sequence.find_by_sequence_text(sequence_text)\n puts \"line ignored as it is already in database : \" + \"#{sequence_text}\"\n else\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n description = \"research\"\n reference = \"literoti\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n created_at = \"2011-12-21 12:12:00\"\n #line = \"#{sequence_text}\\n\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n end\n end\n raise StopIteration\n end",
"def terpene; end",
"def schumann; end",
"def berlioz; end",
"def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend",
"def test_row_first(r)\n flag = false\n $pages[r-1].select{|p| (p.p >> PAGE_SHIFT).even? }.each {|p|\n $pages[r+1].select {|q| (q.p >> PAGE_SHIFT).even? and conflict?(p.v, q.v)\n }.each {|q|\n flag |= hammer_row(r, p, q, $ntime_max)\n } \n }\n return flag\nend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def anchored; end",
"def main\n results = {}\n strings = Hash.new(Array.new)\n 0.upto(10000).each do |ind|\n result = Helper.to_power_3(ind)\n results[ind] = result\n key = result.to_s.split(//).sort.join\n strings[key] += [ind]\n if strings[key].size == 5\n puts strings[key][0] \n puts results[strings[key][0]]\n break\n end\n \n end\n\n#puts results[345]\n#puts results[384]\n#puts results[405]\n\n#strings.each do |key,value|\n#pp results[value[0]] if value.length == 5\n#end\n \nend",
"def find_hex_ciphertext_slow(possible_hex_ciphertexts)\n long_running do\n ciphertexts = possible_hex_ciphertexts.map do |hex_ciphertext|\n long_running_progress\n key = find_key(hex_to_raw(hex_ciphertext))\n plaintext = hex_to_raw(decrypt(hex_ciphertext, hex_key: raw_to_hex(key)))\n Struct.new(:hex, :plaintext_score)[hex_ciphertext, score_plaintext(plaintext)]\n end\n\n ciphertexts.max_by(&:plaintext_score).hex\n end\nend",
"def sequence_check_for_submission(sequence,group_hash,reversed_group_hash)\n\n result_array = Array.new\n aa_threshold = 0.9\n \n begin\n \n query = Bio::FastaFormat.new( sequence )\n query_name = query.definition\n sequence = query.to_seq\n\n existing_matched_group_exist = CustomizedProteinSequence.find_by(:chain => sequence.seq)\n if !existing_matched_group_exist.nil? # find existing sequence\n result_array << collection(query_name, \"WARN\", \"Your sequence exists in our database. Common Name: #{existing_matched_group_exist.header} \")\n return result_array\n end\n\n sequence.auto # Guess the type of sequence. Changes the class of sequence.\n query_sequence_type = sequence.seq.class == Bio::Sequence::AA ? 'protein' : 'gene'\n\n program = 'blastp'\n database = 'reductive_dehalogenase_protein'\n blast_options = get_blast_options\n\n\n blaster = Bio::Blast.local( program, \"#{Rails.root}/index/blast/#{database}\", blast_options)\n aa_report = blaster.query(sequence.seq) # sequence.seq automatically remove the \\n; possibly other wildcard\n aa_similarity = aa_report.hits().length.to_f / aa_report.db_num().to_f\n identity_with_90 = check_alignment_identity(aa_report, 90) # identity_with_90 contains all the header that share >=90% identity\n\n # group_hash => group : Array {seq_definition}\n # reversed_group_hash = seq_definition : group\n if identity_with_90.length > 0\n identified_group_at_aa_level = get_identified_group(identity_with_90,group_hash,reversed_group_hash) # identified_group_at_aa_level contains confirmed group in aa level \n else\n # if identity_with_90.length == 0; no RD with ~=90% identity => create new RD groups\n\n if aa_similarity >= aa_threshold\n last_group = CustomizedProteinSequence.group(:group).order(:group).last.group\n new_group_number = last_group + 1\n result_array << collection(query_name,\"NEW\", \"Your sequence belongs to a new RD group: #{new_group_number}\",new_group_number)\n else\n result_array << collection(query_name, \"FAILED\",\"Your sequence doesn't share 90\\% identity of any sequences in database at amino acid level.\")\n end\n\n return result_array\n end\n\n if identified_group_at_aa_level.length > 0\n result_array << collection(query_name, \"SUCCESS\",\"Your sequence belongs RD group: #{identified_group_at_aa_level.join(\",\")}\",identified_group_at_aa_level.join(\",\"))\n else\n result_array << collection(query_name, \"FAILED\",\"Your sequence doesn't share 90\\% identity with all representatives of the group at amino acid level.\")\n end\n\n return result_array\n \n rescue => exception\n # puts exception\n result_array << collection(query_name, \"ERROR\",\"Your sequence is not validated. Or send it to our lab for manual checking.\")\n end\n \n return result_array\n\n end",
"def problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend",
"def process(dfstr)\n tracelog {\"process(commands, input).\"}\n #\"\"\"Filesystem Size Used Avail Use%\n # /dev/grid/node-x0-y0 92T 73T 19T 79%\"\"\"\n linect = 0\n nodes = {}\n dfstr.each_line do |line|\n linect += 1\n line = line.chomp.chomp\n tracelog { \"read-line #{linect}: #{line}\" }\n if md = (/^\\/dev\\/grid\\/node\\-x(\\d+)\\-y(\\d+) +(\\d+)T +(\\d+)T +(\\d+)T +(\\d+)%$/.match line) #md = (/^\\/dev\\/grid\\/node\\-x(\\d+)\\-y(\\d+) +(\\d+) +(\\d+) +(\\d+) +(\\d+)%$/.match line)\n x = md[1].to_i\n y = md[2].to_i\n siz = md[3].to_i\n usd = md[4].to_i\n ava = md[5].to_i\n prc = md[6].to_i\n key = \"#{x},#{y}\"\n nodes[key] = {:size=>siz, :used=>usd, :avail=>ava, :useperc=>prc}\n tracelog {\"node[#{key}]=#{nodes[key]}\"}\n else\n deblog {\" skipped line ##{linect} #{line}.\"}\n end\n end\n deblog {\"#nodes=#{nodes.size} of #lines=#{linect}\"}\n \n viabpairnum = 0\n nodes.each do |a_key, a_vals|\n nodes.each do |b_key, b_vals|\n #next if a_key == b_key\n if a_vals[:used] > 0 && a_key != b_key && a_vals[:used] <= b_vals[:avail]\n tracelog {\"viable pair: A=#{a_key}, used=#{a_vals[:used]}; B=#{b_key}, avail=#{b_vals[:avail]}\"}\n viabpairnum += 1\n end\n end\n end\n viabpairnum\nend",
"def find_word( file, target_letter_height, iterations )\n\n points = []\n File.open( file , \"r\" ) do |f|\n f.each_line do |line|\n matches = /position=<\\s*([^\\s]+),\\s*([^\\s]+)> velocity=<\\s*([^\\s]+),\\s*([^\\s]+)>/.match( line )\n points << Point.new( matches[1].to_i, matches[2].to_i, matches[3].to_i, matches[4].to_i )\n end\n end\n\n iter_counter = 0\n candidate_grid = nil\n candidate_iteration = nil\n cols_at_height_current = 0\n \n loop do\n\n break if iter_counter >= iterations\n\n allpoints = {}\n xmaxes = Hash.new( 0 )\n \n points.each do |p|\n p.x = p.xvel + p.x \n p.y = p.yvel + p.y \n key = \"#{p.x},#{p.y}\"\n \n # if we have not yet seen this point, then count its x pos\n if ! allpoints.key?( key )\n xmaxes[p.x] = xmaxes[p.x] + 1\n end\n \n allpoints[key] = 1\n end\n\n # figure out how many columns we have, that are at the same row value\n cols_at_height = 0\n xmaxes.each do |k,v|\n cols_at_height = cols_at_height + 1 if v == target_letter_height\n end\n\n if cols_at_height > cols_at_height_current\n cols_at_height_current = cols_at_height\n candidate_grid = allpoints.dup\n candidate_iteration = iter_counter\n end\n \n iter_counter += 1\n end\n\n [ candidate_iteration + 1, candidate_grid ]\nend",
"def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend",
"def get_route(curr_pos, end_time, pmap, tws, twe) \n ans = []\n starting_tuple = curr_pos << 0 # 0 is the waiting time\n ans << starting_tuple # [y, x, time unit]\n \n\t\n\t\n max_y = pmap.length - 1 \n max_x = pmap[0].length - 1\n \n highest_score = 0.0\n \n\ttime_for_score = 0.0\n\ttime_for_get_ans = 0.0\n\t\n\ttemp = -1\n\ttemp1 = 0\n\tfor y in 0..max_y\n\t\ttemp1 = pmap[y].count(temp)+ temp1 \n\tend\n\t\n\tno_of_pokemon = (pmap.length*pmap[0].length - temp1)\n\t\n\tnumber_of_loops = 0.7541*Math.log(no_of_pokemon,E) + 0.9829\n\t\n\n\t\n\t\n for h in 0...number_of_loops\n pmap1 = Marshal.load(Marshal.dump(pmap))\n tws1 = Marshal.load(Marshal.dump(tws))\n twe1 = Marshal.load(Marshal.dump(twe))\n\t\t\n time_taken = Time.now\n sortedArrayByRatioDistStart1 = []\n ans1 = []\n ans1 = getArrayResultsWithStartingPokemon(starting_tuple, pmap1, tws1, twe1, sortedArrayByRatioDistStart1, end_time, h)\n\t\ttime_for_get_ans = Time.now - time_taken + time_for_get_ans\n\t\t\n\t\tpmap1 = Marshal.load(Marshal.dump(pmap))\n tws1 = Marshal.load(Marshal.dump(tws))\n twe1 = Marshal.load(Marshal.dump(twe))\n\t\t\n\t\ttime_taken = Time.now\n score_time1 = get_score(ans1, pmap1, tws1, twe1)\n route_score1 = score_time1[0].round\n route_time1 = score_time1[1].round(3)\n time_for_score = Time.now - time_taken + time_for_score\n\t\t\n if highest_score <= route_score1\n final_ans = ans1\n highest_score = route_score1\n end\n\t\t\n\t\t\n end\n \n\n return final_ans\nend",
"def processdup_all(c)\n prev_base = nil\n show = false\n c.each do |l|\n base = get_base(l[:file])\n if prev_base && base != prev_base\n show = true\n break\n end\n prev_base = base\n end\n if show\n c.each do |l|\n puts \"#{get_file(l[:file])} similarity #{l[:count]}\"\n end\n puts \"\"\n end\nend",
"def getMostCover records\n numset = []\n num = 0\n wArry=[];\n for i in 0...@maxloopnum do\n for j in [email protected] do\n for k in j+1 [email protected] do\n for n in [email protected] do\n if @pairs[n].firstParam ==j and @pairs[n].secondParam ==k\n for m in 0...@pairs[n].pairsArr.length do\n if records.recordsArr[i].valuesArr[j] == @pairs[n].pairsArr[m].firstValue and records.recordsArr[i].valuesArr[k] ==@pairs[n].pairsArr[m].secondValue and @pairs[n].pairsArr[m].isVisited== false\n num+=1\n \n end\n end\n end\n end\n end\n end\n numset << num\n num =0\n end\n maxtag=0\n maxnum=0\n max = Array.new\n for i in 0...@maxloopnum do\n if numset[i] == maxnum\n max << i \n elsif numset[i] > maxnum\n maxnum = numset[i]\n max.clear\n max << i\n end \n end\n #addb by chuangye ----------------------start\n if @useweight==1\n for h in 0...max.length do\n weight=0\n for p in [email protected] do\n pos=records.recordsArr[max[h]].valuesArr[p]\n [email protected][p].elementsArr[pos].weight\n \n end\n wArry << [max[h],weight]\n end\n maxweight=wArry[0][1]\n maxArry=[]\n for x in 0... wArry.length do\n if wArry[x][1]==maxweight\n maxArry << wArry[x][0]\n elsif wArry[x][1]==maxweight\n maxArry.clear\n maxArry << wArry[x][0]\n end\n \n end\n tag= randchar(0,maxArry.length-1)\n return maxArry[tag]\n else \n #add by chuangye ------------------------end\n tag = randchar(0,max.length-1)\n return max[tag]\n end\n end",
"def check_target_in_exon(exon_id,strand_target,strand,len_bioseq,exones_site)\r\n #we are going to keep the exon_id, the strand and the location of the target for the gff file\r\n target_in_exon = Hash.new\r\n strand_target.each do |pos|\r\n #c=[]--> vector auxiliar \r\n c=[]\r\n pos.zip(exones_site).map { |x, y| c << x-y}\r\n if c[0] >=0 && c[1] <= 0\r\n if strand == 'reverse'\r\n #the target is in the exon\r\n #for the format of ebi we have to change again our start and final points \r\n e_start = len_bioseq - pos[1].to_i\r\n e_final = len_bioseq - pos[0].to_i\r\n target_in_exon[[e_start,e_final]] = [exon_id,'-']\r\n else\r\n target_in_exon[[pos[0],pos[1]]] = [exon_id,'+']\r\n end\r\n end\r\n end\r\n if not target_in_exon.empty? # We check there are targets inside the exon\r\n return target_in_exon\r\n end\r\nend",
"def files_500(files)\n prc = Proc.new { |x, y| x[0] <=> y[0] }\n heap = BinaryMinHeap.new()\n result = []\n\n files.length.time do |i|\n heap.push([files[i][0], i, 0])\n end\n\n while heap.count > 0\n min = heap.extract\n result << min[0]\n\n next_arr_i = min[1]\n next_idx = min[2] + 1\n next_el = files[next_arr_i][next_idx]\n\n heap.push([next_el, next_arr_i, next_idx]) if next_el\n end\n result\nend",
"def proteinInfo2hash (xmlRes)\n\n#\t\txmlDoc = Document.new xmlRes\n#\t\tentries = xmlDoc.elements.collect('uniprot/entry') { |ent| ent }\n\t\txmlDoc = Nokogiri::XML(xmlRes)\n\t\tentries = xmlDoc.css('uniprot > entry')\n# just take the very first entry\n\t\tmain_entry = entries.first\n\n\t\trecommended_name = main_entry.css('protein > recommendedName > fullName').collect {\n\t\t\t|node| node.text\n\t\t}\n\t\tsynonyms = main_entry.css('protein > alternativeName > fullName').collect {\n\t\t\t|alt_name| alt_name.text\n\t\t}\n\t\tkeywords = main_entry.css('keyword').collect { |keyw| keyw.text }\n\n\t\torganism = main_entry.css('organism > name').collect { |org|\n\t\t\tif org['type'] == 'scientific' then org.text end\n\t\t}\n\t\tfunction = main_entry.css(\"comment[type='function']\").collect { |func|\n\t\t\tfunc.text\n\t\t}\n\t\tlocation = main_entry.css(\"comment[type='subcellular location'] > subcellularLocation > location\").collect { |loc|\n\t\t\tloc.text\n\t\t}\n\n\t\tmolWeight = nil\n\t\tseqLength = nil\n\t\tseq = nil\n\t\tmain_entry.css(\"/sequence\").collect { |theSeq|\n\t\t\tmolWeight = theSeq.attributes['mass'].value\n\t\t\tseqLength = theSeq.attributes['length'].value\n\t\t\tseq = theSeq.text\n\t\t}\n\n# the very first pdb reference is got. a comparison based on resolution can improve the choice\n\t\tpdbs = main_entry.css(\"dbReference[type='PDB']\").collect { |pdb|\n\t\t\tpdb\n\t\t}\n\t\tpdbNodeMalformed = false\n\t\tpdbs.each { |node|\n\t\t\tresolution = node.css(\"property[type='resolution']\")\n\t\t\tif resolution.nil? || resolution.length == 0 then\n\t\t\t\tpdbNodeMalformed = true\n\t\t\t\tbreak\n\t\t\tend\n\t\t}\n\t\tif pdbs.empty? == false && pdbNodeMalformed == false\n# sort by value resolution to get the element with lowes resolution value\n\t\t\tpdbs = pdbs.sort_by{ |node|\n\t\t\t\tnode.css(\"property[type='resolution']\").first['value']\n\t\t\t}\n\t\tend\n\n\n\t\tpdbResult = ''\n\t\tif pdbs.empty? == false\n\t\t\tpdbResult = 'http://www.pdb.org/pdb/explore/explore.do?structureId='\n#\t\t\tpdbResult += pdbs[0].css(\"property[type='resolution']\").first['value']\n\t\t\tpdbResult += pdbs[0].attributes['id'].value\n\t\tend\n\t\thash_result = Hash.new\n\t\thash_result[:target_name] = \"#{recommended_name[0]} (#{organism[0]})\"\n\t\thash_result[:target_type] = 'PROTEIN'\n\t\thash_result[:description] = recommended_name[0]\n\t\thash_result[:synonyms] = synonyms.join('; ')\n\t\thash_result[:organism] = organism[0]\n\t\thash_result[:keywords] = keywords.join('; ')\n\t\thash_result[:cellularLocations] = location.join('; ')\n\t\thash_result[:molecularWeight] = molWeight\n\t\thash_result[:numberOfResidues] = seqLength\n\t\thash_result[:sequence] = seq\n\t\thash_result[:specificFunction] = function.join('; ')\n\t\thash_result[:pdbIdPage] = pdbResult\n\t\thash_result[:theoreticalPi] = nil\n\n\t\thash_result\n\tend",
"def commonChild(s1, s2)\n arr_s1 = s1.split(//)\n arr_s2 = s2.split(//)\n common = arr_s1 & arr_s2\n if common.length != 0\n s1_com = []\n s2_com = []\n arr_s1.each do |s1|\n if common.include?(s1)\n s1_com << s1\n end\n end\n arr_s2.each do |s2|\n if common.include?(s2)\n s2_com << s2\n end\n end\n row = [0]*(s2_com.size+1)\n for i in 1..s1_com.size\n column = [0]\n for j in 1..s2_com.size\n column.push s1_com[i-1] == s2_com[j-1] ? row[j-1]+1 : [column[j-1], row[j]].max\n end\n row = column\n end\n return row[-1]\n else\n return 0\n end\n # create first liine\n # row = [0]*(s1.size+1)\n # for i in 1..s1.size\n # column = [0]\n # for j in 1..s2.size\n # column.push s1[i-1] == s2[j-1] ? row[j-1]+1 : [column[j-1], row[j]].max\n # end\n # row = column\n # end\n # return row[-1]\n # # arr_s1 = s1.split(//)\n # # arr_s2 = s2.split(//)\n # common = arr_s1 & arr_s2\n # if common.length != 0\n # s1_com = []\n # s2_com = []\n # arr_s1.each do |s1|\n # if common.include?(s1)\n # s1_com << s1\n # end\n # end\n # arr_s2.each do |s2|\n # if common.include?(s2)\n # s2_com << s2\n # end\n # end\n # com_length = Array.new(s1_com.length, Array.new(s2_com.length, 0))\n # p com_length\n # com_length[0][1] = 'A'\n # com_length[1][1] = 'C'\n # com_length[1][0] = 'B'\n # p com_length[1][1]\n # s1_com.each_with_index do |s1,i|\n # s2_com.each_with_index do |s2, j|\n # if i == 0\n # if s1 == s2\n # com_length[i][j] = 1\n # else\n # if j != 0\n # if com_length[i][j-1] != 0\n # com_length[i][j] = com_length[i][j-1]\n # end\n # end\n # end\n # else\n # if j == 0\n # if s1 == s2\n # com_length[i][1] = 1\n # end\n # else\n # if s1 == s2\n # com_length[i][j] = com_length[i-1][j-1] + 1\n # else\n # if com_length[i-1][j] != 0 && com_length[i][j-1] != 0\n # com_length[i][j] = [com_length[i-1][j], com_length[i][j-1]].max\n # elsif com_length[i-1][j] != 0\n # com_length[i][j] = com_length[i-1][j]\n # elsif com_length[i][j-1] != 0\n # com_length[i][j] = com_length[i][j-1]\n # end\n # end\n # end\n # end\n # end\n # end\n # rs = 0\n # p com_length\n # com_length.each do |r|\n # if r.max > rs\n # rs = r.max\n # end\n # end\n # return rs\n # else\n # return 0\n # end\nend",
"def single_connected_fragmentation\n peptide2 = @peptide.split('').insert(0,\"h\").insert(-1,\"oh\").join\n frag__b = ([email protected]+1).collect do |num|\n peptide2.split('').insert(num,'b').join \n end\n frag__y = (2..(@peptide.size)).to_a.collect do |ei|\n peptide2.split('').insert(ei,'y').join \n end\t\t\t\n final_arry_spectra = [frag__b,frag__y].flatten.collect do |pep_b|\n\t\t\t\tpep_b.gsub!(/[by]/, 'b'=>'+-h', 'y'=>'%-hh+').split(\"-\")\n end \n final_arry_spectra\n end",
"def recursive_solution\n\n end",
"def identify; end",
"def compare(f1, f2)\n data = []\n data[0] = JSON.parse File.read f1\n data[1] = JSON.parse File.read f2\n data.each_with_index do |d, i|\n if d.count == 0\n puts \"No data in ##{i+1} file\"\n exit 1\n end\n data[i] = d.map { |row| row['_source'] }\n end\n all = {}\n all_keys = []\n data.each_with_index do |d, i|\n all_keys[i] = {}\n d.each_with_index do |row, r|\n ks = row.keys.sort\n ks.each do |k| \n all_keys[i][k] = 0 unless all_keys[i].key?(k)\n all_keys[i][k] += 1\n all[k] = 0 unless all.key?(k)\n all[k] += 1\n end\n end\n end\n ks = all.keys.sort.join(',')\n ks1 = all_keys[0].keys.sort\n ks2 = all_keys[1].keys.sort\n if ks1 != ks2\n puts \"WARNING: different key sets:\\n#{ks1}\\nnot equal to:\\n#{ks2}\"\n end\n vals1 = all_keys[0].values.uniq\n vals2 = all_keys[1].values.uniq\n puts \"Unique key presence counts in 1st file: #{vals1}\"\n puts \"Unique key presence counts in 2nd file: #{vals2}\"\n skip_keys = ENV['SKIP_KEYS']\n if skip_keys.nil? || skip_keys == ''\n skip_keys = 'metadata__updated_on,metadata__timestamp,metadata__enriched_on'\n elsif skip_keys == \"-\"\n skip_keys = ''\n end\n skip_keys = skip_keys.split(',').map(&:strip)\n skip = {}\n skip_keys.each do |k|\n skip[k] = true\n end\n keys = ENV['KEYS']\n if keys.nil? || keys == ''\n puts \"You should specify keys to check via KEYS='key1,key2,...,keyN', available keys:\\n#{ks}\"\n puts \"You can also specify special value ALLKEYS\"\n puts \"You can specify non-standard keys to skip, default are: metadata__updated_on,metadata__timestamp,metadata__enriched_on\"\n puts \"To specify them use SKIP_KEYS='key1,key2,...,keyN', use 'SKIP_KEYS=- to disable skipping anything\"\n puts \"Will use default key: grimoire_creation_date\"\n keys = 'grimoire_creation_date'\n end\n if keys == 'ALLKEYS'\n keys = ks.split(',')\n else\n keys = keys.split(',').map(&:strip)\n end\n diff = 0\n keys.each do |k|\n next if skip.key?(k)\n values = []\n data.each_with_index do |d, i|\n values[i] = {}\n d.each_with_index do |row, r|\n v = (row[k] || '(nil)').to_s\n values[i][v] = true\n end\n end\n miss1 = {}\n miss2 = {}\n values[1].keys.each do |k|\n unless values[0].key?(k)\n miss1[k] = true\n end\n end\n values[0].keys.each do |k|\n unless values[1].key?(k)\n miss2[k] = true\n end\n end\n if miss1.count > 0 || miss2.count > 0\n puts \"Key: #{k}\"\n diff += 1\n end\n if miss1.count > 0\n puts \"Values from 2nd file missing in 1st file: #{miss1.keys.sort.join(',')}\"\n end\n if miss2.count > 0\n puts \"Values from 1st file missing in 2nd file: #{miss2.keys.sort.join(',')}\"\n end\n end\n puts \"Differences on #{diff} keys specified to check\"\nend",
"def maxXor(arr, queries)\n # solve here\n # build a trie with each element of arr as leaf\n # binary tree left = \"0\", right = \"1\"\n # 30 levels\n trie_root = TrieNode.new\n arr.each do |x|\n p = trie_root\n xb = '%030b' % x\n xb.each_char do |bit|\n if bit == \"0\"\n # go left\n if p.left\n p = p.left\n else\n nn = TrieNode.new\n p.left = nn\n p = p.left\n end\n else\n # go right\n if p.right\n p = p.right\n else\n nn = TrieNode.new\n p.right = nn\n p = p.right\n end\n end\n end\n end\n ans_seq = []\n queries.each do |q|\n # walk down the trie to leaf\n leaf = \"\"\n p = trie_root\n qb = '%030b' % q\n qb.each_char do |bit|\n # prefer opposite of bit\n if bit == \"0\"\n # try go right (\"1\")\n if p.right\n p = p.right\n leaf << \"1\"\n else\n p = p.left\n leaf << \"0\" \n end\n else\n # try to go left (\"0\")\n if p.left\n p = p.left\n leaf << \"0\"\n else\n p = p.right\n leaf << \"1\"\n end\n end\n end\n a = leaf.to_i(2)\n ans_seq << (a^q)\n end\n return ans_seq\nend",
"def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend",
"def classificateResult(label, sampleMap, foundAllArr)\n puts \"[classificateResult] started label #{label}\"\n foundArr = foundAllArr.select{|found| matchLabels?(found.label, label)}\n expRecognitionResult = Spnt::Exp::Data::ExpRecognitionResult.new()\n expRecognitionResult.falseNegative = []\n expRecognitionResult.falsePostive = []\n #missed = sampleArr - foundArr\n #1 step. filter that was found and transform to array\n substituted = sampleMap.select{|ekey, sample|\n if(matchLabels?( label, sample.label))\n nil == foundArr.detect{|found| sample.ekey == found.ekey && found.shouldStart != @@UNDEFINED_CELL} \n end\n }.collect { |k, v| v }\n deleted =foundArr.select{|found|\n found.foundStart == nil || found.foundStart == @@UNDEFINED_CELL \n }\n inserted =foundArr.select{|found|\n found.shouldStart == nil || found.shouldStart == @@UNDEFINED_CELL \n }\n \n puts \"[classificateResult] %s substituted: %i\" % [label, substituted.length]\n puts \"[classificateResult] %s deleted: %i\" % [label, deleted.length]\n puts \"[classificateResult] %s inserted: %i\" % [label, inserted.length]\n\n expRecognitionResult.falseNegative = (expRecognitionResult.falseNegative << substituted).flatten\n expRecognitionResult.falseNegative = (expRecognitionResult.falseNegative << deleted).flatten\n expRecognitionResult.falsePostive = (expRecognitionResult.falsePostive << inserted).flatten\n \n puts \"[classificateResult] %s falseNegative: %i\" % [label, expRecognitionResult.falseNegative.length]\n puts \"[classificateResult] %s falsePostive: %i\" % [label, expRecognitionResult.falsePostive.length]\n\n\n puts \"[classificateResult]substituted: \" + substituted.collect{|v| \" %i => %s[%s]\" % [v.id, v.ekey, v.foundStart]}.join(\"; \")\n\n# foundDuplicates = {}\n# expRecognitionResult.correct = foundArr.select{|found|\n# sample = sampleMap[found.ekey]\n# if(sample != nil && matchLabels?( label, found.label))\n# if(found.foundStart == nil)\n# #puts \"[classificateResult]falseNegative [#{found.ekey}] no start: #{sample.shouldStart} #{found.foundStart}\"\n# expRecognitionResult.falseNegative << sample\n# false\n# else\n# absStartDelta = (sample.shouldStart - found.foundStart).abs\n# absEndDelta = (sample.shouldEnd - found.foundEnd).abs\n# matched = sample.ekey == found.ekey && absStartDelta <= @@thresholdStart && absEndDelta <= @@thresholdEnd\n# if matched == true\n# foundDuplicateElement = foundDuplicates[found.ekey]\n# if foundDuplicateElement == nil\n# foundDuplicateElement = []\n# foundDuplicates[found.ekey] = foundDuplicateElement\n# end\n# foundDuplicateElement << found\n# #puts \"foundDuplicates[#{sample.ekey}] #{foundDuplicates[sample.ekey].length} #{matched && foundDuplicates[sample.ekey].length == 1}\"\n# end\n# matched && foundDuplicates[sample.ekey].length == 1\n# end\n# else\n# false\n# end\n# }\n #expRecognitionResult.falsePostive = foundArr.select{|found| !expRecognitionResult.correct.include?(found) && !expRecognitionResult.falseNegative.include?(found)}\n# expRecognitionResult.correct = foundArr.select{|found|\n# expRecognitionResult.falsePostive.include?(found) && expRecognitionResult.falseNegative.include?(found)\n# }\n expRecognitionResult.correct = foundArr.to_set - expRecognitionResult.falsePostive.to_set - expRecognitionResult.falseNegative.to_set;\n puts \"falsePostive[#{expRecognitionResult.falsePostive.length}] + falseNegative[#{expRecognitionResult.falseNegative.length}]+correct[#{expRecognitionResult.correct.length}] = foundArr[#{foundArr.length}]\"\n expRecognitionResult\n end",
"def mark_IV_index_finder(encoded_message,hint)\n key_combinations =Array.new\n for i in 0...9\n for j in 0...9\n decoded_message=mark_IV_decoder(i,j,encoded_message)\n if (decoded_message.include? hint)\n index_combination =Array.new\n index_combination.push i,j\n key_combinations.push index_combination\n final_decoded_message = decoded_message\n end\n end\n end\n return [key_combinations,final_decoded_message]\nend",
"def memo; end",
"def genStr strLen\nsortedAlphabet = @alphabet.sort\nresultStrs = [ ]\ntestStrings = [ ]\ntestStrings[0] = []\ntestStrings[0].push \"\"\n1.upto(strLen.to_i) { |x|\ntestStrings[x] = []\ntestStrings[x-1].each { |s|\nsortedAlphabet.each { |c|\ntestStrings[x].push s+c\n}\n}\n}\ntestStrings.flatten.each { |s|\nresultStrs.push s if accept? s, @start\n}\nresult = \"\"\nresultStrs.each { |x| result.concat '\"'+x+'\" ' }\nresult\nend",
"def smoothing; end",
"def scan_gene_blo_seqs\n GeneBloSeq.destroy_all\n\n genes = Gene.find(:all)\n\n genes.each { |gn|\n\n #assemble gene file location\n gene_blo_runs_f = \"#{AppConfig.gene_blo_runs_dir}/#{gn.name}.fasta\"\n gene_blo_seqs_f = \"#{AppConfig.gene_blo_seqs_dir}/#{gn.name}.fasta\"\n gene_blo_seqs_p = \"#{AppConfig.gene_blo_seqs_dir}/#{gn.name}.phy\"\n\n \n gene_blo_runs_oa = @ud.fastafile_to_original_alignment(gene_blo_runs_f)\n gene_blo_seqs_oa = Bio::Alignment::OriginalAlignment.new\n\n\n\n puts \"gn.seqs_orig_nb:#{gn.seqs_orig_nb} oa_size: #{gene_blo_runs_oa.size}\"\n\n #schould be equal\n #should insert assertion here or make an rspec to detect source\n #puts oa.keys\n\n gene_blo_runs_oa.each_pair { |key, seq|\n puts key, seq\n gbs = GeneBloSeq.new\n #find corresponding gi\n ns = NcbiSeq.find_by_vers_access(key)\n #link to objects gene and gi\n gbs.gene = gn\n gbs.ncbi_seq = ns\n gbs.save\n gene_blo_seqs_oa.add_seq(seq,ns.id)\n\n }\n \n #save fasta file \n @ud.string_to_file(gene_blo_seqs_oa.output(:fasta),gene_blo_seqs_f)\n #save phylip file\n @ud.string_to_file(gene_blo_seqs_oa.output(:phylip),gene_blo_seqs_p)\n\n\n\n\n }\n\n end",
"def malts; end",
"def optimize_every; end",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def trans_enemies\n b = []\n a = \"\"\n for i in $data_enemies\n if i != nil and i.name != nil\n oldname = i.name.split(/\\//)[0]\n oldname = oldname.gsub(\"【data】\", \"\").gsub(\"【fix】\",\"\") if oldname.is_a?(String)\n if oldname!= \"\" and oldname!= nil #and oldname.translation_check != i.UK_name\n a = \"when \" + i.id.to_s + \" \\#\" + oldname + \"\\n\"\n b.push(a)\n a = \" return \\\"\" + i.UK_name + \"\\\"\"\n a = a + \" ***TODO\" if oldname == i.UK_name\n a = a + \"\\n\"\n b.push(a)\n end\n end\n end\n open(\"zzz.txt\",\"a+\") do |log|\n log.puts b\n end\nend",
"def transformations; end",
"def main\n\n while line = ARGF.gets do \n next if line.match(\"^#\")\n \n cols = line.chomp.split(/\\s+/)\n \n allelec = [0,0,0,0]\n pos = cols[1] \n cols[3..-1].each do |gt|\n a = gt.split(';')\n 1.upto(4) do |i|\n n = a[i].to_i\n# a[1..-1].each do |n|\n if n > 0\n allelec[i-1] += 1\n end\n # allelec += n.to_i\n end\n end\n \n ga = allelec.select {|g| g > 0}\n if ga.size > 1\n puts line\n# if pos == \"121320556\"\n # $stderr.puts ga.join(\"\\t\")\n # end\n end\n end\nend",
"def find_smallest_subsequence(text, pattern)\n puts \"text= #{text}; pattern= #{pattern}\"\n beginPtr, minBeginPtr, endPtr, minEndPtr = 0, 0, text.length-1, -1\n hasFound = Hash.new(0)\n needToFind = Hash.new(0)\n counter, windowLen, minWindowLen = 0,0,-1\n\n pattern.chars.each { |c| needToFind[c] += 1 }\n\n text.chars.each_with_index do |c, idx| \n endPtr = idx\n # puts \"looking at text char #{c}; beginPtr= #{beginPtr}; endPtr=#{endPtr}\"\n\n if needToFind.has_key?(c)\n hasFound[c] += 1\n if hasFound[c] <= needToFind[c]\n counter += 1 \n end\n\n ch = text.chars[beginPtr] \n if counter == pattern.length \n\n # puts \"hasFound= #{hasFound.inspect}\"\n # puts \"ch= #{ch}; beginPtr= #{beginPtr}; endPtr=#{endPtr}\"\n\n while hasFound[ch] > needToFind[ch] || needToFind[ch] == 0\n # puts \"hasFound[#{ch}] = #{hasFound[ch]}; needToFind[#{ch}] = #{needToFind[ch]}\"\n\n unless needToFind[ch] == 0\n hasFound[ch] -= 1 if hasFound.has_key?(ch)\n # puts \"changing ptrs; beginPtr= #{beginPtr}; endPtr=#{endPtr}; hasFound= #{hasFound.inspect}\"\n end\n beginPtr = beginPtr + 1 \n ch = text.chars[beginPtr] \n end\n windowLen = endPtr - beginPtr + 1\n # print \"Found the current minWindow ==> beginPtr= #{beginPtr}; endPtr=#{endPtr}; windowLen= #{windowLen}; minWindowLen= #{minWindowLen}\"\n if minWindowLen == -1 || windowLen < minWindowLen\n minWindowLen = windowLen \n minBeginPtr = beginPtr\n minEndPtr = endPtr\n end\n # print \" was changed to minWindowLen= #{minWindowLen}\"\n # puts \"\\n\\n\"\n end\n\n end\n end\n return ['none', 'none', 'none'] if minEndPtr == -1\n return [minBeginPtr, minEndPtr, text[minBeginPtr..minEndPtr]]\nend",
"def get_model_years_slow\n start = Time.now\n\n # open the json file of all cars and models\n json = JSON.parse(File.read(@all_cars_file))\n\n if json.nil?\n puts \"ERROR - could not find json file\"\n exit\n end\n\n # get all of the car ids with model ids\n # model_ids = json.map{|key, value| value['models'].keys}.flatten\n car_model_ids = json.map{|key, value| [key, value['models'].keys]}\n\n if car_model_ids.nil? || car_model_ids.length == 0\n puts \"ERROR - could not find model ids\"\n exit\n end\n\n puts \"- found #{car_model_ids.length} cars with a total of #{car_model_ids.map{|x| x[1]}.flatten.length} models\"\n\n total_left_to_process = car_model_ids.length\n car_model_ids.each_with_index do |car, index|\n puts \"-------------------\"\n puts \"#{index} cars download so far in #{((Time.now-start)/60).round(2)} minutes\\n\\n\"\n\n car[1].each do |model_id|\n puts \"- car #{car[0]}, model #{model_id}\"\n # save years\n json[car[0]]['models'][model_id]['years'] = JSON.parse(open(\"#{@model_years_url}#{model_id}\").read)\n end\n end\n\n puts \"FINISHED DOWNLOAD DATA!!\"\n\n # save to file\n File.open(@all_cars_file_with_years, 'wb') { |file| file.write(JSON.generate(json)) }\n\n puts \"TOTAL TIME TO DOWNLOAD AND WRITE TO FILE = #{((Time.now-start)/60).round(2)} minutes\"\nend",
"def findlargestdrop(arr)\n\n\n\nend",
"def fingerprint; end",
"def solve\n # Read lines and split into start-end pairs.\n pairs = []\n IO.read( 'resources/0079_keylog.txt' ).split.uniq.each do |line|\n pairs << line[0, 2] << line[1, 2] << line[0] + line[2]\n end\n\n # Delete duplicates and compute weight based on start character frequency.\n pairs.uniq!\n weight = (0..9).map {|i| pairs.count {|p| p[0].to_i == i}}\n\n # Order pairs according to most popular starting character, since we want\n # to maximize how many numbers appear after each one.\n pairs.sort_by! {|p| 10 * weight[p[0].to_i] + weight[p[1].to_i]}\n\n # Concatenate characters as long as they haven't been seen before. This\n # is not a general-purpose solution, but the problem (as stated) is not\n # exceptionally challenging.\n pwd = []\n pairs.reverse.each do |p|\n pwd << p[0] unless pwd.include?( p[0] )\n pwd << p[1] unless pwd.include?( p[1] )\n end\n\n pwd.join.to_i\n end",
"def generate_possible_areas_for_all_numbered_tiles\n t = Time.now\n puts 'Start: Generate possible areas for all numbered tiles'\n all_possible_areas = {}\n\n # @b_nl.each_with_value do |value, i, j|\n # if value != 0 then\n # restricted_board = create_restricted_board [i,j]\n # t_area = Time.now\n # next if [i,j] == [7,1]\n # puts \"Summoning for [#{i},#{j}]\"\n # a = summon_areas([i,j], value, restricted_board)\n\n # puts \"Summoned area for [#{i},#{j}], time: \" + (Time.now - t_area).to_i.to_s + 's size ' + a.count.to_s\n # all_possible_areas[\"#{i}-#{j}\"] = a\n # end\n (0..@row_count-1).to_a.each do |i|\n (0..@col_count-1).to_a.each do |j|\n # Summon for each numbered tile(non zero)\n if @b_nl[i,j] != 0 then\n restricted_board = create_restricted_board [i,j]\n t_area = Time.now\n next if [i,j] == [7,1]\n puts \"Summoning for [#{i},#{j}]\"\n a = summon_areas([i,j],@b_nl[i,j], restricted_board)\n\n puts \"Summoned area for [#{i},#{j}], time: \" + (Time.now - t_area).to_i.to_s + 's size ' + a.count.to_s\n all_possible_areas[\"#{i}-#{j}\"] = a\n end\n end\n end\n puts 'Finish: Generate possible areas for all numbered tiles, time: ' + (Time.now - t).to_i.to_s + 'seconds'\n all_possible_areas[\"7-1\"] = [[[]]]\n all_possible_areas\n end",
"def map_tgup_by_proteinid()\n # output unmatch list for map by gene_id (prefix of gene_id is first char of gene_id. (\"1\", \"2\", ..))\n refg_output = {}\n FileUtils.mkdir_p(\"#{$prepare_dir}/refg\") unless File.exist?(\"#{$prepare_dir}/refg\")\n (1..9).each do |prefix|\n refg_output[prefix.to_s] = File.open(\"#{$prepare_dir}/refg/#{prefix.to_s}.dat\", \"w\")\n end\n\n output_header\n\n # try mapping the same prefix of RefSeq data and UniProt data(for performance)\n Dir.glob(\"#{$prepare_dir}/refp/*.dat\") do |input_file|\n # parse data\n refseq_gene_list = []\n protein_id_prefix = input_file.split(\"/\").last.split(\"\\.\").first\n puts \"protein_id prefix: #{protein_id_prefix}\"\n File.open(input_file) do |f|\n f.each_line do |line|\n columns = line.chomp.strip.split(\"\\t\")\n gene_id_prefix = columns[4].nil? ? \"\" : columns[4][0]\n refseq_gene_list.push({taxid: columns[0], gene_rsrc: columns[1], gene_label: columns[2], protein_id: columns[3], gene_id: columns[4], gene_id_prefix: gene_id_prefix})\n end\n end\n\n $count_nc += refseq_gene_list.size if protein_id_prefix == \"no_protein_id\" # no protein_id on RefSeq\n up_list = load_up_refp(protein_id_prefix) # get same prefix data from UniProt\n\n refseq_gene_list.each do |refseq_data|\n match = false\n output_tax(refseq_data) # output all gene-tax turtle\n unless up_list.nil? # exist prefix on UniProt\n match_list = up_list[refseq_data[:protein_id]]\n unless match_list.nil? # match some uniprot_ids\n match_list.each do |up_info|\n if refseq_data[:taxid] == up_info[:taxid] # ignore unmatch tax\n output_idmap(refseq_data, up_info[:upid])\n match = true\n else # match protein_id but not match tax_id\n output_uptax(up_info)\n $taxup_list[up_info[:taxid]] = true\n $tax_mismatch[\"#{refseq_data[:taxid]}-#{up_info[:taxid]} : #{refseq_data[:protein_id]}\"] = true\n end\n end\n end\n end\n if match == false\n if refseq_data[:gene_id_prefix].nil? ||refseq_data[:gene_id_prefix] == \"\" # can't salvage it by gene_id.\n $no_up += 1\n else # output a file to each prefix of gene_id that can be salvaged by gene_id\n line = [refseq_data[:taxid], refseq_data[:gene_rsrc], refseq_data[:gene_label], refseq_data[:protein_id], refseq_data[:gene_id], refseq_data[:gene_id_prefix]]\n refg_output[refseq_data[:gene_id_prefix]].puts(line.join(\"\\t\"))\n end\n end\n $count += 1\n end\n end\n refg_output.each do |k, v|\n v.flush\n v.close\n end\nend",
"def problem_79\n digits = []\n lines = open(\"keylog.txt\").reduce([]) do |a,l|\n a << l.chomp.split(//).map(&:to_i)\n end\n p = lines.transpose\n loop do \n first = (p[0] - p[1]).uniq\n if first.length == 1\n d = first[0]\n digits << d \n puts \"Remove #{d}\"\n # shift off leading 'd' values\n lines.select {|l| l[0] == d}.map {|l| l.shift; l.push nil }\n # Rebuild out first, second, third arrays\n p = lines.transpose\n return digits.map(&:to_s).join if p.flatten.compact.length == 0\n puts \"len = #{p.flatten.compact.length}\"\n else\n raise \"Trouble - 2 candidates : #{first.inspect}, rework algorithm\"\n end\n end\nend",
"def process_externals\n File.open(\"./lib/externals/externals_table_data_input_hash.txt\", \"r\") do |f|\n #File.open(\"./lib/externals/externals_table_data_input_lines.txt\", \"r\") do |f|\n f.each_line do |line|\n external_searched, searched = line.chomp.split(\"\\t\")\n # created_sequence_id = external_searched(/continue code/)\n # creation_sequence_id = \n # complete_sequence_id = \n # lexigram_sequence_id = \n # singular_sequence_id = complete_sequence_id.squeeze\n puts \"#{external_searched.to_textual}\\t#{searched}\" \n sleep(0.01)\n end\n end\n end",
"def findDups(objArray, dupsHashArray, emptyFileArray)\n objArray.each_with_index do |obj, idx1|\n if obj.is_empty?\n emptyFileArray.push(obj.fileName)\n next \n end\n objArray.each_with_index do |obj2, idx2|\n next if idx1 >= idx2 \n if obj.md5 === obj2.md5\n foundDupHash= {:filePath => obj.fileName, :duplicatePath => obj2.fileName}\n dupsHashArray.push(foundDupHash)\n end\n end\n end \n end",
"def count_debate_references\n extr = FileLinesExtractor.new\n mp_refs = {} # cia bus sumesti visi SN vardai i kuriuos buvo kreiptasi\n count do |mp, sten|\n puts \"#{mp}\"\n extr.extract(sten).each do |line|\n line.scan(/( \\D\\.(\\D\\.)?\\w{4,})/).each do |ref|\n puts \"\\t#{ref}\"\n (mp_refs[mp] ||= []) << ref[0].strip if ref[0].strip.size > 4\n end\n end\n end\n \n #TODO sitas turetu eiti i kita vieta (t.y. i lrs moduli), bet kolkas nera architekturos kaip tvarkyti stenogramas\n DebateReference.delete_all\n mp_refs.each{|p,ref|\n author = Politician.find_by_id_in_lrs(p)\n ref.each{|ref|\n name = ref.gsub(/(ai|as|ą|čiui|čio|is|io|į|iuj|iu|iaus|iui|ius|ių|iumi|os|iaus|o|u|ui|ys)$/, '').gsub(/(|ė|ės|ei|e|ę|a)$/, '')\n \n first_name_initials = name.split('.').first\n last_name = name.split('.').last\n reference_sql=<<-SQL\n select * from politicians\n where\n last_name like '#{last_name + '%'}' and\n (substring(first_name, 1,1) = '#{first_name_initials}' or substring(second_name, 1,1) = '#{first_name_initials}')\n SQL\n ref_mp = Politician.find_by_sql(reference_sql).first \n author.debate_references << \n author.debate_references.new(:name_reference_id => ref_mp.id, :sitting_id=>nil) if ref_mp\n }\n }\nend",
"def get_to(options={})\n options = {\n :goal => 100,\n :digits => '123456789',\n :ops => %w[- - +],\n :verbose => false,\n :return_counts => false\n } .merge(options)\n digits= options[:digits]\n goal, digits, ops, verbose, return_counts = *options.values_at(:goal, :digits, :ops, :verbose, :return_counts)\n operators = Permutation.for(ops).map{|perm| perm.project}.uniq\n puts \"Looking for #{goal}, digits=#{digits}, operators=#{ops.inspect}\"\n counts = Hash.new(0)\n found_in_a_row = 0\n digits.each_partition(ops.size + 1) do |numbers|\n operators.each do |ops|\n op_index = -1\n eqn = numbers.zip(ops).flatten.compact.join(' ')\n val = eval(eqn)\n counts[val] += 1 if return_counts\n found = val == goal\n puts \"********************************\" if found_in_a_row == 0 && found\n puts \"********************************\" unless found_in_a_row == 0 || found\n puts \"#{eqn} = #{val}\" if verbose || goal == val\n found_in_a_row = found ? found_in_a_row + 1 : 0\n end\n end\n return_counts ? counts.select {|key,value| value > 1} : nil\nend",
"def minimize; end",
"def work(filename = 'data.txt', number_lines = FIXNUM_MAX)\n file_lines = read_file(filename, number_lines)\n\n users, sessions = parse_lines(file_lines)\n\n unique_browsers = unique_browsers(sessions)\n\n report = {\n 'totalUsers' => users.length,\n 'uniqueBrowsersCount' => unique_browsers.length,\n 'totalSessions' => sessions.length,\n 'allBrowsers' => unique_browsers.sort!.join(','),\n 'usersStats' => {}\n }\n\n # Статистика по пользователям\n users_objects = collect_users_objects(users, sessions)\n\n collect_stats_from_users(report, users_objects) do |user|\n user_sessions = user.sessions\n user_sessions_times = user_sessions.map { |s| s[:time] }\n user_sessions_browsers = user_sessions.map { |s| s[:browser] }\n {\n 'sessionsCount' => user_sessions.length, # Собираем количество сессий по пользователям\n 'totalTime' => \"#{user_sessions_times.sum} min.\", # Собираем количество времени по пользователям\n 'longestSession' => \"#{user_sessions_times.max} min.\", # Выбираем самую длинную сессию пользователя\n 'browsers' => user_sessions_browsers.sort.join(', '), # Браузеры пользователя через запятую\n 'usedIE' => user_sessions_browsers.any? { |b| b.include?('INTERNET EXPLORER') }, # Хоть раз использовал IE?\n 'alwaysUsedChrome' => user_sessions_browsers.all? { |b| b.include?('CHROME') }, # Всегда использовал только Chrome?\n 'dates' => user_sessions.map! { |s| s[:date] }.sort!.reverse! # Даты сессий через запятую в обратном порядке в формате iso8601\n }\n end\n\n File.write('result.json', \"#{Oj.dump(report)}\\n\")\nend",
"def verdi; end",
"def orf_find(prediction = @prediction)\n\n if prediction.seq_type != \"nucleotide\"\n \"-\"\n end\n \n #stop codons\n stop_codons = [\"TAG\", \"TAA\", \"TGA\"]\n #minimimum ORF length\n orf_length = 100\n \n seq = prediction.raw_sequence\n stops = {}\n result = {}\n\n stop_codons.each do |codon|\n occurences = (0 .. seq.length - 1).find_all { |i| seq[i,3].downcase == codon.downcase }\n occurences.each do |occ|\n stops[occ + 3] = codon\n end\n end\n\n\n #direct strand\n stop_positions = stops.map{|x| x[0]}\n result[\"+1\"] = []\n result[\"+2\"] = []\n result[\"+3\"] = []\n result[\"-1\"] = []\n result[\"-2\"] = []\n result[\"-3\"] = []\n\n #reading frame 1, direct strand\n m3 = stops.map{|x| x[0]}.select{|y| y % 3 == 0}.sort\n m3 = [1, m3, prediction.raw_sequence.length].flatten\n #puts \"multiple of 3: #{m3.to_s}\"\n (1..m3.length-1).each do |i|\n if m3[i] - m3[i-1] > orf_length\n# result[[m3[i-1], m3[i]]] = \"+1\"\n result[\"+1\"].push([m3[i-1], m3[i]])\n end\n end\n \n #reading frame 2, direct strand\n m3_1 = stops.map{|x| x[0]}.select{|y| y % 3 == 1}.sort\n m3_1 = [2, m3_1, prediction.raw_sequence.length].flatten\n #puts \"multiple of 3 + 1: #{m3_1.to_s}\"\n (1..m3_1.length-1).each do |i|\n if m3_1[i] - m3_1[i-1] > orf_length\n# result[[m3_1[i-1], m3_1[i]]] = \"+2\"\n result[\"+2\"].push([m3_1[i-1], m3_1[i]])\n end\n end\n\n #reading frame 3, direct strand\n m3_2 = stops.map{|x| x[0]}.select{|y| y % 3 == 2}.sort\n m3_2 = [3, m3_2, prediction.raw_sequence.length].flatten\n #puts \"multiple of 3 + 2: #{m3_2.to_s}\"\n (1..m3_2.length-1).each do |i|\n if m3_2[i] - m3_2[i-1] > orf_length\n# result[[m3_2[i-1], m3_2[i]]] = \"+3\"\n result[\"+3\"].push([m3_2[i-1], m3_2[i]])\n end\n end\n\n #reverse strand\n stops_reverse = {}\n seq_reverse = seq.reverse.downcase.gsub('a','T').gsub('t','A').gsub('c','G').gsub('g','C')\n stop_codons.each do |codon|\n occurences = (0 .. seq_reverse.length - 1).find_all { |i| seq_reverse[i,3].downcase == codon.downcase }\n #puts \"-1 #{codon}: #{occurences.to_s}\"\n occurences.each do |occ|\n stops_reverse[occ + 3] = codon\n end\n end\n\n stop_positions_reverse = stops_reverse.map{|x| x[0]}\n m3 = stops_reverse.map{|x| x[0]}.select{|y| y % 3 == 0}.sort\n m3 = [1, m3, prediction.raw_sequence.length].flatten\n #puts \"-1 multiple of 3: #{m3.to_s}\"\n (1..m3.length-1).each do |i|\n if m3[i] - m3[i-1] > orf_length\n# result[[m3[i-1], m3[i]]] = \"-1\"\n result[\"-1\"].push([m3[i-1], m3[i]])\n end\n end\n\n m3_1 = stops_reverse.map{|x| x[0]}.select{|y| y % 3 == 1}.sort\n m3_1 = [2, m3_1, prediction.raw_sequence.length].flatten\n #puts \"-1 multiple of 3 + 1: #{m3_1.to_s}\"\n (1..m3_1.length-1).each do |i|\n if m3_1[i] - m3_1[i-1] > orf_length\n result[\"-2\"].push([m3_1[i-1], m3_1[i]])\n end\n end\n\n m3_2 = stops_reverse.map{|x| x[0]}.select{|y| y % 3 == 2}.sort\n m3_2 = [3, m3_2, prediction.raw_sequence.length].flatten\n #puts \"-1 multiple of 3 + 2: #{m3_2.to_s}\"\n (1..m3_2.length-1).each do |i|\n if m3_2[i] - m3_2[i-1] > orf_length\n result[\"-3\"].push([m3_2[i-1], m3_2[i]])\n# result[[m3_2[i-1], m3_2[i]]] = \"-3\"\n end\n end\n\n result\n end",
"def solve(file)\r\n x, y = Integer($sx), Integer($sy)\r\n visited = []\r\n discovered = []\r\n value = $table[\"#{x} #{y}\"]\r\n value = value.to_s\r\n direction, weight = value.split(/\\s/,2)\r\n discovered.push(\"#{x} #{y}\")\r\n \r\n while discovered.size != 0\r\n current = discovered.pop\r\n x, y = current.split(/\\s/)\r\n x = Integer(x)\r\n y = Integer(y)\r\n value = $table[current]\r\n value = value.to_s\r\n direction, weight = value.split(/\\s/,2)\r\n \r\n if visited.include?(current) == false\r\n visited.push(current)\r\n direction = direction.split(//)\r\n \r\n i = 0\r\n while i < direction.size\r\n case direction[i]\r\n when \"u\"\r\n y = y - 1\r\n if visited.include?(\"#{x} #{y}\") == false\r\n discovered.push(\"#{x} #{y}\")\r\n if \"#{x} #{y}\" == \"#{$ex} #{$ey}\"\r\n result = true\r\n end\r\n end\r\n y = y + 1\r\n when \"d\"\r\n y = y + 1\r\n if visited.include?(\"#{x} #{y}\") == false\r\n discovered.push(\"#{x} #{y}\")\r\n if \"#{x} #{y}\" == \"#{$ex} #{$ey}\"\r\n result = true\r\n end\r\n end\r\n y = y - 1\r\n when \"l\"\r\n x = x - 1\r\n if visited.include?(\"#{x} #{y}\") == false\r\n discovered.push(\"#{x} #{y}\")\r\n if \"#{x} #{y}\" == \"#{$ex} #{$ey}\"\r\n result = true\r\n end\r\n end\r\n x = x + 1\r\n when \"r\"\r\n x = x + 1\r\n if visited.include?(\"#{x} #{y}\") == false\r\n discovered.push(\"#{x} #{y}\")\r\n if \"#{x} #{y}\" == \"#{$ex} #{$ey}\"\r\n result = true\r\n end\r\n end\r\n x = x - 1\r\n end\r\n i = i + 1\r\n end\r\n end\r\n end\r\n puts discovered\r\n if result == true\r\n puts result\r\n else\r\n puts false\r\n end\r\n end",
"def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend",
"def apply_solution array\n\n # Reverse the String to iterate right to left JUST because is easier :P\n index = find_small_neighbors array.reverse!\n \n return \"no answer\" unless index\n\n # Find rightmost successor to pivot in the suffix\n sec_index = array.index(array.slice(0..index).select{ |num| num > array[index] }.sort.first)\n # Swap with pivot\n array[index], array[sec_index] = array[sec_index], array[index]\n\n # Reverse the suffix REVERT rathern than sort\n solution = array.slice!(0..index-1).sort.join.reverse\n solution << array.join\n return solution.reverse\nend",
"def get_product_service_kpi_from_to(product_service_map,time,time_list)\n @pro_normalPv_list = Array.new\n @pro_delayPv_list = Array.new\n size = time.size\n 0.upto(size-1) do |i|\n new_p,new_s = new_and_old_service(time[i]) \n product_service_map = concat_pro_ser(product_service_map,new_p,new_s)\n pro_kpi,pro_pv,pro_normalPv,pro_delayPv = get_kpi_by_collection_name(@db,\"count_kpi\",product_service_map,time_list[i],time_list[i+1])\n @pro_normalPv_list.push(pro_normalPv)\n @pro_delayPv_list.push(pro_delayPv)\n end\n pro_size = @pro_normalPv_list.size\n @pro_pv = 0\n @pro_delayPv = 0\n 0.upto(pro_size-1) {|i|@pro_pv += @pro_normalPv_list[i]+@pro_delayPv_list[i]; @pro_delayPv+=@pro_delayPv_list[i]} \n @pro_kpi = (@pro_pv-@pro_delayPv)/(@pro_pv*1.0)*100\n last = time_list.size-1\n @ser_kpi,@ser_pv,@ser_normalPv,@ser_delayPv = get_kpi_by_collection_name(@db,\"search_kpi\",nil,time_list[0],time_list[last])\n @pro_avi,@pro_yes_num,@pro_no_num = get_availability_by_collection_name(@db,\"count_usable\",time_list[0],time_list[last])\n @ser_avi,@ser_yes_num,@ser_no_num = get_availability_by_collection_name(@db,\"search_usable\",time_list[0],time_list[last])\n puts \"Starttime: #{time_list[0]}\\t Endtime: #{time_list[last]}\\t timegap: #{time_list.size-1} \"\n print nil\n end",
"def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend"
] | [
"0.548031",
"0.5328847",
"0.53015554",
"0.5236806",
"0.5204727",
"0.5182975",
"0.5174632",
"0.5113446",
"0.5081588",
"0.5081588",
"0.5081588",
"0.5081588",
"0.5081588",
"0.50653243",
"0.5018727",
"0.5018078",
"0.50173885",
"0.5011533",
"0.49891126",
"0.4976755",
"0.4976109",
"0.49726337",
"0.4956041",
"0.49392492",
"0.49264348",
"0.4923654",
"0.49223423",
"0.49185038",
"0.49140358",
"0.4912859",
"0.4903733",
"0.48993677",
"0.48872972",
"0.4887244",
"0.48672894",
"0.48571187",
"0.48564714",
"0.4853356",
"0.48520157",
"0.48520157",
"0.48520157",
"0.48520157",
"0.48520157",
"0.48520157",
"0.48520157",
"0.48520157",
"0.48520157",
"0.4843768",
"0.48370087",
"0.48369086",
"0.48326814",
"0.4830528",
"0.48275402",
"0.4824607",
"0.48225045",
"0.48222423",
"0.48204926",
"0.48165888",
"0.48110816",
"0.48069414",
"0.48049408",
"0.47917646",
"0.47900483",
"0.47900334",
"0.4789111",
"0.47884893",
"0.477803",
"0.4775415",
"0.47746584",
"0.47726867",
"0.47725442",
"0.4771078",
"0.47685128",
"0.4768157",
"0.4766586",
"0.4763271",
"0.4762189",
"0.4754979",
"0.47545445",
"0.47536832",
"0.47527027",
"0.47480145",
"0.4746141",
"0.4731668",
"0.47304925",
"0.47294965",
"0.47281265",
"0.47266895",
"0.47226605",
"0.47162247",
"0.47145748",
"0.47136295",
"0.47127232",
"0.47079346",
"0.47040284",
"0.47032958",
"0.47008342",
"0.47004208",
"0.46985996",
"0.46948338",
"0.46926534"
] | 0.0 | -1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.